vendor: 4,255 bytes, lines 1-105
1/** 2 * @license 3 * Copyright Google LLC All Rights Reserved. 4 * 5 * Use of this source code is governed by an MIT-style license that can be 6 * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE 7 */ 8(function webpackUniversalModuleDefinition(root, factory) { 9 if(typeof exports === 'object' && typeof module === 'object') 10 module.exports = factory(); 11 else if(typeof define === 'function' && define.amd) 12 define([], factory); 13 else if(typeof exports === 'object') 14 exports["mdc"] = factory(); 15 else 16 root["mdc"] = factory(); 17})(this, function() { 18return /******/ (function(modules) { // webpackBootstrap 19/******/ // The module cache 20/******/ var installedModules = {}; 21/******/ 22/******/ // The require function 23/******/ function __webpack_require__(moduleId) { 24/******/ 25/******/ // Check if module is in cache 26/******/ if(installedModules[moduleId]) { 27/******/ return installedModules[moduleId].exports; 28/******/ } 29/******/ // Create a new module (and put it into the cache) 30/******/ var module = installedModules[moduleId] = { 31/******/ i: moduleId, 32/******/ l: false, 33/******/ exports: {} 34/******/ }; 35/******/ 36/******/ // Execute the module function 37/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 38/******/ 39/******/ // Flag the module as loaded 40/******/ module.l = true; 41/******/ 42/******/ // Return the exports of the module 43/******/ return module.exports; 44/******/ } 45/******/ 46/******/ 47/******/ // expose the modules object (__webpack_modules__) 48/******/ __webpack_require__.m = modules; 49/******/ 50/******/ // expose the module cache 51/******/ __webpack_require__.c = installedModules; 52/******/ 53/******/ // define getter function for harmony exports 54/******/ __webpack_require__.d = function(exports, name, getter) { 55/******/ if(!__webpack_require__.o(exports, name)) { 56/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 57/******/ } 58/******/ }; 59/******/ 60/******/ // define __esModule on exports 61/******/ __webpack_require__.r = function(exports) { 62/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 63/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 64/******/ } 65/******/ Object.defineProperty(exports, '__esModule', { value: true }); 66/******/ }; 67/******/ 68/******/ // create a fake namespace object 69/******/ // mode & 1: value is a module id, require it 70/******/ // mode & 2: merge all properties of value into the ns 71/******/ // mode & 4: return value when already ns object 72/******/ // mode & 8|1: behave like require 73/******/ __webpack_require__.t = function(value, mode) { 74/******/ if(mode & 1) value = __webpack_require__(value); 75/******/ if(mode & 8) return value; 76/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 77/******/ var ns = Object.create(null); 78/******/ __webpack_require__.r(ns); 79/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 80/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 81/******/ return ns; 82/******/ }; 83/******/ 84/******/ // getDefaultExport function for compatibility with non-harmony modules 85/******/ __webpack_require__.n = function(module) { 86/******/ var getter = module && module.__esModule ? 87/******/ function getDefault() { return module['default']; } : 88/******/ function getModuleExports() { return module; }; 89/******/ __webpack_require__.d(getter, 'a', getter); 90/******/ return getter; 91/******/ }; 92/******/ 93/******/ // Object.prototype.hasOwnProperty.call 94/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 95/******/ 96/******/ // __webpack_public_path__ 97/******/ __webpack_require__.p = ""; 98/******/ 99/******/ 100/******/ // Load entry module and return exports 101/******/ return __webpack_require__(__webpack_require__.s = "./packages/material-components-web/index.ts"); 102/******/ }) 103/************************************************************************/ 104/******/ ({ 105
106/***/ "./packages/material-components-web/index.ts": 107/*!***************************************************!*\ 108 !*** ./packages/material-components-web/index.ts ***! 109 \***************************************************/ 110/*! no static exports found */ 111/***/ (function(module, exports, __webpack_require__) { 112 113"use strict"; 114 115/** 116 * @license 117 * Copyright 2016 Google Inc. 118 * 119 * Permission is hereby granted, free of charge, to any person obtaining a copy 120 * of this software and associated documentation files (the "Software"), to deal 121 * in the Software without restriction, including without limitation the rights 122 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 123 * copies of the Software, and to permit persons to whom the Software is 124 * furnished to do so, subject to the following conditions: 125 * 126 * The above copyright notice and this permission notice shall be included in 127 * all copies or substantial portions of the Software. 128 * 129 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 130 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 131 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 132 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 133 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 134 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 135 * THE SOFTWARE. 136 */ 137 138var __importDefault = this && this.__importDefault || function (mod) { 139 return mod && mod.__esModule ? mod : { "default": mod }; 140}; 141var __importStar = this && this.__importStar || function (mod) { 142 if (mod && mod.__esModule) return mod; 143 var result = {}; 144 if (mod != null) for (var k in mod) { 145 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 146 }result["default"] = mod; 147 return result; 148}; 149Object.defineProperty(exports, "__esModule", { value: true }); 150var index_1 = __importDefault(__webpack_require__(/*! @material/auto-init/index */ "./packages/mdc-auto-init/index.ts")); 151exports.autoInit = index_1.default; 152var banner = __importStar(__webpack_require__(/*! @material/banner/index */ "./packages/mdc-banner/index.ts")); 153exports.banner = banner; 154var base = __importStar(__webpack_require__(/*! @material/base/index */ "./packages/mdc-base/index.ts")); 155exports.base = base; 156var checkbox = __importStar(__webpack_require__(/*! @material/checkbox/index */ "./packages/mdc-checkbox/index.ts")); 157exports.checkbox = checkbox; 158var chips = __importStar(__webpack_require__(/*! @material/chips/index */ "./packages/mdc-chips/index.ts")); 159exports.chips = chips; 160var circularProgress = __importStar(__webpack_require__(/*! @material/circular-progress/index */ "./packages/mdc-circular-progress/index.ts")); 161exports.circularProgress = circularProgress; 162var dataTable = __importStar(__webpack_require__(/*! @material/data-table/index */ "./packages/mdc-data-table/index.ts")); 163exports.dataTable = dataTable; 164var dialog = __importStar(__webpack_require__(/*! @material/dialog/index */ "./packages/mdc-dialog/index.ts")); 165exports.dialog = dialog; 166var dom = __importStar(__webpack_require__(/*! @material/dom/index */ "./packages/mdc-dom/index.ts")); 167exports.dom = dom; 168var drawer = __importStar(__webpack_require__(/*! @material/drawer/index */ "./packages/mdc-drawer/index.ts")); 169exports.drawer = drawer; 170var floatingLabel = __importStar(__webpack_require__(/*! @material/floating-label/index */ "./packages/mdc-floating-label/index.ts")); 171exports.floatingLabel = floatingLabel; 172var formField = __importStar(__webpack_require__(/*! @material/form-field/index */ "./packages/mdc-form-field/index.ts")); 173exports.formField = formField; 174var iconButton = __importStar(__webpack_require__(/*! @material/icon-button/index */ "./packages/mdc-icon-button/index.ts")); 175exports.iconButton = iconButton; 176var lineRipple = __importStar(__webpack_require__(/*! @material/line-ripple/index */ "./packages/mdc-line-ripple/index.ts")); 177exports.lineRipple = lineRipple; 178var linearProgress = __importStar(__webpack_require__(/*! @material/linear-progress/index */ "./packages/mdc-linear-progress/index.ts")); 179exports.linearProgress = linearProgress; 180var list = __importStar(__webpack_require__(/*! @material/list/index */ "./packages/mdc-list/index.ts")); 181exports.list = list; 182var menuSurface = __importStar(__webpack_require__(/*! @material/menu-surface/index */ "./packages/mdc-menu-surface/index.ts")); 183exports.menuSurface = menuSurface; 184var menu = __importStar(__webpack_require__(/*! @material/menu/index */ "./packages/mdc-menu/index.ts")); 185exports.menu = menu; 186var notchedOutline = __importStar(__webpack_require__(/*! @material/notched-outline/index */ "./packages/mdc-notched-outline/index.ts")); 187exports.notchedOutline = notchedOutline; 188var radio = __importStar(__webpack_require__(/*! @material/radio/index */ "./packages/mdc-radio/index.ts")); 189exports.radio = radio; 190var ripple = __importStar(__webpack_require__(/*! @material/ripple/index */ "./packages/mdc-ripple/index.ts")); 191exports.ripple = ripple; 192var segmentedButton = __importStar(__webpack_require__(/*! @material/segmented-button/index */ "./packages/mdc-segmented-button/index.ts")); 193exports.segmentedButton = segmentedButton; 194var select = __importStar(__webpack_require__(/*! @material/select/index */ "./packages/mdc-select/index.ts")); 195exports.select = select; 196var slider = __importStar(__webpack_require__(/*! @material/slider/index */ "./packages/mdc-slider/index.ts")); 197exports.slider = slider; 198var snackbar = __importStar(__webpack_require__(/*! @material/snackbar/index */ "./packages/mdc-snackbar/index.ts")); 199exports.snackbar = snackbar; 200var switchControl = __importStar(__webpack_require__(/*! @material/switch/index */ "./packages/mdc-switch/index.ts")); 201exports.switchControl = switchControl; 202var tabBar = __importStar(__webpack_require__(/*! @material/tab-bar/index */ "./packages/mdc-tab-bar/index.ts")); 203exports.tabBar = tabBar; 204var tabIndicator = __importStar(__webpack_require__(/*! @material/tab-indicator/index */ "./packages/mdc-tab-indicator/index.ts")); 205exports.tabIndicator = tabIndicator; 206var tabScroller = __importStar(__webpack_require__(/*! @material/tab-scroller/index */ "./packages/mdc-tab-scroller/index.ts")); 207exports.tabScroller = tabScroller; 208var tab = __importStar(__webpack_require__(/*! @material/tab/index */ "./packages/mdc-tab/index.ts")); 209exports.tab = tab; 210var textField = __importStar(__webpack_require__(/*! @material/textfield/index */ "./packages/mdc-textfield/index.ts")); 211exports.textField = textField; 212var tooltip = __importStar(__webpack_require__(/*! @material/tooltip/index */ "./packages/mdc-tooltip/index.ts")); 213exports.tooltip = tooltip; 214var topAppBar = __importStar(__webpack_require__(/*! @material/top-app-bar/index */ "./packages/mdc-top-app-bar/index.ts")); 215exports.topAppBar = topAppBar; 216// Register all components 217index_1.default.register('MDCBanner', banner.MDCBanner); 218index_1.default.register('MDCCheckbox', checkbox.MDCCheckbox); 219index_1.default.register('MDCChip', chips.MDCChip);
220index_1.default.register('MDCChipSet', chips.MDCChipSet); 221index_1.default.register('MDCCircularProgress', circularProgress.MDCCircularProgress); 222index_1.default.register('MDCDataTable', dataTable.MDCDataTable); 223index_1.default.register('MDCDialog', dialog.MDCDialog); 224index_1.default.register('MDCDrawer', drawer.MDCDrawer); 225index_1.default.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel); 226index_1.default.register('MDCFormField', formField.MDCFormField); 227index_1.default.register('MDCIconButtonToggle', iconButton.MDCIconButtonToggle); 228index_1.default.register('MDCLineRipple', lineRipple.MDCLineRipple); 229index_1.default.register('MDCLinearProgress', linearProgress.MDCLinearProgress); 230index_1.default.register('MDCList', list.MDCList); 231index_1.default.register('MDCMenu', menu.MDCMenu); 232index_1.default.register('MDCMenuSurface', menuSurface.MDCMenuSurface); 233index_1.default.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline); 234index_1.default.register('MDCRadio', radio.MDCRadio); 235index_1.default.register('MDCRipple', ripple.MDCRipple); 236index_1.default.register('MDCSegmentedButton', segmentedButton.MDCSegmentedButton); 237index_1.default.register('MDCSelect', select.MDCSelect); 238index_1.default.register('MDCSlider', slider.MDCSlider); 239index_1.default.register('MDCSnackbar', snackbar.MDCSnackbar); 240index_1.default.register('MDCSwitch', switchControl.MDCSwitch); 241index_1.default.register('MDCTabBar', tabBar.MDCTabBar); 242index_1.default.register('MDCTextField', textField.MDCTextField); 243index_1.default.register('MDCTooltip', tooltip.MDCTooltip); 244index_1.default.register('MDCTopAppBar', topAppBar.MDCTopAppBar); 245 246/***/ }), 247
248/***/ "./packages/mdc-animation/animationframe.ts": 249/*!**************************************************!*\ 250 !*** ./packages/mdc-animation/animationframe.ts ***! 251 \**************************************************/ 252/*! no static exports found */ 253/***/ (function(module, exports, __webpack_require__) { 254 255"use strict"; 256 257/** 258 * @license 259 * Copyright 2020 Google Inc. 260 * 261 * Permission is hereby granted, free of charge, to any person obtaining a copy 262 * of this software and associated documentation files (the "Software"), to deal 263 * in the Software without restriction, including without limitation the rights 264 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 265 * copies of the Software, and to permit persons to whom the Software is 266 * furnished to do so, subject to the following conditions: 267 * 268 * The above copyright notice and this permission notice shall be included in 269 * all copies or substantial portions of the Software. 270 * 271 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 272 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 273 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 274 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 275 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 276 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 277 * THE SOFTWARE. 278 */ 279 280Object.defineProperty(exports, "__esModule", { value: true }); 281/** 282 * AnimationFrame provides a user-friendly abstraction around requesting 283 * and canceling animation frames. 284 */ 285var AnimationFrame = /** @class */function () { 286 function AnimationFrame() { 287 this.rafIDs = new Map(); 288 } 289 /** 290 * Requests an animation frame. Cancels any existing frame with the same key. 291 * @param {string} key The key for this callback. 292 * @param {FrameRequestCallback} callback The callback to be executed. 293 */ 294 AnimationFrame.prototype.request = function (key, callback) { 295 var _this = this; 296 this.cancel(key); 297 var frameID = requestAnimationFrame(function (frame) { 298 _this.rafIDs.delete(key); 299 // Callback must come *after* the key is deleted so that nested calls to 300 // request with the same key are not deleted. 301 callback(frame); 302 }); 303 this.rafIDs.set(key, frameID); 304 }; 305 /** 306 * Cancels a queued callback with the given key. 307 * @param {string} key The key for this callback. 308 */ 309 AnimationFrame.prototype.cancel = function (key) { 310 var rafID = this.rafIDs.get(key); 311 if (rafID) { 312 cancelAnimationFrame(rafID); 313 this.rafIDs.delete(key); 314 } 315 }; 316 /** 317 * Cancels all queued callback. 318 */ 319 AnimationFrame.prototype.cancelAll = function () { 320 var _this = this; 321 // Need to use forEach because it's the only iteration method supported 322 // by IE11. Suppress the underscore because we don't need it. 323 // tslint:disable-next-line:enforce-name-casing 324 this.rafIDs.forEach(function (_, key) { 325 _this.cancel(key); 326 }); 327 }; 328 /** 329 * Returns the queue of unexecuted callback keys. 330 */ 331 AnimationFrame.prototype.getQueue = function () { 332 var queue = []; 333 // Need to use forEach because it's the only iteration method supported 334 // by IE11. Suppress the underscore because we don't need it. 335 // tslint:disable-next-line:enforce-name-casing 336 this.rafIDs.forEach(function (_, key) { 337 queue.push(key); 338 }); 339 return queue; 340 }; 341 return AnimationFrame; 342}(); 343exports.AnimationFrame = AnimationFrame; 344 345/***/ }), 346
347/***/ "./packages/mdc-animation/util.ts": 348/*!****************************************!*\ 349 !*** ./packages/mdc-animation/util.ts ***! 350 \****************************************/ 351/*! no static exports found */ 352/***/ (function(module, exports, __webpack_require__) { 353 354"use strict"; 355 356/** 357 * @license 358 * Copyright 2016 Google Inc. 359 * 360 * Permission is hereby granted, free of charge, to any person obtaining a copy 361 * of this software and associated documentation files (the "Software"), to deal 362 * in the Software without restriction, including without limitation the rights 363 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 364 * copies of the Software, and to permit persons to whom the Software is 365 * furnished to do so, subject to the following conditions: 366 * 367 * The above copyright notice and this permission notice shall be included in 368 * all copies or substantial portions of the Software. 369 * 370 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 371 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 372 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 373 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 374 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 375 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 376 * THE SOFTWARE. 377 */ 378 379Object.defineProperty(exports, "__esModule", { value: true }); 380var cssPropertyNameMap = { 381 animation: { 382 prefixed: '-webkit-animation', 383 standard: 'animation' 384 }, 385 transform: { 386 prefixed: '-webkit-transform', 387 standard: 'transform' 388 }, 389 transition: { 390 prefixed: '-webkit-transition', 391 standard: 'transition' 392 } 393}; 394var jsEventTypeMap = { 395 animationend: { 396 cssProperty: 'animation', 397 prefixed: 'webkitAnimationEnd', 398 standard: 'animationend' 399 }, 400 animationiteration: { 401 cssProperty: 'animation', 402 prefixed: 'webkitAnimationIteration', 403 standard: 'animationiteration' 404 }, 405 animationstart: { 406 cssProperty: 'animation', 407 prefixed: 'webkitAnimationStart', 408 standard: 'animationstart' 409 }, 410 transitionend: { 411 cssProperty: 'transition', 412 prefixed: 'webkitTransitionEnd', 413 standard: 'transitionend' 414 } 415}; 416function isWindow(windowObj) { 417 return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; 418} 419function getCorrectPropertyName(windowObj, cssProperty) { 420 if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { 421 var el = windowObj.document.createElement('div'); 422 var _a = cssPropertyNameMap[cssProperty], 423 standard = _a.standard, 424 prefixed = _a.prefixed; 425 var isStandard = standard in el.style; 426 return isStandard ? standard : prefixed; 427 } 428 return cssProperty; 429} 430exports.getCorrectPropertyName = getCorrectPropertyName; 431function getCorrectEventName(windowObj, eventType) { 432 if (isWindow(windowObj) && eventType in jsEventTypeMap) { 433 var el = windowObj.document.createElement('div'); 434 var _a = jsEventTypeMap[eventType], 435 standard = _a.standard, 436 prefixed = _a.prefixed, 437 cssProperty = _a.cssProperty; 438 var isStandard = cssProperty in el.style; 439 return isStandard ? standard : prefixed; 440 } 441 return eventType; 442} 443exports.getCorrectEventName = getCorrectEventName; 444 445/***/ }), 446
447/***/ "./packages/mdc-auto-init/constants.ts": 448/*!*********************************************!*\ 449 !*** ./packages/mdc-auto-init/constants.ts ***! 450 \*********************************************/ 451/*! no static exports found */ 452/***/ (function(module, exports, __webpack_require__) { 453 454"use strict"; 455 456/** 457 * @license 458 * Copyright 2019 Google Inc. 459 * 460 * Permission is hereby granted, free of charge, to any person obtaining a copy 461 * of this software and associated documentation files (the "Software"), to deal 462 * in the Software without restriction, including without limitation the rights 463 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 464 * copies of the Software, and to permit persons to whom the Software is 465 * furnished to do so, subject to the following conditions: 466 * 467 * The above copyright notice and this permission notice shall be included in 468 * all copies or substantial portions of the Software. 469 * 470 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 471 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 472 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 473 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 474 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 475 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 476 * THE SOFTWARE. 477 */ 478 479Object.defineProperty(exports, "__esModule", { value: true }); 480exports.strings = { 481 AUTO_INIT_ATTR: 'data-mdc-auto-init', 482 AUTO_INIT_STATE_ATTR: 'data-mdc-auto-init-state', 483 INITIALIZED_STATE: 'initialized' 484}; 485 486/***/ }), 487
488/***/ "./packages/mdc-auto-init/index.ts": 489/*!*****************************************!*\ 490 !*** ./packages/mdc-auto-init/index.ts ***! 491 \*****************************************/ 492/*! no static exports found */ 493/***/ (function(module, exports, __webpack_require__) { 494 495"use strict"; 496 497/** 498 * @license 499 * Copyright 2016 Google Inc. 500 * 501 * Permission is hereby granted, free of charge, to any person obtaining a copy 502 * of this software and associated documentation files (the "Software"), to deal 503 * in the Software without restriction, including without limitation the rights 504 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 505 * copies of the Software, and to permit persons to whom the Software is 506 * furnished to do so, subject to the following conditions: 507 * 508 * The above copyright notice and this permission notice shall be included in 509 * all copies or substantial portions of the Software. 510 * 511 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 512 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 513 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 514 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 515 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 516 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 517 * THE SOFTWARE. 518 */ 519 520var __values = this && this.__values || function (o) { 521 var s = typeof Symbol === "function" && Symbol.iterator, 522 m = s && o[s], 523 i = 0; 524 if (m) return m.call(o); 525 if (o && typeof o.length === "number") return { 526 next: function next() { 527 if (o && i >= o.length) o = void 0; 528 return { value: o && o[i++], done: !o }; 529 } 530 }; 531 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 532}; 533Object.defineProperty(exports, "__esModule", { value: true }); 534var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-auto-init/constants.ts"); 535var AUTO_INIT_ATTR = constants_1.strings.AUTO_INIT_ATTR, 536 AUTO_INIT_STATE_ATTR = constants_1.strings.AUTO_INIT_STATE_ATTR, 537 INITIALIZED_STATE = constants_1.strings.INITIALIZED_STATE; 538var registry = {}; 539var CONSOLE_WARN = console.warn.bind(console); // tslint:disable-line:no-console 540function emit(evtType, evtData, shouldBubble) { 541 if (shouldBubble === void 0) { 542 shouldBubble = false; 543 } 544 var evt; 545 if (typeof CustomEvent === 'function') { 546 evt = new CustomEvent(evtType, { 547 bubbles: shouldBubble, 548 detail: evtData 549 }); 550 } else { 551 evt = document.createEvent('CustomEvent'); 552 evt.initCustomEvent(evtType, shouldBubble, false, evtData); 553 } 554 document.dispatchEvent(evt); 555} 556/* istanbul ignore next: optional argument is not a branch statement */ 557/** 558 * Auto-initializes all MDC components on a page. 559 */ 560function mdcAutoInit(root) { 561 var e_1, _a; 562 if (root === void 0) { 563 root = document; 564 } 565 var components = []; 566 var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]")); 567 nodes = nodes.filter(function (node) { 568 return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE; 569 }); 570 try { 571 for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) { 572 var node = nodes_1_1.value; 573 var ctorName = node.getAttribute(AUTO_INIT_ATTR); 574 if (!ctorName) { 575 throw new Error('(mdc-auto-init) Constructor name must be given.'); 576 } 577 var Constructor = registry[ctorName]; // tslint:disable-line:variable-name 578 if (typeof Constructor !== 'function') { 579 throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName); 580 } 581 // TODO: Should we make an eslint rule for an attachTo() static method? 582 // See https://github.com/Microsoft/TypeScript/issues/14600 for discussion of static interface support in TS 583 var component = Constructor.attachTo(node); 584 Object.defineProperty(node, ctorName, { 585 configurable: true, 586 enumerable: false, 587 value: component, 588 writable: false 589 }); 590 components.push(component); 591 node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE); 592 } 593 } catch (e_1_1) { 594 e_1 = { error: e_1_1 }; 595 } finally { 596 try { 597 if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1); 598 } finally { 599 if (e_1) throw e_1.error; 600 } 601 } 602 emit('MDCAutoInit:End', {}); 603 return components; 604} 605exports.mdcAutoInit = mdcAutoInit; 606// Constructor is PascalCased because it is a direct reference to a class, rather than an instance of a class. 607// tslint:disable-next-line:variable-name 608mdcAutoInit.register = function (componentName, Constructor, warn) { 609 if (warn === void 0) { 610 warn = CONSOLE_WARN; 611 } 612 if (typeof Constructor !== 'function') { 613 throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function."); 614 } 615 var registryValue = registry[componentName]; 616 if (registryValue) { 617 warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue); 618 } 619 registry[componentName] = Constructor; 620}; 621mdcAutoInit.deregister = function (componentName) { 622 delete registry[componentName]; 623}; 624/** @nocollapse */ 625mdcAutoInit.deregisterAll = function () { 626 var keys = Object.keys(registry);
627 keys.forEach(this.deregister, this); 628}; 629// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 630exports.default = mdcAutoInit; 631 632/***/ }), 633
634/***/ "./packages/mdc-banner/component.ts": 635/*!******************************************!*\ 636 !*** ./packages/mdc-banner/component.ts ***! 637 \******************************************/ 638/*! no static exports found */ 639/***/ (function(module, exports, __webpack_require__) { 640 641"use strict"; 642 643/** 644 * @license 645 * Copyright 2020 Google Inc. 646 * 647 * Permission is hereby granted, free of charge, to any person obtaining a copy 648 * of this software and associated documentation files (the "Software"), to deal 649 * in the Software without restriction, including without limitation the rights 650 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 651 * copies of the Software, and to permit persons to whom the Software is 652 * furnished to do so, subject to the following conditions: 653 * 654 * The above copyright notice and this permission notice shall be included in 655 * all copies or substantial portions of the Software. 656 * 657 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 658 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 659 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 660 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 661 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 662 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 663 * THE SOFTWARE. 664 */ 665 666var __extends = this && this.__extends || function () { 667 var _extendStatics = function extendStatics(d, b) { 668 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 669 d.__proto__ = b; 670 } || function (d, b) { 671 for (var p in b) { 672 if (b.hasOwnProperty(p)) d[p] = b[p]; 673 } 674 }; 675 return _extendStatics(d, b); 676 }; 677 return function (d, b) { 678 _extendStatics(d, b); 679 function __() { 680 this.constructor = d; 681 } 682 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 683 }; 684}(); 685Object.defineProperty(exports, "__esModule", { value: true }); 686var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 687var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 688var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-banner/constants.ts"); 689var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-banner/foundation.ts"); 690/** Vanilla JS implementation of banner component. */ 691var MDCBanner = /** @class */function (_super) { 692 __extends(MDCBanner, _super); 693 function MDCBanner() { 694 return _super !== null && _super.apply(this, arguments) || this; 695 } 696 MDCBanner.attachTo = function (root) { 697 return new MDCBanner(root); 698 }; 699 MDCBanner.prototype.initialize = function () { 700 var _this = this; 701 this.contentEl = this.root.querySelector(constants_1.selectors.CONTENT); 702 this.textEl = this.root.querySelector(constants_1.selectors.TEXT); 703 this.primaryActionEl = this.root.querySelector(constants_1.selectors.PRIMARY_ACTION); 704 this.secondaryActionEl = this.root.querySelector(constants_1.selectors.SECONDARY_ACTION); 705 this.handleContentClick = function (evt) { 706 var target = evt.target; 707 if (ponyfill_1.closest(target, constants_1.selectors.PRIMARY_ACTION)) { 708 _this.foundation.handlePrimaryActionClick(); 709 } else if (ponyfill_1.closest(target, constants_1.selectors.SECONDARY_ACTION)) { 710 _this.foundation.handleSecondaryActionClick(); 711 } 712 }; 713 }; 714 MDCBanner.prototype.initialSyncWithDOM = function () { 715 this.registerContentClickHandler(this.handleContentClick); 716 }; 717 MDCBanner.prototype.destroy = function () { 718 _super.prototype.destroy.call(this); 719 this.deregisterContentClickHandler(this.handleContentClick); 720 }; 721 MDCBanner.prototype.layout = function () { 722 this.foundation.layout(); 723 }; 724 /** 725 * Opens the banner and fires events.OPENING to indicate the beginning of its 726 * opening animation and then events.OPENED once the animation finishes. 727 */ 728 MDCBanner.prototype.open = function () { 729 this.foundation.open(); 730 }; 731 /** 732 * Closes the banner and fires events.CLOSING to indicate the beginning of its 733 * closing animation and then events.CLOSED once the animation finishes. 734 * @param reason Why the banner was closed. Value will be passed to 735 * events.CLOSING and events.CLOSED via the `event.detail.reason` 736 * property. Standard values are CloseReason.PRIMARY and 737 * CloseReason.SECONDARY, but CloseReason.UNSPECIFIED is provided for 738 * custom handling of programmatic closing of the banner. 739 */ 740 MDCBanner.prototype.close = function (reason) { 741 this.foundation.close(reason); 742 }; 743 MDCBanner.prototype.getDefaultFoundation = function () { 744 var _this = this; 745 // DO NOT INLINE this variable. For backward compatibility, foundations take 746 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 747 // methods, we need a separate, strongly typed adapter variable. 748 var adapter = { 749 addClass: function addClass(className) { 750 _this.root.classList.add(className); 751 }, 752 getContentHeight: function getContentHeight() { 753 return _this.contentEl.offsetHeight; 754 }, 755 notifyClosed: function notifyClosed(reason) {
756 _this.emit(constants_1.events.CLOSED, { reason: reason }); 757 }, 758 notifyClosing: function notifyClosing(reason) { 759 _this.emit(constants_1.events.CLOSING, { reason: reason }); 760 }, 761 notifyOpened: function notifyOpened() { 762 _this.emit(constants_1.events.OPENED, {}); 763 }, 764 notifyOpening: function notifyOpening() { 765 _this.emit(constants_1.events.OPENING, {}); 766 }, 767 removeClass: function removeClass(className) { 768 _this.root.classList.remove(className); 769 }, 770 setStyleProperty: function setStyleProperty(propertyName, value) { 771 _this.root.style.setProperty(propertyName, value); 772 } 773 }; 774 return new foundation_1.MDCBannerFoundation(adapter); 775 }; 776 Object.defineProperty(MDCBanner.prototype, "isOpen", { 777 get: function get() { 778 return this.foundation.isOpen(); 779 }, 780 enumerable: true, 781 configurable: true 782 }); 783 MDCBanner.prototype.getText = function () { 784 return this.textEl.textContent || ''; 785 }; 786 MDCBanner.prototype.setText = function (text) { 787 this.textEl.textContent = text; 788 }; 789 MDCBanner.prototype.getPrimaryActionText = function () { 790 return this.primaryActionEl.textContent || ''; 791 }; 792 MDCBanner.prototype.setPrimaryActionText = function (actionButtonText) { 793 this.primaryActionEl.textContent = actionButtonText; 794 }; 795 /** Returns null if the banner has no secondary action. */ 796 MDCBanner.prototype.getSecondaryActionText = function () { 797 return this.secondaryActionEl ? this.secondaryActionEl.textContent || '' : null; 798 }; 799 MDCBanner.prototype.setSecondaryActionText = function (actionButtonText) { 800 if (this.secondaryActionEl) { 801 this.secondaryActionEl.textContent = actionButtonText; 802 } 803 }; 804 MDCBanner.prototype.registerContentClickHandler = function (handler) { 805 this.contentEl.addEventListener('click', handler); 806 }; 807 MDCBanner.prototype.deregisterContentClickHandler = function (handler) { 808 this.contentEl.removeEventListener('click', handler); 809 }; 810 return MDCBanner; 811}(component_1.MDCComponent); 812exports.MDCBanner = MDCBanner; 813 814/***/ }), 815
816/***/ "./packages/mdc-banner/constants.ts": 817/*!******************************************!*\ 818 !*** ./packages/mdc-banner/constants.ts ***! 819 \******************************************/ 820/*! no static exports found */ 821/***/ (function(module, exports, __webpack_require__) { 822 823"use strict"; 824 825/** 826 * @license 827 * Copyright 2020 Google Inc. 828 * 829 * Permission is hereby granted, free of charge, to any person obtaining a copy 830 * of this software and associated documentation files (the "Software"), to deal 831 * in the Software without restriction, including without limitation the rights 832 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 833 * copies of the Software, and to permit persons to whom the Software is 834 * furnished to do so, subject to the following conditions: 835 * 836 * The above copyright notice and this permission notice shall be included in 837 * all copies or substantial portions of the Software. 838 * 839 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 840 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 841 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 842 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 843 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 844 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 845 * THE SOFTWARE. 846 */ 847 848Object.defineProperty(exports, "__esModule", { value: true }); 849/** Banner element classes. */ 850exports.cssClasses = { 851 CLOSING: 'mdc-banner--closing', 852 OPEN: 'mdc-banner--open', 853 OPENING: 'mdc-banner--opening' 854}; 855/** Banner numbers. */ 856exports.numbers = { 857 BANNER_ANIMATION_CLOSE_TIME_MS: 250, 858 BANNER_ANIMATION_OPEN_TIME_MS: 300 859}; 860/** Banner events. */ 861exports.events = { 862 CLOSED: 'MDCBanner:closed', 863 CLOSING: 'MDCBanner:closing', 864 OPENED: 'MDCBanner:opened', 865 OPENING: 'MDCBanner:opening' 866}; 867/** Banner selectors. */ 868exports.selectors = { 869 CONTENT: '.mdc-banner__content', 870 PRIMARY_ACTION: '.mdc-banner__primary-action', 871 SECONDARY_ACTION: '.mdc-banner__secondary-action', 872 TEXT: '.mdc-banner__text' 873}; 874/** Reason as to why the banner was closed. */ 875var CloseReason; 876(function (CloseReason) { 877 // Indicates the banner was closed via primary action button. 878 CloseReason[CloseReason["PRIMARY"] = 0] = "PRIMARY"; 879 // Indicates the banner was closed via secondary action button. 880 CloseReason[CloseReason["SECONDARY"] = 1] = "SECONDARY"; 881 // Will never be used by the component. Provided for custom handling of 882 // programmatic closing of the banner. 883 CloseReason[CloseReason["UNSPECIFIED"] = 2] = "UNSPECIFIED"; 884})(CloseReason = exports.CloseReason || (exports.CloseReason = {})); 885 886/***/ }), 887
vendor: 2,752 bytes, lines 888-953
888/***/ "./packages/mdc-banner/foundation.ts": 889/*!*******************************************!*\ 890 !*** ./packages/mdc-banner/foundation.ts ***! 891 \*******************************************/ 892/*! no static exports found */ 893/***/ (function(module, exports, __webpack_require__) { 894 895"use strict"; 896 897/** 898 * @license 899 * Copyright 2020 Google Inc. 900 * 901 * Permission is hereby granted, free of charge, to any person obtaining a copy 902 * of this software and associated documentation files (the "Software"), to deal 903 * in the Software without restriction, including without limitation the rights 904 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 905 * copies of the Software, and to permit persons to whom the Software is 906 * furnished to do so, subject to the following conditions: 907 * 908 * The above copyright notice and this permission notice shall be included in 909 * all copies or substantial portions of the Software. 910 * 911 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 912 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 913 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 914 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 915 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 916 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 917 * THE SOFTWARE. 918 */ 919 920var __extends = this && this.__extends || function () { 921 var _extendStatics = function extendStatics(d, b) { 922 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 923 d.__proto__ = b; 924 } || function (d, b) { 925 for (var p in b) { 926 if (b.hasOwnProperty(p)) d[p] = b[p]; 927 } 928 }; 929 return _extendStatics(d, b); 930 }; 931 return function (d, b) { 932 _extendStatics(d, b); 933 function __() { 934 this.constructor = d; 935 } 936 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 937 }; 938}(); 939var __assign = this && this.__assign || function () { 940 __assign = Object.assign || function (t) { 941 for (var s, i = 1, n = arguments.length; i < n; i++) { 942 s = arguments[i]; 943 for (var p in s) { 944 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 945 } 946 } 947 return t; 948 }; 949 return __assign.apply(this, arguments); 950}; 951Object.defineProperty(exports, "__esModule", { value: true }); 952var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 953var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-banner/constants.ts");
954var OPENING = constants_1.cssClasses.OPENING, 955 OPEN = constants_1.cssClasses.OPEN, 956 CLOSING = constants_1.cssClasses.CLOSING; 957/** 958 * Foundation class for banner. Responsibilities include opening and closing the 959 * banner. 960 */ 961var MDCBannerFoundation = /** @class */function (_super) { 962 __extends(MDCBannerFoundation, _super); 963 function MDCBannerFoundation(adapter) { 964 var _this = _super.call(this, __assign(__assign({}, MDCBannerFoundation.defaultAdapter), adapter)) || this; 965 _this.isOpened = false; 966 // Request id for open animation, used to cancel the refresh callback 967 // request on close() and destroy(). 968 _this.animationFrame = 0; 969 // Timer id for close and open animation, used to cancel the timer on 970 // close() and destroy(). 971 _this.animationTimer = 0; 972 return _this; 973 } 974 Object.defineProperty(MDCBannerFoundation, "defaultAdapter", { 975 get: function get() { 976 return { 977 addClass: function addClass() { 978 return undefined; 979 }, 980 getContentHeight: function getContentHeight() { 981 return 0; 982 }, 983 notifyClosed: function notifyClosed() { 984 return undefined; 985 }, 986 notifyClosing: function notifyClosing() { 987 return undefined; 988 }, 989 notifyOpened: function notifyOpened() { 990 return undefined; 991 }, 992 notifyOpening: function notifyOpening() { 993 return undefined; 994 }, 995 removeClass: function removeClass() { 996 return undefined; 997 }, 998 setStyleProperty: function setStyleProperty() { 999 return undefined; 1000 } 1001 }; 1002 }, 1003 enumerable: true, 1004 configurable: true 1005 }); 1006 MDCBannerFoundation.prototype.destroy = function () { 1007 cancelAnimationFrame(this.animationFrame); 1008 this.animationFrame = 0; 1009 clearTimeout(this.animationTimer); 1010 this.animationTimer = 0; 1011 }; 1012 MDCBannerFoundation.prototype.open = function () { 1013 var _this = this; 1014 this.isOpened = true; 1015 this.adapter.notifyOpening(); 1016 this.adapter.removeClass(CLOSING); 1017 this.adapter.addClass(OPENING); 1018 var contentHeight = this.adapter.getContentHeight(); 1019 this.animationFrame = requestAnimationFrame(function () { 1020 _this.adapter.addClass(OPEN); 1021 _this.adapter.setStyleProperty('height', contentHeight + "px"); 1022 _this.animationTimer = setTimeout(function () { 1023 _this.handleAnimationTimerEnd(); 1024 _this.adapter.notifyOpened(); 1025 }, constants_1.numbers.BANNER_ANIMATION_OPEN_TIME_MS); 1026 }); 1027 }; 1028 /** 1029 * @param reason Why the banner was closed. Value will be passed to 1030 * events.CLOSING and events.CLOSED via the `event.detail.reason` 1031 * property. Standard values are CloseReason.PRIMARY and 1032 * CloseReason.SECONDARY, but CloseReason.UNSPECIFIED is provided for 1033 * custom handling of programmatic closing of the banner. 1034 */ 1035 MDCBannerFoundation.prototype.close = function (reason) { 1036 var _this = this; 1037 if (!this.isOpened) { 1038 // Avoid redundant close calls (and events), e.g. repeated interactions as 1039 // the banner is animating closed 1040 return; 1041 } 1042 cancelAnimationFrame(this.animationFrame); 1043 this.animationFrame = 0; 1044 this.isOpened = false; 1045 this.adapter.notifyClosing(reason); 1046 this.adapter.addClass(CLOSING); 1047 this.adapter.setStyleProperty('height', '0'); 1048 this.adapter.removeClass(OPEN); 1049 this.adapter.removeClass(OPENING); 1050 clearTimeout(this.animationTimer); 1051 this.animationTimer = setTimeout(function () { 1052 _this.handleAnimationTimerEnd(); 1053 _this.adapter.notifyClosed(reason); 1054 }, constants_1.numbers.BANNER_ANIMATION_CLOSE_TIME_MS); 1055 }; 1056 MDCBannerFoundation.prototype.isOpen = function () { 1057 return this.isOpened; 1058 }; 1059 MDCBannerFoundation.prototype.handlePrimaryActionClick = function () { 1060 this.close(constants_1.CloseReason.PRIMARY); 1061 }; 1062 MDCBannerFoundation.prototype.handleSecondaryActionClick = function () { 1063 this.close(constants_1.CloseReason.SECONDARY); 1064 }; 1065 MDCBannerFoundation.prototype.layout = function () { 1066 var contentHeight = this.adapter.getContentHeight(); 1067 this.adapter.setStyleProperty('height', contentHeight + "px"); 1068 }; 1069 MDCBannerFoundation.prototype.handleAnimationTimerEnd = function () { 1070 this.animationTimer = 0; 1071 this.adapter.removeClass(OPENING); 1072 this.adapter.removeClass(CLOSING); 1073 }; 1074 return MDCBannerFoundation; 1075}(foundation_1.MDCFoundation); 1076exports.MDCBannerFoundation = MDCBannerFoundation; 1077 1078/***/ }), 1079
1080/***/ "./packages/mdc-banner/index.ts": 1081/*!**************************************!*\ 1082 !*** ./packages/mdc-banner/index.ts ***! 1083 \**************************************/ 1084/*! no static exports found */ 1085/***/ (function(module, exports, __webpack_require__) { 1086 1087"use strict"; 1088 1089/** 1090 * @license 1091 * Copyright 2020 Google Inc. 1092 * 1093 * Permission is hereby granted, free of charge, to any person obtaining a copy 1094 * of this software and associated documentation files (the "Software"), to deal 1095 * in the Software without restriction, including without limitation the rights 1096 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1097 * copies of the Software, and to permit persons to whom the Software is 1098 * furnished to do so, subject to the following conditions: 1099 * 1100 * The above copyright notice and this permission notice shall be included in 1101 * all copies or substantial portions of the Software. 1102 * 1103 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1104 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1105 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1106 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1107 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1108 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1109 * THE SOFTWARE. 1110 */ 1111 1112function __export(m) { 1113 for (var p in m) { 1114 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 1115 } 1116} 1117Object.defineProperty(exports, "__esModule", { value: true }); 1118__export(__webpack_require__(/*! ./component */ "./packages/mdc-banner/component.ts")); 1119__export(__webpack_require__(/*! ./constants */ "./packages/mdc-banner/constants.ts")); 1120__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-banner/foundation.ts")); 1121 1122/***/ }), 1123
1124/***/ "./packages/mdc-base/component.ts": 1125/*!****************************************!*\ 1126 !*** ./packages/mdc-base/component.ts ***! 1127 \****************************************/ 1128/*! no static exports found */ 1129/***/ (function(module, exports, __webpack_require__) { 1130 1131"use strict"; 1132 1133/** 1134 * @license 1135 * Copyright 2016 Google Inc. 1136 * 1137 * Permission is hereby granted, free of charge, to any person obtaining a copy 1138 * of this software and associated documentation files (the "Software"), to deal 1139 * in the Software without restriction, including without limitation the rights 1140 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1141 * copies of the Software, and to permit persons to whom the Software is 1142 * furnished to do so, subject to the following conditions: 1143 * 1144 * The above copyright notice and this permission notice shall be included in 1145 * all copies or substantial portions of the Software. 1146 * 1147 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1148 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1149 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1150 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1151 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1152 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1153 * THE SOFTWARE. 1154 */ 1155 1156var __read = this && this.__read || function (o, n) { 1157 var m = typeof Symbol === "function" && o[Symbol.iterator]; 1158 if (!m) return o; 1159 var i = m.call(o), 1160 r, 1161 ar = [], 1162 e; 1163 try { 1164 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { 1165 ar.push(r.value); 1166 } 1167 } catch (error) { 1168 e = { error: error }; 1169 } finally { 1170 try { 1171 if (r && !r.done && (m = i["return"])) m.call(i); 1172 } finally { 1173 if (e) throw e.error; 1174 } 1175 } 1176 return ar; 1177}; 1178var __spread = this && this.__spread || function () { 1179 for (var ar = [], i = 0; i < arguments.length; i++) { 1180 ar = ar.concat(__read(arguments[i])); 1181 }return ar; 1182}; 1183Object.defineProperty(exports, "__esModule", { value: true }); 1184var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"); 1185var MDCComponent = /** @class */function () { 1186 function MDCComponent(root, foundation) { 1187 var args = []; 1188 for (var _i = 2; _i < arguments.length; _i++) { 1189 args[_i - 2] = arguments[_i]; 1190 } 1191 this.root = root; 1192 this.initialize.apply(this, __spread(args)); 1193 // Note that we initialize foundation here and not within the constructor's default param so that 1194 // this.root_ is defined and can be used within the foundation class. 1195 this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation; 1196 this.foundation.init(); 1197 this.initialSyncWithDOM(); 1198 } 1199 MDCComponent.attachTo = function (root) { 1200 // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and 1201 // returns an instantiated component with its root set to that element. Also note that in the cases of 1202 // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized 1203 // from getDefaultFoundation(). 1204 return new MDCComponent(root, new foundation_1.MDCFoundation({})); 1205 }; 1206 /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ 1207 MDCComponent.prototype.initialize = function () { 1208 var _args = []; 1209 for (var _i = 0; _i < arguments.length; _i++) { 1210 _args[_i] = arguments[_i]; 1211 } 1212 // Subclasses can override this to do any additional setup work that would be considered part of a 1213 // "constructor". Essentially, it is a hook into the parent constructor before the foundation is 1214 // initialized. Any additional arguments besides root and foundation will be passed in here. 1215 }; 1216 MDCComponent.prototype.getDefaultFoundation = function () { 1217 // Subclasses must override this method to return a properly configured foundation class for the 1218 // component. 1219 throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); 1220 }; 1221 MDCComponent.prototype.initialSyncWithDOM = function () { 1222 // Subclasses should override this method if they need to perform work to
1222synchronize with a host DOM 1223 // object. An example of this would be a form control wrapper that needs to synchronize its internal state 1224 // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM 1225 // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. 1226 }; 1227 MDCComponent.prototype.destroy = function () { 1228 // Subclasses may implement this method to release any resources / deregister any listeners they have 1229 // attached. An example of this might be deregistering a resize event from the window object. 1230 this.foundation.destroy(); 1231 }; 1232 MDCComponent.prototype.listen = function (evtType, handler, options) { 1233 this.root.addEventListener(evtType, handler, options); 1234 }; 1235 MDCComponent.prototype.unlisten = function (evtType, handler, options) { 1236 this.root.removeEventListener(evtType, handler, options); 1237 }; 1238 /** 1239 * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. 1240 */ 1241 MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { 1242 if (shouldBubble === void 0) { 1243 shouldBubble = false; 1244 } 1245 var evt; 1246 if (typeof CustomEvent === 'function') { 1247 evt = new CustomEvent(evtType, { 1248 bubbles: shouldBubble, 1249 detail: evtData 1250 }); 1251 } else { 1252 evt = document.createEvent('CustomEvent'); 1253 evt.initCustomEvent(evtType, shouldBubble, false, evtData); 1254 } 1255 this.root.dispatchEvent(evt); 1256 }; 1257 return MDCComponent; 1258}(); 1259exports.MDCComponent = MDCComponent; 1260// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 1261exports.default = MDCComponent; 1262 1263/***/ }), 1264
1265/***/ "./packages/mdc-base/foundation.ts": 1266/*!*****************************************!*\ 1267 !*** ./packages/mdc-base/foundation.ts ***! 1268 \*****************************************/ 1269/*! no static exports found */ 1270/***/ (function(module, exports, __webpack_require__) { 1271 1272"use strict"; 1273 1274/** 1275 * @license 1276 * Copyright 2016 Google Inc. 1277 * 1278 * Permission is hereby granted, free of charge, to any person obtaining a copy 1279 * of this software and associated documentation files (the "Software"), to deal 1280 * in the Software without restriction, including without limitation the rights 1281 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1282 * copies of the Software, and to permit persons to whom the Software is 1283 * furnished to do so, subject to the following conditions: 1284 * 1285 * The above copyright notice and this permission notice shall be included in 1286 * all copies or substantial portions of the Software. 1287 * 1288 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1289 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1290 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1291 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1292 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1293 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1294 * THE SOFTWARE. 1295 */ 1296 1297Object.defineProperty(exports, "__esModule", { value: true }); 1298var MDCFoundation = /** @class */function () { 1299 function MDCFoundation(adapter) { 1300 if (adapter === void 0) { 1301 adapter = {}; 1302 } 1303 this.adapter = adapter; 1304 } 1305 Object.defineProperty(MDCFoundation, "cssClasses", { 1306 get: function get() { 1307 // Classes extending MDCFoundation should implement this method to return an object which exports every 1308 // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} 1309 return {}; 1310 }, 1311 enumerable: true, 1312 configurable: true 1313 }); 1314 Object.defineProperty(MDCFoundation, "strings", { 1315 get: function get() { 1316 // Classes extending MDCFoundation should implement this method to return an object which exports all 1317 // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} 1318 return {}; 1319 }, 1320 enumerable: true, 1321 configurable: true 1322 }); 1323 Object.defineProperty(MDCFoundation, "numbers", { 1324 get: function get() { 1325 // Classes extending MDCFoundation should implement this method to return an object which exports all 1326 // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} 1327 return {}; 1328 }, 1329 enumerable: true, 1330 configurable: true 1331 }); 1332 Object.defineProperty(MDCFoundation, "defaultAdapter", { 1333 get: function get() { 1334 // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient 1335 // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter 1336 // validation. 1337 return {}; 1338 }, 1339 enumerable: true, 1340 configurable: true 1341 }); 1342 MDCFoundation.prototype.init = function () { 1343 // Subclasses should override this method to perform initialization routines (registering events, etc.) 1344 }; 1345 MDCFoundation.prototype.destroy = function () { 1346 // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) 1347 }; 1348 return MDCFoundation; 1349}(); 1350exports.MDCFoundation = MDCFoundation; 1351// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 1352exports.default = MDCFoundation; 1353 1354/***/ }), 1355
1356/***/ "./packages/mdc-base/index.ts": 1357/*!************************************!*\ 1358 !*** ./packages/mdc-base/index.ts ***! 1359 \************************************/ 1360/*! no static exports found */ 1361/***/ (function(module, exports, __webpack_require__) { 1362 1363"use strict"; 1364 1365/** 1366 * @license 1367 * Copyright 2019 Google Inc. 1368 * 1369 * Permission is hereby granted, free of charge, to any person obtaining a copy 1370 * of this software and associated documentation files (the "Software"), to deal 1371 * in the Software without restriction, including without limitation the rights 1372 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1373 * copies of the Software, and to permit persons to whom the Software is 1374 * furnished to do so, subject to the following conditions: 1375 * 1376 * The above copyright notice and this permission notice shall be included in 1377 * all copies or substantial portions of the Software. 1378 * 1379 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1380 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1381 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1382 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1383 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1384 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1385 * THE SOFTWARE. 1386 */ 1387 1388function __export(m) { 1389 for (var p in m) { 1390 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 1391 } 1392} 1393Object.defineProperty(exports, "__esModule", { value: true }); 1394__export(__webpack_require__(/*! ./component */ "./packages/mdc-base/component.ts")); 1395__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts")); 1396 1397/***/ }), 1398
1399/***/ "./packages/mdc-checkbox/component.ts": 1400/*!********************************************!*\ 1401 !*** ./packages/mdc-checkbox/component.ts ***! 1402 \********************************************/ 1403/*! no static exports found */ 1404/***/ (function(module, exports, __webpack_require__) { 1405 1406"use strict"; 1407 1408/** 1409 * @license 1410 * Copyright 2016 Google Inc. 1411 * 1412 * Permission is hereby granted, free of charge, to any person obtaining a copy 1413 * of this software and associated documentation files (the "Software"), to deal 1414 * in the Software without restriction, including without limitation the rights 1415 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1416 * copies of the Software, and to permit persons to whom the Software is 1417 * furnished to do so, subject to the following conditions: 1418 * 1419 * The above copyright notice and this permission notice shall be included in 1420 * all copies or substantial portions of the Software. 1421 * 1422 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1423 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1424 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1425 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1426 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1427 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1428 * THE SOFTWARE. 1429 */ 1430 1431var __extends = this && this.__extends || function () { 1432 var _extendStatics = function extendStatics(d, b) { 1433 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 1434 d.__proto__ = b; 1435 } || function (d, b) { 1436 for (var p in b) { 1437 if (b.hasOwnProperty(p)) d[p] = b[p]; 1438 } 1439 }; 1440 return _extendStatics(d, b); 1441 }; 1442 return function (d, b) { 1443 _extendStatics(d, b); 1444 function __() { 1445 this.constructor = d; 1446 } 1447 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 1448 }; 1449}(); 1450var __assign = this && this.__assign || function () { 1451 __assign = Object.assign || function (t) { 1452 for (var s, i = 1, n = arguments.length; i < n; i++) { 1453 s = arguments[i]; 1454 for (var p in s) { 1455 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 1456 } 1457 } 1458 return t; 1459 }; 1460 return __assign.apply(this, arguments); 1461}; 1462Object.defineProperty(exports, "__esModule", { value: true }); 1463var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 1464var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 1465var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 1466var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 1467var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 1468var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 1469var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"); 1470var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts"); 1471var CB_PROTO_PROPS = ['checked', 'indeterminate']; 1472var MDCCheckbox = /** @class */function (_super) { 1473 __extends(MDCCheckbox, _super); 1474 function MDCCheckbox() { 1475 var _this = _super !== null && _super.apply(this, arguments) || this; 1476 _this.ripple_ = _this.createRipple_(); 1477 return _this; 1478 } 1479 MDCCheckbox.attachTo = function (root) { 1480 return new MDCCheckbox(root); 1481 }; 1482 Object.defineProperty(MDCCheckbox.prototype, "ripple", { 1483 get: function get() { 1484 return this.ripple_; 1485 }, 1486 enumerable: true, 1487 configurable: true 1488 }); 1489 Object.defineProperty(MDCCheckbox.prototype, "checked", { 1490 get: function get() { 1491 return this.nativeControl_.checked; 1492 }, 1493 set: function set(checked) { 1494 this.nativeControl_.checked = checked; 1495 }, 1496 enumerable: true, 1497 configurable: true 1498 });
1499 Object.defineProperty(MDCCheckbox.prototype, "indeterminate", { 1500 get: function get() { 1501 return this.nativeControl_.indeterminate; 1502 }, 1503 set: function set(indeterminate) { 1504 this.nativeControl_.indeterminate = indeterminate; 1505 }, 1506 enumerable: true, 1507 configurable: true 1508 }); 1509 Object.defineProperty(MDCCheckbox.prototype, "disabled", { 1510 get: function get() { 1511 return this.nativeControl_.disabled; 1512 }, 1513 set: function set(disabled) { 1514 this.foundation.setDisabled(disabled); 1515 }, 1516 enumerable: true, 1517 configurable: true 1518 }); 1519 Object.defineProperty(MDCCheckbox.prototype, "value", { 1520 get: function get() { 1521 return this.nativeControl_.value; 1522 }, 1523 set: function set(value) { 1524 this.nativeControl_.value = value; 1525 }, 1526 enumerable: true, 1527 configurable: true 1528 }); 1529 MDCCheckbox.prototype.initialize = function () { 1530 var DATA_INDETERMINATE_ATTR = constants_1.strings.DATA_INDETERMINATE_ATTR; 1531 this.nativeControl_.indeterminate = this.nativeControl_.getAttribute(DATA_INDETERMINATE_ATTR) === 'true'; 1532 this.nativeControl_.removeAttribute(DATA_INDETERMINATE_ATTR); 1533 }; 1534 MDCCheckbox.prototype.initialSyncWithDOM = function () { 1535 var _this = this; 1536 this.handleChange_ = function () { 1537 return _this.foundation.handleChange(); 1538 }; 1539 this.handleAnimationEnd_ = function () { 1540 return _this.foundation.handleAnimationEnd(); 1541 }; 1542 this.nativeControl_.addEventListener('change', this.handleChange_); 1543 this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_); 1544 this.installPropertyChangeHooks_(); 1545 }; 1546 MDCCheckbox.prototype.destroy = function () { 1547 this.ripple_.destroy(); 1548 this.nativeControl_.removeEventListener('change', this.handleChange_); 1549 this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_); 1550 this.uninstallPropertyChangeHooks_(); 1551 _super.prototype.destroy.call(this); 1552 }; 1553 MDCCheckbox.prototype.getDefaultFoundation = function () { 1554 var _this = this; 1555 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 1556 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 1557 var adapter = { 1558 addClass: function addClass(className) { 1559 return _this.root.classList.add(className); 1560 }, 1561 forceLayout: function forceLayout() { 1562 return _this.root.offsetWidth; 1563 }, 1564 hasNativeControl: function hasNativeControl() { 1565 return !!_this.nativeControl_; 1566 }, 1567 isAttachedToDOM: function isAttachedToDOM() { 1568 return Boolean(_this.root.parentNode); 1569 }, 1570 isChecked: function isChecked() { 1571 return _this.checked; 1572 }, 1573 isIndeterminate: function isIndeterminate() { 1574 return _this.indeterminate; 1575 }, 1576 removeClass: function removeClass(className) { 1577 _this.root.classList.remove(className); 1578 }, 1579 removeNativeControlAttr: function removeNativeControlAttr(attr) { 1580 _this.nativeControl_.removeAttribute(attr); 1581 }, 1582 setNativeControlAttr: function setNativeControlAttr(attr, value) { 1583 _this.nativeControl_.setAttribute(attr, value); 1584 }, 1585 setNativeControlDisabled: function setNativeControlDisabled(disabled) { 1586 _this.nativeControl_.disabled = disabled; 1587 } 1588 }; 1589 return new foundation_2.MDCCheckboxFoundation(adapter); 1590 }; 1591 MDCCheckbox.prototype.createRipple_ = function () { 1592 var _this = this; 1593 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 1594 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 1595 var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 1596 return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive()); 1597 }, isSurfaceActive: function isSurfaceActive() { 1598 return ponyfill_1.matches(_this.nativeControl_, ':active'); 1599 }, isUnbounded: function isUnbounded() { 1600 return true; 1601 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 1602 return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive()); 1603 } }); 1604 return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter)); 1605 }; 1606 MDCCheckbox.prototype.installPropertyChangeHooks_ = function () { 1607 var _this = this; 1608 var nativeCb = this.nativeControl_; 1609 var cbProto = Object.getPrototypeOf(nativeCb);
1610 CB_PROTO_PROPS.forEach(function (controlState) { 1611 var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); 1612 // We have to check for this descriptor, since some browsers (Safari) don't support its return. 1613 // See: https://bugs.webkit.org/show_bug.cgi?id=49739 1614 if (!validDescriptor(desc)) { 1615 return; 1616 } 1617 // Type cast is needed for compatibility with Closure Compiler. 1618 var nativeGetter = desc.get; 1619 var nativeCbDesc = { 1620 configurable: desc.configurable, 1621 enumerable: desc.enumerable, 1622 get: nativeGetter, 1623 set: function set(state) { 1624 desc.set.call(nativeCb, state); 1625 _this.foundation.handleChange(); 1626 } 1627 }; 1628 Object.defineProperty(nativeCb, controlState, nativeCbDesc); 1629 }); 1630 }; 1631 MDCCheckbox.prototype.uninstallPropertyChangeHooks_ = function () { 1632 var nativeCb = this.nativeControl_; 1633 var cbProto = Object.getPrototypeOf(nativeCb); 1634 CB_PROTO_PROPS.forEach(function (controlState) { 1635 var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); 1636 if (!validDescriptor(desc)) { 1637 return; 1638 } 1639 Object.defineProperty(nativeCb, controlState, desc); 1640 }); 1641 }; 1642 Object.defineProperty(MDCCheckbox.prototype, "nativeControl_", { 1643 get: function get() { 1644 var NATIVE_CONTROL_SELECTOR = constants_1.strings.NATIVE_CONTROL_SELECTOR; 1645 var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR); 1646 if (!el) { 1647 throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element"); 1648 } 1649 return el; 1650 }, 1651 enumerable: true, 1652 configurable: true 1653 }); 1654 return MDCCheckbox; 1655}(component_1.MDCComponent); 1656exports.MDCCheckbox = MDCCheckbox; 1657function validDescriptor(inputPropDesc) { 1658 return !!inputPropDesc && typeof inputPropDesc.set === 'function'; 1659} 1660 1661/***/ }), 1662
1663/***/ "./packages/mdc-checkbox/constants.ts": 1664/*!********************************************!*\ 1665 !*** ./packages/mdc-checkbox/constants.ts ***! 1666 \********************************************/ 1667/*! no static exports found */ 1668/***/ (function(module, exports, __webpack_require__) { 1669 1670"use strict"; 1671 1672/** 1673 * @license 1674 * Copyright 2016 Google Inc. 1675 * 1676 * Permission is hereby granted, free of charge, to any person obtaining a copy 1677 * of this software and associated documentation files (the "Software"), to deal 1678 * in the Software without restriction, including without limitation the rights 1679 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1680 * copies of the Software, and to permit persons to whom the Software is 1681 * furnished to do so, subject to the following conditions: 1682 * 1683 * The above copyright notice and this permission notice shall be included in 1684 * all copies or substantial portions of the Software. 1685 * 1686 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1687 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1688 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1689 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1690 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1691 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1692 * THE SOFTWARE. 1693 */ 1694 1695Object.defineProperty(exports, "__esModule", { value: true }); 1696exports.cssClasses = { 1697 ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate', 1698 ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked', 1699 ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked', 1700 ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked', 1701 ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked', 1702 ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate', 1703 BACKGROUND: 'mdc-checkbox__background', 1704 CHECKED: 'mdc-checkbox--checked', 1705 CHECKMARK: 'mdc-checkbox__checkmark', 1706 CHECKMARK_PATH: 'mdc-checkbox__checkmark-path', 1707 DISABLED: 'mdc-checkbox--disabled', 1708 INDETERMINATE: 'mdc-checkbox--indeterminate', 1709 MIXEDMARK: 'mdc-checkbox__mixedmark', 1710 NATIVE_CONTROL: 'mdc-checkbox__native-control', 1711 ROOT: 'mdc-checkbox', 1712 SELECTED: 'mdc-checkbox--selected', 1713 UPGRADED: 'mdc-checkbox--upgraded' 1714}; 1715exports.strings = { 1716 ARIA_CHECKED_ATTR: 'aria-checked', 1717 ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed', 1718 DATA_INDETERMINATE_ATTR: 'data-indeterminate', 1719 NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control', 1720 TRANSITION_STATE_CHECKED: 'checked', 1721 TRANSITION_STATE_INDETERMINATE: 'indeterminate', 1722 TRANSITION_STATE_INIT: 'init', 1723 TRANSITION_STATE_UNCHECKED: 'unchecked' 1724}; 1725exports.numbers = { 1726 ANIM_END_LATCH_MS: 250 1727}; 1728 1729/***/ }), 1730
1731/***/ "./packages/mdc-checkbox/foundation.ts": 1732/*!*********************************************!*\ 1733 !*** ./packages/mdc-checkbox/foundation.ts ***! 1734 \*********************************************/ 1735/*! no static exports found */ 1736/***/ (function(module, exports, __webpack_require__) { 1737 1738"use strict"; 1739 1740/** 1741 * @license 1742 * Copyright 2016 Google Inc. 1743 * 1744 * Permission is hereby granted, free of charge, to any person obtaining a copy 1745 * of this software and associated documentation files (the "Software"), to deal 1746 * in the Software without restriction, including without limitation the rights 1747 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1748 * copies of the Software, and to permit persons to whom the Software is 1749 * furnished to do so, subject to the following conditions: 1750 * 1751 * The above copyright notice and this permission notice shall be included in 1752 * all copies or substantial portions of the Software. 1753 * 1754 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1755 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1756 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1757 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1758 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1759 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1760 * THE SOFTWARE. 1761 */ 1762 1763var __extends = this && this.__extends || function () { 1764 var _extendStatics = function extendStatics(d, b) { 1765 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 1766 d.__proto__ = b; 1767 } || function (d, b) { 1768 for (var p in b) { 1769 if (b.hasOwnProperty(p)) d[p] = b[p]; 1770 } 1771 }; 1772 return _extendStatics(d, b); 1773 }; 1774 return function (d, b) { 1775 _extendStatics(d, b); 1776 function __() { 1777 this.constructor = d; 1778 } 1779 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 1780 }; 1781}(); 1782var __assign = this && this.__assign || function () { 1783 __assign = Object.assign || function (t) { 1784 for (var s, i = 1, n = arguments.length; i < n; i++) { 1785 s = arguments[i]; 1786 for (var p in s) { 1787 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 1788 } 1789 } 1790 return t; 1791 }; 1792 return __assign.apply(this, arguments); 1793}; 1794Object.defineProperty(exports, "__esModule", { value: true }); 1795var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 1796var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"); 1797var MDCCheckboxFoundation = /** @class */function (_super) { 1798 __extends(MDCCheckboxFoundation, _super); 1799 function MDCCheckboxFoundation(adapter) { 1800 var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this; 1801 _this.currentCheckState_ = constants_1.strings.TRANSITION_STATE_INIT; 1802 _this.currentAnimationClass_ = ''; 1803 _this.animEndLatchTimer_ = 0; 1804 _this.enableAnimationEndHandler_ = false; 1805 return _this; 1806 } 1807 Object.defineProperty(MDCCheckboxFoundation, "cssClasses", { 1808 get: function get() {
1809 return constants_1.cssClasses; 1810 }, 1811 enumerable: true, 1812 configurable: true 1813 }); 1814 Object.defineProperty(MDCCheckboxFoundation, "strings", { 1815 get: function get() { 1816 return constants_1.strings; 1817 }, 1818 enumerable: true, 1819 configurable: true 1820 }); 1821 Object.defineProperty(MDCCheckboxFoundation, "numbers", { 1822 get: function get() { 1823 return constants_1.numbers; 1824 }, 1825 enumerable: true, 1826 configurable: true 1827 }); 1828 Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", { 1829 get: function get() { 1830 return { 1831 addClass: function addClass() { 1832 return undefined; 1833 }, 1834 forceLayout: function forceLayout() { 1835 return undefined; 1836 }, 1837 hasNativeControl: function hasNativeControl() { 1838 return false; 1839 }, 1840 isAttachedToDOM: function isAttachedToDOM() { 1841 return false; 1842 }, 1843 isChecked: function isChecked() { 1844 return false; 1845 }, 1846 isIndeterminate: function isIndeterminate() { 1847 return false; 1848 }, 1849 removeClass: function removeClass() { 1850 return undefined; 1851 }, 1852 removeNativeControlAttr: function removeNativeControlAttr() { 1853 return undefined; 1854 }, 1855 setNativeControlAttr: function setNativeControlAttr() { 1856 return undefined; 1857 }, 1858 setNativeControlDisabled: function setNativeControlDisabled() { 1859 return undefined; 1860 } 1861 }; 1862 }, 1863 enumerable: true, 1864 configurable: true 1865 }); 1866 MDCCheckboxFoundation.prototype.init = function () { 1867 this.currentCheckState_ = this.determineCheckState_(); 1868 this.updateAriaChecked_();
1869 this.adapter.addClass(constants_1.cssClasses.UPGRADED); 1870 }; 1871 MDCCheckboxFoundation.prototype.destroy = function () { 1872 clearTimeout(this.animEndLatchTimer_); 1873 }; 1874 MDCCheckboxFoundation.prototype.setDisabled = function (disabled) { 1875 this.adapter.setNativeControlDisabled(disabled); 1876 if (disabled) { 1877 this.adapter.addClass(constants_1.cssClasses.DISABLED); 1878 } else { 1879 this.adapter.removeClass(constants_1.cssClasses.DISABLED); 1880 } 1881 }; 1882 /** 1883 * Handles the animationend event for the checkbox 1884 */ 1885 MDCCheckboxFoundation.prototype.handleAnimationEnd = function () { 1886 var _this = this; 1887 if (!this.enableAnimationEndHandler_) { 1888 return; 1889 } 1890 clearTimeout(this.animEndLatchTimer_); 1891 this.animEndLatchTimer_ = setTimeout(function () { 1892 _this.adapter.removeClass(_this.currentAnimationClass_); 1893 _this.enableAnimationEndHandler_ = false; 1894 }, constants_1.numbers.ANIM_END_LATCH_MS); 1895 }; 1896 /** 1897 * Handles the change event for the checkbox 1898 */ 1899 MDCCheckboxFoundation.prototype.handleChange = function () { 1900 this.transitionCheckState_(); 1901 }; 1902 MDCCheckboxFoundation.prototype.transitionCheckState_ = function () { 1903 if (!this.adapter.hasNativeControl()) { 1904 return; 1905 } 1906 var oldState = this.currentCheckState_; 1907 var newState = this.determineCheckState_(); 1908 if (oldState === newState) { 1909 return; 1910 } 1911 this.updateAriaChecked_(); 1912 var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
1913 var SELECTED = constants_1.cssClasses.SELECTED; 1914 if (newState === TRANSITION_STATE_UNCHECKED) { 1915 this.adapter.removeClass(SELECTED); 1916 } else { 1917 this.adapter.addClass(SELECTED); 1918 } 1919 // Check to ensure that there isn't a previously existing animation class, in case for example 1920 // the user interacted with the checkbox before the animation was finished. 1921 if (this.currentAnimationClass_.length > 0) { 1922 clearTimeout(this.animEndLatchTimer_); 1923 this.adapter.forceLayout(); 1924 this.adapter.removeClass(this.currentAnimationClass_); 1925 } 1926 this.currentAnimationClass_ = this.getTransitionAnimationClass_(oldState, newState); 1927 this.currentCheckState_ = newState; 1928 // Check for parentNode so that animations are only run when the element is attached 1929 // to the DOM. 1930 if (this.adapter.isAttachedToDOM() && this.currentAnimationClass_.length > 0) { 1931 this.adapter.addClass(this.currentAnimationClass_); 1932 this.enableAnimationEndHandler_ = true; 1933 } 1934 }; 1935 MDCCheckboxFoundation.prototype.determineCheckState_ = function () { 1936 var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE, 1937 TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED, 1938 TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED; 1939 if (this.adapter.isIndeterminate()) { 1940 return TRANSITION_STATE_INDETERMINATE; 1941 } 1942 return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED; 1943 }; 1944 MDCCheckboxFoundation.prototype.getTransitionAnimationClass_ = function (oldState, newState) { 1945 var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT, 1946 TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED, 1947 TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED; 1948 var _a = MDCCheckboxFoundation.cssClasses, 1949 ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED, 1950 ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE, 1951 ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED, 1952 ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE, 1953 ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED, 1954 ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED; 1955 switch (oldState) { 1956 case TRANSITION_STATE_INIT: 1957 if (newState === TRANSITION_STATE_UNCHECKED) { 1958 return ''; 1959 } 1960 return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; 1961 case TRANSITION_STATE_UNCHECKED: 1962 return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE; 1963 case TRANSITION_STATE_CHECKED: 1964 return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE; 1965 default: 1966 // TRANSITION_STATE_INDETERMINATE 1967 return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; 1968 } 1969 }; 1970 MDCCheckboxFoundation.prototype.updateAriaChecked_ = function () { 1971 // Ensure aria-checked is set to mixed if checkbox is in indeterminate state. 1972 if (this.adapter.isIndeterminate()) { 1973 this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE); 1974 } else { 1975 // The on/off state does not need to keep track of aria-checked, since 1976 // the screenreader uses the checked property on the checkbox element. 1977 this.adapter.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR); 1978 } 1979 }; 1980 return MDCCheckboxFoundation; 1981}(foundation_1.MDCFoundation); 1982exports.MDCCheckboxFoundation = MDCCheckboxFoundation; 1983// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 1984exports.default = MDCCheckboxFoundation; 1985 1986/***/ }), 1987
1988/***/ "./packages/mdc-checkbox/index.ts": 1989/*!****************************************!*\ 1990 !*** ./packages/mdc-checkbox/index.ts ***! 1991 \****************************************/ 1992/*! no static exports found */ 1993/***/ (function(module, exports, __webpack_require__) { 1994 1995"use strict"; 1996 1997/** 1998 * @license 1999 * Copyright 2019 Google Inc. 2000 * 2001 * Permission is hereby granted, free of charge, to any person obtaining a copy 2002 * of this software and associated documentation files (the "Software"), to deal 2003 * in the Software without restriction, including without limitation the rights 2004 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2005 * copies of the Software, and to permit persons to whom the Software is 2006 * furnished to do so, subject to the following conditions: 2007 * 2008 * The above copyright notice and this permission notice shall be included in 2009 * all copies or substantial portions of the Software. 2010 * 2011 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2012 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2013 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2014 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2015 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2017 * THE SOFTWARE. 2018 */ 2019 2020function __export(m) { 2021 for (var p in m) { 2022 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 2023 } 2024} 2025Object.defineProperty(exports, "__esModule", { value: true }); 2026__export(__webpack_require__(/*! ./component */ "./packages/mdc-checkbox/component.ts")); 2027__export(__webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts")); 2028__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts")); 2029 2030/***/ }), 2031
2032/***/ "./packages/mdc-chips/chip-set/component.ts": 2033/*!**************************************************!*\ 2034 !*** ./packages/mdc-chips/chip-set/component.ts ***! 2035 \**************************************************/ 2036/*! no static exports found */ 2037/***/ (function(module, exports, __webpack_require__) { 2038 2039"use strict"; 2040 2041/** 2042 * @license 2043 * Copyright 2016 Google Inc. 2044 * 2045 * Permission is hereby granted, free of charge, to any person obtaining a copy 2046 * of this software and associated documentation files (the "Software"), to deal 2047 * in the Software without restriction, including without limitation the rights 2048 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2049 * copies of the Software, and to permit persons to whom the Software is 2050 * furnished to do so, subject to the following conditions: 2051 * 2052 * The above copyright notice and this permission notice shall be included in 2053 * all copies or substantial portions of the Software. 2054 * 2055 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2056 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2057 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2058 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2059 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2060 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2061 * THE SOFTWARE. 2062 */ 2063 2064var __extends = this && this.__extends || function () { 2065 var _extendStatics = function extendStatics(d, b) { 2066 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 2067 d.__proto__ = b; 2068 } || function (d, b) { 2069 for (var p in b) { 2070 if (b.hasOwnProperty(p)) d[p] = b[p]; 2071 } 2072 }; 2073 return _extendStatics(d, b); 2074 }; 2075 return function (d, b) { 2076 _extendStatics(d, b); 2077 function __() { 2078 this.constructor = d; 2079 } 2080 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2081 }; 2082}(); 2083Object.defineProperty(exports, "__esModule", { value: true }); 2084var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 2085var announce_1 = __webpack_require__(/*! @material/dom/announce */ "./packages/mdc-dom/announce.ts"); 2086var component_2 = __webpack_require__(/*! ../chip/component */ "./packages/mdc-chips/chip/component.ts"); 2087var foundation_1 = __webpack_require__(/*! ../chip/foundation */ "./packages/mdc-chips/chip/foundation.ts"); 2088var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts"); 2089var _a = foundation_1.MDCChipFoundation.strings, 2090 INTERACTION_EVENT = _a.INTERACTION_EVENT, 2091 SELECTION_EVENT = _a.SELECTION_EVENT, 2092 REMOVAL_EVENT = _a.REMOVAL_EVENT, 2093 NAVIGATION_EVENT = _a.NAVIGATION_EVENT; 2094var CHIP_SELECTOR = foundation_2.MDCChipSetFoundation.strings.CHIP_SELECTOR; 2095var idCounter = 0; 2096var MDCChipSet = /** @class */function (_super) { 2097 __extends(MDCChipSet, _super); 2098 function MDCChipSet() { 2099 return _super !== null && _super.apply(this, arguments) || this; 2100 } 2101 MDCChipSet.attachTo = function (root) { 2102 return new MDCChipSet(root); 2103 }; 2104 Object.defineProperty(MDCChipSet.prototype, "chips", { 2105 get: function get() { 2106 return this.chips_.slice(); 2107 }, 2108 enumerable: true, 2109 configurable: true 2110 }); 2111 Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", { 2112 /** 2113 * @return An array of the IDs of all selected chips. 2114 */ 2115 get: function get() { 2116 return this.foundation.getSelectedChipIds(); 2117 }, 2118 enumerable: true, 2119 configurable: true 2120 }); 2121 /** 2122 * @param chipFactory A function which creates a new MDCChip. 2123 */ 2124 MDCChipSet.prototype.initialize = function (chipFactory) { 2125 if (chipFactory === void 0) { 2126 chipFactory = function chipFactory(el) { 2127 return new component_2.MDCChip(el); 2128 }; 2129 } 2130 this.chipFactory_ = chipFactory; 2131 this.chips_ = this.instantiateChips_(this.chipFactory_); 2132 }; 2133 MDCChipSet.prototype.initialSyncWithDOM = function () { 2134 var _this = this; 2135 this.chips_.forEach(function (chip) { 2136 if (chip.id && chip.selected) { 2137 _this.foundation.select(chip.id); 2138 } 2139 }); 2140 this.handleChipInteraction_ = function (evt) { 2141 return _this.foundation.handleChipInteraction(evt.detail); 2142 }; 2143 this.handleChipSelection_ = function (evt) { 2144 return _this.foundation.handleChipSelection(evt.detail); 2145 }; 2146 this.handleChipRemoval_ = function (evt) { 2147 return _this.foundation.handleChipRemoval(evt.detail); 2148 }; 2149 this.handleChipNavigation_ = function (evt) { 2150 return _this.foundation.handleChipNavigation(evt.detail); 2151 }; 2152 this.listen(INTERACTION_EVENT, this.handleChipInteraction_); 2153 this.listen(SELECTION_EVENT, this.handleChipSelection_); 2154 this.listen(REMOVAL_EVENT, this.handleChipRemoval_); 2155 this.listen(NAVIGATION_EVENT, this.handleChipNavigation_); 2156 }; 2157 MDCChipSet.prototype.destroy = function () { 2158 this.chips_.forEach(function (chip) { 2159 chip.destroy(); 2160 }); 2161 this.unlisten(INTERACTION_EVENT, this.handleChipInteraction_); 2162 this.unlisten(SELECTION_EVENT, this.handleChipSelection_); 2163 this.unlisten(REMOVAL_EVENT, this.handleChipRemoval_); 2164 this.unlisten(NAVIGATION_EVENT, this.handleChipNavigation_); 2165 _super.prototype.destroy.call(this); 2166 }; 2167 /**
2168 * Adds a new chip object to the chip set from the given chip element. 2169 */ 2170 MDCChipSet.prototype.addChip = function (chipEl) { 2171 chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter; 2172 this.chips_.push(this.chipFactory_(chipEl)); 2173 }; 2174 MDCChipSet.prototype.getDefaultFoundation = function () { 2175 var _this = this; 2176 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 2177 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 2178 var adapter = { 2179 announceMessage: function announceMessage(message) { 2180 announce_1.announce(message); 2181 }, 2182 focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex(index) { 2183 _this.chips_[index].focusPrimaryAction(); 2184 }, 2185 focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex(index) { 2186 _this.chips_[index].focusTrailingAction(); 2187 }, 2188 getChipListCount: function getChipListCount() { 2189 return _this.chips_.length; 2190 }, 2191 getIndexOfChipById: function getIndexOfChipById(chipId) { 2192 return _this.findChipIndex_(chipId); 2193 }, 2194 hasClass: function hasClass(className) { 2195 return _this.root.classList.contains(className); 2196 }, 2197 isRTL: function isRTL() { 2198 return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; 2199 }, 2200 removeChipAtIndex: function removeChipAtIndex(index) { 2201 if (index >= 0 && index < _this.chips_.length) { 2202 _this.chips_[index].destroy(); 2203 _this.chips_[index].remove(); 2204 _this.chips_.splice(index, 1); 2205 } 2206 }, 2207 removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex(index) { 2208 _this.chips_[index].removeFocus(); 2209 }, 2210 selectChipAtIndex: function selectChipAtIndex(index, selected, shouldNotifyClients) { 2211 if (index >= 0 && index < _this.chips_.length) { 2212 _this.chips_[index].setSelectedFromChipSet(selected, shouldNotifyClients); 2213 } 2214 } 2215 }; 2216 return new foundation_2.MDCChipSetFoundation(adapter); 2217 }; 2218 /** 2219 * Instantiates chip components on all of the chip set's child chip elements. 2220 */ 2221 MDCChipSet.prototype.instantiateChips_ = function (chipFactory) { 2222 var chipElements = [].slice.call(this.root.querySelectorAll(CHIP_SELECTOR)); 2223 return chipElements.map(function (el) { 2224 el.id = el.id || "mdc-chip-" + ++idCounter; 2225 return chipFactory(el); 2226 }); 2227 }; 2228 /** 2229 * Returns the index of the chip with the given id, or -1 if the chip does not exist. 2230 */ 2231 MDCChipSet.prototype.findChipIndex_ = function (chipId) { 2232 for (var i = 0; i < this.chips_.length; i++) { 2233 if (this.chips_[i].id === chipId) { 2234 return i; 2235 } 2236 } 2237 return -1; 2238 }; 2239 return MDCChipSet; 2240}(component_1.MDCComponent); 2241exports.MDCChipSet = MDCChipSet; 2242 2243/***/ }), 2244
2245/***/ "./packages/mdc-chips/chip-set/constants.ts": 2246/*!**************************************************!*\ 2247 !*** ./packages/mdc-chips/chip-set/constants.ts ***! 2248 \**************************************************/ 2249/*! no static exports found */ 2250/***/ (function(module, exports, __webpack_require__) { 2251 2252"use strict"; 2253 2254/** 2255 * @license 2256 * Copyright 2016 Google Inc. 2257 * 2258 * Permission is hereby granted, free of charge, to any person obtaining a copy 2259 * of this software and associated documentation files (the "Software"), to deal 2260 * in the Software without restriction, including without limitation the rights 2261 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2262 * copies of the Software, and to permit persons to whom the Software is 2263 * furnished to do so, subject to the following conditions: 2264 * 2265 * The above copyright notice and this permission notice shall be included in 2266 * all copies or substantial portions of the Software. 2267 * 2268 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2269 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2270 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2271 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2272 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2273 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2274 * THE SOFTWARE. 2275 */ 2276 2277Object.defineProperty(exports, "__esModule", { value: true }); 2278exports.strings = { 2279 CHIP_SELECTOR: '.mdc-chip' 2280}; 2281exports.cssClasses = { 2282 CHOICE: 'mdc-chip-set--choice', 2283 FILTER: 'mdc-chip-set--filter' 2284}; 2285 2286/***/ }), 2287
2288/***/ "./packages/mdc-chips/chip-set/foundation.ts": 2289/*!***************************************************!*\ 2290 !*** ./packages/mdc-chips/chip-set/foundation.ts ***! 2291 \***************************************************/ 2292/*! no static exports found */ 2293/***/ (function(module, exports, __webpack_require__) { 2294 2295"use strict"; 2296 2297/** 2298 * @license 2299 * Copyright 2017 Google Inc. 2300 * 2301 * Permission is hereby granted, free of charge, to any person obtaining a copy 2302 * of this software and associated documentation files (the "Software"), to deal 2303 * in the Software without restriction, including without limitation the rights 2304 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2305 * copies of the Software, and to permit persons to whom the Software is 2306 * furnished to do so, subject to the following conditions: 2307 * 2308 * The above copyright notice and this permission notice shall be included in 2309 * all copies or substantial portions of the Software. 2310 * 2311 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2312 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2313 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2314 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2315 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2316 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2317 * THE SOFTWARE. 2318 */ 2319 2320var __extends = this && this.__extends || function () { 2321 var _extendStatics = function extendStatics(d, b) { 2322 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 2323 d.__proto__ = b; 2324 } || function (d, b) { 2325 for (var p in b) { 2326 if (b.hasOwnProperty(p)) d[p] = b[p]; 2327 } 2328 }; 2329 return _extendStatics(d, b); 2330 }; 2331 return function (d, b) { 2332 _extendStatics(d, b); 2333 function __() { 2334 this.constructor = d; 2335 } 2336 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2337 }; 2338}(); 2339var __assign = this && this.__assign || function () { 2340 __assign = Object.assign || function (t) { 2341 for (var s, i = 1, n = arguments.length; i < n; i++) { 2342 s = arguments[i]; 2343 for (var p in s) { 2344 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 2345 } 2346 } 2347 return t; 2348 }; 2349 return __assign.apply(this, arguments); 2350}; 2351Object.defineProperty(exports, "__esModule", { value: true }); 2352var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 2353var constants_1 = __webpack_require__(/*! ../chip/constants */ "./packages/mdc-chips/chip/constants.ts"); 2354var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts"); 2355var MDCChipSetFoundation = /** @class */function (_super) { 2356 __extends(MDCChipSetFoundation, _super); 2357 function MDCChipSetFoundation(adapter) { 2358 var _this = _super.call(this, __assign(__assign({}, MDCChipSetFoundation.defaultAdapter), adapter)) || this; 2359 /** 2360 * The ids of the selected chips in the set. Only used for choice chip set or filter chip set. 2361 */ 2362 _this.selectedChipIds_ = []; 2363 return _this; 2364 } 2365 Object.defineProperty(MDCChipSetFoundation, "strings", { 2366 get: function get() { 2367 return constants_2.strings; 2368 }, 2369 enumerable: true, 2370 configurable: true 2371 }); 2372 Object.defineProperty(MDCChipSetFoundation, "cssClasses", { 2373 get: function get() { 2374 return constants_2.cssClasses; 2375 }, 2376 enumerable: true, 2377 configurable: true 2378 }); 2379 Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", { 2380 get: function get() { 2381 return { 2382 announceMessage: function announceMessage() { 2383 return undefined; 2384 }, 2385 focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex() { 2386 return undefined; 2387 }, 2388 focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex() { 2389 return undefined; 2390 }, 2391 getChipListCount: function getChipListCount() { 2392 return -1; 2393 }, 2394 getIndexOfChipById: function getIndexOfChipById() { 2395 return -1; 2396 }, 2397 hasClass: function hasClass() { 2398 return false;
2399 }, 2400 isRTL: function isRTL() { 2401 return false; 2402 }, 2403 removeChipAtIndex: function removeChipAtIndex() { 2404 return undefined; 2405 }, 2406 removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex() { 2407 return undefined; 2408 }, 2409 selectChipAtIndex: function selectChipAtIndex() { 2410 return undefined; 2411 } 2412 }; 2413 }, 2414 enumerable: true, 2415 configurable: true 2416 }); 2417 /** 2418 * Returns an array of the IDs of all selected chips. 2419 */ 2420 MDCChipSetFoundation.prototype.getSelectedChipIds = function () { 2421 return this.selectedChipIds_.slice(); 2422 }; 2423 /** 2424 * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant. 2425 * Does not notify clients of the updated selection state. 2426 */ 2427 MDCChipSetFoundation.prototype.select = function (chipId) { 2428 this.select_(chipId, false); 2429 }; 2430 /** 2431 * Handles a chip interaction event 2432 */ 2433 MDCChipSetFoundation.prototype.handleChipInteraction = function (_a) { 2434 var chipId = _a.chipId; 2435 var index = this.adapter.getIndexOfChipById(chipId); 2436 this.removeFocusFromChipsExcept_(index); 2437 if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) || this.adapter.hasClass(constants_2.cssClasses.FILTER)) { 2438 this.toggleSelect_(chipId); 2439 } 2440 }; 2441 /** 2442 * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip. 2443 */ 2444 MDCChipSetFoundation.prototype.handleChipSelection = function (_a) { 2445 var chipId = _a.chipId, 2446 selected = _a.selected, 2447 shouldIgnore = _a.shouldIgnore; 2448 // Early exit if we should ignore the event 2449 if (shouldIgnore) { 2450 return; 2451 } 2452 var chipIsSelected = this.selectedChipIds_.indexOf(chipId) >= 0; 2453 if (selected && !chipIsSelected) { 2454 this.select(chipId); 2455 } else if (!selected && chipIsSelected) { 2456 this.deselect_(chipId); 2457 } 2458 }; 2459 /** 2460 * Handles the event when a chip is removed. 2461 */ 2462 MDCChipSetFoundation.prototype.handleChipRemoval = function (_a) { 2463 var chipId = _a.chipId, 2464 removedAnnouncement = _a.removedAnnouncement; 2465 if (removedAnnouncement) { 2466 this.adapter.announceMessage(removedAnnouncement); 2467 } 2468 var index = this.adapter.getIndexOfChipById(chipId); 2469 this.deselectAndNotifyClients_(chipId); 2470 this.adapter.removeChipAtIndex(index); 2471 var maxIndex = this.adapter.getChipListCount() - 1; 2472 if (maxIndex < 0) { 2473 return; 2474 } 2475 var nextIndex = Math.min(index, maxIndex); 2476 this.removeFocusFromChipsExcept_(nextIndex); 2477 // After removing a chip, we should focus the trailing action for the next chip. 2478 this.adapter.focusChipTrailingActionAtIndex(nextIndex); 2479 }; 2480 /** 2481 * Handles a chip navigation event. 2482 */ 2483 MDCChipSetFoundation.prototype.handleChipNavigation = function (_a) { 2484 var chipId = _a.chipId, 2485 key = _a.key, 2486 source = _a.source; 2487 var maxIndex = this.adapter.getChipListCount() - 1; 2488 var index = this.adapter.getIndexOfChipById(chipId); 2489 // Early exit if the index is out of range or the key is unusable 2490 if (index === -1 || !constants_1.navigationKeys.has(key)) { 2491 return; 2492 } 2493 var isRTL = this.adapter.isRTL(); 2494 var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; 2495 var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; 2496 var isDownKey = key === constants_1.strings.ARROW_DOWN_KEY || key === constants_1.strings.IE_ARROW_DOWN_KEY; 2497 var shouldIncrement = !isRTL && isRightKey || isRTL && isLeftKey || isDownKey; 2498 var isHome = key === constants_1.strings.HOME_KEY; 2499 var isEnd = key === constants_1.strings.END_KEY; 2500 if (shouldIncrement) { 2501 index++; 2502 } else if (isHome) { 2503 index = 0; 2504 } else if (isEnd) { 2505 index = maxIndex; 2506 } else { 2507 index--; 2508 } 2509 // Early exit if the index is out of bounds 2510 if (index < 0 || index > maxIndex) { 2511 return; 2512 } 2513 this.removeFocusFromChipsExcept_(index); 2514 this.focusChipAction_(index, key, source); 2515 };
2516 MDCChipSetFoundation.prototype.focusChipAction_ = function (index, key, source) { 2517 var shouldJumpChips = constants_1.jumpChipKeys.has(key); 2518 if (shouldJumpChips && source === constants_1.EventSource.PRIMARY) { 2519 return this.adapter.focusChipPrimaryActionAtIndex(index); 2520 } 2521 if (shouldJumpChips && source === constants_1.EventSource.TRAILING) { 2522 return this.adapter.focusChipTrailingActionAtIndex(index); 2523 } 2524 var dir = this.getDirection_(key); 2525 if (dir === constants_1.Direction.LEFT) { 2526 return this.adapter.focusChipTrailingActionAtIndex(index); 2527 } 2528 if (dir === constants_1.Direction.RIGHT) { 2529 return this.adapter.focusChipPrimaryActionAtIndex(index); 2530 } 2531 }; 2532 MDCChipSetFoundation.prototype.getDirection_ = function (key) { 2533 var isRTL = this.adapter.isRTL(); 2534 var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; 2535 var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; 2536 if (!isRTL && isLeftKey || isRTL && isRightKey) { 2537 return constants_1.Direction.LEFT; 2538 } 2539 return constants_1.Direction.RIGHT; 2540 }; 2541 /** 2542 * Deselects the chip with the given id and optionally notifies clients. 2543 */ 2544 MDCChipSetFoundation.prototype.deselect_ = function (chipId, shouldNotifyClients) { 2545 if (shouldNotifyClients === void 0) { 2546 shouldNotifyClients = false; 2547 } 2548 var index = this.selectedChipIds_.indexOf(chipId); 2549 if (index >= 0) { 2550 this.selectedChipIds_.splice(index, 1); 2551 var chipIndex = this.adapter.getIndexOfChipById(chipId); 2552 this.adapter.selectChipAtIndex(chipIndex, /** isSelected */false, shouldNotifyClients); 2553 } 2554 }; 2555 /** 2556 * Deselects the chip with the given id and notifies clients. 2557 */ 2558 MDCChipSetFoundation.prototype.deselectAndNotifyClients_ = function (chipId) { 2559 this.deselect_(chipId, true); 2560 }; 2561 /** 2562 * Toggles selection of the chip with the given id. 2563 */ 2564 MDCChipSetFoundation.prototype.toggleSelect_ = function (chipId) { 2565 if (this.selectedChipIds_.indexOf(chipId) >= 0) { 2566 this.deselectAndNotifyClients_(chipId); 2567 } else { 2568 this.selectAndNotifyClients_(chipId); 2569 } 2570 }; 2571 MDCChipSetFoundation.prototype.removeFocusFromChipsExcept_ = function (index) { 2572 var chipCount = this.adapter.getChipListCount(); 2573 for (var i = 0; i < chipCount; i++) { 2574 if (i !== index) { 2575 this.adapter.removeFocusFromChipAtIndex(i); 2576 } 2577 } 2578 }; 2579 MDCChipSetFoundation.prototype.selectAndNotifyClients_ = function (chipId) { 2580 this.select_(chipId, true); 2581 }; 2582 MDCChipSetFoundation.prototype.select_ = function (chipId, shouldNotifyClients) { 2583 if (this.selectedChipIds_.indexOf(chipId) >= 0) { 2584 return; 2585 } 2586 if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) && this.selectedChipIds_.length > 0) { 2587 var previouslySelectedChip = this.selectedChipIds_[0]; 2588 var previouslySelectedIndex = this.adapter.getIndexOfChipById(previouslySelectedChip); 2589 this.selectedChipIds_ = []; 2590 this.adapter.selectChipAtIndex(previouslySelectedIndex, /** isSelected */false, shouldNotifyClients); 2591 } 2592 this.selectedChipIds_.push(chipId); 2593 var index = this.adapter.getIndexOfChipById(chipId); 2594 this.adapter.selectChipAtIndex(index, /** isSelected */true, shouldNotifyClients); 2595 }; 2596 return MDCChipSetFoundation; 2597}(foundation_1.MDCFoundation); 2598exports.MDCChipSetFoundation = MDCChipSetFoundation; 2599// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 2600exports.default = MDCChipSetFoundation; 2601 2602/***/ }), 2603
2604/***/ "./packages/mdc-chips/chip-set/index.ts": 2605/*!**********************************************!*\ 2606 !*** ./packages/mdc-chips/chip-set/index.ts ***! 2607 \**********************************************/ 2608/*! no static exports found */ 2609/***/ (function(module, exports, __webpack_require__) { 2610 2611"use strict"; 2612 2613/** 2614 * @license 2615 * Copyright 2019 Google Inc. 2616 * 2617 * Permission is hereby granted, free of charge, to any person obtaining a copy 2618 * of this software and associated documentation files (the "Software"), to deal 2619 * in the Software without restriction, including without limitation the rights 2620 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2621 * copies of the Software, and to permit persons to whom the Software is 2622 * furnished to do so, subject to the following conditions: 2623 * 2624 * The above copyright notice and this permission notice shall be included in 2625 * all copies or substantial portions of the Software. 2626 * 2627 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2628 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2629 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2630 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2631 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2632 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2633 * THE SOFTWARE. 2634 */ 2635 2636function __export(m) { 2637 for (var p in m) { 2638 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 2639 } 2640} 2641Object.defineProperty(exports, "__esModule", { value: true }); 2642__export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip-set/component.ts")); 2643__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts")); 2644var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts");
2645exports.chipSetCssClasses = constants_1.cssClasses; 2646exports.chipSetStrings = constants_1.strings; 2647 2648/***/ }), 2649
2650/***/ "./packages/mdc-chips/chip/component.ts": 2651/*!**********************************************!*\ 2652 !*** ./packages/mdc-chips/chip/component.ts ***! 2653 \**********************************************/ 2654/*! no static exports found */ 2655/***/ (function(module, exports, __webpack_require__) { 2656 2657"use strict"; 2658 2659/** 2660 * @license 2661 * Copyright 2016 Google Inc. 2662 * 2663 * Permission is hereby granted, free of charge, to any person obtaining a copy 2664 * of this software and associated documentation files (the "Software"), to deal 2665 * in the Software without restriction, including without limitation the rights 2666 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2667 * copies of the Software, and to permit persons to whom the Software is 2668 * furnished to do so, subject to the following conditions: 2669 * 2670 * The above copyright notice and this permission notice shall be included in 2671 * all copies or substantial portions of the Software. 2672 * 2673 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2674 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2675 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2676 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2677 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2678 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2679 * THE SOFTWARE. 2680 */ 2681 2682var __extends = this && this.__extends || function () { 2683 var _extendStatics = function extendStatics(d, b) { 2684 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 2685 d.__proto__ = b; 2686 } || function (d, b) { 2687 for (var p in b) { 2688 if (b.hasOwnProperty(p)) d[p] = b[p]; 2689 } 2690 }; 2691 return _extendStatics(d, b); 2692 }; 2693 return function (d, b) { 2694 _extendStatics(d, b); 2695 function __() { 2696 this.constructor = d; 2697 } 2698 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2699 }; 2700}(); 2701var __assign = this && this.__assign || function () { 2702 __assign = Object.assign || function (t) { 2703 for (var s, i = 1, n = arguments.length; i < n; i++) { 2704 s = arguments[i]; 2705 for (var p in s) { 2706 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 2707 } 2708 } 2709 return t; 2710 }; 2711 return __assign.apply(this, arguments); 2712}; 2713Object.defineProperty(exports, "__esModule", { value: true }); 2714var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 2715var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 2716var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 2717var component_3 = __webpack_require__(/*! ../trailingaction/component */ "./packages/mdc-chips/trailingaction/component.ts"); 2718var constants_1 = __webpack_require__(/*! ../trailingaction/constants */ "./packages/mdc-chips/trailingaction/constants.ts"); 2719var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts"); 2720var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts"); 2721var MDCChip = /** @class */function (_super) { 2722 __extends(MDCChip, _super); 2723 function MDCChip() { 2724 return _super !== null && _super.apply(this, arguments) || this; 2725 } 2726 Object.defineProperty(MDCChip.prototype, "selected", { 2727 /** 2728 * @return Whether the chip is selected. 2729 */ 2730 get: function get() { 2731 return this.foundation.isSelected(); 2732 }, 2733 /** 2734 * Sets selected state on the chip. 2735 */ 2736 set: function set(selected) { 2737 this.foundation.setSelected(selected); 2738 }, 2739 enumerable: true, 2740 configurable: true 2741 }); 2742 Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", { 2743 /** 2744 * @return Whether a trailing icon click should trigger exit/removal of the chip. 2745 */ 2746 get: function get() { 2747 return this.foundation.getShouldRemoveOnTrailingIconClick(); 2748 }, 2749 /** 2750 * Sets whether a trailing icon click should trigger exit/removal of the chip. 2751 */ 2752 set: function set(shouldRemove) { 2753 this.foundation.setShouldRemoveOnTrailingIconClick(shouldRemove); 2754 }, 2755 enumerable: true, 2756 configurable: true 2757 });
2758 Object.defineProperty(MDCChip.prototype, "setShouldFocusPrimaryActionOnClick", { 2759 /** 2760 * Sets whether a clicking on the chip should focus the primary action. 2761 */ 2762 set: function set(shouldFocus) { 2763 this.foundation.setShouldFocusPrimaryActionOnClick(shouldFocus); 2764 }, 2765 enumerable: true, 2766 configurable: true 2767 }); 2768 Object.defineProperty(MDCChip.prototype, "ripple", { 2769 get: function get() { 2770 return this.ripple_; 2771 }, 2772 enumerable: true, 2773 configurable: true 2774 }); 2775 Object.defineProperty(MDCChip.prototype, "id", { 2776 get: function get() { 2777 return this.root.id; 2778 }, 2779 enumerable: true, 2780 configurable: true 2781 }); 2782 MDCChip.attachTo = function (root) { 2783 return new MDCChip(root); 2784 }; 2785 MDCChip.prototype.initialize = function (rippleFactory, trailingActionFactory) { 2786 var _this = this; 2787 if (rippleFactory === void 0) { 2788 rippleFactory = function rippleFactory(el, foundation) { 2789 return new component_2.MDCRipple(el, foundation); 2790 }; 2791 } 2792 if (trailingActionFactory === void 0) { 2793 trailingActionFactory = function trailingActionFactory(el) { 2794 return new component_3.MDCChipTrailingAction(el); 2795 }; 2796 } 2797 this.leadingIcon_ = this.root.querySelector(constants_2.strings.LEADING_ICON_SELECTOR); 2798 this.checkmark_ = this.root.querySelector(constants_2.strings.CHECKMARK_SELECTOR); 2799 this.primaryAction_ = this.root.querySelector(constants_2.strings.PRIMARY_ACTION_SELECTOR); 2800 var trailingActionEl = this.root.querySelector(constants_2.strings.TRAILING_ACTION_SELECTOR); 2801 if (trailingActionEl) { 2802 this.trailingAction_ = trailingActionFactory(trailingActionEl); 2803 } 2804 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 2805 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 2806 var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() { 2807 return _this.foundation.getDimensions(); 2808 } }); 2809 this.ripple_ = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter)); 2810 }; 2811 MDCChip.prototype.initialSyncWithDOM = function () { 2812 var _this = this; 2813 // Custom events 2814 this.handleTrailingActionInteraction_ = function () { 2815 _this.foundation.handleTrailingActionInteraction(); 2816 }; 2817 this.handleTrailingActionNavigation_ = function (evt) { 2818 _this.foundation.handleTrailingActionNavigation(evt); 2819 }; 2820 // Native events 2821 this.handleClick_ = function () { 2822 _this.foundation.handleClick(); 2823 }; 2824 this.handleKeydown_ = function (evt) { 2825 _this.foundation.handleKeydown(evt); 2826 }; 2827 this.handleTransitionEnd_ = function (evt) { 2828 _this.foundation.handleTransitionEnd(evt); 2829 }; 2830 this.handleFocusIn_ = function (evt) { 2831 _this.foundation.handleFocusIn(evt); 2832 }; 2833 this.handleFocusOut_ = function (evt) { 2834 _this.foundation.handleFocusOut(evt); 2835 }; 2836 this.listen('transitionend', this.handleTransitionEnd_); 2837 this.listen('click', this.handleClick_); 2838 this.listen('keydown', this.handleKeydown_); 2839 this.listen('focusin', this.handleFocusIn_); 2840 this.listen('focusout', this.handleFocusOut_); 2841 if (this.trailingAction_) { 2842 this.listen(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction_); 2843 this.listen(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation_); 2844 } 2845 }; 2846 MDCChip.prototype.destroy = function () { 2847 this.ripple_.destroy(); 2848 this.unlisten('transitionend', this.handleTransitionEnd_); 2849 this.unlisten('keydown', this.handleKeydown_); 2850 this.unlisten('click', this.handleClick_); 2851 this.unlisten('focusin', this.handleFocusIn_); 2852 this.unlisten('focusout', this.handleFocusOut_); 2853 if (this.trailingAction_) { 2854 this.unlisten(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction_); 2855 this.unlisten(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation_); 2856 } 2857 _super.prototype.destroy.call(this); 2858 }; 2859 /** 2860 * Begins the exit animation which leads to removal of the chip. 2861 */ 2862 MDCChip.prototype.beginExit = function () { 2863 this.foundation.beginExit(); 2864 }; 2865 MDCChip.prototype.getDefaultFoundation = function () { 2866 var _this = this; 2867 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 2868 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 2869 var adapter = { 2870 addClass: function addClass(className) { 2871 return _this.root.classList.add(className); 2872 }, 2873 addClassToLeadingIcon: function addClassToLeadingIcon(className) { 2874 if (_this.leadingIcon_) { 2875 _this.leadingIcon_.classList.add(className); 2876 } 2877 }, 2878 eventTargetHasClass: function eventTargetHasClass(target, className) { 2879 return target ? target.classList.contains(className) : false;
2880 }, 2881 focusPrimaryAction: function focusPrimaryAction() { 2882 if (_this.primaryAction_) { 2883 _this.primaryAction_.focus(); 2884 } 2885 }, 2886 focusTrailingAction: function focusTrailingAction() { 2887 if (_this.trailingAction_) { 2888 _this.trailingAction_.focus(); 2889 } 2890 }, 2891 getAttribute: function getAttribute(attr) { 2892 return _this.root.getAttribute(attr); 2893 }, 2894 getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() { 2895 return _this.checkmark_ ? _this.checkmark_.getBoundingClientRect() : null; 2896 }, 2897 getComputedStyleValue: function getComputedStyleValue(propertyName) { 2898 return window.getComputedStyle(_this.root).getPropertyValue(propertyName); 2899 }, 2900 getRootBoundingClientRect: function getRootBoundingClientRect() { 2901 return _this.root.getBoundingClientRect(); 2902 }, 2903 hasClass: function hasClass(className) { 2904 return _this.root.classList.contains(className); 2905 }, 2906 hasLeadingIcon: function hasLeadingIcon() { 2907 return !!_this.leadingIcon_; 2908 }, 2909 isRTL: function isRTL() { 2910 return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; 2911 }, 2912 isTrailingActionNavigable: function isTrailingActionNavigable() { 2913 if (_this.trailingAction_) { 2914 return _this.trailingAction_.isNavigable(); 2915 } 2916 return false; 2917 }, 2918 notifyInteraction: function notifyInteraction() { 2919 return _this.emit(constants_2.strings.INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */); 2920 }, 2921 notifyNavigation: function notifyNavigation(key, source) { 2922 return _this.emit(constants_2.strings.NAVIGATION_EVENT, { chipId: _this.id, key: key, source: source }, true /* shouldBubble */); 2923 }, 2924 notifyRemoval: function notifyRemoval(removedAnnouncement) { 2925 _this.emit(constants_2.strings.REMOVAL_EVENT, { chipId: _this.id, removedAnnouncement: removedAnnouncement }, true /* shouldBubble */); 2926 }, 2927 notifySelection: function notifySelection(selected, shouldIgnore) { 2928 return _this.emit(constants_2.strings.SELECTION_EVENT, { chipId: _this.id, selected: selected, shouldIgnore: shouldIgnore }, true /* shouldBubble */); 2929 }, 2930 notifyTrailingIconInteraction: function notifyTrailingIconInteraction() { 2931 return _this.emit(constants_2.strings.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */); 2932 }, 2933 notifyEditStart: function notifyEditStart() {}, 2934 notifyEditFinish: function notifyEditFinish() {}, 2935 removeClass: function removeClass(className) { 2936 return _this.root.classList.remove(className); 2937 }, 2938 removeClassFromLeadingIcon: function removeClassFromLeadingIcon(className) { 2939 if (_this.leadingIcon_) { 2940 _this.leadingIcon_.classList.remove(className); 2941 } 2942 }, 2943 removeTrailingActionFocus: function removeTrailingActionFocus() { 2944 if (_this.trailingAction_) { 2945 _this.trailingAction_.removeFocus(); 2946 } 2947 }, 2948 setPrimaryActionAttr: function setPrimaryActionAttr(attr, value) { 2949 if (_this.primaryAction_) { 2950 _this.primaryAction_.setAttribute(attr, value); 2951 } 2952 }, 2953 setStyleProperty: function setStyleProperty(propertyName, value) { 2954 return _this.root.style.setProperty(propertyName, value); 2955 } 2956 }; 2957 return new foundation_2.MDCChipFoundation(adapter); 2958 }; 2959 MDCChip.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) { 2960 this.foundation.setSelectedFromChipSet(selected, shouldNotifyClients); 2961 };
2962 MDCChip.prototype.focusPrimaryAction = function () { 2963 this.foundation.focusPrimaryAction(); 2964 }; 2965 MDCChip.prototype.focusTrailingAction = function () { 2966 this.foundation.focusTrailingAction(); 2967 }; 2968 MDCChip.prototype.removeFocus = function () { 2969 this.foundation.removeFocus(); 2970 }; 2971 MDCChip.prototype.remove = function () { 2972 var parent = this.root.parentNode; 2973 if (parent !== null) { 2974 parent.removeChild(this.root); 2975 } 2976 }; 2977 return MDCChip; 2978}(component_1.MDCComponent); 2979exports.MDCChip = MDCChip; 2980 2981/***/ }), 2982
2983/***/ "./packages/mdc-chips/chip/constants.ts": 2984/*!**********************************************!*\ 2985 !*** ./packages/mdc-chips/chip/constants.ts ***! 2986 \**********************************************/ 2987/*! no static exports found */ 2988/***/ (function(module, exports, __webpack_require__) { 2989 2990"use strict"; 2991 2992/** 2993 * @license 2994 * Copyright 2016 Google Inc. 2995 * 2996 * Permission is hereby granted, free of charge, to any person obtaining a copy 2997 * of this software and associated documentation files (the "Software"), to deal 2998 * in the Software without restriction, including without limitation the rights 2999 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3000 * copies of the Software, and to permit persons to whom the Software is 3001 * furnished to do so, subject to the following conditions: 3002 * 3003 * The above copyright notice and this permission notice shall be included in 3004 * all copies or substantial portions of the Software. 3005 * 3006 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3007 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3008 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3009 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3010 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3011 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3012 * THE SOFTWARE. 3013 */ 3014 3015Object.defineProperty(exports, "__esModule", { value: true }); 3016var Direction; 3017(function (Direction) { 3018 Direction["LEFT"] = "left"; 3019 Direction["RIGHT"] = "right"; 3020})(Direction = exports.Direction || (exports.Direction = {})); 3021var EventSource; 3022(function (EventSource) { 3023 EventSource["PRIMARY"] = "primary"; 3024 EventSource["TRAILING"] = "trailing"; 3025 EventSource["NONE"] = "none"; 3026})(EventSource = exports.EventSource || (exports.EventSource = {})); 3027exports.strings = { 3028 ADDED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-added-announcement', 3029 ARIA_CHECKED: 'aria-checked', 3030 ARROW_DOWN_KEY: 'ArrowDown', 3031 ARROW_LEFT_KEY: 'ArrowLeft', 3032 ARROW_RIGHT_KEY: 'ArrowRight', 3033 ARROW_UP_KEY: 'ArrowUp', 3034 BACKSPACE_KEY: 'Backspace', 3035 CHECKMARK_SELECTOR: '.mdc-chip__checkmark', 3036 DELETE_KEY: 'Delete', 3037 END_KEY: 'End',
3038 ENTER_KEY: 'Enter', 3039 ENTRY_ANIMATION_NAME: 'mdc-chip-entry', 3040 HOME_KEY: 'Home', 3041 IE_ARROW_DOWN_KEY: 'Down', 3042 IE_ARROW_LEFT_KEY: 'Left', 3043 IE_ARROW_RIGHT_KEY: 'Right', 3044 IE_ARROW_UP_KEY: 'Up', 3045 IE_DELETE_KEY: 'Del', 3046 INTERACTION_EVENT: 'MDCChip:interaction', 3047 LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading', 3048 NAVIGATION_EVENT: 'MDCChip:navigation', 3049 PRIMARY_ACTION_SELECTOR: '.mdc-chip__primary-action', 3050 REMOVED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-removed-announcement', 3051 REMOVAL_EVENT: 'MDCChip:removal', 3052 SELECTION_EVENT: 'MDCChip:selection', 3053 SPACEBAR_KEY: ' ', 3054 TAB_INDEX: 'tabindex', 3055 TRAILING_ACTION_SELECTOR: '.mdc-chip-trailing-action', 3056 TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction', 3057 TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing' 3058}; 3059exports.cssClasses = { 3060 CHECKMARK: 'mdc-chip__checkmark', 3061 CHIP_EXIT: 'mdc-chip--exit', 3062 DELETABLE: 'mdc-chip--deletable', 3063 EDITABLE: 'mdc-chip--editable', 3064 EDITING: 'mdc-chip--editing', 3065 HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden', 3066 LEADING_ICON: 'mdc-chip__icon--leading', 3067 PRIMARY_ACTION: 'mdc-chip__primary-action', 3068 PRIMARY_ACTION_FOCUSED: 'mdc-chip--primary-action-focused', 3069 SELECTED: 'mdc-chip--selected', 3070 TEXT: 'mdc-chip__text', 3071 TRAILING_ACTION: 'mdc-chip__trailing-action', 3072 TRAILING_ICON: 'mdc-chip__icon--trailing' 3073}; 3074exports.navigationKeys = new Set(); 3075// IE11 has no support for new Set with iterable so we need to initialize this by hand 3076exports.navigationKeys.add(exports.strings.ARROW_LEFT_KEY); 3077exports.navigationKeys.add(exports.strings.ARROW_RIGHT_KEY); 3078exports.navigationKeys.add(exports.strings.ARROW_DOWN_KEY); 3079exports.navigationKeys.add(exports.strings.ARROW_UP_KEY); 3080exports.navigationKeys.add(exports.strings.END_KEY); 3081exports.navigationKeys.add(exports.strings.HOME_KEY); 3082exports.navigationKeys.add(exports.strings.IE_ARROW_LEFT_KEY); 3083exports.navigationKeys.add(exports.strings.IE_ARROW_RIGHT_KEY); 3084exports.navigationKeys.add(exports.strings.IE_ARROW_DOWN_KEY); 3085exports.navigationKeys.add(exports.strings.IE_ARROW_UP_KEY); 3086exports.jumpChipKeys = new Set(); 3087// IE11 has no support for new Set with iterable so we need to initialize this by hand 3088exports.jumpChipKeys.add(exports.strings.ARROW_UP_KEY); 3089exports.jumpChipKeys.add(exports.strings.ARROW_DOWN_KEY); 3090exports.jumpChipKeys.add(exports.strings.HOME_KEY); 3091exports.jumpChipKeys.add(exports.strings.END_KEY); 3092exports.jumpChipKeys.add(exports.strings.IE_ARROW_UP_KEY); 3093exports.jumpChipKeys.add(exports.strings.IE_ARROW_DOWN_KEY); 3094 3095/***/ }), 3096
3097/***/ "./packages/mdc-chips/chip/foundation.ts": 3098/*!***********************************************!*\ 3099 !*** ./packages/mdc-chips/chip/foundation.ts ***! 3100 \***********************************************/ 3101/*! no static exports found */ 3102/***/ (function(module, exports, __webpack_require__) { 3103 3104"use strict"; 3105 3106/** 3107 * @license 3108 * Copyright 2016 Google Inc. 3109 * 3110 * Permission is hereby granted, free of charge, to any person obtaining a copy 3111 * of this software and associated documentation files (the "Software"), to deal 3112 * in the Software without restriction, including without limitation the rights 3113 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3114 * copies of the Software, and to permit persons to whom the Software is 3115 * furnished to do so, subject to the following conditions: 3116 * 3117 * The above copyright notice and this permission notice shall be included in 3118 * all copies or substantial portions of the Software. 3119 * 3120 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3121 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3122 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3123 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3124 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3125 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3126 * THE SOFTWARE. 3127 */ 3128 3129var __extends = this && this.__extends || function () { 3130 var _extendStatics = function extendStatics(d, b) { 3131 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 3132 d.__proto__ = b; 3133 } || function (d, b) { 3134 for (var p in b) { 3135 if (b.hasOwnProperty(p)) d[p] = b[p]; 3136 } 3137 }; 3138 return _extendStatics(d, b); 3139 }; 3140 return function (d, b) { 3141 _extendStatics(d, b); 3142 function __() { 3143 this.constructor = d; 3144 } 3145 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 3146 }; 3147}(); 3148var __assign = this && this.__assign || function () { 3149 __assign = Object.assign || function (t) { 3150 for (var s, i = 1, n = arguments.length; i < n; i++) { 3151 s = arguments[i]; 3152 for (var p in s) { 3153 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 3154 } 3155 } 3156 return t; 3157 }; 3158 return __assign.apply(this, arguments); 3159}; 3160Object.defineProperty(exports, "__esModule", { value: true }); 3161var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 3162var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts"); 3163var emptyClientRect = { 3164 bottom: 0, 3165 height: 0, 3166 left: 0, 3167 right: 0, 3168 top: 0, 3169 width: 0 3170}; 3171var FocusBehavior; 3172(function (FocusBehavior) { 3173 FocusBehavior[FocusBehavior["SHOULD_FOCUS"] = 0] = "SHOULD_FOCUS"; 3174 FocusBehavior[FocusBehavior["SHOULD_NOT_FOCUS"] = 1] = "SHOULD_NOT_FOCUS"; 3175})(FocusBehavior || (FocusBehavior = {})); 3176var MDCChipFoundation = /** @class */function (_super) { 3177 __extends(MDCChipFoundation, _super); 3178 function MDCChipFoundation(adapter) { 3179 var _this = _super.call(this, __assign(__assign({}, MDCChipFoundation.defaultAdapter), adapter)) || this; 3180 /** Whether a trailing icon click should immediately trigger exit/removal of the chip. */ 3181 _this.shouldRemoveOnTrailingIconClick_ = true; 3182 /** 3183 * Whether the primary action should receive focus on click. Should only be 3184 * set to true for clients who programmatically give focus to a different 3185 * element on the page when a chip is clicked (like a menu). 3186 */ 3187 _this.shouldFocusPrimaryActionOnClick_ = true; 3188 return _this; 3189 } 3190 Object.defineProperty(MDCChipFoundation, "strings", { 3191 get: function get() { 3192 return constants_1.strings; 3193 }, 3194 enumerable: true, 3195 configurable: true 3196 });
3197 Object.defineProperty(MDCChipFoundation, "cssClasses", { 3198 get: function get() { 3199 return constants_1.cssClasses; 3200 }, 3201 enumerable: true, 3202 configurable: true 3203 }); 3204 Object.defineProperty(MDCChipFoundation, "defaultAdapter", { 3205 get: function get() { 3206 return { 3207 addClass: function addClass() { 3208 return undefined; 3209 }, 3210 addClassToLeadingIcon: function addClassToLeadingIcon() { 3211 return undefined; 3212 }, 3213 eventTargetHasClass: function eventTargetHasClass() { 3214 return false; 3215 }, 3216 focusPrimaryAction: function focusPrimaryAction() { 3217 return undefined; 3218 }, 3219 focusTrailingAction: function focusTrailingAction() { 3220 return undefined; 3221 }, 3222 getAttribute: function getAttribute() { 3223 return null; 3224 }, 3225 getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() { 3226 return emptyClientRect; 3227 }, 3228 getComputedStyleValue: function getComputedStyleValue() { 3229 return ''; 3230 }, 3231 getRootBoundingClientRect: function getRootBoundingClientRect() { 3232 return emptyClientRect; 3233 }, 3234 hasClass: function hasClass() { 3235 return false; 3236 }, 3237 hasLeadingIcon: function hasLeadingIcon() { 3238 return false; 3239 }, 3240 isRTL: function isRTL() { 3241 return false; 3242 }, 3243 isTrailingActionNavigable: function isTrailingActionNavigable() { 3244 return false; 3245 }, 3246 notifyEditFinish: function notifyEditFinish() { 3247 return undefined; 3248 }, 3249 notifyEditStart: function notifyEditStart() { 3250 return undefined; 3251 }, 3252 notifyInteraction: function notifyInteraction() { 3253 return undefined; 3254 }, 3255 notifyNavigation: function notifyNavigation() { 3256 return undefined; 3257 }, 3258 notifyRemoval: function notifyRemoval() { 3259 return undefined; 3260 }, 3261 notifySelection: function notifySelection() { 3262 return undefined; 3263 }, 3264 notifyTrailingIconInteraction: function notifyTrailingIconInteraction() { 3265 return undefined; 3266 }, 3267 removeClass: function removeClass() { 3268 return undefined; 3269 }, 3270 removeClassFromLeadingIcon: function removeClassFromLeadingIcon() { 3271 return undefined; 3272 }, 3273 removeTrailingActionFocus: function removeTrailingActionFocus() { 3274 return undefined; 3275 }, 3276 setPrimaryActionAttr: function setPrimaryActionAttr() { 3277 return undefined; 3278 }, 3279 setStyleProperty: function setStyleProperty() { 3280 return undefined; 3281 } 3282 }; 3283 }, 3284 enumerable: true, 3285 configurable: true 3286 }); 3287 MDCChipFoundation.prototype.isSelected = function () {
3288 return this.adapter.hasClass(constants_1.cssClasses.SELECTED); 3289 }; 3290 MDCChipFoundation.prototype.isEditable = function () { 3291 return this.adapter.hasClass(constants_1.cssClasses.EDITABLE); 3292 }; 3293 MDCChipFoundation.prototype.isEditing = function () { 3294 return this.adapter.hasClass(constants_1.cssClasses.EDITING); 3295 }; 3296 MDCChipFoundation.prototype.setSelected = function (selected) { 3297 this.setSelected_(selected); 3298 this.notifySelection_(selected); 3299 }; 3300 MDCChipFoundation.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) { 3301 this.setSelected_(selected); 3302 if (shouldNotifyClients) { 3303 this.notifyIgnoredSelection_(selected); 3304 } 3305 }; 3306 MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () { 3307 return this.shouldRemoveOnTrailingIconClick_; 3308 }; 3309 MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) { 3310 this.shouldRemoveOnTrailingIconClick_ = shouldRemove; 3311 }; 3312 MDCChipFoundation.prototype.setShouldFocusPrimaryActionOnClick = function (shouldFocus) { 3313 this.shouldFocusPrimaryActionOnClick_ = shouldFocus; 3314 }; 3315 MDCChipFoundation.prototype.getDimensions = function () { 3316 var _this = this; 3317 var getRootRect = function getRootRect() { 3318 return _this.adapter.getRootBoundingClientRect(); 3319 }; 3320 var getCheckmarkRect = function getCheckmarkRect() { 3321 return _this.adapter.getCheckmarkBoundingClientRect(); 3322 }; 3323 // When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current 3324 // size of the checkmark. 3325 if (!this.adapter.hasLeadingIcon()) { 3326 var checkmarkRect = getCheckmarkRect(); 3327 if (checkmarkRect) { 3328 var rootRect = getRootRect(); 3329 // Checkmark is a square, meaning the client rect's width and height are identical once the animation completes. 3330 // However, the checkbox is initially hidden by setting the width to 0. 3331 // To account for an initial width of 0, we use the checkbox's height instead (which equals the end-state width) 3332 // when adding it to the root client rect's width. 3333 return { 3334 bottom: rootRect.bottom, 3335 height: rootRect.height, 3336 left: rootRect.left, 3337 right: rootRect.right, 3338 top: rootRect.top, 3339 width: rootRect.width + checkmarkRect.height 3340 }; 3341 } 3342 } 3343 return getRootRect(); 3344 }; 3345 /** 3346 * Begins the exit animation which leads to removal of the chip. 3347 */ 3348 MDCChipFoundation.prototype.beginExit = function () {
3349 this.adapter.addClass(constants_1.cssClasses.CHIP_EXIT); 3350 }; 3351 MDCChipFoundation.prototype.handleClick = function () { 3352 this.adapter.notifyInteraction(); 3353 this.setPrimaryActionFocusable_(this.getFocusBehavior_()); 3354 }; 3355 MDCChipFoundation.prototype.handleDoubleClick = function () { 3356 if (this.isEditable()) { 3357 this.startEditing(); 3358 } 3359 }; 3360 /** 3361 * Handles a transition end event on the root element. 3362 */ 3363 MDCChipFoundation.prototype.handleTransitionEnd = function (evt) { 3364 var _this = this; 3365 // Handle transition end event on the chip when it is about to be removed. 3366 var shouldHandle = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHIP_EXIT); 3367 var widthIsAnimating = evt.propertyName === 'width'; 3368 var opacityIsAnimating = evt.propertyName === 'opacity'; 3369 if (shouldHandle && opacityIsAnimating) { 3370 // See: https://css-tricks.com/using-css-transitions-auto-dimensions/#article-header-id-5 3371 var chipWidth_1 = this.adapter.getComputedStyleValue('width'); 3372 // On the next frame (once we get the computed width), explicitly set the chip's width 3373 // to its current pixel width, so we aren't transitioning out of 'auto'. 3374 requestAnimationFrame(function () { 3375 _this.adapter.setStyleProperty('width', chipWidth_1); 3376 // To mitigate jitter, start transitioning padding and margin before width. 3377 _this.adapter.setStyleProperty('padding', '0'); 3378 _this.adapter.setStyleProperty('margin', '0'); 3379 // On the next frame (once width is explicitly set), transition width to 0. 3380 requestAnimationFrame(function () { 3381 _this.adapter.setStyleProperty('width', '0'); 3382 }); 3383 }); 3384 return; 3385 } 3386 if (shouldHandle && widthIsAnimating) { 3387 this.removeFocus(); 3388 var removedAnnouncement = this.adapter.getAttribute(constants_1.strings.REMOVED_ANNOUNCEMENT_ATTRIBUTE); 3389 this.adapter.notifyRemoval(removedAnnouncement); 3390 } 3391 // Handle a transition end event on the leading icon or checkmark, since the transition end event bubbles. 3392 if (!opacityIsAnimating) { 3393 return; 3394 } 3395 var shouldHideLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasse
3395s.LEADING_ICON) && this.adapter.hasClass(constants_1.cssClasses.SELECTED); 3396 var shouldShowLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHECKMARK) && !this.adapter.hasClass(constants_1.cssClasses.SELECTED); 3397 if (shouldHideLeadingIcon) { 3398 this.adapter.addClassToLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON); 3399 return; 3400 } 3401 if (shouldShowLeadingIcon) { 3402 this.adapter.removeClassFromLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON); 3403 return; 3404 } 3405 }; 3406 MDCChipFoundation.prototype.handleFocusIn = function (evt) { 3407 // Early exit if the event doesn't come from the primary action 3408 if (!this.eventFromPrimaryAction_(evt)) { 3409 return; 3410 } 3411 this.adapter.addClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED); 3412 }; 3413 MDCChipFoundation.prototype.handleFocusOut = function (evt) { 3414 // Early exit if the event doesn't come from the primary action 3415 if (!this.eventFromPrimaryAction_(evt)) { 3416 return; 3417 } 3418 if (this.isEditing()) { 3419 this.finishEditing(); 3420 }
3421 this.adapter.removeClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED); 3422 }; 3423 /** 3424 * Handles an interaction event on the trailing icon element. This is used to 3425 * prevent the ripple from activating on interaction with the trailing icon. 3426 */ 3427 MDCChipFoundation.prototype.handleTrailingActionInteraction = function () { 3428 this.adapter.notifyTrailingIconInteraction(); 3429 this.removeChip_(); 3430 }; 3431 /** 3432 * Handles a keydown event from the root element. 3433 */ 3434 MDCChipFoundation.prototype.handleKeydown = function (evt) { 3435 if (this.isEditing()) { 3436 if (this.shouldFinishEditing(evt)) { 3437 evt.preventDefault(); 3438 this.finishEditing(); 3439 } 3440 // When editing, the foundation should only handle key events that finish 3441 // the editing process. 3442 return; 3443 } 3444 if (this.isEditable()) { 3445 if (this.shouldStartEditing(evt)) { 3446 evt.preventDefault(); 3447 this.startEditing(); 3448 } 3449 } 3450 if (this.shouldNotifyInteraction_(evt)) { 3451 this.adapter.notifyInteraction(); 3452 this.setPrimaryActionFocusable_(this.getFocusBehavior_()); 3453 return; 3454 } 3455 if (this.isDeleteAction_(evt)) { 3456 evt.preventDefault(); 3457 this.removeChip_(); 3458 return; 3459 } 3460 // Early exit if the key is not usable 3461 if (!constants_1.navigationKeys.has(evt.key)) { 3462 return; 3463 } 3464 // Prevent default behavior for movement keys which could include scrolling 3465 evt.preventDefault(); 3466 this.focusNextAction_(evt.key, constants_1.EventSource.PRIMARY); 3467 }; 3468 MDCChipFoundation.prototype.handleTrailingActionNavigation = function (evt) { 3469 return this.focusNextAction_(evt.detail.key, constants_1.EventSource.TRAILING); 3470 }; 3471 /** 3472 * Called by the chip set to remove focus from the chip actions. 3473 */ 3474 MDCChipFoundation.prototype.removeFocus = function () { 3475 this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1'); 3476 this.adapter.removeTrailingActionFocus(); 3477 }; 3478 /** 3479 * Called by the chip set to focus the primary action. 3480 * 3481 */ 3482 MDCChipFoundation.prototype.focusPrimaryAction = function () { 3483 this.setPrimaryActionFocusable_(FocusBehavior.SHOULD_FOCUS); 3484 }; 3485 /** 3486 * Called by the chip set to focus the trailing action (if present), otherwise 3487 * gives focus to the trailing action. 3488 */ 3489 MDCChipFoundation.prototype.focusTrailingAction = function () { 3490 var trailingActionIsNavigable = this.adapter.isTrailingActionNavigable(); 3491 if (trailingActionIsNavigable) { 3492 this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1'); 3493 this.adapter.focusTrailingAction(); 3494 return; 3495 } 3496 this.focusPrimaryAction(); 3497 }; 3498 MDCChipFoundation.prototype.setPrimaryActionFocusable_ = function (focusBehavior) { 3499 this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '0'); 3500 if (focusBehavior === FocusBehavior.SHOULD_FOCUS) { 3501 this.adapter.focusPrimaryAction(); 3502 } 3503 this.adapter.removeTrailingActionFocus(); 3504 }; 3505 MDCChipFoundation.prototype.getFocusBehavior_ = function () { 3506 if (this.shouldFocusPrimaryActionOnClick_) { 3507 return FocusBehavior.SHOULD_FOCUS; 3508 } 3509 return FocusBehavior.SHOULD_NOT_FOCUS; 3510 }; 3511 MDCChipFoundation.prototype.focusNextAction_ = function (key, source) { 3512 var isTrailingActionNavigable = this.adapter.isTrailingActionNavigable(); 3513 var dir = this.getDirection_(key); 3514 // Early exit if the key should jump chips 3515 if (constants_1.jumpChipKeys.has(key) || !isTrailingActionNavigable) { 3516 return this.adapter.notifyNavigation(key, source); 3517 } 3518 if (source === constants_1.EventSource.PRIMARY && dir === constants_1.Direction.RIGHT) { 3519 return this.focusTrailingAction(); 3520 } 3521 if (source === constants_1.EventSource.TRAILING && dir === constants_1.Direction.LEFT) { 3522 return this.focusPrimaryAction(); 3523 } 3524 this.adapter.notifyNavigation(key, constants_1.EventSource.NONE); 3525 }; 3526 MDCChipFoundation.prototype.getDirection_ = function (key) { 3527 var isRTL = this.adapter.isRTL(); 3528 var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; 3529 var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; 3530 if (!isRTL && isLeftKey || isRTL && isRightKey) { 3531 return constants_1.Direction.LEFT; 3532 } 3533 return constants_1.Direction.RIGHT; 3534 }; 3535 MDCChipFoundation.prototype.removeChip_ = function () { 3536 if (this.shouldRemoveOnTrailingIconClick_) { 3537 this.beginExit(); 3538 } 3539 }; 3540 MDCChipFoundation.prototype.shouldStartEditing = function (evt) { 3541 return this.eventFromPrimaryAction_(evt) && evt.key === constants_1.strings.ENTER_KEY; 3542 }; 3543 MDCChipFoundation.prototype.shouldFinishEditing = function (evt) { 3544 return evt.key === constants_1.strings.ENTER_KEY; 3545 }; 3546 MDCChipFoundation.prototype.shouldNotifyInteraction_ = function (evt) { 3547 return evt.key === constants_1.strings.ENTER_KEY || evt.key === constants_1.strings.SPACEBAR_KEY; 3548 }; 3549 MDCChipFoundation.prototype.isDeleteAction_ = function (evt) { 3550 var isDeletable = this.adapter.hasClass(constants_1.cssClasse
3550s.DELETABLE); 3551 return isDeletable && (evt.key === constants_1.strings.BACKSPACE_KEY || evt.key === constants_1.strings.DELETE_KEY || evt.key === constants_1.strings.IE_DELETE_KEY); 3552 }; 3553 MDCChipFoundation.prototype.setSelected_ = function (selected) { 3554 if (selected) { 3555 this.adapter.addClass(constants_1.cssClasses.SELECTED); 3556 this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'true'); 3557 } else { 3558 this.adapter.removeClass(constants_1.cssClasses.SELECTED); 3559 this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'false'); 3560 } 3561 }; 3562 MDCChipFoundation.prototype.notifySelection_ = function (selected) { 3563 this.adapter.notifySelection(selected, false); 3564 }; 3565 MDCChipFoundation.prototype.notifyIgnoredSelection_ = function (selected) { 3566 this.adapter.notifySelection(selected, true); 3567 }; 3568 MDCChipFoundation.prototype.eventFromPrimaryAction_ = function (evt) { 3569 return this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasse
3569s.PRIMARY_ACTION); 3570 }; 3571 MDCChipFoundation.prototype.startEditing = function () { 3572 this.adapter.addClass(constants_1.cssClasses.EDITING); 3573 this.adapter.notifyEditStart(); 3574 }; 3575 MDCChipFoundation.prototype.finishEditing = function () { 3576 this.adapter.removeClass(constants_1.cssClasses.EDITING); 3577 this.adapter.notifyEditFinish(); 3578 }; 3579 return MDCChipFoundation; 3580}(foundation_1.MDCFoundation); 3581exports.MDCChipFoundation = MDCChipFoundation; 3582// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 3583exports.default = MDCChipFoundation; 3584 3585/***/ }), 3586
3587/***/ "./packages/mdc-chips/chip/index.ts": 3588/*!******************************************!*\ 3589 !*** ./packages/mdc-chips/chip/index.ts ***! 3590 \******************************************/ 3591/*! no static exports found */ 3592/***/ (function(module, exports, __webpack_require__) { 3593 3594"use strict"; 3595 3596/** 3597 * @license 3598 * Copyright 2019 Google Inc. 3599 * 3600 * Permission is hereby granted, free of charge, to any person obtaining a copy 3601 * of this software and associated documentation files (the "Software"), to deal 3602 * in the Software without restriction, including without limitation the rights 3603 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3604 * copies of the Software, and to permit persons to whom the Software is 3605 * furnished to do so, subject to the following conditions: 3606 * 3607 * The above copyright notice and this permission notice shall be included in 3608 * all copies or substantial portions of the Software. 3609 * 3610 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3611 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3612 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3613 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3614 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3615 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3616 * THE SOFTWARE. 3617 */ 3618 3619function __export(m) { 3620 for (var p in m) { 3621 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 3622 } 3623} 3624Object.defineProperty(exports, "__esModule", { value: true }); 3625__export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip/component.ts")); 3626__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts")); 3627var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
3628exports.chipCssClasses = constants_1.cssClasses; 3629exports.chipStrings = constants_1.strings; 3630 3631/***/ }), 3632
3633/***/ "./packages/mdc-chips/index.ts": 3634/*!*************************************!*\ 3635 !*** ./packages/mdc-chips/index.ts ***! 3636 \*************************************/ 3637/*! no static exports found */ 3638/***/ (function(module, exports, __webpack_require__) { 3639 3640"use strict"; 3641 3642/** 3643 * @license 3644 * Copyright 2019 Google Inc. 3645 * 3646 * Permission is hereby granted, free of charge, to any person obtaining a copy 3647 * of this software and associated documentation files (the "Software"), to deal 3648 * in the Software without restriction, including without limitation the rights 3649 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3650 * copies of the Software, and to permit persons to whom the Software is 3651 * furnished to do so, subject to the following conditions: 3652 * 3653 * The above copyright notice and this permission notice shall be included in 3654 * all copies or substantial portions of the Software. 3655 * 3656 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3657 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3658 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3659 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3660 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3661 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3662 * THE SOFTWARE. 3663 */ 3664 3665function __export(m) { 3666 for (var p in m) { 3667 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 3668 } 3669} 3670Object.defineProperty(exports, "__esModule", { value: true }); 3671__export(__webpack_require__(/*! ./trailingaction/index */ "./packages/mdc-chips/trailingaction/index.ts")); 3672__export(__webpack_require__(/*! ./chip/index */ "./packages/mdc-chips/chip/index.ts")); 3673__export(__webpack_require__(/*! ./chip-set/index */ "./packages/mdc-chips/chip-set/index.ts")); 3674 3675/***/ }), 3676
3677/***/ "./packages/mdc-chips/trailingaction/component.ts": 3678/*!********************************************************!*\ 3679 !*** ./packages/mdc-chips/trailingaction/component.ts ***! 3680 \********************************************************/ 3681/*! no static exports found */ 3682/***/ (function(module, exports, __webpack_require__) { 3683 3684"use strict"; 3685 3686/** 3687 * @license 3688 * Copyright 2020 Google Inc. 3689 * 3690 * Permission is hereby granted, free of charge, to any person obtaining a copy 3691 * of this software and associated documentation files (the "Software"), to deal 3692 * in the Software without restriction, including without limitation the rights 3693 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3694 * copies of the Software, and to permit persons to whom the Software is 3695 * furnished to do so, subject to the following conditions: 3696 * 3697 * The above copyright notice and this permission notice shall be included in 3698 * all copies or substantial portions of the Software. 3699 * 3700 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3701 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3702 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3703 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3704 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3705 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3706 * THE SOFTWARE. 3707 */ 3708 3709var __extends = this && this.__extends || function () { 3710 var _extendStatics = function extendStatics(d, b) { 3711 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 3712 d.__proto__ = b; 3713 } || function (d, b) { 3714 for (var p in b) { 3715 if (b.hasOwnProperty(p)) d[p] = b[p]; 3716 } 3717 }; 3718 return _extendStatics(d, b); 3719 }; 3720 return function (d, b) { 3721 _extendStatics(d, b); 3722 function __() { 3723 this.constructor = d; 3724 } 3725 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 3726 }; 3727}(); 3728Object.defineProperty(exports, "__esModule", { value: true }); 3729var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 3730var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 3731var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 3732var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts"); 3733var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/trailingaction/foundation.ts"); 3734var MDCChipTrailingAction = /** @class */function (_super) { 3735 __extends(MDCChipTrailingAction, _super); 3736 function MDCChipTrailingAction() { 3737 return _super !== null && _super.apply(this, arguments) || this; 3738 } 3739 Object.defineProperty(MDCChipTrailingAction.prototype, "ripple", { 3740 get: function get() { 3741 return this.ripple_; 3742 }, 3743 enumerable: true, 3744 configurable: true 3745 }); 3746 MDCChipTrailingAction.attachTo = function (root) { 3747 return new MDCChipTrailingAction(root); 3748 }; 3749 MDCChipTrailingAction.prototype.initialize = function (rippleFactory) { 3750 if (rippleFactory === void 0) { 3751 rippleFactory = function rippleFactory(el, foundation) { 3752 return new component_2.MDCRipple(el, foundation); 3753 }; 3754 } 3755 // DO NOT INLINE this variable. For backward compatibility, foundations take 3756 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 3757 // methods, we need a separate, strongly typed adapter variable. 3758 var rippleAdapter = component_2.MDCRipple.createAdapter(this); 3759 this.ripple_ = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter)); 3760 }; 3761 MDCChipTrailingAction.prototype.initialSyncWithDOM = function () { 3762 var _this = this; 3763 this.handleClick_ = function (evt) { 3764 _this.foundation.handleClick(evt); 3765 }; 3766 this.handleKeydown_ = function (evt) { 3767 _this.foundation.handleKeydown(evt); 3768 }; 3769 this.listen('click', this.handleClick_); 3770 this.listen('keydown', this.handleKeydown_); 3771 }; 3772 MDCChipTrailingAction.prototype.destroy = function () { 3773 this.ripple_.destroy(); 3774 this.unlisten('click', this.handleClick_); 3775 this.unlisten('keydown', this.handleKeydown_); 3776 _super.prototype.destroy.call(this); 3777 }; 3778 MDCChipTrailingAction.prototype.getDefaultFoundation = function () { 3779 var _this = this; 3780 // DO NOT INLINE this variable. For backward compatibility, foundations take 3781 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 3782 // methods, we need a separate, strongly typed adapter variable. 3783 var adapter = { 3784 focus: function focus() { 3785 // TODO(b/157231863): Migate MDCComponent#root to HTMLElement 3786 _this.root.focus(); 3787 }, 3788 getAttribute: function getAttribute(attr) { 3789 return _this.root.getAttribute(attr); 3790 }, 3791 notifyInteraction: function notifyInteraction(trigger) {
3792 return _this.emit(constants_1.strings.INTERACTION_EVENT, { trigger: trigger }, true /* shouldBubble */); 3793 }, 3794 notifyNavigation: function notifyNavigation(key) { 3795 _this.emit(constants_1.strings.NAVIGATION_EVENT, { key: key }, true /* shouldBubble */); 3796 }, 3797 setAttribute: function setAttribute(attr, value) { 3798 _this.root.setAttribute(attr, value); 3799 } 3800 }; 3801 return new foundation_2.MDCChipTrailingActionFoundation(adapter); 3802 }; 3803 MDCChipTrailingAction.prototype.isNavigable = function () { 3804 return this.foundation.isNavigable(); 3805 }; 3806 MDCChipTrailingAction.prototype.focus = function () { 3807 this.foundation.focus(); 3808 }; 3809 MDCChipTrailingAction.prototype.removeFocus = function () { 3810 this.foundation.removeFocus(); 3811 }; 3812 return MDCChipTrailingAction; 3813}(component_1.MDCComponent); 3814exports.MDCChipTrailingAction = MDCChipTrailingAction; 3815 3816/***/ }), 3817
3818/***/ "./packages/mdc-chips/trailingaction/constants.ts": 3819/*!********************************************************!*\ 3820 !*** ./packages/mdc-chips/trailingaction/constants.ts ***! 3821 \********************************************************/ 3822/*! no static exports found */ 3823/***/ (function(module, exports, __webpack_require__) { 3824 3825"use strict"; 3826 3827/** 3828 * @license 3829 * Copyright 2020 Google Inc. 3830 * 3831 * Permission is hereby granted, free of charge, to any person obtaining a copy 3832 * of this software and associated documentation files (the "Software"), to deal 3833 * in the Software without restriction, including without limitation the rights 3834 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3835 * copies of the Software, and to permit persons to whom the Software is 3836 * furnished to do so, subject to the following conditions: 3837 * 3838 * The above copyright notice and this permission notice shall be included in 3839 * all copies or substantial portions of the Software. 3840 * 3841 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3842 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3843 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3844 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3845 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3846 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3847 * THE SOFTWARE. 3848 */ 3849 3850Object.defineProperty(exports, "__esModule", { value: true }); 3851var InteractionTrigger; 3852(function (InteractionTrigger) { 3853 InteractionTrigger[InteractionTrigger["UNSPECIFIED"] = 0] = "UNSPECIFIED"; 3854 InteractionTrigger[InteractionTrigger["CLICK"] = 1] = "CLICK"; 3855 InteractionTrigger[InteractionTrigger["BACKSPACE_KEY"] = 2] = "BACKSPACE_KEY"; 3856 InteractionTrigger[InteractionTrigger["DELETE_KEY"] = 3] = "DELETE_KEY"; 3857 InteractionTrigger[InteractionTrigger["SPACEBAR_KEY"] = 4] = "SPACEBAR_KEY"; 3858 InteractionTrigger[InteractionTrigger["ENTER_KEY"] = 5] = "ENTER_KEY"; 3859})(InteractionTrigger = exports.InteractionTrigger || (exports.InteractionTrigger = {})); 3860exports.strings = { 3861 ARIA_HIDDEN: 'aria-hidden', 3862 INTERACTION_EVENT: 'MDCChipTrailingAction:interaction', 3863 NAVIGATION_EVENT: 'MDCChipTrailingAction:navigation', 3864 TAB_INDEX: 'tabindex' 3865}; 3866 3867/***/ }), 3868
3869/***/ "./packages/mdc-chips/trailingaction/foundation.ts": 3870/*!*********************************************************!*\ 3871 !*** ./packages/mdc-chips/trailingaction/foundation.ts ***! 3872 \*********************************************************/ 3873/*! no static exports found */ 3874/***/ (function(module, exports, __webpack_require__) { 3875 3876"use strict"; 3877 3878/** 3879 * @license 3880 * Copyright 2020 Google Inc. 3881 * 3882 * Permission is hereby granted, free of charge, to any person obtaining a copy 3883 * of this software and associated documentation files (the "Software"), to deal 3884 * in the Software without restriction, including without limitation the rights 3885 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3886 * copies of the Software, and to permit persons to whom the Software is 3887 * furnished to do so, subject to the following conditions: 3888 * 3889 * The above copyright notice and this permission notice shall be included in 3890 * all copies or substantial portions of the Software. 3891 * 3892 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3893 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3894 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3895 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3896 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3897 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3898 * THE SOFTWARE. 3899 */ 3900 3901var __extends = this && this.__extends || function () { 3902 var _extendStatics = function extendStatics(d, b) { 3903 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 3904 d.__proto__ = b; 3905 } || function (d, b) { 3906 for (var p in b) { 3907 if (b.hasOwnProperty(p)) d[p] = b[p]; 3908 } 3909 }; 3910 return _extendStatics(d, b); 3911 }; 3912 return function (d, b) { 3913 _extendStatics(d, b); 3914 function __() { 3915 this.constructor = d; 3916 } 3917 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 3918 }; 3919}(); 3920var __assign = this && this.__assign || function () { 3921 __assign = Object.assign || function (t) { 3922 for (var s, i = 1, n = arguments.length; i < n; i++) { 3923 s = arguments[i]; 3924 for (var p in s) { 3925 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 3926 } 3927 } 3928 return t; 3929 }; 3930 return __assign.apply(this, arguments); 3931}; 3932Object.defineProperty(exports, "__esModule", { value: true }); 3933var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 3934var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 3935var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts"); 3936var MDCChipTrailingActionFoundation = /** @class */function (_super) { 3937 __extends(MDCChipTrailingActionFoundation, _super); 3938 function MDCChipTrailingActionFoundation(adapter) { 3939 return _super.call(this, __assign(__assign({}, MDCChipTrailingActionFoundation.defaultAdapter), adapter)) || this; 3940 } 3941 Object.defineProperty(MDCChipTrailingActionFoundation, "strings", { 3942 get: function get() { 3943 return constants_1.strings; 3944 }, 3945 enumerable: true, 3946 configurable: true 3947 }); 3948 Object.defineProperty(MDCChipTrailingActionFoundation, "defaultAdapter", { 3949 get: function get() { 3950 return { 3951 focus: function focus() { 3952 return undefined; 3953 }, 3954 getAttribute: function getAttribute() { 3955 return null; 3956 }, 3957 setAttribute: function setAttribute() { 3958 return undefined; 3959 }, 3960 notifyInteraction: function notifyInteraction() { 3961 return undefined; 3962 }, 3963 notifyNavigation: function notifyNavigation() { 3964 return undefined; 3965 } 3966 }; 3967 }, 3968 enumerable: true, 3969 configurable: true 3970 }); 3971 MDCChipTrailingActionFoundation.prototype.handleClick = function (evt) { 3972 evt.stopPropagation(); 3973 this.adapter.notifyInteraction(constants_1.InteractionTrigger.CLICK); 3974 }; 3975 MDCChipTrailingActionFoundation.prototype.handleKeydown = function (evt) { 3976 evt.stopPropagation(); 3977 var key = keyboard_1.normalizeKey(evt); 3978 if (this.shouldNotifyInteractionFromKey_(key)) { 3979 var trigger = this.getTriggerFromKey_(key); 3980 this.adapter.notifyInteraction(trigger); 3981 return; 3982 } 3983 if (keyboard_1.isNavigationEvent(evt)) { 3984 this.adapter.notifyNavigation(key); 3985 return; 3986 } 3987 }; 3988 MDCChipTrailingActionFoundation.prototype.removeFocus = function () { 3989 this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '-1'); 3990 };
3991 MDCChipTrailingActionFoundation.prototype.focus = function () { 3992 this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '0'); 3993 this.adapter.focus(); 3994 }; 3995 MDCChipTrailingActionFoundation.prototype.isNavigable = function () { 3996 return this.adapter.getAttribute(constants_1.strings.ARIA_HIDDEN) !== 'true'; 3997 }; 3998 MDCChipTrailingActionFoundation.prototype.shouldNotifyInteractionFromKey_ = function (key) { 3999 var isFromActionKey = key === keyboard_1.KEY.ENTER || key === keyboard_1.KEY.SPACEBAR; 4000 var isFromDeleteKey = key === keyboard_1.KEY.BACKSPACE || key === keyboard_1.KEY.DELETE; 4001 return isFromActionKey || isFromDeleteKey; 4002 }; 4003 MDCChipTrailingActionFoundation.prototype.getTriggerFromKey_ = function (key) { 4004 if (key === keyboard_1.KEY.SPACEBAR) { 4005 return constants_1.InteractionTrigger.SPACEBAR_KEY; 4006 } 4007 if (key === keyboard_1.KEY.ENTER) { 4008 return constants_1.InteractionTrigger.ENTER_KEY; 4009 } 4010 if (key === keyboard_1.KEY.DELETE) { 4011 return constants_1.InteractionTrigger.DELETE_KEY; 4012 } 4013 if (key === keyboard_1.KEY.BACKSPACE) { 4014 return constants_1.InteractionTrigger.BACKSPACE_KEY; 4015 } 4016 // Default case, should never be returned 4017 return constants_1.InteractionTrigger.UNSPECIFIED; 4018 }; 4019 return MDCChipTrailingActionFoundation; 4020}(foundation_1.MDCFoundation); 4021exports.MDCChipTrailingActionFoundation = MDCChipTrailingActionFoundation; 4022// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 4023exports.default = MDCChipTrailingActionFoundation; 4024 4025/***/ }), 4026
4027/***/ "./packages/mdc-chips/trailingaction/index.ts": 4028/*!****************************************************!*\ 4029 !*** ./packages/mdc-chips/trailingaction/index.ts ***! 4030 \****************************************************/ 4031/*! no static exports found */ 4032/***/ (function(module, exports, __webpack_require__) { 4033 4034"use strict"; 4035 4036/** 4037 * @license 4038 * Copyright 2020 Google Inc. 4039 * 4040 * Permission is hereby granted, free of charge, to any person obtaining a copy 4041 * of this software and associated documentation files (the "Software"), to deal 4042 * in the Software without restriction, including without limitation the rights 4043 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4044 * copies of the Software, and to permit persons to whom the Software is 4045 * furnished to do so, subject to the following conditions: 4046 * 4047 * The above copyright notice and this permission notice shall be included in 4048 * all copies or substantial portions of the Software. 4049 * 4050 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4051 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4052 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4053 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4054 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4055 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4056 * THE SOFTWARE. 4057 */ 4058 4059function __export(m) { 4060 for (var p in m) { 4061 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 4062 } 4063} 4064Object.defineProperty(exports, "__esModule", { value: true }); 4065__export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/trailingaction/component.ts")); 4066__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/trailingaction/foundation.ts")); 4067var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts"); 4068exports.trailingActionStrings = constants_1.strings; 4069 4070/***/ }), 4071
4072/***/ "./packages/mdc-circular-progress/component.ts": 4073/*!*****************************************************!*\ 4074 !*** ./packages/mdc-circular-progress/component.ts ***! 4075 \*****************************************************/ 4076/*! no static exports found */ 4077/***/ (function(module, exports, __webpack_require__) { 4078 4079"use strict"; 4080 4081/** 4082 * @license 4083 * Copyright 2020 Google Inc. 4084 * 4085 * Permission is hereby granted, free of charge, to any person obtaining a copy 4086 * of this software and associated documentation files (the "Software"), to deal 4087 * in the Software without restriction, including without limitation the rights 4088 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4089 * copies of the Software, and to permit persons to whom the Software is 4090 * furnished to do so, subject to the following conditions: 4091 * 4092 * The above copyright notice and this permission notice shall be included in 4093 * all copies or substantial portions of the Software. 4094 * 4095 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4096 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4097 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4098 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4099 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4100 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4101 * THE SOFTWARE. 4102 */ 4103 4104var __extends = this && this.__extends || function () { 4105 var _extendStatics = function extendStatics(d, b) { 4106 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 4107 d.__proto__ = b; 4108 } || function (d, b) { 4109 for (var p in b) { 4110 if (b.hasOwnProperty(p)) d[p] = b[p]; 4111 } 4112 }; 4113 return _extendStatics(d, b); 4114 }; 4115 return function (d, b) { 4116 _extendStatics(d, b); 4117 function __() { 4118 this.constructor = d; 4119 } 4120 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4121 }; 4122}(); 4123Object.defineProperty(exports, "__esModule", { value: true }); 4124var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 4125var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-circular-progress/foundation.ts"); 4126var MDCCircularProgress = /** @class */function (_super) { 4127 __extends(MDCCircularProgress, _super); 4128 function MDCCircularProgress() { 4129 return _super !== null && _super.apply(this, arguments) || this; 4130 } 4131 MDCCircularProgress.prototype.initialize = function () { 4132 this.determinateCircle_ = this.root.querySelector(foundation_1.MDCCircularProgressFoundation.strings.DETERMINATE_CIRCLE_SELECTOR); 4133 }; 4134 MDCCircularProgress.attachTo = function (root) { 4135 return new MDCCircularProgress(root); 4136 }; 4137 Object.defineProperty(MDCCircularProgress.prototype, "determinate", { 4138 /** 4139 * Sets whether the progress indicator is in determinate mode. 4140 * @param isDeterminate Whether the indicator should be determinate. 4141 */ 4142 set: function set(value) { 4143 this.foundation.setDeterminate(value); 4144 }, 4145 enumerable: true, 4146 configurable: true 4147 }); 4148 Object.defineProperty(MDCCircularProgress.prototype, "progress", { 4149 /** 4150 * Sets the current progress value. In indeterminate mode, this has no 4151 * visual effect but will be reflected if the indicator is switched to 4152 * determinate mode. 4153 * @param value The current progress value, which must be between 0 and 1. 4154 */ 4155 set: function set(value) { 4156 this.foundation.setProgress(value); 4157 }, 4158 enumerable: true, 4159 configurable: true 4160 }); 4161 Object.defineProperty(MDCCircularProgress.prototype, "isClosed", { 4162 /** 4163 * Whether the progress indicator is hidden. 4164 */ 4165 get: function get() { 4166 return this.foundation.isClosed(); 4167 }, 4168 enumerable: true, 4169 configurable: true 4170 }); 4171 /** 4172 * Shows the progress indicator. 4173 */ 4174 MDCCircularProgress.prototype.open = function () { 4175 this.foundation.open(); 4176 }; 4177 /** 4178 * Hides the progress indicator. 4179 */ 4180 MDCCircularProgress.prototype.close = function () { 4181 this.foundation.close(); 4182 }; 4183 MDCCircularProgress.prototype.getDefaultFoundation = function () { 4184 var _this = this; 4185 // DO NOT INLINE this variable. For backward compatibility, foundations take 4186 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 4187 // methods, we need a separate, strongly typed adapter variable. 4188 var adapter = { 4189 addClass: function addClass(className) { 4190 return _this.root.classList.add(className); 4191 }, 4192 getDeterminateCircleAttribute: function getDeterminateCircleAttribute(attributeName) { 4193 return _this.determinateCircle_.getAttribute(attributeName); 4194 }, 4195 hasClass: function hasClass(className) { 4196 return _this.root.classList.contains(className); 4197 }, 4198 removeClass: function removeClass(className) { 4199 return _this.root.classList.remove(className); 4200 }, 4201 removeAttribute: function removeAttribute(attributeName) { 4202 return _this.root.removeAttribute(attributeName); 4203 }, 4204 setAttribute: function setAttribute(attributeName, value) { 4205 return _this.root.setAttribute(attributeName, value); 4206 }, 4207 setDeterminateCircleAttribute: function setDeterminateCircleAttribute(attributeName, value) { 4208 return _this.determinateCircle_.setAttribute(attributeName, value); 4209 } 4210 }; 4211 return new foundation_1.MDCCircularProgressFoundation(adapter); 4212 }; 4213 return MDCCircularProgress; 4214}(component_1.MDCComponent); 4215exports.MDCCircularProgress = MDCCircularProgress; 4216 4217/***/ }), 4218
4219/***/ "./packages/mdc-circular-progress/constants.ts": 4220/*!*****************************************************!*\ 4221 !*** ./packages/mdc-circular-progress/constants.ts ***! 4222 \*****************************************************/ 4223/*! no static exports found */ 4224/***/ (function(module, exports, __webpack_require__) { 4225 4226"use strict"; 4227 4228/** 4229 * @license 4230 * Copyright 2020 Google Inc. 4231 * 4232 * Permission is hereby granted, free of charge, to any person obtaining a copy 4233 * of this software and associated documentation files (the "Software"), to deal 4234 * in the Software without restriction, including without limitation the rights 4235 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4236 * copies of the Software, and to permit persons to whom the Software is 4237 * furnished to do so, subject to the following conditions: 4238 * 4239 * The above copyright notice and this permission notice shall be included in 4240 * all copies or substantial portions of the Software. 4241 * 4242 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4243 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4244 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4245 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4246 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4247 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4248 * THE SOFTWARE. 4249 */ 4250 4251Object.defineProperty(exports, "__esModule", { value: true }); 4252/** 4253 * CSS class names used in component. 4254 */ 4255exports.cssClasses = { 4256 INDETERMINATE_CLASS: 'mdc-circular-progress--indeterminate', 4257 CLOSED_CLASS: 'mdc-circular-progress--closed' 4258}; 4259/** 4260 * Attributes and selectors used in component. 4261 */ 4262exports.strings = { 4263 DETERMINATE_CIRCLE_SELECTOR: '.mdc-circular-progress__determinate-circle', 4264 ARIA_VALUENOW: 'aria-valuenow', 4265 RADIUS: 'r', 4266 STROKE_DASHOFFSET: 'stroke-dashoffset' 4267}; 4268 4269/***/ }), 4270
4271/***/ "./packages/mdc-circular-progress/foundation.ts": 4272/*!******************************************************!*\ 4273 !*** ./packages/mdc-circular-progress/foundation.ts ***! 4274 \******************************************************/ 4275/*! no static exports found */ 4276/***/ (function(module, exports, __webpack_require__) { 4277 4278"use strict"; 4279 4280/** 4281 * @license 4282 * Copyright 2020 Google Inc. 4283 * 4284 * Permission is hereby granted, free of charge, to any person obtaining a copy 4285 * of this software and associated documentation files (the "Software"), to deal 4286 * in the Software without restriction, including without limitation the rights 4287 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4288 * copies of the Software, and to permit persons to whom the Software is 4289 * furnished to do so, subject to the following conditions: 4290 * 4291 * The above copyright notice and this permission notice shall be included in 4292 * all copies or substantial portions of the Software. 4293 * 4294 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4295 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4296 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4297 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4298 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4299 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4300 * THE SOFTWARE. 4301 */ 4302 4303var __extends = this && this.__extends || function () { 4304 var _extendStatics = function extendStatics(d, b) { 4305 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 4306 d.__proto__ = b; 4307 } || function (d, b) { 4308 for (var p in b) { 4309 if (b.hasOwnProperty(p)) d[p] = b[p]; 4310 } 4311 }; 4312 return _extendStatics(d, b); 4313 }; 4314 return function (d, b) { 4315 _extendStatics(d, b); 4316 function __() { 4317 this.constructor = d; 4318 } 4319 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4320 }; 4321}(); 4322var __assign = this && this.__assign || function () { 4323 __assign = Object.assign || function (t) { 4324 for (var s, i = 1, n = arguments.length; i < n; i++) { 4325 s = arguments[i]; 4326 for (var p in s) { 4327 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 4328 } 4329 } 4330 return t; 4331 }; 4332 return __assign.apply(this, arguments); 4333}; 4334Object.defineProperty(exports, "__esModule", { value: true }); 4335var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 4336var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-circular-progress/constants.ts"); 4337var MDCCircularProgressFoundation = /** @class */function (_super) { 4338 __extends(MDCCircularProgressFoundation, _super); 4339 function MDCCircularProgressFoundation(adapter) { 4340 return _super.call(this, __assign(__assign({}, MDCCircularProgressFoundation.defaultAdapter), adapter)) || this; 4341 } 4342 Object.defineProperty(MDCCircularProgressFoundation, "cssClasses", { 4343 get: function get() {
4344 return constants_1.cssClasses; 4345 }, 4346 enumerable: true, 4347 configurable: true 4348 }); 4349 Object.defineProperty(MDCCircularProgressFoundation, "strings", { 4350 get: function get() { 4351 return constants_1.strings; 4352 }, 4353 enumerable: true, 4354 configurable: true 4355 }); 4356 Object.defineProperty(MDCCircularProgressFoundation, "defaultAdapter", { 4357 get: function get() { 4358 return { 4359 addClass: function addClass() { 4360 return undefined; 4361 }, 4362 getDeterminateCircleAttribute: function getDeterminateCircleAttribute() { 4363 return null; 4364 }, 4365 hasClass: function hasClass() { 4366 return false; 4367 }, 4368 removeClass: function removeClass() { 4369 return undefined; 4370 }, 4371 removeAttribute: function removeAttribute() { 4372 return undefined; 4373 }, 4374 setAttribute: function setAttribute() { 4375 return undefined; 4376 }, 4377 setDeterminateCircleAttribute: function setDeterminateCircleAttribute() { 4378 return undefined; 4379 } 4380 }; 4381 }, 4382 enumerable: true, 4383 configurable: true 4384 }); 4385 MDCCircularProgressFoundation.prototype.init = function () { 4386 this.isClosed_ = this.adapter.hasClass(constants_1.cssClasse
4386s.CLOSED_CLASS); 4387 this.isDeterminate_ = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS); 4388 this.progress_ = 0; 4389 if (this.isDeterminate_) { 4390 this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress_.toString()); 4391 } 4392 this.radius_ = Number(this.adapter.getDeterminateCircleAttribute(constants_1.strings.RADIUS)); 4393 }; 4394 MDCCircularProgressFoundation.prototype.isDeterminate = function () { 4395 return this.isDeterminate_; 4396 }; 4397 MDCCircularProgressFoundation.prototype.getProgress = function () { 4398 return this.progress_; 4399 }; 4400 /** 4401 * @return Returns whether the progress indicator is hidden. 4402 */ 4403 MDCCircularProgressFoundation.prototype.isClosed = function () { 4404 return this.isClosed_; 4405 }; 4406 /** 4407 * Sets whether the progress indicator is in determinate mode. 4408 * @param isDeterminate Whether the indicator should be determinate. 4409 */ 4410 MDCCircularProgressFoundation.prototype.setDeterminate = function (isDeterminate) { 4411 this.isDeterminate_ = isDeterminate; 4412 if (this.isDeterminate_) {
4413 this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS); 4414 this.setProgress(this.progress_); 4415 } else { 4416 this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS); 4417 this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW); 4418 } 4419 }; 4420 /** 4421 * Sets the current progress value. In indeterminate mode, this has no 4422 * visual effect but will be reflected if the indicator is switched to 4423 * determinate mode. 4424 * @param value The current progress value, which must be between 0 and 1. 4425 */ 4426 MDCCircularProgressFoundation.prototype.setProgress = function (value) { 4427 this.progress_ = value; 4428 if (this.isDeterminate_) { 4429 var unfilledArcLength = (1 - this.progress_) * (2 * Math.PI * this.radius_); 4430 this.adapter.setDeterminateCircleAttribute(constants_1.strings.STROKE_DASHOFFSET, "" + unfilledArcLength); 4431 this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress_.toString()); 4432 } 4433 }; 4434 /** 4435 * Shows the progress indicator. 4436 */ 4437 MDCCircularProgressFoundation.prototype.open = function () { 4438 this.isClosed_ = false;
4439 this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS); 4440 }; 4441 /** 4442 * Hides the progress indicator 4443 */ 4444 MDCCircularProgressFoundation.prototype.close = function () { 4445 this.isClosed_ = true; 4446 this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS); 4447 }; 4448 return MDCCircularProgressFoundation; 4449}(foundation_1.MDCFoundation); 4450exports.MDCCircularProgressFoundation = MDCCircularProgressFoundation; 4451// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 4452exports.default = MDCCircularProgressFoundation; 4453 4454/***/ }), 4455
4456/***/ "./packages/mdc-circular-progress/index.ts": 4457/*!*************************************************!*\ 4458 !*** ./packages/mdc-circular-progress/index.ts ***! 4459 \*************************************************/ 4460/*! no static exports found */ 4461/***/ (function(module, exports, __webpack_require__) { 4462 4463"use strict"; 4464 4465/** 4466 * @license 4467 * Copyright 2020 Google Inc. 4468 * 4469 * Permission is hereby granted, free of charge, to any person obtaining a copy 4470 * of this software and associated documentation files (the "Software"), to deal 4471 * in the Software without restriction, including without limitation the rights 4472 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4473 * copies of the Software, and to permit persons to whom the Software is 4474 * furnished to do so, subject to the following conditions: 4475 * 4476 * The above copyright notice and this permission notice shall be included in 4477 * all copies or substantial portions of the Software. 4478 * 4479 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4480 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4481 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4482 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4483 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4484 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4485 * THE SOFTWARE. 4486 */ 4487 4488function __export(m) { 4489 for (var p in m) { 4490 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 4491 } 4492} 4493Object.defineProperty(exports, "__esModule", { value: true }); 4494__export(__webpack_require__(/*! ./component */ "./packages/mdc-circular-progress/component.ts")); 4495__export(__webpack_require__(/*! ./constants */ "./packages/mdc-circular-progress/constants.ts")); 4496__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-circular-progress/foundation.ts")); 4497 4498/***/ }), 4499
4500/***/ "./packages/mdc-data-table/component.ts": 4501/*!**********************************************!*\ 4502 !*** ./packages/mdc-data-table/component.ts ***! 4503 \**********************************************/ 4504/*! no static exports found */ 4505/***/ (function(module, exports, __webpack_require__) { 4506 4507"use strict"; 4508 4509/** 4510 * @license 4511 * Copyright 2019 Google Inc. 4512 * 4513 * Permission is hereby granted, free of charge, to any person obtaining a copy 4514 * of this software and associated documentation files (the "Software"), to deal 4515 * in the Software without restriction, including without limitation the rights 4516 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4517 * copies of the Software, and to permit persons to whom the Software is 4518 * furnished to do so, subject to the following conditions: 4519 * 4520 * The above copyright notice and this permission notice shall be included in 4521 * all copies or substantial portions of the Software. 4522 * 4523 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4524 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4525 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4526 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4527 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4528 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4529 * THE SOFTWARE. 4530 */ 4531 4532var __extends = this && this.__extends || function () { 4533 var _extendStatics = function extendStatics(d, b) { 4534 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 4535 d.__proto__ = b; 4536 } || function (d, b) { 4537 for (var p in b) { 4538 if (b.hasOwnProperty(p)) d[p] = b[p]; 4539 } 4540 }; 4541 return _extendStatics(d, b); 4542 }; 4543 return function (d, b) { 4544 _extendStatics(d, b); 4545 function __() { 4546 this.constructor = d; 4547 } 4548 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4549 }; 4550}(); 4551var __values = this && this.__values || function (o) { 4552 var s = typeof Symbol === "function" && Symbol.iterator, 4553 m = s && o[s], 4554 i = 0; 4555 if (m) return m.call(o); 4556 if (o && typeof o.length === "number") return { 4557 next: function next() { 4558 if (o && i >= o.length) o = void 0; 4559 return { value: o && o[i++], done: !o }; 4560 } 4561 }; 4562 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 4563}; 4564Object.defineProperty(exports, "__esModule", { value: true }); 4565var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 4566var component_2 = __webpack_require__(/*! @material/checkbox/component */ "./packages/mdc-checkbox/component.ts"); 4567var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 4568var component_3 = __webpack_require__(/*! @material/linear-progress/component */ "./packages/mdc-linear-progress/component.ts"); 4569var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"); 4570var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts"); 4571/** 4572 * Implementation of `MDCDataTableFoundation` 4573 */ 4574var MDCDataTable = /** @class */function (_super) { 4575 __extends(MDCDataTable, _super); 4576 function MDCDataTable() { 4577 return _super !== null && _super.apply(this, arguments) || this; 4578 } 4579 MDCDataTable.attachTo = function (root) { 4580 return new MDCDataTable(root); 4581 }; 4582 MDCDataTable.prototype.initialize = function (checkboxFactory) { 4583 if (checkboxFactory === void 0) { 4584 checkboxFactory = function checkboxFactory(el) { 4585 return new component_2.MDCCheckbox(el); 4586 }; 4587 } 4588 this.checkboxFactory = checkboxFactory; 4589 }; 4590 MDCDataTable.prototype.initialSyncWithDOM = function () { 4591 var _this = this; 4592 this.headerRow = this.root.querySelector("." + constants_1.cssClasse
4592s.HEADER_ROW); 4593 this.handleHeaderRowCheckboxChange = function () { 4594 _this.foundation.handleHeaderRowCheckboxChange(); 4595 }; 4596 this.headerRow.addEventListener('change', this.handleHeaderRowCheckboxChange); 4597 this.headerRowClickListener = function (event) { 4598 _this.handleHeaderRowClick(event); 4599 }; 4600 this.headerRow.addEventListener('click', this.headerRowClickListener); 4601 this.content = this.root.querySelector("." + constants_1.cssClasses.CONTENT); 4602 this.handleRowCheckboxChange = function (event) { 4603 _this.foundation.handleRowCheckboxChange(event); 4604 }; 4605 this.content.addEventListener('change', this.handleRowCheckboxChange); 4606 this.layout(); 4607 }; 4608 /** 4609 * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. 4610 */ 4611 MDCDataTable.prototype.layout = function () { 4612 this.foundation.layout(); 4613 }; 4614 /** 4615 * @return Returns array of header row cell elements. 4616 */ 4617 MDCDataTable.prototype.getHeaderCells = function () { 4618 return [].slice.call(this.root.querySelectorAll(constants_1.selectors.HEADER_CELL)); 4619 }; 4620 /** 4621 * @return Returns array of row elements. 4622 */ 4623 MDCDataTable.prototype.getRows = function () { 4624 return this.foundation.getRows(); 4625 }; 4626 /** 4627 * @return Returns array of selected row ids. 4628 */ 4629 MDCDataTable.prototype.getSelectedRowIds = function () { 4630 return this.foundation.getSelectedRowIds(); 4631 }; 4632 /** 4633 * Sets selected row ids. Overwrites previously selected rows. 4634 * @param rowIds Array of row ids that needs to be selected. 4635 */ 4636 MDCDataTable.prototype.setSelectedRowIds = function (rowIds) { 4637 this.foundation.setSelectedRowIds(rowIds); 4638 }; 4639 /** 4640 * Shows progress indicator when data table is in loading state. 4641 */ 4642 MDCDataTable.prototype.showProgress = function () { 4643 this.getLinearProgress().open(); 4644 this.foundation.showProgress(); 4645 }; 4646 /** 4647 * Hides progress indicator after data table is finished loading. 4648 */ 4649 MDCDataTable.prototype.hideProgress = function () { 4650 this.foundation.hideProgress(); 4651 this.getLinearProgress().close(); 4652 }; 4653 MDCDataTable.prototype.destroy = function () { 4654 var e_1, _a; 4655 if (this.handleHeaderRowCheckboxChange) { 4656 this.headerRow.removeEventListener('change', this.handleHeaderRowCheckboxChange); 4657 } 4658 if (this.headerRowClickListener) { 4659 this.headerRow.removeEventListener('click', this.headerRowClickListener); 4660 } 4661 if (this.handleRowCheckboxChange) { 4662 this.content.removeEventListener('change', this.handleRowCheckboxChange); 4663 } 4664 if (this.headerRowCheckbox) { 4665 this.headerRowCheckbox.destroy(); 4666 } 4667 if (this.rowCheckboxList) { 4668 try { 4669 for (var _b = __values(this.rowCheckboxList), _c = _b.next(); !_c.done; _c = _b.next()) { 4670 var checkbox = _c.value; 4671 checkbox.destroy(); 4672 } 4673 } catch (e_1_1) { 4674 e_1 = { error: e_1_1 }; 4675 } finally { 4676 try { 4677 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 4678 } finally { 4679 if (e_1) throw e_1.error; 4680 } 4681 } 4682 } 4683 }; 4684 MDCDataTable.prototype.getDefaultFoundation = function () { 4685 var _this = this; 4686 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 4687 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 4688 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 4689 var adapter = { 4690 addClass: function addClass(className) { 4691 _this.root.classList.add(className); 4692 }, 4693 removeClass: function removeClass(className) { 4694 _this.root.classList.remove(className); 4695 }, 4696 getHeaderCellElements: function getHeaderCellElements() { 4697 return _this.getHeaderCells(); 4698 }, 4699 getHeaderCellCount: function getHeaderCellCount() { 4700 return _this.getHeaderCells().length; 4701 }, 4702 getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex(index, attribute) { 4703 return _this.getHeaderCells()[index].getAttribute(attribute); 4704 }, 4705 setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex(index, attribute, value) { 4706 _this.getHeaderCells()[index].setAttribute(attribute, value); 4707 }, 4708 setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex(index, className) { 4709 _this.getHeaderCells()[index].classList.add(className); 4710 }, 4711 removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex(index, className) { 4712 _this.getHeaderCells()[index].classList.remove(className); 4713 }, 4714 notifySortAction: function notifySortAction(data) {
4715 _this.emit(constants_1.events.SORTED, data, /** shouldBubble */true); 4716 }, 4717 getTableContainerHeight: function getTableContainerHeight() { 4718 var tableContainer = _this.root.querySelector("." + constants_1.cssClasses.TABLE_CONTAINER); 4719 if (!tableContainer) { 4720 throw new Error('MDCDataTable: Table container element not found.'); 4721 } 4722 return tableContainer.getBoundingClientRect().height; 4723 }, 4724 getTableHeaderHeight: function getTableHeaderHeight() { 4725 var tableHeader = _this.root.querySelector(constants_1.selectors.HEADER_ROW); 4726 if (!tableHeader) { 4727 throw new Error('MDCDataTable: Table header element not found.'); 4728 } 4729 return tableHeader.getBoundingClientRect().height; 4730 }, 4731 setProgressIndicatorStyles: function setProgressIndicatorStyles(styles) { 4732 var progressIndicator = _this.root.querySelector(constants_1.selectors.PROGRESS_INDICATOR); 4733 if (!progressIndicator) { 4734 throw new Error('MDCDataTable: Progress indicator element not found.'); 4735 } 4736 progressIndicator.style.setProperty('height', styles.height); 4737 progressIndicator.style.setProperty('top', styles.top); 4738 }, 4739 addClassAtRowIndex: function addClassAtRowIndex(rowIndex, className) { 4740 _this.getRows()[rowIndex].classList.add(className); 4741 }, 4742 getRowCount: function getRowCount() { 4743 return _this.getRows().length; 4744 }, 4745 getRowElements: function getRowElements() { 4746 return [].slice.call(_this.root.querySelectorAll(constants_1.selectors.ROW)); 4747 }, 4748 getRowIdAtIndex: function getRowIdAtIndex(rowIndex) { 4749 return _this.getRows()[rowIndex].getAttribute(constants_1.dataAttributes.ROW_ID); 4750 }, 4751 getRowIndexByChildElement: function getRowIndexByChildElement(el) { 4752 return _this.getRows().indexOf(ponyfill_1.closest(el, constants_1.selectors.ROW)); 4753 }, 4754 getSelectedRowCount: function getSelectedRowCount() { 4755 return _this.root.querySelectorAll(constants_1.selectors.ROW_SELECTED).length; 4756 }, 4757 isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked(rowIndex) { 4758 return _this.rowCheckboxList[rowIndex].checked; 4759 }, 4760 isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() { 4761 return _this.headerRowCheckbox.checked; 4762 }, 4763 isRowsSelectable: function isRowsSelectable() { 4764 return !!_this.root.querySelector(constants_1.selectors.ROW_CHECKBOX) || !!_this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX); 4765 }, 4766 notifyRowSelectionChanged: function notifyRowSelectionChanged(data) { 4767 _this.emit(constants_1.events.ROW_SELECTION_CHANGED, { 4768 row: _this.getRowByIndex(data.rowIndex), 4769 rowId: _this.getRowIdByIndex(data.rowIndex), 4770 rowIndex: data.rowIndex, 4771 selected: data.selected 4772 }, 4773 /** shouldBubble */true); 4774 }, 4775 notifySelectedAll: function notifySelectedAll() { 4776 _this.emit(constants_1.events.SELECTED_ALL, {}, /** shouldBubble */true); 4777 }, 4778 notifyUnselectedAll: function notifyUnselectedAll() { 4779 _this.emit(constants_1.events.UNSELECTED_ALL, {}, /** shouldBubble */true); 4780 }, 4781 registerHeaderRowCheckbox: function registerHeaderRowCheckbox() { 4782 if (_this.headerRowCheckbox) { 4783 _this.headerRowCheckbox.destroy(); 4784 } 4785 var checkboxEl = _this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX); 4786 _this.headerRowCheckbox = _this.checkboxFactory(checkboxEl); 4787 }, 4788 registerRowCheckboxes: function registerRowCheckboxes() { 4789 if (_this.rowCheckboxList) { 4790 _this.rowCheckboxList.forEach(function (checkbox) { 4791 checkbox.destroy(); 4792 }); 4793 } 4794 _this.rowCheckboxList = [];
4795 _this.getRows().forEach(function (rowEl) { 4796 var checkbox = _this.checkboxFactory(rowEl.querySelector(constants_1.selectors.ROW_CHECKBOX)); 4797 _this.rowCheckboxList.push(checkbox); 4798 }); 4799 }, 4800 removeClassAtRowIndex: function removeClassAtRowIndex(rowIndex, className) { 4801 _this.getRows()[rowIndex].classList.remove(className); 4802 }, 4803 setAttributeAtRowIndex: function setAttributeAtRowIndex(rowIndex, attr, value) { 4804 _this.getRows()[rowIndex].setAttribute(attr, value); 4805 }, 4806 setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked(checked) { 4807 _this.headerRowCheckbox.checked = checked; 4808 }, 4809 setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate(indeterminate) { 4810 _this.headerRowCheckbox.indeterminate = indeterminate; 4811 }, 4812 setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex(rowIndex, checked) { 4813 _this.rowCheckboxList[rowIndex].checked = checked; 4814 }, 4815 setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue) { 4816 var headerCell = _this.getHeaderCells()[columnIndex]; 4817 var sortStatusLabel = headerCell.querySelector(constants_1.selectors.SORT_STATUS_LABEL); 4818 if (!sortStatusLabel) return; 4819 sortStatusLabel.textContent = _this.getSortStatusMessageBySortValue(sortValue); 4820 } 4821 }; 4822 return new foundation_1.MDCDataTableFoundation(adapter); 4823 }; 4824 MDCDataTable.prototype.getRowByIndex = function (index) { 4825 return this.getRows()[index]; 4826 }; 4827 MDCDataTable.prototype.getRowIdByIndex = function (index) { 4828 return this.getRowByIndex(index).getAttribute(constants_1.dataAttributes.ROW_ID); 4829 }; 4830 MDCDataTable.prototype.handleHeaderRowClick = function (event) { 4831 var headerCell = ponyfill_1.closest(event.target, constants_1.selectors.HEADER_CELL_WITH_SORT); 4832 if (!headerCell) { 4833 return; 4834 } 4835 var columnId = headerCell.getAttribute(constants_1.dataAttributes.COLUMN_ID); 4836 var columnIndex = this.getHeaderCells().indexOf(headerCell); 4837 if (columnIndex === -1) { 4838 return; 4839 } 4840 this.foundation.handleSortAction({ columnId: columnId, columnIndex: columnIndex, headerCell: headerCell }); 4841 }; 4842 MDCDataTable.prototype.getSortStatusMessageBySortValue = function (sortValue) { 4843 switch (sortValue) { 4844 case constants_1.SortValue.ASCENDING: 4845 return constants_1.messages.SORTED_IN_ASCENDING; 4846 case constants_1.SortValue.DESCENDING: 4847 return constants_1.messages.SORTED_IN_DESCENDING; 4848 default: 4849 return ''; 4850 } 4851 }; 4852 MDCDataTable.prototype.getLinearProgressElement = function () { 4853 var el = this.root.querySelector("." + constants_1.cssClasse
4853s.LINEAR_PROGRESS); 4854 if (!el) { 4855 throw new Error('MDCDataTable: linear progress element is not found.'); 4856 } 4857 return el; 4858 }; 4859 MDCDataTable.prototype.getLinearProgress = function () { 4860 if (!this.linearProgress) { 4861 var el = this.getLinearProgressElement(); 4862 this.linearProgress = new component_3.MDCLinearProgress(el); 4863 } 4864 return this.linearProgress; 4865 }; 4866 return MDCDataTable; 4867}(component_1.MDCComponent); 4868exports.MDCDataTable = MDCDataTable; 4869 4870/***/ }), 4871
4872/***/ "./packages/mdc-data-table/constants.ts": 4873/*!**********************************************!*\ 4874 !*** ./packages/mdc-data-table/constants.ts ***! 4875 \**********************************************/ 4876/*! no static exports found */ 4877/***/ (function(module, exports, __webpack_require__) { 4878 4879"use strict"; 4880 4881/** 4882 * @license 4883 * Copyright 2019 Google Inc. 4884 * 4885 * Permission is hereby granted, free of charge, to any person obtaining a copy 4886 * of this software and associated documentation files (the "Software"), to deal 4887 * in the Software without restriction, including without limitation the rights 4888 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4889 * copies of the Software, and to permit persons to whom the Software is 4890 * furnished to do so, subject to the following conditions: 4891 * 4892 * The above copyright notice and this permission notice shall be included in 4893 * all copies or substantial portions of the Software. 4894 * 4895 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4896 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4897 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4898 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4899 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4900 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4901 * THE SOFTWARE. 4902 */ 4903 4904Object.defineProperty(exports, "__esModule", { value: true }); 4905/** 4906 * CSS class names used in component. 4907 */ 4908exports.cssClasses = { 4909 CELL: 'mdc-data-table__cell', 4910 CELL_NUMERIC: 'mdc-data-table__cell--numeric', 4911 CONTENT: 'mdc-data-table__content', 4912 HEADER_CELL: 'mdc-data-table__header-cell', 4913 HEADER_CELL_LABEL: 'mdc-data-table__header-cell-label', 4914 HEADER_CELL_SORTED: 'mdc-data-table__header-cell--sorted', 4915 HEADER_CELL_SORTED_DESCENDING: 'mdc-data-table__header-cell--sorted-descending', 4916 HEADER_CELL_WITH_SORT: 'mdc-data-table__header-cell--with-sort', 4917 HEADER_CELL_WRAPPER: 'mdc-data-table__header-cell-wrapper', 4918 HEADER_ROW: 'mdc-data-table__header-row', 4919 HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox', 4920 IN_PROGRESS: 'mdc-data-table--in-progress', 4921 LINEAR_PROGRESS: 'mdc-data-table__linear-progress', 4922 PAGINATION_ROWS_PER_PAGE_LABEL: 'mdc-data-table__pagination-rows-per-page-label', 4923 PAGINATION_ROWS_PER_PAGE_SELECT: 'mdc-data-table__pagination-rows-per-page-select', 4924 PROGRESS_INDICATOR: 'mdc-data-table__progress-indicator', 4925 ROOT: 'mdc-data-table', 4926 ROW: 'mdc-data-table__row', 4927 ROW_CHECKBOX: 'mdc-data-table__row-checkbox', 4928 ROW_SELECTED: 'mdc-data-table__row--selected', 4929 SORT_ICON_BUTTON: 'mdc-data-table__sort-icon-button', 4930 SORT_STATUS_LABEL: 'mdc-data-table__sort-status-label', 4931 TABLE_CONTAINER: 'mdc-data-table__table-container' 4932}; 4933/** 4934 * DOM attributes used in component. 4935 */ 4936exports.attributes = { 4937 ARIA_SELECTED: 'aria-selected', 4938 ARIA_SORT: 'aria-sort' 4939}; 4940/** 4941 * List of data attributes used in component. 4942 */ 4943exports.dataAttributes = { 4944 COLUMN_ID: 'data-column-id', 4945 ROW_ID: 'data-row-id' 4946}; 4947/** 4948 * CSS selectors used in component. 4949 */ 4950exports.selectors = { 4951 CONTENT: "." + exports.cssClasses.CONTENT, 4952 HEADER_CELL: "." + exports.cssClasses.HEADER_CELL, 4953 HEADER_CELL_WITH_SORT: "." + exports.cssClasses.HEADER_CELL_WITH_SORT, 4954 HEADER_ROW: "." + exports.cssClasses.HEADER_ROW, 4955 HEADER_ROW_CHECKBOX: "." + exports.cssClasses.HEADER_ROW_CHECKBOX, 4956 PROGRESS_INDICATOR: "." + exports.cssClasses.PROGRESS_INDICATOR, 4957 ROW: "." + exports.cssClasses.ROW, 4958 ROW_CHECKBOX: "." + exports.cssClasses.ROW_CHECKBOX, 4959 ROW_SELECTED: "." + exports.cssClasses.ROW_SELECTED, 4960 SORT_ICON_BUTTON: "." + exports.cssClasses.SORT_ICON_BUTTON, 4961 SORT_STATUS_LABEL: "." + exports.cssClasses.SORT_STATUS_LABEL 4962}; 4963/** 4964 * Messages used in component. 4965 */ 4966exports.messages = { 4967 SORTED_IN_DESCENDING: 'Sorted in descending order', 4968 SORTED_IN_ASCENDING: 'Sorted in ascending order' 4969}; 4970/** 4971 * Attributes and selectors used in component. 4972 * @deprecated Use `attributes`, `dataAttributes` and `selectors` instead. 4973 */ 4974exports.strings = { 4975 ARIA_SELECTED: exports.attributes.ARIA_SELECTED, 4976 ARIA_SORT: exports.attributes.ARIA_SORT, 4977 DATA_ROW_ID_ATTR: exports.dataAttributes.ROW_ID, 4978 HEADER_ROW_CHECKBOX_SELECTOR: exports.selectors.HEADER_ROW_CHECKBOX, 4979 ROW_CHECKBOX_SELECTOR: exports.selectors.ROW_CHECKBOX, 4980 ROW_SELECTED_SELECTOR: exports.selectors.ROW_SELECTED, 4981 ROW_SELECTOR: exports.selectors.ROW 4982}; 4983/** 4984 * Sort values defined by ARIA. 4985 * See https://www.w3.org/WAI/PF/aria/states_and_properties#aria-sort 4986 */ 4987var SortValue; 4988(function (SortValue) { 4989 // Items are sorted in ascending order by this column. 4990 SortValue["ASCENDING"] = "ascending"; 4991 // Items are sorted in descending order by this column. 4992 SortValue["DESCENDING"] = "descending"; 4993 // There is no defined sort applied to the column. 4994 SortValue["NONE"] = "none"; 4995 // A sort algorithm other than ascending or descending has been applied. 4996 SortValue["OTHER"] = "other"; 4997})(SortValue = exports.SortValue || (exports.SortValue = {})); 4998/** 4999 * Event names used in component. 5000 */ 5001exports.events = { 5002 ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged', 5003 SELECTED_ALL: 'MDCDataTable:selectedAll', 5004 UNSELECTED_ALL: 'MDCDataTable:unselectedAll', 5005 SORTED: 'MDCDataTable:sorted' 5006}; 5007 5008/***/ }), 5009
vendor: 5,633 bytes, lines 5010-5153
5010/***/ "./packages/mdc-data-table/foundation.ts": 5011/*!***********************************************!*\ 5012 !*** ./packages/mdc-data-table/foundation.ts ***! 5013 \***********************************************/ 5014/*! no static exports found */ 5015/***/ (function(module, exports, __webpack_require__) { 5016 5017"use strict"; 5018 5019/** 5020 * @license 5021 * Copyright 2019 Google Inc. 5022 * 5023 * Permission is hereby granted, free of charge, to any person obtaining a copy 5024 * of this software and associated documentation files (the "Software"), to deal 5025 * in the Software without restriction, including without limitation the rights 5026 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5027 * copies of the Software, and to permit persons to whom the Software is 5028 * furnished to do so, subject to the following conditions: 5029 * 5030 * The above copyright notice and this permission notice shall be included in 5031 * all copies or substantial portions of the Software. 5032 * 5033 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5034 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5035 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5036 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5037 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5038 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5039 * THE SOFTWARE. 5040 */ 5041 5042var __extends = this && this.__extends || function () { 5043 var _extendStatics = function extendStatics(d, b) { 5044 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 5045 d.__proto__ = b; 5046 } || function (d, b) { 5047 for (var p in b) { 5048 if (b.hasOwnProperty(p)) d[p] = b[p]; 5049 } 5050 }; 5051 return _extendStatics(d, b); 5052 }; 5053 return function (d, b) { 5054 _extendStatics(d, b); 5055 function __() { 5056 this.constructor = d; 5057 } 5058 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5059 }; 5060}(); 5061var __assign = this && this.__assign || function () { 5062 __assign = Object.assign || function (t) { 5063 for (var s, i = 1, n = arguments.length; i < n; i++) { 5064 s = arguments[i]; 5065 for (var p in s) { 5066 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 5067 } 5068 } 5069 return t; 5070 }; 5071 return __assign.apply(this, arguments); 5072}; 5073var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 5074 function adopt(value) { 5075 return value instanceof P ? value : new P(function (resolve) { 5076 resolve(value); 5077 }); 5078 } 5079 return new (P || (P = Promise))(function (resolve, reject) { 5080 function fulfilled(value) { 5081 try { 5082 step(generator.next(value)); 5083 } catch (e) { 5084 reject(e); 5085 } 5086 } 5087 function rejected(value) { 5088 try { 5089 step(generator["throw"](value)); 5090 } catch (e) { 5091 reject(e); 5092 } 5093 } 5094 function step(result) { 5095 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 5096 } 5097 step((generator = generator.apply(thisArg, _arguments || [])).next()); 5098 }); 5099}; 5100var __generator = this && this.__generator || function (thisArg, body) { 5101 var _ = { label: 0, sent: function sent() { 5102 if (t[0] & 1) throw t[1];return t[1]; 5103 }, trys: [], ops: [] }, 5104 f, 5105 y, 5106 t, 5107 g; 5108 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { 5109 return this; 5110 }), g; 5111 function verb(n) { 5112 return function (v) { 5113 return step([n, v]); 5114 }; 5115 } 5116 function step(op) { 5117 if (f) throw new TypeError("Generator is already executing."); 5118 while (_) { 5119 try { 5120 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; 5121 if (y = 0, t) op = [op[0] & 2, t.value]; 5122 switch (op[0]) { 5123 case 0:case 1: 5124 t = op;break; 5125 case 4: 5126 _.label++;return { value: op[1], done: false }; 5127 case 5: 5128 _.label++;y = op[1];op = [0];continue; 5129 case 7: 5130 op = _.ops.pop();_.trys.pop();continue; 5131 default: 5132 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { 5133 _ = 0;continue; 5134 } 5135 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { 5136 _.label = op[1];break; 5137 } 5138 if (op[0] === 6 && _.label < t[1]) { 5139 _.label = t[1];t = op;break; 5140 } 5141 if (t && _.label < t[2]) { 5142 _.label = t[2];_.ops.push(op);break; 5143 } 5144 if (t[2]) _.ops.pop(); 5145 _.trys.pop();continue; 5146 } 5147 op = body.call(thisArg, _); 5148 } catch (e) { 5149 op = [6, e];y = 0; 5150 } finally { 5151 f = t = 0; 5152 } 5153 }if (op[0] & 5) throw op[1];
5153return { value: op[0] ? op[1] : void 0, done: true }; 5154 } 5155}; 5156Object.defineProperty(exports, "__esModule", { value: true }); 5157var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 5158var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"); 5159/** 5160 * The Foundation of data table component containing pure business logic, any 5161 * logic requiring DOM manipulation are delegated to adapter methods. 5162 */ 5163var MDCDataTableFoundation = /** @class */function (_super) { 5164 __extends(MDCDataTableFoundation, _super); 5165 function MDCDataTableFoundation(adapter) { 5166 return _super.call(this, __assign(__assign({}, MDCDataTableFoundation.defaultAdapter), adapter)) || this; 5167 } 5168 Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", { 5169 get: function get() { 5170 return { 5171 addClass: function addClass() { 5172 return undefined; 5173 }, 5174 addClassAtRowIndex: function addClassAtRowIndex() { 5175 return undefined; 5176 }, 5177 getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex() { 5178 return ''; 5179 }, 5180 getHeaderCellCount: function getHeaderCellCount() { 5181 return 0; 5182 }, 5183 getHeaderCellElements: function getHeaderCellElements() { 5184 return []; 5185 }, 5186 getRowCount: function getRowCount() { 5187 return 0; 5188 }, 5189 getRowElements: function getRowElements() { 5190 return []; 5191 }, 5192 getRowIdAtIndex: function getRowIdAtIndex() { 5193 return ''; 5194 }, 5195 getRowIndexByChildElement: function getRowIndexByChildElement() { 5196 return 0; 5197 }, 5198 getSelectedRowCount: function getSelectedRowCount() { 5199 return 0; 5200 }, 5201 getTableContainerHeight: function getTableContainerHeight() { 5202 return 0; 5203 }, 5204 getTableHeaderHeight: function getTableHeaderHeight() { 5205 return 0; 5206 }, 5207 isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked() { 5208 return false; 5209 }, 5210 isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() { 5211 return false; 5212 }, 5213 isRowsSelectable: function isRowsSelectable() { 5214 return false; 5215 }, 5216 notifyRowSelectionChanged: function notifyRowSelectionChanged() { 5217 return undefined; 5218 }, 5219 notifySelectedAll: function notifySelectedAll() { 5220 return undefined; 5221 }, 5222 notifySortAction: function notifySortAction() { 5223 return undefined; 5224 }, 5225 notifyUnselectedAll: function notifyUnselectedAll() { 5226 return undefined; 5227 }, 5228 registerHeaderRowCheckbox: function registerHeaderRowCheckbox() { 5229 return undefined; 5230 }, 5231 registerRowCheckboxes: function registerRowCheckboxes() { 5232 return undefined; 5233 }, 5234 removeClass: function removeClass() { 5235 return undefined; 5236 }, 5237 removeClassAtRowIndex: function removeClassAtRowIndex() { 5238 return undefined; 5239 }, 5240 removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex() { 5241 return undefined; 5242 }, 5243 setAttributeAtRowIndex: function setAttributeAtRowIndex() { 5244 return undefined; 5245 }, 5246 setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex() { 5247 return undefined; 5248 }, 5249 setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex() { 5250 return undefined; 5251 }, 5252 setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked() { 5253 return undefined; 5254 }, 5255 setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate() { 5256 return undefined; 5257 }, 5258 setProgressIndicatorStyles: function setProgressIndicatorStyles() { 5259 return undefined; 5260 }, 5261 setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex() { 5262 return undefined; 5263 }, 5264 setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex() { 5265 return undefined; 5266 } 5267 }; 5268 }, 5269 enumerable: true, 5270 configurable: true 5271 }); 5272 /** 5273 * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. 5274 * Use this if registering checkbox is synchronous. 5275 */ 5276 MDCDataTableFoundation.prototype.layout = function () { 5277 if (this.adapter.isRowsSelectable()) { 5278 this.adapter.registerHeaderRowCheckbox(); 5279 this.adapter.registerRowCheckboxes(); 5280 this.setHeaderRowCheckboxState(); 5281 } 5282 }; 5283 /** 5284 * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. 5285 * Use this if registering checkbox is asynchronous. 5286 */ 5287 MDCDataTableFoundation.prototype.layoutAsync = function () { 5288 return __awaiter(this, void 0, void 0, function () { 5289 return __generator(this, function (_a) { 5290 switch (_a.label) { 5291 case 0: 5292 if (!this.adapter.isRowsSelectable()) return [3 /*break*/, 3]; 5293 return [4 /*yield*/, this.adapter.registerHeaderRowCheckbox()]; 5294 case 1: 5295 _a.sent(); 5296 return [4 /*yield*/, this.adapter.registerRowCheckboxes()]; 5297 case 2: 5298 _a.sent(); 5299 this.setHeaderRowCheckboxState(); 5300 _a.label = 3; 5301 case 3: 5302 return [2 /*return*/]; 5303 } 5304 }); 5305 }); 5306 }; 5307 /** 5308 * @return Returns array of row elements. 5309 */ 5310 MDCDataTableFoundation.prototype.getRows = function () { 5311 return this.adapter.getRowElements(); 5312 }; 5313 /** 5314 * @return Array of header cell elements. 5315 */ 5316 MDCDataTableFoundation.prototype.getHeaderCells = function () { 5317 return this.adapter.getHeaderCellElements(); 5318 }; 5319 /** 5320 * Sets selected row ids. Overwrites previously selected rows. 5321 * @param rowIds Array of row ids that needs to be selected. 5322 */ 5323 MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) { 5324 for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { 5325 var rowId = this.adapter.getRowIdAtIndex(rowIndex); 5326 var isSelected = false;
5327 if (rowId && rowIds.indexOf(rowId) >= 0) { 5328 isSelected = true; 5329 } 5330 this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isSelected); 5331 this.selectRowAtIndex(rowIndex, isSelected); 5332 } 5333 this.setHeaderRowCheckboxState(); 5334 }; 5335 /** 5336 * @return Returns array of all row ids. 5337 */ 5338 MDCDataTableFoundation.prototype.getRowIds = function () { 5339 var rowIds = []; 5340 for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { 5341 rowIds.push(this.adapter.getRowIdAtIndex(rowIndex)); 5342 } 5343 return rowIds; 5344 }; 5345 /** 5346 * @return Returns array of selected row ids. 5347 */ 5348 MDCDataTableFoundation.prototype.getSelectedRowIds = function () { 5349 var selectedRowIds = []; 5350 for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { 5351 if (this.adapter.isCheckboxAtRowIndexChecked(rowIndex)) { 5352 selectedRowIds.push(this.adapter.getRowIdAtIndex(rowIndex)); 5353 } 5354 } 5355 return selectedRowIds; 5356 }; 5357 /** 5358 * Handles header row checkbox change event. 5359 */ 5360 MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () { 5361 var isHeaderChecked = this.adapter.isHeaderRowCheckboxChecked(); 5362 for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { 5363 this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked); 5364 this.selectRowAtIndex(rowIndex, isHeaderChecked); 5365 } 5366 if (isHeaderChecked) { 5367 this.adapter.notifySelectedAll(); 5368 } else { 5369 this.adapter.notifyUnselectedAll(); 5370 } 5371 }; 5372 /** 5373 * Handles change event originated from row checkboxes. 5374 */ 5375 MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) { 5376 var rowIndex = this.adapter.getRowIndexByChildElement(event.target); 5377 if (rowIndex === -1) { 5378 return; 5379 } 5380 var selected = this.adapter.isCheckboxAtRowIndexChecked(rowIndex); 5381 this.selectRowAtIndex(rowIndex, selected); 5382 this.setHeaderRowCheckboxState(); 5383 var rowId = this.adapter.getRowIdAtIndex(rowIndex); 5384 this.adapter.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected }); 5385 }; 5386 /** 5387 * Handles sort action on sortable header cell. 5388 */ 5389 MDCDataTableFoundation.prototype.handleSortAction = function (eventData) { 5390 var columnId = eventData.columnId, 5391 columnIndex = eventData.columnIndex, 5392 headerCell = eventData.headerCell; 5393 // Reset sort attributes / classes on other header cells. 5394 for (var index = 0; index < this.adapter.getHeaderCellCount(); index++) { 5395 if (index === columnIndex) { 5396 continue; 5397 } 5398 this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasse
5398s.HEADER_CELL_SORTED); 5399 this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING); 5400 this.adapter.setAttributeByHeaderCellIndex(index, constants_1.strings.ARIA_SORT, constants_1.SortValue.NONE); 5401 this.adapter.setSortStatusLabelByHeaderCellIndex(index, constants_1.SortValue.NONE); 5402 } 5403 // Set appropriate sort attributes / classes on target header cell. 5404 this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED); 5405 var currentSortValue = this.adapter.getAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT); 5406 var sortValue = constants_1.SortValue.NONE; 5407 // Set to descending if sorted on ascending order. 5408 if (currentSortValue === constants_1.SortValue.ASCENDING) { 5409 this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING); 5410 this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.DESCENDING); 5411 sortValue = constants_1.SortValue.DESCENDING; 5412 // Set to ascending if sorted on descending order. 5413 } else if (currentSortValue === constants_1.SortValue.DESCENDING) { 5414 this.adapter.removeClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasse
5414s.HEADER_CELL_SORTED_DESCENDING); 5415 this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING); 5416 sortValue = constants_1.SortValue.ASCENDING; 5417 } else { 5418 // Set to ascending by default when not sorted. 5419 this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING); 5420 sortValue = constants_1.SortValue.ASCENDING; 5421 } 5422 this.adapter.setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue); 5423 this.adapter.notifySortAction({ 5424 columnId: columnId, 5425 columnIndex: columnIndex, 5426 headerCell: headerCell, 5427 sortValue: sortValue 5428 }); 5429 }; 5430 /** 5431 * Shows progress indicator blocking only the table body content when in 5432 * loading state. 5433 */ 5434 MDCDataTableFoundation.prototype.showProgress = function () { 5435 var tableHeaderHeight = this.adapter.getTableHeaderHeight(); 5436 // Calculate the height of table content (Not scroll content) excluding 5437 // header row height. 5438 var height = this.adapter.getTableContainerHeight() - tableHeaderHeight; 5439 var top = tableHeaderHeight; 5440 this.adapter.setProgressIndicatorStyles({ 5441 height: height + "px", 5442 top: top + "px" 5443 });
5444 this.adapter.addClass(constants_1.cssClasses.IN_PROGRESS); 5445 }; 5446 /** 5447 * Hides progress indicator when data table is finished loading. 5448 */ 5449 MDCDataTableFoundation.prototype.hideProgress = function () { 5450 this.adapter.removeClass(constants_1.cssClasses.IN_PROGRESS); 5451 }; 5452 /** 5453 * Updates header row checkbox state based on number of rows selected. 5454 */ 5455 MDCDataTableFoundation.prototype.setHeaderRowCheckboxState = function () { 5456 if (this.adapter.getSelectedRowCount() === 0) { 5457 this.adapter.setHeaderRowCheckboxChecked(false); 5458 this.adapter.setHeaderRowCheckboxIndeterminate(false); 5459 } else if (this.adapter.getSelectedRowCount() === this.adapter.getRowCount()) { 5460 this.adapter.setHeaderRowCheckboxChecked(true); 5461 this.adapter.setHeaderRowCheckboxIndeterminate(false); 5462 } else { 5463 this.adapter.setHeaderRowCheckboxIndeterminate(true); 5464 this.adapter.setHeaderRowCheckboxChecked(false); 5465 } 5466 }; 5467 /** 5468 * Sets the attributes of row element based on selection state. 5469 */ 5470 MDCDataTableFoundation.prototype.selectRowAtIndex = function (rowIndex, selected) { 5471 if (selected) { 5472 this.adapter.addClassAtRowIndex(rowIndex, constants_1.cssClasse
5472s.ROW_SELECTED); 5473 this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'true'); 5474 } else { 5475 this.adapter.removeClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED); 5476 this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'false'); 5477 } 5478 }; 5479 return MDCDataTableFoundation; 5480}(foundation_1.MDCFoundation); 5481exports.MDCDataTableFoundation = MDCDataTableFoundation; 5482 5483/***/ }), 5484
5485/***/ "./packages/mdc-data-table/index.ts": 5486/*!******************************************!*\ 5487 !*** ./packages/mdc-data-table/index.ts ***! 5488 \******************************************/ 5489/*! no static exports found */ 5490/***/ (function(module, exports, __webpack_require__) { 5491 5492"use strict"; 5493 5494/** 5495 * @license 5496 * Copyright 2019 Google Inc. 5497 * 5498 * Permission is hereby granted, free of charge, to any person obtaining a copy 5499 * of this software and associated documentation files (the "Software"), to deal 5500 * in the Software without restriction, including without limitation the rights 5501 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5502 * copies of the Software, and to permit persons to whom the Software is 5503 * furnished to do so, subject to the following conditions: 5504 * 5505 * The above copyright notice and this permission notice shall be included in 5506 * all copies or substantial portions of the Software. 5507 * 5508 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5509 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5510 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5511 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5512 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5513 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5514 * THE SOFTWARE. 5515 */ 5516 5517function __export(m) { 5518 for (var p in m) { 5519 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 5520 } 5521} 5522Object.defineProperty(exports, "__esModule", { value: true }); 5523__export(__webpack_require__(/*! ./component */ "./packages/mdc-data-table/component.ts")); 5524__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts")); 5525__export(__webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts")); 5526 5527/***/ }), 5528
5529/***/ "./packages/mdc-dialog/component.ts": 5530/*!******************************************!*\ 5531 !*** ./packages/mdc-dialog/component.ts ***! 5532 \******************************************/ 5533/*! no static exports found */ 5534/***/ (function(module, exports, __webpack_require__) { 5535 5536"use strict"; 5537 5538/** 5539 * @license 5540 * Copyright 2017 Google Inc. 5541 * 5542 * Permission is hereby granted, free of charge, to any person obtaining a copy 5543 * of this software and associated documentation files (the "Software"), to deal 5544 * in the Software without restriction, including without limitation the rights 5545 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5546 * copies of the Software, and to permit persons to whom the Software is 5547 * furnished to do so, subject to the following conditions: 5548 * 5549 * The above copyright notice and this permission notice shall be included in 5550 * all copies or substantial portions of the Software. 5551 * 5552 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5553 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5554 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5555 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5556 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5557 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5558 * THE SOFTWARE. 5559 */ 5560 5561var __extends = this && this.__extends || function () { 5562 var _extendStatics = function extendStatics(d, b) { 5563 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 5564 d.__proto__ = b; 5565 } || function (d, b) { 5566 for (var p in b) { 5567 if (b.hasOwnProperty(p)) d[p] = b[p]; 5568 } 5569 }; 5570 return _extendStatics(d, b); 5571 }; 5572 return function (d, b) { 5573 _extendStatics(d, b); 5574 function __() { 5575 this.constructor = d; 5576 } 5577 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5578 }; 5579}(); 5580var __values = this && this.__values || function (o) { 5581 var s = typeof Symbol === "function" && Symbol.iterator, 5582 m = s && o[s], 5583 i = 0; 5584 if (m) return m.call(o); 5585 if (o && typeof o.length === "number") return { 5586 next: function next() { 5587 if (o && i >= o.length) o = void 0; 5588 return { value: o && o[i++], done: !o }; 5589 } 5590 }; 5591 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 5592}; 5593var __importStar = this && this.__importStar || function (mod) { 5594 if (mod && mod.__esModule) return mod; 5595 var result = {}; 5596 if (mod != null) for (var k in mod) { 5597 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 5598 }result["default"] = mod; 5599 return result; 5600}; 5601Object.defineProperty(exports, "__esModule", { value: true }); 5602var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 5603var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts"); 5604var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 5605var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 5606var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts"); 5607var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts")); 5608var strings = foundation_1.MDCDialogFoundation.strings; 5609var MDCDialog = /** @class */function (_super) { 5610 __extends(MDCDialog, _super); 5611 function MDCDialog() { 5612 return _super !== null && _super.apply(this, arguments) || this; 5613 } 5614 Object.defineProperty(MDCDialog.prototype, "isOpen", { 5615 get: function get() { 5616 return this.foundation.isOpen(); 5617 }, 5618 enumerable: true, 5619 configurable: true 5620 }); 5621 Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", { 5622 get: function get() { 5623 return this.foundation.getEscapeKeyAction(); 5624 }, 5625 set: function set(action) { 5626 this.foundation.setEscapeKeyAction(action); 5627 }, 5628 enumerable: true, 5629 configurable: true 5630 });
5631 Object.defineProperty(MDCDialog.prototype, "scrimClickAction", { 5632 get: function get() { 5633 return this.foundation.getScrimClickAction(); 5634 }, 5635 set: function set(action) { 5636 this.foundation.setScrimClickAction(action); 5637 }, 5638 enumerable: true, 5639 configurable: true 5640 }); 5641 Object.defineProperty(MDCDialog.prototype, "autoStackButtons", { 5642 get: function get() { 5643 return this.foundation.getAutoStackButtons(); 5644 }, 5645 set: function set(autoStack) { 5646 this.foundation.setAutoStackButtons(autoStack); 5647 }, 5648 enumerable: true, 5649 configurable: true 5650 }); 5651 MDCDialog.attachTo = function (root) { 5652 return new MDCDialog(root); 5653 }; 5654 MDCDialog.prototype.initialize = function (focusTrapFactory) { 5655 var e_1, _a; 5656 if (focusTrapFactory === void 0) { 5657 focusTrapFactory = function focusTrapFactory(el, focusOptions) { 5658 return new focus_trap_1.FocusTrap(el, focusOptions); 5659 }; 5660 } 5661 var container = this.root.querySelector(strings.CONTAINER_SELECTOR); 5662 if (!container) { 5663 throw new Error("Dialog component requires a " + strings.CONTAINER_SELECTOR + " container element"); 5664 } 5665 this.container = container; 5666 this.content = this.root.querySelector(strings.CONTENT_SELECTOR); 5667 this.buttons = [].slice.call(this.root.querySelectorAll(strings.BUTTON_SELECTOR)); 5668 this.defaultButton = this.root.querySelector("[" + strings.BUTTON_DEFAULT_ATTRIBUTE + "]"); 5669 this.focusTrapFactory = focusTrapFactory; 5670 this.buttonRipples = []; 5671 try { 5672 for (var _b = __values(this.buttons), _c = _b.next(); !_c.done; _c = _b.next()) { 5673 var buttonEl = _c.value; 5674 this.buttonRipples.push(new component_2.MDCRipple(buttonEl)); 5675 } 5676 } catch (e_1_1) { 5677 e_1 = { error: e_1_1 }; 5678 } finally { 5679 try { 5680 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 5681 } finally { 5682 if (e_1) throw e_1.error; 5683 } 5684 } 5685 }; 5686 MDCDialog.prototype.initialSyncWithDOM = function () { 5687 var _this = this; 5688 this.focusTrap = util.createFocusTrapInstance(this.container, this.focusTrapFactory, this.getInitialFocusEl() || undefined); 5689 this.handleClick = this.foundation.handleClick.bind(this.foundation); 5690 this.handleKeydown = this.foundation.handleKeydown.bind(this.foundation); 5691 this.handleDocumentKeydown = this.foundation.handleDocumentKeydown.bind(this.foundation); 5692 this.handleLayout = this.layout.bind(this); 5693 var LAYOUT_EVENTS = ['resize', 'orientationchange']; 5694 this.handleOpening = function () { 5695 LAYOUT_EVENTS.forEach(function (evtType) { 5696 window.addEventListener(evtType, _this.handleLayout); 5697 }); 5698 document.addEventListener('keydown', _this.handleDocumentKeydown); 5699 }; 5700 this.handleClosing = function () { 5701 LAYOUT_EVENTS.forEach(function (evtType) { 5702 window.removeEventListener(evtType, _this.handleLayout); 5703 }); 5704 document.removeEventListener('keydown', _this.handleDocumentKeydown); 5705 }; 5706 this.listen('click', this.handleClick); 5707 this.listen('keydown', this.handleKeydown); 5708 this.listen(strings.OPENING_EVENT, this.handleOpening); 5709 this.listen(strings.CLOSING_EVENT, this.handleClosing); 5710 }; 5711 MDCDialog.prototype.destroy = function () { 5712 this.unlisten('click', this.handleClick); 5713 this.unlisten('keydown', this.handleKeydown); 5714 this.unlisten(strings.OPENING_EVENT, this.handleOpening); 5715 this.unlisten(strings.CLOSING_EVENT, this.handleClosing); 5716 this.handleClosing(); 5717 this.buttonRipples.forEach(function (ripple) { 5718 ripple.destroy(); 5719 }); 5720 _super.prototype.destroy.call(this); 5721 }; 5722 MDCDialog.prototype.layout = function () { 5723 this.foundation.layout(); 5724 }; 5725 MDCDialog.prototype.open = function () { 5726 this.foundation.open(); 5727 }; 5728 MDCDialog.prototype.close = function (action) { 5729 if (action === void 0) { 5730 action = ''; 5731 } 5732 this.foundation.close(action); 5733 }; 5734 MDCDialog.prototype.getDefaultFoundation = function () { 5735 var _this = this; 5736 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 5737 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 5738 var adapter = { 5739 addBodyClass: function addBodyClass(className) { 5740 return document.body.classList.add(className); 5741 }, 5742 addClass: function addClass(className) { 5743 return _this.root.classList.add(className); 5744 }, 5745 areButtonsStacked: function areButtonsStacked() { 5746 return util.areTopsMisaligned(_this.buttons); 5747 }, 5748 clickDefaultButton: function clickDefaultButton() { 5749 if (_this.defaultButton) { 5750 _this.defaultButton.click(); 5751 } 5752 }, 5753 eventTargetMatches: function eventTargetMatches(target, selector) { 5754 return target ? ponyfill_1.matches(target, selector) : false;
5755 }, 5756 getActionFromEvent: function getActionFromEvent(evt) { 5757 if (!evt.target) { 5758 return ''; 5759 } 5760 var element = ponyfill_1.closest(evt.target, "[" + strings.ACTION_ATTRIBUTE + "]"); 5761 return element && element.getAttribute(strings.ACTION_ATTRIBUTE); 5762 }, 5763 getInitialFocusEl: function getInitialFocusEl() { 5764 return _this.getInitialFocusEl(); 5765 }, 5766 hasClass: function hasClass(className) { 5767 return _this.root.classList.contains(className); 5768 }, 5769 isContentScrollable: function isContentScrollable() { 5770 return util.isScrollable(_this.content); 5771 }, 5772 notifyClosed: function notifyClosed(action) { 5773 return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {}); 5774 }, 5775 notifyClosing: function notifyClosing(action) { 5776 return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {}); 5777 }, 5778 notifyOpened: function notifyOpened() { 5779 return _this.emit(strings.OPENED_EVENT, {}); 5780 }, 5781 notifyOpening: function notifyOpening() { 5782 return _this.emit(strings.OPENING_EVENT, {}); 5783 }, 5784 releaseFocus: function releaseFocus() { 5785 _this.focusTrap.releaseFocus(); 5786 }, 5787 removeBodyClass: function removeBodyClass(className) { 5788 return document.body.classList.remove(className); 5789 }, 5790 removeClass: function removeClass(className) { 5791 return _this.root.classList.remove(className); 5792 }, 5793 reverseButtons: function reverseButtons() { 5794 _this.buttons.reverse(); 5795 _this.buttons.forEach(function (button) { 5796 button.parentElement.appendChild(button); 5797 }); 5798 }, 5799 trapFocus: function trapFocus() { 5800 _this.focusTrap.trapFocus(); 5801 }, 5802 registerContentEventHandler: function registerContentEventHandler(evt, handler) { 5803 if (_this.content instanceof HTMLElement) { 5804 _this.content.addEventListener(evt, handler); 5805 } 5806 }, 5807 deregisterContentEventHandler: function deregisterContentEventHandler(evt, handler) { 5808 if (_this.content instanceof HTMLElement) { 5809 _this.content.removeEventListener(evt, handler); 5810 } 5811 }, 5812 isScrollableContentAtTop: function isScrollableContentAtTop() { 5813 return util.isScrollAtTop(_this.content); 5814 }, 5815 isScrollableContentAtBottom: function isScrollableContentAtBottom() { 5816 return util.isScrollAtBottom(_this.content); 5817 } 5818 }; 5819 return new foundation_1.MDCDialogFoundation(adapter); 5820 }; 5821 MDCDialog.prototype.getInitialFocusEl = function () { 5822 return this.root.querySelector("[" + strings.INITIAL_FOCUS_ATTRIBUTE + "]"); 5823 }; 5824 return MDCDialog; 5825}(component_1.MDCComponent); 5826exports.MDCDialog = MDCDialog; 5827 5828/***/ }), 5829
5830/***/ "./packages/mdc-dialog/constants.ts": 5831/*!******************************************!*\ 5832 !*** ./packages/mdc-dialog/constants.ts ***! 5833 \******************************************/ 5834/*! no static exports found */ 5835/***/ (function(module, exports, __webpack_require__) { 5836 5837"use strict"; 5838 5839/** 5840 * @license 5841 * Copyright 2016 Google Inc. 5842 * 5843 * Permission is hereby granted, free of charge, to any person obtaining a copy 5844 * of this software and associated documentation files (the "Software"), to deal 5845 * in the Software without restriction, including without limitation the rights 5846 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5847 * copies of the Software, and to permit persons to whom the Software is 5848 * furnished to do so, subject to the following conditions: 5849 * 5850 * The above copyright notice and this permission notice shall be included in 5851 * all copies or substantial portions of the Software. 5852 * 5853 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5854 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5855 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5856 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5857 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5858 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5859 * THE SOFTWARE. 5860 */ 5861 5862Object.defineProperty(exports, "__esModule", { value: true }); 5863exports.cssClasses = { 5864 CLOSING: 'mdc-dialog--closing', 5865 OPEN: 'mdc-dialog--open', 5866 OPENING: 'mdc-dialog--opening', 5867 SCROLLABLE: 'mdc-dialog--scrollable', 5868 SCROLL_LOCK: 'mdc-dialog-scroll-lock', 5869 STACKED: 'mdc-dialog--stacked', 5870 FULLSCREEN: 'mdc-dialog--fullscreen', 5871 // Class for showing a scroll divider on full-screen dialog header element. 5872 // Should only be displayed on scrollable content, when the dialog content is 5873 // scrolled "underneath" the header. 5874 SCROLL_DIVIDER_HEADER: 'mdc-dialog-scroll-divider-header', 5875 // Class for showing a scroll divider on a full-screen dialog footer element. 5876 // Should only be displayed on scrolalble content, when the dialog content is 5877 // obscured "underneath" the footer. 5878 SCROLL_DIVIDER_FOOTER: 'mdc-dialog-scroll-divider-footer' 5879}; 5880exports.strings = { 5881 ACTION_ATTRIBUTE: 'data-mdc-dialog-action', 5882 BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default', 5883 BUTTON_SELECTOR: '.mdc-dialog__button', 5884 CLOSED_EVENT: 'MDCDialog:closed', 5885 CLOSE_ACTION: 'close', 5886 CLOSING_EVENT: 'MDCDialog:closing', 5887 CONTAINER_SELECTOR: '.mdc-dialog__container', 5888 CONTENT_SELECTOR: '.mdc-dialog__content', 5889 DESTROY_ACTION: 'destroy', 5890 INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus', 5891 OPENED_EVENT: 'MDCDialog:opened', 5892 OPENING_EVENT: 'MDCDialog:opening', 5893 SCRIM_SELECTOR: '.mdc-dialog__scrim', 5894 SUPPRESS_DEFAULT_PRESS_SELECTOR: ['textarea', '.mdc-menu .mdc-list-item'].join(', '), 5895 SURFACE_SELECTOR: '.mdc-dialog__surface' 5896}; 5897exports.numbers = { 5898 DIALOG_ANIMATION_CLOSE_TIME_MS: 75, 5899 DIALOG_ANIMATION_OPEN_TIME_MS: 150 5900}; 5901 5902/***/ }), 5903
5904/***/ "./packages/mdc-dialog/foundation.ts": 5905/*!*******************************************!*\ 5906 !*** ./packages/mdc-dialog/foundation.ts ***! 5907 \*******************************************/ 5908/*! no static exports found */ 5909/***/ (function(module, exports, __webpack_require__) { 5910 5911"use strict"; 5912 5913/** 5914 * @license 5915 * Copyright 2017 Google Inc. 5916 * 5917 * Permission is hereby granted, free of charge, to any person obtaining a copy 5918 * of this software and associated documentation files (the "Software"), to deal 5919 * in the Software without restriction, including without limitation the rights 5920 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5921 * copies of the Software, and to permit persons to whom the Software is 5922 * furnished to do so, subject to the following conditions: 5923 * 5924 * The above copyright notice and this permission notice shall be included in 5925 * all copies or substantial portions of the Software. 5926 * 5927 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5928 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5929 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5930 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5931 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5932 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5933 * THE SOFTWARE. 5934 */ 5935 5936var __extends = this && this.__extends || function () { 5937 var _extendStatics = function extendStatics(d, b) { 5938 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 5939 d.__proto__ = b; 5940 } || function (d, b) { 5941 for (var p in b) { 5942 if (b.hasOwnProperty(p)) d[p] = b[p]; 5943 } 5944 }; 5945 return _extendStatics(d, b); 5946 }; 5947 return function (d, b) { 5948 _extendStatics(d, b); 5949 function __() { 5950 this.constructor = d; 5951 } 5952 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5953 }; 5954}(); 5955var __assign = this && this.__assign || function () { 5956 __assign = Object.assign || function (t) { 5957 for (var s, i = 1, n = arguments.length; i < n; i++) { 5958 s = arguments[i]; 5959 for (var p in s) { 5960 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 5961 } 5962 } 5963 return t; 5964 }; 5965 return __assign.apply(this, arguments); 5966}; 5967Object.defineProperty(exports, "__esModule", { value: true }); 5968var animationframe_1 = __webpack_require__(/*! @material/animation/animationframe */ "./packages/mdc-animation/animationframe.ts"); 5969var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 5970var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts"); 5971var AnimationKeys; 5972(function (AnimationKeys) { 5973 AnimationKeys["POLL_SCROLL_POS"] = "poll_scroll_position"; 5974})(AnimationKeys || (AnimationKeys = {})); 5975var MDCDialogFoundation = /** @class */function (_super) { 5976 __extends(MDCDialogFoundation, _super); 5977 function MDCDialogFoundation(adapter) { 5978 var _this = _super.call(this, __assign(__assign({}, MDCDialogFoundation.defaultAdapter), adapter)) || this; 5979 _this.dialogOpen = false; 5980 _this.isFullscreen = false; 5981 _this.animationFrame = 0; 5982 _this.animationTimer = 0; 5983 _this.layoutFrame = 0; 5984 _this.escapeKeyAction = constants_1.strings.CLOSE_ACTION; 5985 _this.scrimClickAction = constants_1.strings.CLOSE_ACTION; 5986 _this.autoStackButtons = true; 5987 _this.areButtonsStacked = false; 5988 _this.suppressDefaultPressSelector = constants_1.strings.SUPPRESS_DEFAULT_PRESS_SELECTOR; 5989 _this.animFrame = new animationframe_1.AnimationFrame(); 5990 _this.contentScrollHandler = function () { 5991 _this.handleScrollEvent(); 5992 }; 5993 return _this; 5994 } 5995 Object.defineProperty(MDCDialogFoundation, "cssClasses", { 5996 get: function get() {
5997 return constants_1.cssClasses; 5998 }, 5999 enumerable: true, 6000 configurable: true 6001 }); 6002 Object.defineProperty(MDCDialogFoundation, "strings", { 6003 get: function get() { 6004 return constants_1.strings; 6005 }, 6006 enumerable: true, 6007 configurable: true 6008 }); 6009 Object.defineProperty(MDCDialogFoundation, "numbers", { 6010 get: function get() { 6011 return constants_1.numbers; 6012 }, 6013 enumerable: true, 6014 configurable: true 6015 }); 6016 Object.defineProperty(MDCDialogFoundation, "defaultAdapter", { 6017 get: function get() { 6018 return { 6019 addBodyClass: function addBodyClass() { 6020 return undefined; 6021 }, 6022 addClass: function addClass() { 6023 return undefined; 6024 }, 6025 areButtonsStacked: function areButtonsStacked() { 6026 return false; 6027 }, 6028 clickDefaultButton: function clickDefaultButton() { 6029 return undefined; 6030 }, 6031 eventTargetMatches: function eventTargetMatches() { 6032 return false; 6033 }, 6034 getActionFromEvent: function getActionFromEvent() { 6035 return ''; 6036 }, 6037 getInitialFocusEl: function getInitialFocusEl() { 6038 return null; 6039 }, 6040 hasClass: function hasClass() { 6041 return false; 6042 }, 6043 isContentScrollable: function isContentScrollable() { 6044 return false; 6045 }, 6046 notifyClosed: function notifyClosed() { 6047 return undefined; 6048 }, 6049 notifyClosing: function notifyClosing() { 6050 return undefined; 6051 }, 6052 notifyOpened: function notifyOpened() { 6053 return undefined; 6054 }, 6055 notifyOpening: function notifyOpening() { 6056 return undefined; 6057 }, 6058 releaseFocus: function releaseFocus() { 6059 return undefined; 6060 }, 6061 removeBodyClass: function removeBodyClass() { 6062 return undefined; 6063 }, 6064 removeClass: function removeClass() { 6065 return undefined; 6066 }, 6067 reverseButtons: function reverseButtons() { 6068 return undefined; 6069 }, 6070 trapFocus: function trapFocus() { 6071 return undefined; 6072 }, 6073 registerContentEventHandler: function registerContentEventHandler() { 6074 return undefined; 6075 }, 6076 deregisterContentEventHandler: function deregisterContentEventHandler() { 6077 return undefined; 6078 }, 6079 isScrollableContentAtTop: function isScrollableContentAtTop() { 6080 return false; 6081 }, 6082 isScrollableContentAtBottom: function isScrollableContentAtBottom() { 6083 return false; 6084 } 6085 }; 6086 }, 6087 enumerable: true, 6088 configurable: true 6089 }); 6090 MDCDialogFoundation.prototype.init = function () {
6091 if (this.adapter.hasClass(constants_1.cssClasses.STACKED)) { 6092 this.setAutoStackButtons(false); 6093 } 6094 this.isFullscreen = this.adapter.hasClass(constants_1.cssClasses.FULLSCREEN); 6095 }; 6096 MDCDialogFoundation.prototype.destroy = function () { 6097 if (this.dialogOpen) { 6098 this.close(constants_1.strings.DESTROY_ACTION); 6099 } 6100 if (this.animationTimer) { 6101 clearTimeout(this.animationTimer); 6102 this.handleAnimationTimerEnd(); 6103 } 6104 if (this.layoutFrame) { 6105 cancelAnimationFrame(this.layoutFrame); 6106 this.layoutFrame = 0; 6107 } 6108 if (this.isFullscreen && this.adapter.isContentScrollable()) { 6109 this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler); 6110 } 6111 }; 6112 MDCDialogFoundation.prototype.open = function () { 6113 var _this = this; 6114 this.dialogOpen = true; 6115 this.adapter.notifyOpening(); 6116 this.adapter.addClass(constants_1.cssClasses.OPENING); 6117 if (this.isFullscreen && this.adapter.isContentScrollable()) { 6118 this.adapter.registerContentEventHandler('scroll', this.contentScrollHandler); 6119 } 6120 // Wait a frame once display is no longer "none", to establish basis for 6121 // animation 6122 this.runNextAnimationFrame(function () {
6123 _this.adapter.addClass(constants_1.cssClasses.OPEN); 6124 _this.adapter.addBodyClass(constants_1.cssClasses.SCROLL_LOCK); 6125 _this.layout(); 6126 _this.animationTimer = setTimeout(function () { 6127 _this.handleAnimationTimerEnd(); 6128 _this.adapter.trapFocus(_this.adapter.getInitialFocusEl()); 6129 _this.adapter.notifyOpened(); 6130 }, constants_1.numbers.DIALOG_ANIMATION_OPEN_TIME_MS); 6131 }); 6132 }; 6133 MDCDialogFoundation.prototype.close = function (action) { 6134 var _this = this; 6135 if (action === void 0) { 6136 action = ''; 6137 } 6138 if (!this.dialogOpen) { 6139 // Avoid redundant close calls (and events), e.g. from keydown on elements 6140 // that inherently emit click 6141 return; 6142 } 6143 this.dialogOpen = false; 6144 this.adapter.notifyClosing(action); 6145 this.adapter.addClass(constants_1.cssClasses.CLOSING); 6146 this.adapter.removeClass(constants_1.cssClasses.OPEN);
6147 this.adapter.removeBodyClass(constants_1.cssClasses.SCROLL_LOCK); 6148 if (this.isFullscreen && this.adapter.isContentScrollable()) { 6149 this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler); 6150 } 6151 cancelAnimationFrame(this.animationFrame); 6152 this.animationFrame = 0; 6153 clearTimeout(this.animationTimer); 6154 this.animationTimer = setTimeout(function () { 6155 _this.adapter.releaseFocus(); 6156 _this.handleAnimationTimerEnd(); 6157 _this.adapter.notifyClosed(action); 6158 }, constants_1.numbers.DIALOG_ANIMATION_CLOSE_TIME_MS); 6159 }; 6160 MDCDialogFoundation.prototype.isOpen = function () { 6161 return this.dialogOpen; 6162 }; 6163 MDCDialogFoundation.prototype.getEscapeKeyAction = function () { 6164 return this.escapeKeyAction; 6165 }; 6166 MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) { 6167 this.escapeKeyAction = action; 6168 }; 6169 MDCDialogFoundation.prototype.getScrimClickAction = function () { 6170 return this.scrimClickAction; 6171 }; 6172 MDCDialogFoundation.prototype.setScrimClickAction = function (action) { 6173 this.scrimClickAction = action; 6174 }; 6175 MDCDialogFoundation.prototype.getAutoStackButtons = function () { 6176 return this.autoStackButtons; 6177 }; 6178 MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) { 6179 this.autoStackButtons = autoStack; 6180 }; 6181 MDCDialogFoundation.prototype.getSuppressDefaultPressSelector = function () { 6182 return this.suppressDefaultPressSelector; 6183 }; 6184 MDCDialogFoundation.prototype.setSuppressDefaultPressSelector = function (selector) { 6185 this.suppressDefaultPressSelector = selector; 6186 }; 6187 MDCDialogFoundation.prototype.layout = function () { 6188 var _this = this; 6189 if (this.layoutFrame) { 6190 cancelAnimationFrame(this.layoutFrame); 6191 } 6192 this.layoutFrame = requestAnimationFrame(function () { 6193 _this.layoutInternal(); 6194 _this.layoutFrame = 0; 6195 }); 6196 }; 6197 /** Handles click on the dialog root element. */ 6198 MDCDialogFoundation.prototype.handleClick = function (evt) { 6199 var isScrim = this.adapter.eventTargetMatches(evt.target, constants_1.strings.SCRIM_SELECTOR); 6200 // Check for scrim click first since it doesn't require querying ancestors. 6201 if (isScrim && this.scrimClickAction !== '') { 6202 this.close(this.scrimClickAction); 6203 } else { 6204 var action = this.adapter.getActionFromEvent(evt); 6205 if (action) { 6206 this.close(action); 6207 } 6208 } 6209 }; 6210 /** Handles keydown on the dialog root element. */ 6211 MDCDialogFoundation.prototype.handleKeydown = function (evt) { 6212 var isEnter = evt.key === 'Enter' || evt.keyCode === 13; 6213 if (!isEnter) { 6214 return; 6215 } 6216 var action = this.adapter.getActionFromEvent(evt); 6217 if (action) { 6218 // Action button callback is handled in `handleClick`, 6219 // since space/enter keydowns on buttons trigger click events. 6220 return; 6221 } 6222 // `composedPath` is used here, when available, to account for use cases 6223 // where a target meant to suppress the default press behaviour 6224 // may exist in a shadow root. 6225 // For example, a textarea inside a web component: 6226 // <mwc-dialog> 6227 // <horizontal-layout> 6228 // #shadow-root (open) 6229 // <mwc-textarea> 6230 // #shadow-root (open) 6231 // <textarea></textarea> 6232 // </mwc-textarea> 6233 // </horizontal-layout> 6234 // </mwc-dialog> 6235 var target = evt.composedPath ? evt.composedPath()[0] : evt.target; 6236 var isDefault = this.suppressDefaultPressSelector ? !this.adapter.eventTargetMatches(target, this.suppressDefaultPressSelector) : true; 6237 if (isEnter && isDefault) { 6238 this.adapter.clickDefaultButton(); 6239 } 6240 }; 6241 /** Handles keydown on the document. */ 6242 MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) { 6243 var isEscape = evt.key === 'Escape' || evt.keyCode === 27; 6244 if (isEscape && this.escapeKeyAction !== '') { 6245 this.close(this.escapeKeyAction); 6246 } 6247 }; 6248 /** 6249 * Handles scroll event on the dialog's content element -- showing a scroll 6250 * divider on the header or footer based on the scroll position. This handler 6251 * should only be registered on full-screen dialogs with scrollable content. 6252 */ 6253 MDCDialogFoundation.prototype.handleScrollEvent = function () { 6254 var _this = this; 6255 // Since scroll events can fire at a high rate, we throttle these events by 6256 // using requestAnimationFrame. 6257 this.animFrame.request(AnimationKeys.POLL_SCROLL_POS, function () { 6258 _this.toggleScrollDividerHeader(); 6259 _this.toggleScrollDividerFooter(); 6260 }); 6261 }; 6262 MDCDialogFoundation.prototype.layoutInternal = function () { 6263 if (this.autoStackButtons) { 6264 this.detectStackedButtons(); 6265 } 6266 this.toggleScrollableClasses(); 6267 }; 6268 MDCDialogFoundation.prototype.handleAnimationTimerEnd = function () { 6269 this.animationTimer = 0;
6270 this.adapter.removeClass(constants_1.cssClasses.OPENING); 6271 this.adapter.removeClass(constants_1.cssClasses.CLOSING); 6272 }; 6273 /** 6274 * Runs the given logic on the next animation frame, using setTimeout to 6275 * factor in Firefox reflow behavior. 6276 */ 6277 MDCDialogFoundation.prototype.runNextAnimationFrame = function (callback) { 6278 var _this = this; 6279 cancelAnimationFrame(this.animationFrame); 6280 this.animationFrame = requestAnimationFrame(function () { 6281 _this.animationFrame = 0; 6282 clearTimeout(_this.animationTimer); 6283 _this.animationTimer = setTimeout(callback, 0); 6284 }); 6285 }; 6286 MDCDialogFoundation.prototype.detectStackedButtons = function () { 6287 // Remove the class first to let us measure the buttons' natural positions. 6288 this.adapter.removeClass(constants_1.cssClasses.STACKED); 6289 var areButtonsStacked = this.adapter.areButtonsStacked(); 6290 if (areButtonsStacked) { 6291 this.adapter.addClass(constants_1.cssClasse
6291s.STACKED); 6292 } 6293 if (areButtonsStacked !== this.areButtonsStacked) { 6294 this.adapter.reverseButtons(); 6295 this.areButtonsStacked = areButtonsStacked; 6296 } 6297 }; 6298 MDCDialogFoundation.prototype.toggleScrollableClasses = function () { 6299 // Remove the class first to let us measure the natural height of the 6300 // content. 6301 this.adapter.removeClass(constants_1.cssClasses.SCROLLABLE); 6302 if (this.adapter.isContentScrollable()) { 6303 this.adapter.addClass(constants_1.cssClasses.SCROLLABLE); 6304 if (this.isFullscreen) { 6305 // If dialog is full-screen and scrollable, check if a scroll divider 6306 // should be shown. 6307 this.toggleScrollDividerHeader(); 6308 this.toggleScrollDividerFooter(); 6309 } 6310 } 6311 }; 6312 MDCDialogFoundation.prototype.toggleScrollDividerHeader = function () { 6313 if (!this.adapter.isScrollableContentAtTop()) { 6314 this.adapter.addClass(constants_1.cssClasse
6314s.SCROLL_DIVIDER_HEADER); 6315 } else if (this.adapter.hasClass(constants_1.cssClasses.SCROLL_DIVIDER_HEADER)) { 6316 this.adapter.removeClass(constants_1.cssClasses.SCROLL_DIVIDER_HEADER); 6317 } 6318 }; 6319 MDCDialogFoundation.prototype.toggleScrollDividerFooter = function () { 6320 if (!this.adapter.isScrollableContentAtBottom()) { 6321 this.adapter.addClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER); 6322 } else if (this.adapter.hasClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER)) { 6323 this.adapter.removeClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER); 6324 } 6325 }; 6326 return MDCDialogFoundation; 6327}(foundation_1.MDCFoundation); 6328exports.MDCDialogFoundation = MDCDialogFoundation; 6329// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 6330exports.default = MDCDialogFoundation; 6331 6332/***/ }), 6333
6334/***/ "./packages/mdc-dialog/index.ts": 6335/*!**************************************!*\ 6336 !*** ./packages/mdc-dialog/index.ts ***! 6337 \**************************************/ 6338/*! no static exports found */ 6339/***/ (function(module, exports, __webpack_require__) { 6340 6341"use strict"; 6342 6343/** 6344 * @license 6345 * Copyright 2019 Google Inc. 6346 * 6347 * Permission is hereby granted, free of charge, to any person obtaining a copy 6348 * of this software and associated documentation files (the "Software"), to deal 6349 * in the Software without restriction, including without limitation the rights 6350 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6351 * copies of the Software, and to permit persons to whom the Software is 6352 * furnished to do so, subject to the following conditions: 6353 * 6354 * The above copyright notice and this permission notice shall be included in 6355 * all copies or substantial portions of the Software. 6356 * 6357 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6358 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6359 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6360 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6361 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6362 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6363 * THE SOFTWARE. 6364 */ 6365 6366function __export(m) { 6367 for (var p in m) { 6368 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 6369 } 6370} 6371var __importStar = this && this.__importStar || function (mod) { 6372 if (mod && mod.__esModule) return mod; 6373 var result = {}; 6374 if (mod != null) for (var k in mod) { 6375 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 6376 }result["default"] = mod; 6377 return result; 6378}; 6379Object.defineProperty(exports, "__esModule", { value: true }); 6380var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts")); 6381exports.util = util; 6382__export(__webpack_require__(/*! ./component */ "./packages/mdc-dialog/component.ts")); 6383__export(__webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts")); 6384__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts")); 6385 6386/***/ }), 6387
6388/***/ "./packages/mdc-dialog/util.ts": 6389/*!*************************************!*\ 6390 !*** ./packages/mdc-dialog/util.ts ***! 6391 \*************************************/ 6392/*! no static exports found */ 6393/***/ (function(module, exports, __webpack_require__) { 6394 6395"use strict"; 6396 6397/** 6398 * @license 6399 * Copyright 2016 Google Inc. 6400 * 6401 * Permission is hereby granted, free of charge, to any person obtaining a copy 6402 * of this software and associated documentation files (the "Software"), to deal 6403 * in the Software without restriction, including without limitation the rights 6404 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6405 * copies of the Software, and to permit persons to whom the Software is 6406 * furnished to do so, subject to the following conditions: 6407 * 6408 * The above copyright notice and this permission notice shall be included in 6409 * all copies or substantial portions of the Software. 6410 * 6411 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6412 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6413 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6414 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6415 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6416 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6417 * THE SOFTWARE. 6418 */ 6419 6420Object.defineProperty(exports, "__esModule", { value: true }); 6421function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) { 6422 return focusTrapFactory(surfaceEl, { initialFocusEl: initialFocusEl }); 6423} 6424exports.createFocusTrapInstance = createFocusTrapInstance; 6425function isScrollable(el) { 6426 return el ? el.scrollHeight > el.offsetHeight : false; 6427} 6428exports.isScrollable = isScrollable; 6429/** 6430 * For scrollable content, returns true if the content has not been scrolled 6431 * (that is, the scroll content is as the "top"). This is used in full-screen 6432 * dialogs, where the scroll divider is expected only to appear once the 6433 * content has been scrolled "underneath" the header bar. 6434 */ 6435function isScrollAtTop(el) { 6436 return el ? el.scrollTop === 0 : false; 6437} 6438exports.isScrollAtTop = isScrollAtTop; 6439/** 6440 * For scrollable content, returns true if the content has been scrolled all the 6441 * way to the bottom. This is used in full-screen dialogs, where the footer 6442 * scroll divider is expected only to appear when the content is "cut-off" by 6443 * the footer bar. 6444 */ 6445function isScrollAtBottom(el) { 6446 return el ? Math.ceil(el.scrollHeight - el.scrollTop) === el.clientHeight : false; 6447} 6448exports.isScrollAtBottom = isScrollAtBottom; 6449function areTopsMisaligned(els) { 6450 var tops = new Set(); 6451 [].forEach.call(els, function (el) { 6452 return tops.add(el.offsetTop); 6453 }); 6454 return tops.size > 1; 6455} 6456exports.areTopsMisaligned = areTopsMisaligned; 6457 6458/***/ }), 6459
6460/***/ "./packages/mdc-dom/announce.ts": 6461/*!**************************************!*\ 6462 !*** ./packages/mdc-dom/announce.ts ***! 6463 \**************************************/ 6464/*! no static exports found */ 6465/***/ (function(module, exports, __webpack_require__) { 6466 6467"use strict"; 6468 6469/** 6470 * @license 6471 * Copyright 2020 Google Inc. 6472 * 6473 * Permission is hereby granted, free of charge, to any person obtaining a copy 6474 * of this software and associated documentation files (the "Software"), to deal 6475 * in the Software without restriction, including without limitation the rights 6476 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6477 * copies of the Software, and to permit persons to whom the Software is 6478 * furnished to do so, subject to the following conditions: 6479 * 6480 * The above copyright notice and this permission notice shall be included in 6481 * all copies or substantial portions of the Software. 6482 * 6483 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6484 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6485 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6486 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6487 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6488 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6489 * THE SOFTWARE. 6490 */ 6491 6492Object.defineProperty(exports, "__esModule", { value: true }); 6493/** 6494 * Priorities for the announce function 6495 */ 6496var AnnouncerPriority; 6497(function (AnnouncerPriority) { 6498 AnnouncerPriority["POLITE"] = "polite"; 6499 AnnouncerPriority["ASSERTIVE"] = "assertive"; 6500})(AnnouncerPriority = exports.AnnouncerPriority || (exports.AnnouncerPriority = {})); 6501/** 6502 * Data attribute added to live region element. 6503 */ 6504exports.DATA_MDC_DOM_ANNOUNCE = 'data-mdc-dom-announce'; 6505/** 6506 * Announces the given message with optional priority, defaulting to "polite" 6507 */ 6508function announce(message, priority) { 6509 Announcer.getInstance().say(message, priority); 6510} 6511exports.announce = announce; 6512var Announcer = /** @class */function () { 6513 // Constructor made private to ensure only the singleton is used 6514 function Announcer() { 6515 this.liveRegions = new Map(); 6516 } 6517 Announcer.getInstance = function () { 6518 if (!Announcer.instance) { 6519 Announcer.instance = new Announcer(); 6520 } 6521 return Announcer.instance; 6522 }; 6523 Announcer.prototype.say = function (message, priority) { 6524 if (priority === void 0) { 6525 priority = AnnouncerPriority.POLITE; 6526 } 6527 var liveRegion = this.getLiveRegion(priority); 6528 // Reset the region to pick up the message, even if the message is the 6529 // exact same as before. 6530 liveRegion.textContent = ''; 6531 // Timeout is necessary for screen readers like NVDA and VoiceOver. 6532 setTimeout(function () { 6533 liveRegion.textContent = message; 6534 document.addEventListener('click', clearLiveRegion); 6535 }, 1); 6536 function clearLiveRegion() { 6537 liveRegion.textContent = ''; 6538 document.removeEventListener('click', clearLiveRegion); 6539 } 6540 }; 6541 Announcer.prototype.getLiveRegion = function (priority) { 6542 var existingLiveRegion = this.liveRegions.get(priority); 6543 if (existingLiveRegion && document.body.contains(existingLiveRegion)) { 6544 return existingLiveRegion; 6545 } 6546 var liveRegion = this.createLiveRegion(priority); 6547 this.liveRegions.set(priority, liveRegion); 6548 return liveRegion; 6549 }; 6550 Announcer.prototype.createLiveRegion = function (priority) { 6551 var el = document.createElement('div'); 6552 el.style.position = 'absolute'; 6553 el.style.top = '-9999px'; 6554 el.style.left = '-9999px'; 6555 el.style.height = '1px'; 6556 el.style.overflow = 'hidden'; 6557 el.setAttribute('aria-atomic', 'true'); 6558 el.setAttribute('aria-live', priority); 6559 el.setAttribute(exports.DATA_MDC_DOM_ANNOUNCE, 'true'); 6560 document.body.appendChild(el); 6561 return el; 6562 }; 6563 return Announcer; 6564}(); 6565 6566/***/ }), 6567
6568/***/ "./packages/mdc-dom/events.ts": 6569/*!************************************!*\ 6570 !*** ./packages/mdc-dom/events.ts ***! 6571 \************************************/ 6572/*! no static exports found */ 6573/***/ (function(module, exports, __webpack_require__) { 6574 6575"use strict"; 6576 6577/** 6578 * @license 6579 * Copyright 2019 Google Inc. 6580 * 6581 * Permission is hereby granted, free of charge, to any person obtaining a copy 6582 * of this software and associated documentation files (the "Software"), to deal 6583 * in the Software without restriction, including without limitation the rights 6584 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6585 * copies of the Software, and to permit persons to whom the Software is 6586 * furnished to do so, subject to the following conditions: 6587 * 6588 * The above copyright notice and this permission notice shall be included in 6589 * all copies or substantial portions of the Software. 6590 * 6591 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6592 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6593 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6594 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6595 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6596 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6597 * THE SOFTWARE. 6598 */ 6599 6600Object.defineProperty(exports, "__esModule", { value: true }); 6601/** 6602 * Determine whether the current browser supports passive event listeners, and 6603 * if so, use them. 6604 */ 6605function applyPassive(globalObj) { 6606 if (globalObj === void 0) { 6607 globalObj = window; 6608 } 6609 return supportsPassiveOption(globalObj) ? { passive: true } : false; 6610} 6611exports.applyPassive = applyPassive; 6612function supportsPassiveOption(globalObj) { 6613 if (globalObj === void 0) { 6614 globalObj = window; 6615 } 6616 // See 6617 // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener 6618 var passiveSupported = false; 6619 try { 6620 var options = { 6621 // This function will be called when the browser 6622 // attempts to access the passive property. 6623 get passive() { 6624 passiveSupported = true; 6625 return false; 6626 } 6627 }; 6628 var handler = function handler() {}; 6629 globalObj.document.addEventListener('test', handler, options); 6630 globalObj.document.removeEventListener('test', handler, options); 6631 } catch (err) { 6632 passiveSupported = false; 6633 } 6634 return passiveSupported; 6635} 6636 6637/***/ }), 6638
6639/***/ "./packages/mdc-dom/focus-trap.ts": 6640/*!****************************************!*\ 6641 !*** ./packages/mdc-dom/focus-trap.ts ***! 6642 \****************************************/ 6643/*! no static exports found */ 6644/***/ (function(module, exports, __webpack_require__) { 6645 6646"use strict"; 6647 6648/** 6649 * @license 6650 * Copyright 2020 Google Inc. 6651 * 6652 * Permission is hereby granted, free of charge, to any person obtaining a copy 6653 * of this software and associated documentation files (the "Software"), to deal 6654 * in the Software without restriction, including without limitation the rights 6655 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6656 * copies of the Software, and to permit persons to whom the Software is 6657 * furnished to do so, subject to the following conditions: 6658 * 6659 * The above copyright notice and this permission notice shall be included in 6660 * all copies or substantial portions of the Software. 6661 * 6662 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6663 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6664 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6665 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6666 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6667 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6668 * THE SOFTWARE. 6669 */ 6670 6671Object.defineProperty(exports, "__esModule", { value: true }); 6672var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel'; 6673/** 6674 * Utility to trap focus in a given root element, e.g. for modal components such 6675 * as dialogs. The root should have at least one focusable child element, 6676 * for setting initial focus when trapping focus. 6677 * Also tracks the previously focused element, and restores focus to that 6678 * element when releasing focus. 6679 */ 6680var FocusTrap = /** @class */function () { 6681 function FocusTrap(root, options) { 6682 if (options === void 0) { 6683 options = {}; 6684 } 6685 this.root = root; 6686 this.options = options; 6687 // Previously focused element before trapping focus. 6688 this.elFocusedBeforeTrapFocus = null; 6689 } 6690 /** 6691 * Traps focus in `root`. Also focuses on either `initialFocusEl` if set; 6692 * otherwises sets initial focus to the first focusable child element. 6693 */ 6694 FocusTrap.prototype.trapFocus = function () { 6695 var focusableEls = this.getFocusableElements(this.root); 6696 if (focusableEls.length === 0) { 6697 throw new Error('FocusTrap: Element must have at least one focusable child.'); 6698 } 6699 this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null; 6700 this.wrapTabFocus(this.root, focusableEls); 6701 if (!this.options.skipInitialFocus) { 6702 this.focusInitialElement(focusableEls, this.options.initialFocusEl); 6703 } 6704 }; 6705 /** 6706 * Releases focus from `root`. Also restores focus to the previously focused 6707 * element. 6708 */ 6709 FocusTrap.prototype.releaseFocus = function () { 6710 [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS)).forEach(function (sentinelEl) { 6711 sentinelEl.parentElement.removeChild(sentinelEl); 6712 }); 6713 if (this.elFocusedBeforeTrapFocus) { 6714 this.elFocusedBeforeTrapFocus.focus(); 6715 } 6716 }; 6717 /** 6718 * Wraps tab focus within `el` by adding two hidden sentinel divs which are 6719 * used to mark the beginning and the end of the tabbable region. When 6720 * focused, these sentinel elements redirect focus to the first/last 6721 * children elements of the tabbable region, ensuring that focus is trapped 6722 * within that region. 6723 */ 6724 FocusTrap.prototype.wrapTabFocus = function (el, focusableEls) { 6725 var sentinelStart = this.createSentinel(); 6726 var sentinelEnd = this.createSentinel(); 6727 sentinelStart.addEventListener('focus', function () { 6728 if (focusableEls.length > 0) { 6729 focusableEls[focusableEls.length - 1].focus(); 6730 } 6731 }); 6732 sentinelEnd.addEventListener('focus', function () { 6733 if (focusableEls.length > 0) { 6734 focusableEls[0].focus(); 6735 } 6736 }); 6737 el.insertBefore(sentinelStart, el.children[0]); 6738 el.appendChild(sentinelEnd); 6739 }; 6740 /** 6741 * Focuses on `initialFocusEl` if defined and a child of the root element. 6742 * Otherwise, focuses on the first focusable child element of the root. 6743 */
6744 FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) { 6745 var focusIndex = 0; 6746 if (initialFocusEl) { 6747 focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0); 6748 } 6749 focusableEls[focusIndex].focus(); 6750 }; 6751 FocusTrap.prototype.getFocusableElements = function (root) { 6752 var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button')); 6753 return focusableEls.filter(function (el) { 6754 var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' || el.getAttribute('disabled') != null || el.getAttribute('hidden') != null || el.getAttribute('aria-hidden') === 'true'; 6755 var isTabbableAndVisible = el.tabIndex >= 0 && el.getBoundingClientRect().width > 0 && !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden; 6756 var isProgrammaticallyHidden = false; 6757 if (isTabbableAndVisible) { 6758 var style = getComputedStyle(el); 6759 isProgrammaticallyHidden = style.display === 'none' || style.visibility === 'hidden'; 6760 } 6761 return isTabbableAndVisible && !isProgrammaticallyHidden; 6762 }); 6763 }; 6764 FocusTrap.prototype.createSentinel = function () { 6765 var sentinel = document.createElement('div'); 6766 sentinel.setAttribute('tabindex', '0'); 6767 // Don't announce in screen readers. 6768 sentinel.setAttribute('aria-hidden', 'true'); 6769 sentinel.classList.add(FOCUS_SENTINEL_CLASS); 6770 return sentinel; 6771 }; 6772 return FocusTrap; 6773}(); 6774exports.FocusTrap = FocusTrap; 6775 6776/***/ }), 6777
6778/***/ "./packages/mdc-dom/index.ts": 6779/*!***********************************!*\ 6780 !*** ./packages/mdc-dom/index.ts ***! 6781 \***********************************/ 6782/*! no static exports found */ 6783/***/ (function(module, exports, __webpack_require__) { 6784 6785"use strict"; 6786 6787/** 6788 * @license 6789 * Copyright 2018 Google Inc. 6790 * 6791 * Permission is hereby granted, free of charge, to any person obtaining a copy 6792 * of this software and associated documentation files (the "Software"), to deal 6793 * in the Software without restriction, including without limitation the rights 6794 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6795 * copies of the Software, and to permit persons to whom the Software is 6796 * furnished to do so, subject to the following conditions: 6797 * 6798 * The above copyright notice and this permission notice shall be included in 6799 * all copies or substantial portions of the Software. 6800 * 6801 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6802 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6803 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6804 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6805 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6806 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6807 * THE SOFTWARE. 6808 */ 6809 6810var __importStar = this && this.__importStar || function (mod) { 6811 if (mod && mod.__esModule) return mod; 6812 var result = {}; 6813 if (mod != null) for (var k in mod) { 6814 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 6815 }result["default"] = mod; 6816 return result; 6817}; 6818Object.defineProperty(exports, "__esModule", { value: true }); 6819var events = __importStar(__webpack_require__(/*! ./events */ "./packages/mdc-dom/events.ts")); 6820exports.events = events; 6821var focusTrap = __importStar(__webpack_require__(/*! ./focus-trap */ "./packages/mdc-dom/focus-trap.ts")); 6822exports.focusTrap = focusTrap; 6823var keyboard = __importStar(__webpack_require__(/*! ./keyboard */ "./packages/mdc-dom/keyboard.ts")); 6824exports.keyboard = keyboard; 6825var ponyfill = __importStar(__webpack_require__(/*! ./ponyfill */ "./packages/mdc-dom/ponyfill.ts")); 6826exports.ponyfill = ponyfill; 6827 6828/***/ }), 6829
6830/***/ "./packages/mdc-dom/keyboard.ts": 6831/*!**************************************!*\ 6832 !*** ./packages/mdc-dom/keyboard.ts ***! 6833 \**************************************/ 6834/*! no static exports found */ 6835/***/ (function(module, exports, __webpack_require__) { 6836 6837"use strict"; 6838 6839/** 6840 * @license 6841 * Copyright 2020 Google Inc. 6842 * 6843 * Permission is hereby granted, free of charge, to any person obtaining a copy 6844 * of this software and associated documentation files (the "Software"), to deal 6845 * in the Software without restriction, including without limitation the rights 6846 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6847 * copies of the Software, and to permit persons to whom the Software is 6848 * furnished to do so, subject to the following conditions: 6849 * 6850 * The above copyright notice and this permission notice shall be included in 6851 * all copies or substantial portions of the Software. 6852 * 6853 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6854 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6855 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6856 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6857 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6858 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6859 * THE SOFTWARE. 6860 */ 6861 6862Object.defineProperty(exports, "__esModule", { value: true }); 6863/** 6864 * KEY provides normalized string values for keys. 6865 */ 6866exports.KEY = { 6867 UNKNOWN: 'Unknown', 6868 BACKSPACE: 'Backspace', 6869 ENTER: 'Enter', 6870 SPACEBAR: 'Spacebar', 6871 PAGE_UP: 'PageUp', 6872 PAGE_DOWN: 'PageDown', 6873 END: 'End', 6874 HOME: 'Home', 6875 ARROW_LEFT: 'ArrowLeft', 6876 ARROW_UP: 'ArrowUp', 6877 ARROW_RIGHT: 'ArrowRight', 6878 ARROW_DOWN: 'ArrowDown', 6879 DELETE: 'Delete', 6880 ESCAPE: 'Escape' 6881}; 6882var normalizedKeys = new Set(); 6883// IE11 has no support for new Map with iterable so we need to initialize this 6884// by hand. 6885normalizedKeys.add(exports.KEY.BACKSPACE); 6886normalizedKeys.add(exports.KEY.ENTER); 6887normalizedKeys.add(exports.KEY.SPACEBAR); 6888normalizedKeys.add(exports.KEY.PAGE_UP); 6889normalizedKeys.add(exports.KEY.PAGE_DOWN); 6890normalizedKeys.add(exports.KEY.END); 6891normalizedKeys.add(exports.KEY.HOME); 6892normalizedKeys.add(exports.KEY.ARROW_LEFT); 6893normalizedKeys.add(exports.KEY.ARROW_UP); 6894normalizedKeys.add(exports.KEY.ARROW_RIGHT); 6895normalizedKeys.add(exports.KEY.ARROW_DOWN); 6896normalizedKeys.add(exports.KEY.DELETE); 6897normalizedKeys.add(exports.KEY.ESCAPE); 6898var KEY_CODE = { 6899 BACKSPACE: 8,
6900 ENTER: 13, 6901 SPACEBAR: 32, 6902 PAGE_UP: 33, 6903 PAGE_DOWN: 34, 6904 END: 35, 6905 HOME: 36, 6906 ARROW_LEFT: 37, 6907 ARROW_UP: 38, 6908 ARROW_RIGHT: 39, 6909 ARROW_DOWN: 40, 6910 DELETE: 46, 6911 ESCAPE: 27 6912}; 6913var mappedKeyCodes = new Map(); 6914// IE11 has no support for new Map with iterable so we need to initialize this 6915// by hand. 6916mappedKeyCodes.set(KEY_CODE.BACKSPACE, exports.KEY.BACKSPACE); 6917mappedKeyCodes.set(KEY_CODE.ENTER, exports.KEY.ENTER); 6918mappedKeyCodes.set(KEY_CODE.SPACEBAR, exports.KEY.SPACEBAR); 6919mappedKeyCodes.set(KEY_CODE.PAGE_UP, exports.KEY.PAGE_UP); 6920mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, exports.KEY.PAGE_DOWN); 6921mappedKeyCodes.set(KEY_CODE.END, exports.KEY.END); 6922mappedKeyCodes.set(KEY_CODE.HOME, exports.KEY.HOME); 6923mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, exports.KEY.ARROW_LEFT); 6924mappedKeyCodes.set(KEY_CODE.ARROW_UP, exports.KEY.ARROW_UP); 6925mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, exports.KEY.ARROW_RIGHT); 6926mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, exports.KEY.ARROW_DOWN); 6927mappedKeyCodes.set(KEY_CODE.DELETE, exports.KEY.DELETE); 6928mappedKeyCodes.set(KEY_CODE.ESCAPE, exports.KEY.ESCAPE); 6929var navigationKeys = new Set(); 6930// IE11 has no support for new Set with iterable so we need to initialize this 6931// by hand. 6932navigationKeys.add(exports.KEY.PAGE_UP); 6933navigationKeys.add(exports.KEY.PAGE_DOWN); 6934navigationKeys.add(exports.KEY.END); 6935navigationKeys.add(exports.KEY.HOME); 6936navigationKeys.add(exports.KEY.ARROW_LEFT); 6937navigationKeys.add(exports.KEY.ARROW_UP); 6938navigationKeys.add(exports.KEY.ARROW_RIGHT); 6939navigationKeys.add(exports.KEY.ARROW_DOWN); 6940/** 6941 * normalizeKey returns the normalized string for a navigational action. 6942 */ 6943function normalizeKey(evt) { 6944 var key = evt.key; 6945 // If the event already has a normalized key, return it 6946 if (normalizedKeys.has(key)) { 6947 return key; 6948 } 6949 // tslint:disable-next-line:deprecation 6950 var mappedKey = mappedKeyCodes.get(evt.keyCode); 6951 if (mappedKey) { 6952 return mappedKey; 6953 } 6954 return exports.KEY.UNKNOWN; 6955} 6956exports.normalizeKey = normalizeKey; 6957/** 6958 * isNavigationEvent returns whether the event is a navigation event 6959 */ 6960function isNavigationEvent(evt) { 6961 return navigationKeys.has(normalizeKey(evt)); 6962} 6963exports.isNavigationEvent = isNavigationEvent; 6964 6965/***/ }), 6966
6967/***/ "./packages/mdc-dom/ponyfill.ts": 6968/*!**************************************!*\ 6969 !*** ./packages/mdc-dom/ponyfill.ts ***! 6970 \**************************************/ 6971/*! no static exports found */ 6972/***/ (function(module, exports, __webpack_require__) { 6973 6974"use strict"; 6975 6976/** 6977 * @license 6978 * Copyright 2018 Google Inc. 6979 * 6980 * Permission is hereby granted, free of charge, to any person obtaining a copy 6981 * of this software and associated documentation files (the "Software"), to deal 6982 * in the Software without restriction, including without limitation the rights 6983 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6984 * copies of the Software, and to permit persons to whom the Software is 6985 * furnished to do so, subject to the following conditions: 6986 * 6987 * The above copyright notice and this permission notice shall be included in 6988 * all copies or substantial portions of the Software. 6989 * 6990 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6991 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6992 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6993 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6994 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6995 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6996 * THE SOFTWARE. 6997 */ 6998 6999Object.defineProperty(exports, "__esModule", { value: true }); 7000/** 7001 * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. 7002 * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. 7003 */ 7004function closest(element, selector) { 7005 if (element.closest) { 7006 return element.closest(selector); 7007 } 7008 var el = element; 7009 while (el) { 7010 if (matches(el, selector)) { 7011 return el; 7012 } 7013 el = el.parentElement; 7014 } 7015 return null; 7016} 7017exports.closest = closest; 7018function matches(element, selector) { 7019 var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; 7020 return nativeMatches.call(element, selector); 7021} 7022exports.matches = matches; 7023/** 7024 * Used to compute the estimated scroll width of elements. When an element is 7025 * hidden due to display: none; being applied to a parent element, the width is 7026 * returned as 0. However, the element will have a true width once no longer 7027 * inside a display: none context. This method computes an estimated width when 7028 * the element is hidden or returns the true width when the element is visble. 7029 * @param {Element} element the element whose width to estimate 7030 */ 7031function estimateScrollWidth(element) { 7032 // Check the offsetParent. If the element inherits display: none from any 7033 // parent, the offsetParent property will be null (see 7034 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent). 7035 // This check ensures we only clone the node when necessary. 7036 var htmlEl = element; 7037 if (htmlEl.offsetParent !== null) { 7038 return htmlEl.scrollWidth; 7039 } 7040 var clone = htmlEl.cloneNode(true); 7041 clone.style.setProperty('position', 'absolute'); 7042 clone.style.setProperty('transform', 'translate(-9999px, -9999px)'); 7043 document.documentElement.appendChild(clone); 7044 var scrollWidth = clone.scrollWidth; 7045 document.documentElement.removeChild(clone); 7046 return scrollWidth; 7047} 7048exports.estimateScrollWidth = estimateScrollWidth; 7049 7050/***/ }), 7051
7052/***/ "./packages/mdc-drawer/component.ts": 7053/*!******************************************!*\ 7054 !*** ./packages/mdc-drawer/component.ts ***! 7055 \******************************************/ 7056/*! no static exports found */ 7057/***/ (function(module, exports, __webpack_require__) { 7058 7059"use strict"; 7060 7061/** 7062 * @license 7063 * Copyright 2016 Google Inc. 7064 * 7065 * Permission is hereby granted, free of charge, to any person obtaining a copy 7066 * of this software and associated documentation files (the "Software"), to deal 7067 * in the Software without restriction, including without limitation the rights 7068 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7069 * copies of the Software, and to permit persons to whom the Software is 7070 * furnished to do so, subject to the following conditions: 7071 * 7072 * The above copyright notice and this permission notice shall be included in 7073 * all copies or substantial portions of the Software. 7074 * 7075 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7076 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7077 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7078 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7079 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7080 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7081 * THE SOFTWARE. 7082 */ 7083 7084var __extends = this && this.__extends || function () { 7085 var _extendStatics = function extendStatics(d, b) { 7086 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 7087 d.__proto__ = b; 7088 } || function (d, b) { 7089 for (var p in b) { 7090 if (b.hasOwnProperty(p)) d[p] = b[p]; 7091 } 7092 }; 7093 return _extendStatics(d, b); 7094 }; 7095 return function (d, b) { 7096 _extendStatics(d, b); 7097 function __() { 7098 this.constructor = d; 7099 } 7100 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 7101 }; 7102}(); 7103var __importStar = this && this.__importStar || function (mod) { 7104 if (mod && mod.__esModule) return mod; 7105 var result = {}; 7106 if (mod != null) for (var k in mod) { 7107 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 7108 }result["default"] = mod; 7109 return result; 7110}; 7111Object.defineProperty(exports, "__esModule", { value: true }); 7112var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 7113var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts"); 7114var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts"); 7115var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts"); 7116var foundation_2 = __webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"); 7117var foundation_3 = __webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts"); 7118var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts"));
7119var cssClasses = foundation_2.MDCDismissibleDrawerFoundation.cssClasses, 7120 strings = foundation_2.MDCDismissibleDrawerFoundation.strings; 7121/** 7122 * @events `MDCDrawer:closed {}` Emits when the navigation drawer has closed. 7123 * @events `MDCDrawer:opened {}` Emits when the navigation drawer has opened. 7124 */ 7125var MDCDrawer = /** @class */function (_super) { 7126 __extends(MDCDrawer, _super); 7127 function MDCDrawer() { 7128 return _super !== null && _super.apply(this, arguments) || this; 7129 } 7130 MDCDrawer.attachTo = function (root) { 7131 return new MDCDrawer(root); 7132 }; 7133 Object.defineProperty(MDCDrawer.prototype, "open", { 7134 /** 7135 * @return boolean Proxies to the foundation's `open`/`close` methods. 7136 * Also returns true if drawer is in the open position. 7137 */ 7138 get: function get() { 7139 return this.foundation.isOpen(); 7140 }, 7141 /** 7142 * Toggles the drawer open and closed. 7143 */ 7144 set: function set(isOpen) { 7145 if (isOpen) { 7146 this.foundation.open(); 7147 } else { 7148 this.foundation.close(); 7149 } 7150 }, 7151 enumerable: true, 7152 configurable: true 7153 }); 7154 Object.defineProperty(MDCDrawer.prototype, "list", { 7155 get: function get() { 7156 return this.list_; 7157 }, 7158 enumerable: true, 7159 configurable: true 7160 }); 7161 MDCDrawer.prototype.initialize = function (focusTrapFactory, listFactory) { 7162 if (focusTrapFactory === void 0) { 7163 focusTrapFactory = function focusTrapFactory(el) { 7164 return new focus_trap_1.FocusTrap(el); 7165 }; 7166 } 7167 if (listFactory === void 0) { 7168 listFactory = function listFactory(el) { 7169 return new component_2.MDCList(el); 7170 }; 7171 } 7172 var listEl = this.root.querySelector("." + foundation_1.MDCListFoundation.cssClasses.ROOT); 7173 if (listEl) { 7174 this.list_ = listFactory(listEl); 7175 this.list_.wrapFocus = true; 7176 } 7177 this.focusTrapFactory_ = focusTrapFactory; 7178 }; 7179 MDCDrawer.prototype.initialSyncWithDOM = function () { 7180 var _this = this; 7181 var MODAL = cssClasses.MODAL; 7182 var SCRIM_SELECTOR = strings.SCRIM_SELECTOR; 7183 this.scrim_ = this.root.parentNode.querySelector(SCRIM_SELECTOR); 7184 if (this.scrim_ && this.root.classList.contains(MODAL)) { 7185 this.handleScrimClick_ = function () { 7186 return _this.foundation.handleScrimClick(); 7187 }; 7188 this.scrim_.addEventListener('click', this.handleScrimClick_); 7189 this.focusTrap_ = util.createFocusTrapInstance(this.root, this.focusTrapFactory_); 7190 } 7191 this.handleKeydown_ = function (evt) { 7192 return _this.foundation.handleKeydown(evt); 7193 }; 7194 this.handleTransitionEnd_ = function (evt) { 7195 return _this.foundation.handleTransitionEnd(evt); 7196 }; 7197 this.listen('keydown', this.handleKeydown_); 7198 this.listen('transitionend', this.handleTransitionEnd_); 7199 }; 7200 MDCDrawer.prototype.destroy = function () { 7201 this.unlisten('keydown', this.handleKeydown_); 7202 this.unlisten('transitionend', this.handleTransitionEnd_); 7203 if (this.list_) { 7204 this.list_.destroy(); 7205 } 7206 var MODAL = cssClasses.MODAL; 7207 if (this.scrim_ && this.handleScrimClick_ && this.root.classList.contains(MODAL)) { 7208 this.scrim_.removeEventListener('click', this.handleScrimClick_); 7209 // Ensure drawer is closed to hide scrim and release focus 7210 this.open = false; 7211 } 7212 }; 7213 MDCDrawer.prototype.getDefaultFoundation = function () { 7214 var _this = this; 7215 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 7216 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 7217 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 7218 var adapter = { 7219 addClass: function addClass(className) { 7220 return _this.root.classList.add(className); 7221 }, 7222 removeClass: function removeClass(className) { 7223 return _this.root.classList.remove(className); 7224 }, 7225 hasClass: function hasClass(className) { 7226 return _this.root.classList.contains(className); 7227 }, 7228 elementHasClass: function elementHasClass(element, className) { 7229 return element.classList.contains(className); 7230 }, 7231 saveFocus: function saveFocus() { 7232 return _this.previousFocus_ = document.activeElement; 7233 }, 7234 restoreFocus: function restoreFocus() { 7235 var previousFocus = _this.previousFocus_; 7236 if (previousFocus && previousFocus.focus && _this.root.contains(document.activeElement)) { 7237 previousFocus.focus(); 7238 } 7239 }, 7240 focusActiveNavigationItem: function focusActiveNavigationItem() { 7241 var activeNavItemEl = _this.root.querySelector("." + foundation_1.MDCListFoundation.cssClasse
7241s.LIST_ITEM_ACTIVATED_CLASS); 7242 if (activeNavItemEl) { 7243 activeNavItemEl.focus(); 7244 } 7245 }, 7246 notifyClose: function notifyClose() { 7247 return _this.emit(strings.CLOSE_EVENT, {}, true /* shouldBubble */); 7248 }, 7249 notifyOpen: function notifyOpen() { 7250 return _this.emit(strings.OPEN_EVENT, {}, true /* shouldBubble */); 7251 }, 7252 trapFocus: function trapFocus() { 7253 return _this.focusTrap_.trapFocus(); 7254 }, 7255 releaseFocus: function releaseFocus() { 7256 return _this.focusTrap_.releaseFocus(); 7257 } 7258 }; 7259 // tslint:enable:object-literal-sort-keys 7260 var DISMISSIBLE = cssClasses.DISMISSIBLE, 7261 MODAL = cssClasses.MODAL; 7262 if (this.root.classList.contains(DISMISSIBLE)) { 7263 return new foundation_2.MDCDismissibleDrawerFoundation(adapter); 7264 } else if (this.root.classList.contains(MODAL)) { 7265 return new foundation_3.MDCModalDrawerFoundation(adapter); 7266 } else { 7267 throw new Error("MDCDrawer: Failed to instantiate component. Supported variants are " + DISMISSIBLE + " and " + MODAL + "."); 7268 } 7269 }; 7270 return MDCDrawer; 7271}(component_1.MDCComponent); 7272exports.MDCDrawer = MDCDrawer; 7273 7274/***/ }), 7275
7276/***/ "./packages/mdc-drawer/constants.ts": 7277/*!******************************************!*\ 7278 !*** ./packages/mdc-drawer/constants.ts ***! 7279 \******************************************/ 7280/*! no static exports found */ 7281/***/ (function(module, exports, __webpack_require__) { 7282 7283"use strict"; 7284 7285/** 7286 * @license 7287 * Copyright 2016 Google Inc. 7288 * 7289 * Permission is hereby granted, free of charge, to any person obtaining a copy 7290 * of this software and associated documentation files (the "Software"), to deal 7291 * in the Software without restriction, including without limitation the rights 7292 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7293 * copies of the Software, and to permit persons to whom the Software is 7294 * furnished to do so, subject to the following conditions: 7295 * 7296 * The above copyright notice and this permission notice shall be included in 7297 * all copies or substantial portions of the Software. 7298 * 7299 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7300 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7301 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7302 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7303 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7304 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7305 * THE SOFTWARE. 7306 */ 7307 7308Object.defineProperty(exports, "__esModule", { value: true });
7309var cssClasses = { 7310 ANIMATE: 'mdc-drawer--animate', 7311 CLOSING: 'mdc-drawer--closing', 7312 DISMISSIBLE: 'mdc-drawer--dismissible', 7313 MODAL: 'mdc-drawer--modal', 7314 OPEN: 'mdc-drawer--open', 7315 OPENING: 'mdc-drawer--opening', 7316 ROOT: 'mdc-drawer' 7317}; 7318exports.cssClasses = cssClasses; 7319var strings = { 7320 APP_CONTENT_SELECTOR: '.mdc-drawer-app-content', 7321 CLOSE_EVENT: 'MDCDrawer:closed', 7322 OPEN_EVENT: 'MDCDrawer:opened', 7323 SCRIM_SELECTOR: '.mdc-drawer-scrim' 7324}; 7325exports.strings = strings; 7326 7327/***/ }), 7328
7329/***/ "./packages/mdc-drawer/dismissible/foundation.ts": 7330/*!*******************************************************!*\ 7331 !*** ./packages/mdc-drawer/dismissible/foundation.ts ***! 7332 \*******************************************************/ 7333/*! no static exports found */ 7334/***/ (function(module, exports, __webpack_require__) { 7335 7336"use strict"; 7337 7338/** 7339 * @license 7340 * Copyright 2018 Google Inc. 7341 * 7342 * Permission is hereby granted, free of charge, to any person obtaining a copy 7343 * of this software and associated documentation files (the "Software"), to deal 7344 * in the Software without restriction, including without limitation the rights 7345 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7346 * copies of the Software, and to permit persons to whom the Software is 7347 * furnished to do so, subject to the following conditions: 7348 * 7349 * The above copyright notice and this permission notice shall be included in 7350 * all copies or substantial portions of the Software. 7351 * 7352 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7353 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7354 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7355 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7356 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7357 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7358 * THE SOFTWARE. 7359 */ 7360 7361var __extends = this && this.__extends || function () { 7362 var _extendStatics = function extendStatics(d, b) { 7363 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 7364 d.__proto__ = b; 7365 } || function (d, b) { 7366 for (var p in b) { 7367 if (b.hasOwnProperty(p)) d[p] = b[p]; 7368 } 7369 }; 7370 return _extendStatics(d, b); 7371 }; 7372 return function (d, b) { 7373 _extendStatics(d, b); 7374 function __() { 7375 this.constructor = d; 7376 } 7377 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 7378 }; 7379}(); 7380var __assign = this && this.__assign || function () { 7381 __assign = Object.assign || function (t) { 7382 for (var s, i = 1, n = arguments.length; i < n; i++) { 7383 s = arguments[i]; 7384 for (var p in s) { 7385 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 7386 } 7387 } 7388 return t; 7389 }; 7390 return __assign.apply(this, arguments); 7391}; 7392Object.defineProperty(exports, "__esModule", { value: true }); 7393var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 7394var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-drawer/constants.ts"); 7395var MDCDismissibleDrawerFoundation = /** @class */function (_super) { 7396 __extends(MDCDismissibleDrawerFoundation, _super); 7397 function MDCDismissibleDrawerFoundation(adapter) { 7398 var _this = _super.call(this, __assign(__assign({}, MDCDismissibleDrawerFoundation.defaultAdapter), adapter)) || this; 7399 _this.animationFrame_ = 0; 7400 _this.animationTimer_ = 0; 7401 return _this; 7402 } 7403 Object.defineProperty(MDCDismissibleDrawerFoundation, "strings", { 7404 get: function get() { 7405 return constants_1.strings; 7406 }, 7407 enumerable: true, 7408 configurable: true 7409 }); 7410 Object.defineProperty(MDCDismissibleDrawerFoundation, "cssClasses", { 7411 get: function get() {
7412 return constants_1.cssClasses; 7413 }, 7414 enumerable: true, 7415 configurable: true 7416 }); 7417 Object.defineProperty(MDCDismissibleDrawerFoundation, "defaultAdapter", { 7418 get: function get() { 7419 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 7420 return { 7421 addClass: function addClass() { 7422 return undefined; 7423 }, 7424 removeClass: function removeClass() { 7425 return undefined; 7426 }, 7427 hasClass: function hasClass() { 7428 return false; 7429 }, 7430 elementHasClass: function elementHasClass() { 7431 return false; 7432 }, 7433 notifyClose: function notifyClose() { 7434 return undefined; 7435 }, 7436 notifyOpen: function notifyOpen() { 7437 return undefined; 7438 }, 7439 saveFocus: function saveFocus() { 7440 return undefined; 7441 }, 7442 restoreFocus: function restoreFocus() { 7443 return undefined; 7444 }, 7445 focusActiveNavigationItem: function focusActiveNavigationItem() { 7446 return undefined; 7447 }, 7448 trapFocus: function trapFocus() { 7449 return undefined; 7450 }, 7451 releaseFocus: function releaseFocus() { 7452 return undefined; 7453 } 7454 }; 7455 // tslint:enable:object-literal-sort-keys 7456 }, 7457 enumerable: true, 7458 configurable: true 7459 }); 7460 MDCDismissibleDrawerFoundation.prototype.destroy = function () { 7461 if (this.animationFrame_) { 7462 cancelAnimationFrame(this.animationFrame_); 7463 } 7464 if (this.animationTimer_) { 7465 clearTimeout(this.animationTimer_); 7466 } 7467 }; 7468 /** 7469 * Opens the drawer from the closed state. 7470 */ 7471 MDCDismissibleDrawerFoundation.prototype.open = function () { 7472 var _this = this; 7473 if (this.isOpen() || this.isOpening() || this.isClosing()) { 7474 return; 7475 }
7476 this.adapter.addClass(constants_1.cssClasses.OPEN); 7477 this.adapter.addClass(constants_1.cssClasses.ANIMATE); 7478 // Wait a frame once display is no longer "none", to establish basis for animation 7479 this.runNextAnimationFrame_(function () { 7480 _this.adapter.addClass(constants_1.cssClasses.OPENING); 7481 }); 7482 this.adapter.saveFocus(); 7483 }; 7484 /** 7485 * Closes the drawer from the open state. 7486 */ 7487 MDCDismissibleDrawerFoundation.prototype.close = function () { 7488 if (!this.isOpen() || this.isOpening() || this.isClosing()) { 7489 return; 7490 } 7491 this.adapter.addClass(constants_1.cssClasses.CLOSING); 7492 }; 7493 /** 7494 * Returns true if the drawer is in the open position. 7495 * @return true if drawer is in open state. 7496 */ 7497 MDCDismissibleDrawerFoundation.prototype.isOpen = function () { 7498 return this.adapter.hasClass(constants_1.cssClasses.OPEN); 7499 }; 7500 /** 7501 * Returns true if the drawer is animating open. 7502 * @return true if drawer is animating open. 7503 */ 7504 MDCDismissibleDrawerFoundation.prototype.isOpening = function () {
7505 return this.adapter.hasClass(constants_1.cssClasses.OPENING) || this.adapter.hasClass(constants_1.cssClasses.ANIMATE); 7506 }; 7507 /** 7508 * Returns true if the drawer is animating closed. 7509 * @return true if drawer is animating closed. 7510 */ 7511 MDCDismissibleDrawerFoundation.prototype.isClosing = function () { 7512 return this.adapter.hasClass(constants_1.cssClasses.CLOSING); 7513 }; 7514 /** 7515 * Keydown handler to close drawer when key is escape. 7516 */ 7517 MDCDismissibleDrawerFoundation.prototype.handleKeydown = function (evt) { 7518 var keyCode = evt.keyCode, 7519 key = evt.key; 7520 var isEscape = key === 'Escape' || keyCode === 27; 7521 if (isEscape) { 7522 this.close(); 7523 } 7524 }; 7525 /** 7526 * Handles the `transitionend` event when the drawer finishes opening/closing. 7527 */ 7528 MDCDismissibleDrawerFoundation.prototype.handleTransitionEnd = function (evt) { 7529 var OPENING = constants_1.cssClasses.OPENING, 7530 CLOSING = constants_1.cssClasses.CLOSING,
7531 OPEN = constants_1.cssClasses.OPEN, 7532 ANIMATE = constants_1.cssClasses.ANIMATE, 7533 ROOT = constants_1.cssClasses.ROOT; 7534 // In Edge, transitionend on ripple pseudo-elements yields a target without classList, so check for Element first. 7535 var isRootElement = this.isElement_(evt.target) && this.adapter.elementHasClass(evt.target, ROOT); 7536 if (!isRootElement) { 7537 return; 7538 } 7539 if (this.isClosing()) { 7540 this.adapter.removeClass(OPEN); 7541 this.closed_(); 7542 this.adapter.restoreFocus(); 7543 this.adapter.notifyClose(); 7544 } else { 7545 this.adapter.focusActiveNavigationItem(); 7546 this.opened_(); 7547 this.adapter.notifyOpen(); 7548 } 7549 this.adapter.removeClass(ANIMATE); 7550 this.adapter.removeClass(OPENING); 7551 this.adapter.removeClass(CLOSING); 7552 }; 7553 /** 7554 * Extension point for when drawer finishes open animation. 7555 */ 7556 MDCDismissibleDrawerFoundation.prototype.opened_ = function () {}; // tslint:disable-line:no-empty 7557 /** 7558 * Extension point for when drawer finishes close animation. 7559 */ 7560 MDCDismissibleDrawerFoundation.prototype.closed_ = function () {}; // tslint:disable-line:no-empty 7561 /** 7562 * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. 7563 */ 7564 MDCDismissibleDrawerFoundation.prototype.runNextAnimationFrame_ = function (callback) { 7565 var _this = this; 7566 cancelAnimationFrame(this.animationFrame_); 7567 this.animationFrame_ = requestAnimationFrame(function () { 7568 _this.animationFrame_ = 0; 7569 clearTimeout(_this.animationTimer_); 7570 _this.animationTimer_ = setTimeout(callback, 0); 7571 }); 7572 }; 7573 MDCDismissibleDrawerFoundation.prototype.isElement_ = function (element) { 7574 // In Edge, transitionend on ripple pseudo-elements yields a target without classList. 7575 return Boolean(element.classList); 7576 }; 7577 return MDCDismissibleDrawerFoundation; 7578}(foundation_1.MDCFoundation); 7579exports.MDCDismissibleDrawerFoundation = MDCDismissibleDrawerFoundation; 7580// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 7581exports.default = MDCDismissibleDrawerFoundation; 7582 7583/***/ }), 7584
7585/***/ "./packages/mdc-drawer/index.ts": 7586/*!**************************************!*\ 7587 !*** ./packages/mdc-drawer/index.ts ***! 7588 \**************************************/ 7589/*! no static exports found */ 7590/***/ (function(module, exports, __webpack_require__) { 7591 7592"use strict"; 7593 7594/** 7595 * @license 7596 * Copyright 2019 Google Inc. 7597 * 7598 * Permission is hereby granted, free of charge, to any person obtaining a copy 7599 * of this software and associated documentation files (the "Software"), to deal 7600 * in the Software without restriction, including without limitation the rights 7601 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7602 * copies of the Software, and to permit persons to whom the Software is 7603 * furnished to do so, subject to the following conditions: 7604 * 7605 * The above copyright notice and this permission notice shall be included in 7606 * all copies or substantial portions of the Software. 7607 * 7608 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7609 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7610 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7611 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7612 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7613 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7614 * THE SOFTWARE. 7615 */ 7616 7617function __export(m) { 7618 for (var p in m) { 7619 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 7620 } 7621} 7622var __importStar = this && this.__importStar || function (mod) { 7623 if (mod && mod.__esModule) return mod; 7624 var result = {}; 7625 if (mod != null) for (var k in mod) { 7626 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 7627 }result["default"] = mod; 7628 return result; 7629}; 7630Object.defineProperty(exports, "__esModule", { value: true }); 7631var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts")); 7632exports.util = util; 7633__export(__webpack_require__(/*! ./component */ "./packages/mdc-drawer/component.ts")); 7634__export(__webpack_require__(/*! ./constants */ "./packages/mdc-drawer/constants.ts")); 7635__export(__webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts")); 7636__export(__webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts")); 7637 7638/***/ }), 7639
7640/***/ "./packages/mdc-drawer/modal/foundation.ts": 7641/*!*************************************************!*\ 7642 !*** ./packages/mdc-drawer/modal/foundation.ts ***! 7643 \*************************************************/ 7644/*! no static exports found */ 7645/***/ (function(module, exports, __webpack_require__) { 7646 7647"use strict"; 7648 7649/** 7650 * @license 7651 * Copyright 2018 Google Inc. 7652 * 7653 * Permission is hereby granted, free of charge, to any person obtaining a copy 7654 * of this software and associated documentation files (the "Software"), to deal 7655 * in the Software without restriction, including without limitation the rights 7656 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7657 * copies of the Software, and to permit persons to whom the Software is 7658 * furnished to do so, subject to the following conditions: 7659 * 7660 * The above copyright notice and this permission notice shall be included in 7661 * all copies or substantial portions of the Software. 7662 * 7663 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7664 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7665 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7666 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7667 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7668 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7669 * THE SOFTWARE. 7670 */ 7671 7672var __extends = this && this.__extends || function () { 7673 var _extendStatics = function extendStatics(d, b) { 7674 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 7675 d.__proto__ = b; 7676 } || function (d, b) { 7677 for (var p in b) { 7678 if (b.hasOwnProperty(p)) d[p] = b[p]; 7679 } 7680 }; 7681 return _extendStatics(d, b); 7682 }; 7683 return function (d, b) { 7684 _extendStatics(d, b); 7685 function __() { 7686 this.constructor = d; 7687 } 7688 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 7689 }; 7690}(); 7691Object.defineProperty(exports, "__esModule", { value: true }); 7692var foundation_1 = __webpack_require__(/*! ../dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"); 7693/* istanbul ignore next: subclass is not a branch statement */ 7694var MDCModalDrawerFoundation = /** @class */function (_super) { 7695 __extends(MDCModalDrawerFoundation, _super); 7696 function MDCModalDrawerFoundation() { 7697 return _super !== null && _super.apply(this, arguments) || this; 7698 } 7699 /** 7700 * Handles click event on scrim. 7701 */ 7702 MDCModalDrawerFoundation.prototype.handleScrimClick = function () { 7703 this.close(); 7704 }; 7705 /** 7706 * Called when drawer finishes open animation. 7707 */ 7708 MDCModalDrawerFoundation.prototype.opened_ = function () { 7709 this.adapter.trapFocus(); 7710 }; 7711 /** 7712 * Called when drawer finishes close animation. 7713 */ 7714 MDCModalDrawerFoundation.prototype.closed_ = function () { 7715 this.adapter.releaseFocus(); 7716 }; 7717 return MDCModalDrawerFoundation; 7718}(foundation_1.MDCDismissibleDrawerFoundation); 7719exports.MDCModalDrawerFoundation = MDCModalDrawerFoundation; 7720// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 7721exports.default = MDCModalDrawerFoundation; 7722 7723/***/ }), 7724
7725/***/ "./packages/mdc-drawer/util.ts": 7726/*!*************************************!*\ 7727 !*** ./packages/mdc-drawer/util.ts ***! 7728 \*************************************/ 7729/*! no static exports found */ 7730/***/ (function(module, exports, __webpack_require__) { 7731 7732"use strict"; 7733 7734/** 7735 * @license 7736 * Copyright 2016 Google Inc. 7737 * 7738 * Permission is hereby granted, free of charge, to any person obtaining a copy 7739 * of this software and associated documentation files (the "Software"), to deal 7740 * in the Software without restriction, including without limitation the rights 7741 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7742 * copies of the Software, and to permit persons to whom the Software is 7743 * furnished to do so, subject to the following conditions: 7744 * 7745 * The above copyright notice and this permission notice shall be included in 7746 * all copies or substantial portions of the Software. 7747 * 7748 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7749 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7750 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7751 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7752 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7753 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7754 * THE SOFTWARE. 7755 */ 7756 7757Object.defineProperty(exports, "__esModule", { value: true }); 7758function createFocusTrapInstance(surfaceEl, focusTrapFactory) { 7759 return focusTrapFactory(surfaceEl, { 7760 // Component handles focusing on active nav item. 7761 skipInitialFocus: true 7762 }); 7763} 7764exports.createFocusTrapInstance = createFocusTrapInstance; 7765 7766/***/ }), 7767
7768/***/ "./packages/mdc-floating-label/component.ts": 7769/*!**************************************************!*\ 7770 !*** ./packages/mdc-floating-label/component.ts ***! 7771 \**************************************************/ 7772/*! no static exports found */ 7773/***/ (function(module, exports, __webpack_require__) { 7774 7775"use strict"; 7776 7777/** 7778 * @license 7779 * Copyright 2016 Google Inc. 7780 * 7781 * Permission is hereby granted, free of charge, to any person obtaining a copy 7782 * of this software and associated documentation files (the "Software"), to deal 7783 * in the Software without restriction, including without limitation the rights 7784 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7785 * copies of the Software, and to permit persons to whom the Software is 7786 * furnished to do so, subject to the following conditions: 7787 * 7788 * The above copyright notice and this permission notice shall be included in 7789 * all copies or substantial portions of the Software. 7790 * 7791 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7792 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7793 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7794 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7795 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7796 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7797 * THE SOFTWARE. 7798 */ 7799 7800var __extends = this && this.__extends || function () { 7801 var _extendStatics = function extendStatics(d, b) { 7802 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 7803 d.__proto__ = b; 7804 } || function (d, b) { 7805 for (var p in b) { 7806 if (b.hasOwnProperty(p)) d[p] = b[p]; 7807 } 7808 }; 7809 return _extendStatics(d, b); 7810 }; 7811 return function (d, b) { 7812 _extendStatics(d, b); 7813 function __() { 7814 this.constructor = d; 7815 } 7816 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 7817 }; 7818}(); 7819Object.defineProperty(exports, "__esModule", { value: true }); 7820var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 7821var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 7822var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts"); 7823var MDCFloatingLabel = /** @class */function (_super) { 7824 __extends(MDCFloatingLabel, _super); 7825 function MDCFloatingLabel() { 7826 return _super !== null && _super.apply(this, arguments) || this; 7827 } 7828 MDCFloatingLabel.attachTo = function (root) { 7829 return new MDCFloatingLabel(root); 7830 }; 7831 /** 7832 * Styles the label to produce the label shake for errors. 7833 * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class. 7834 */ 7835 MDCFloatingLabel.prototype.shake = function (shouldShake) { 7836 this.foundation.shake(shouldShake); 7837 }; 7838 /** 7839 * Styles the label to float/dock. 7840 * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class. 7841 */ 7842 MDCFloatingLabel.prototype.float = function (shouldFloat) { 7843 this.foundation.float(shouldFloat); 7844 }; 7845 /** 7846 * Styles the label as required. 7847 * @param isRequired If true, adds an asterisk to the label, indicating that it is required. 7848 */ 7849 MDCFloatingLabel.prototype.setRequired = function (isRequired) { 7850 this.foundation.setRequired(isRequired); 7851 }; 7852 MDCFloatingLabel.prototype.getWidth = function () { 7853 return this.foundation.getWidth(); 7854 }; 7855 MDCFloatingLabel.prototype.getDefaultFoundation = function () { 7856 var _this = this; 7857 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 7858 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 7859 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 7860 var adapter = { 7861 addClass: function addClass(className) { 7862 return _this.root.classList.add(className); 7863 }, 7864 removeClass: function removeClass(className) { 7865 return _this.root.classList.remove(className); 7866 }, 7867 getWidth: function getWidth() { 7868 return ponyfill_1.estimateScrollWidth(_this.root); 7869 }, 7870 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 7871 return _this.listen(evtType, handler); 7872 }, 7873 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 7874 return _this.unlisten(evtType, handler); 7875 } 7876 }; 7877 // tslint:enable:object-literal-sort-keys 7878 return new foundation_1.MDCFloatingLabelFoundation(adapter); 7879 }; 7880 return MDCFloatingLabel; 7881}(component_1.MDCComponent); 7882exports.MDCFloatingLabel = MDCFloatingLabel; 7883 7884/***/ }), 7885
7886/***/ "./packages/mdc-floating-label/constants.ts": 7887/*!**************************************************!*\ 7888 !*** ./packages/mdc-floating-label/constants.ts ***! 7889 \**************************************************/ 7890/*! no static exports found */ 7891/***/ (function(module, exports, __webpack_require__) { 7892 7893"use strict"; 7894 7895/** 7896 * @license 7897 * Copyright 2016 Google Inc. 7898 * 7899 * Permission is hereby granted, free of charge, to any person obtaining a copy 7900 * of this software and associated documentation files (the "Software"), to deal 7901 * in the Software without restriction, including without limitation the rights 7902 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7903 * copies of the Software, and to permit persons to whom the Software is 7904 * furnished to do so, subject to the following conditions: 7905 * 7906 * The above copyright notice and this permission notice shall be included in 7907 * all copies or substantial portions of the Software. 7908 * 7909 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7910 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7911 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7912 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7913 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7914 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7915 * THE SOFTWARE. 7916 */ 7917 7918Object.defineProperty(exports, "__esModule", { value: true }); 7919exports.cssClasses = { 7920 LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above', 7921 LABEL_REQUIRED: 'mdc-floating-label--required', 7922 LABEL_SHAKE: 'mdc-floating-label--shake', 7923 ROOT: 'mdc-floating-label' 7924}; 7925 7926/***/ }), 7927
7928/***/ "./packages/mdc-floating-label/foundation.ts": 7929/*!***************************************************!*\ 7930 !*** ./packages/mdc-floating-label/foundation.ts ***! 7931 \***************************************************/ 7932/*! no static exports found */ 7933/***/ (function(module, exports, __webpack_require__) { 7934 7935"use strict"; 7936 7937/** 7938 * @license 7939 * Copyright 2016 Google Inc. 7940 * 7941 * Permission is hereby granted, free of charge, to any person obtaining a copy 7942 * of this software and associated documentation files (the "Software"), to deal 7943 * in the Software without restriction, including without limitation the rights 7944 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7945 * copies of the Software, and to permit persons to whom the Software is 7946 * furnished to do so, subject to the following conditions: 7947 * 7948 * The above copyright notice and this permission notice shall be included in 7949 * all copies or substantial portions of the Software. 7950 * 7951 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7952 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7953 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7954 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7955 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7956 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7957 * THE SOFTWARE. 7958 */ 7959 7960var __extends = this && this.__extends || function () { 7961 var _extendStatics = function extendStatics(d, b) { 7962 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 7963 d.__proto__ = b; 7964 } || function (d, b) { 7965 for (var p in b) { 7966 if (b.hasOwnProperty(p)) d[p] = b[p]; 7967 } 7968 }; 7969 return _extendStatics(d, b); 7970 }; 7971 return function (d, b) { 7972 _extendStatics(d, b); 7973 function __() { 7974 this.constructor = d; 7975 } 7976 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 7977 }; 7978}(); 7979var __assign = this && this.__assign || function () { 7980 __assign = Object.assign || function (t) { 7981 for (var s, i = 1, n = arguments.length; i < n; i++) { 7982 s = arguments[i]; 7983 for (var p in s) { 7984 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 7985 } 7986 } 7987 return t; 7988 }; 7989 return __assign.apply(this, arguments); 7990}; 7991Object.defineProperty(exports, "__esModule", { value: true }); 7992var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 7993var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts"); 7994var MDCFloatingLabelFoundation = /** @class */function (_super) { 7995 __extends(MDCFloatingLabelFoundation, _super); 7996 function MDCFloatingLabelFoundation(adapter) { 7997 var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this; 7998 _this.shakeAnimationEndHandler_ = function () { 7999 return _this.handleShakeAnimationEnd_(); 8000 }; 8001 return _this; 8002 } 8003 Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", { 8004 get: function get() {
8005 return constants_1.cssClasses; 8006 }, 8007 enumerable: true, 8008 configurable: true 8009 }); 8010 Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", { 8011 /** 8012 * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types. 8013 */ 8014 get: function get() { 8015 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 8016 return { 8017 addClass: function addClass() { 8018 return undefined; 8019 }, 8020 removeClass: function removeClass() { 8021 return undefined; 8022 }, 8023 getWidth: function getWidth() { 8024 return 0; 8025 }, 8026 registerInteractionHandler: function registerInteractionHandler() { 8027 return undefined; 8028 }, 8029 deregisterInteractionHandler: function deregisterInteractionHandler() { 8030 return undefined; 8031 } 8032 }; 8033 // tslint:enable:object-literal-sort-keys 8034 }, 8035 enumerable: true, 8036 configurable: true 8037 }); 8038 MDCFloatingLabelFoundation.prototype.init = function () { 8039 this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_); 8040 }; 8041 MDCFloatingLabelFoundation.prototype.destroy = function () { 8042 this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_); 8043 }; 8044 /** 8045 * Returns the width of the label element. 8046 */ 8047 MDCFloatingLabelFoundation.prototype.getWidth = function () { 8048 return this.adapter.getWidth(); 8049 }; 8050 /** 8051 * Styles the label to produce a shake animation to indicate an error. 8052 * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class. 8053 */ 8054 MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) { 8055 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; 8056 if (shouldShake) { 8057 this.adapter.addClass(LABEL_SHAKE); 8058 } else { 8059 this.adapter.removeClass(LABEL_SHAKE); 8060 } 8061 }; 8062 /** 8063 * Styles the label to float or dock. 8064 * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label. 8065 */ 8066 MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) { 8067 var _a = MDCFloatingLabelFoundation.cssClasses, 8068 LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, 8069 LABEL_SHAKE = _a.LABEL_SHAKE; 8070 if (shouldFloat) { 8071 this.adapter.addClass(LABEL_FLOAT_ABOVE); 8072 } else { 8073 this.adapter.removeClass(LABEL_FLOAT_ABOVE); 8074 this.adapter.removeClass(LABEL_SHAKE); 8075 } 8076 }; 8077 /** 8078 * Styles the label as required. 8079 * @param isRequired If true, adds an asterisk to the label, indicating that it is required. 8080 */ 8081 MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) { 8082 var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED; 8083 if (isRequired) { 8084 this.adapter.addClass(LABEL_REQUIRED); 8085 } else { 8086 this.adapter.removeClass(LABEL_REQUIRED); 8087 } 8088 }; 8089 MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () { 8090 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; 8091 this.adapter.removeClass(LABEL_SHAKE); 8092 }; 8093 return MDCFloatingLabelFoundation; 8094}(foundation_1.MDCFoundation); 8095exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation; 8096// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 8097exports.default = MDCFloatingLabelFoundation; 8098 8099/***/ }), 8100
8101/***/ "./packages/mdc-floating-label/index.ts": 8102/*!**********************************************!*\ 8103 !*** ./packages/mdc-floating-label/index.ts ***! 8104 \**********************************************/ 8105/*! no static exports found */ 8106/***/ (function(module, exports, __webpack_require__) { 8107 8108"use strict"; 8109 8110/** 8111 * @license 8112 * Copyright 2019 Google Inc. 8113 * 8114 * Permission is hereby granted, free of charge, to any person obtaining a copy 8115 * of this software and associated documentation files (the "Software"), to deal 8116 * in the Software without restriction, including without limitation the rights 8117 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8118 * copies of the Software, and to permit persons to whom the Software is 8119 * furnished to do so, subject to the following conditions: 8120 * 8121 * The above copyright notice and this permission notice shall be included in 8122 * all copies or substantial portions of the Software. 8123 * 8124 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8125 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8126 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8127 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8128 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8129 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8130 * THE SOFTWARE. 8131 */ 8132 8133function __export(m) { 8134 for (var p in m) { 8135 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 8136 } 8137} 8138Object.defineProperty(exports, "__esModule", { value: true }); 8139__export(__webpack_require__(/*! ./component */ "./packages/mdc-floating-label/component.ts")); 8140__export(__webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts")); 8141__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts")); 8142 8143/***/ }), 8144
8145/***/ "./packages/mdc-form-field/component.ts": 8146/*!**********************************************!*\ 8147 !*** ./packages/mdc-form-field/component.ts ***! 8148 \**********************************************/ 8149/*! no static exports found */ 8150/***/ (function(module, exports, __webpack_require__) { 8151 8152"use strict"; 8153 8154/** 8155 * @license 8156 * Copyright 2017 Google Inc. 8157 * 8158 * Permission is hereby granted, free of charge, to any person obtaining a copy 8159 * of this software and associated documentation files (the "Software"), to deal 8160 * in the Software without restriction, including without limitation the rights 8161 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8162 * copies of the Software, and to permit persons to whom the Software is 8163 * furnished to do so, subject to the following conditions: 8164 * 8165 * The above copyright notice and this permission notice shall be included in 8166 * all copies or substantial portions of the Software. 8167 * 8168 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8169 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8170 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8171 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8172 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8173 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8174 * THE SOFTWARE. 8175 */ 8176 8177var __extends = this && this.__extends || function () { 8178 var _extendStatics = function extendStatics(d, b) { 8179 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8180 d.__proto__ = b; 8181 } || function (d, b) { 8182 for (var p in b) { 8183 if (b.hasOwnProperty(p)) d[p] = b[p]; 8184 } 8185 }; 8186 return _extendStatics(d, b); 8187 }; 8188 return function (d, b) { 8189 _extendStatics(d, b); 8190 function __() { 8191 this.constructor = d; 8192 } 8193 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8194 }; 8195}(); 8196Object.defineProperty(exports, "__esModule", { value: true }); 8197var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 8198var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts"); 8199var MDCFormField = /** @class */function (_super) { 8200 __extends(MDCFormField, _super); 8201 function MDCFormField() { 8202 return _super !== null && _super.apply(this, arguments) || this; 8203 } 8204 MDCFormField.attachTo = function (root) { 8205 return new MDCFormField(root); 8206 }; 8207 MDCFormField.prototype.labelEl = function () { 8208 var LABEL_SELECTOR = foundation_1.MDCFormFieldFoundation.strings.LABEL_SELECTOR; 8209 return this.root.querySelector(LABEL_SELECTOR); 8210 }; 8211 MDCFormField.prototype.getDefaultFoundation = function () { 8212 var _this = this; 8213 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 8214 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 8215 var adapter = { 8216 activateInputRipple: function activateInputRipple() { 8217 if (_this.input && _this.input.ripple) { 8218 _this.input.ripple.activate(); 8219 } 8220 }, 8221 deactivateInputRipple: function deactivateInputRipple() { 8222 if (_this.input && _this.input.ripple) { 8223 _this.input.ripple.deactivate(); 8224 } 8225 }, 8226 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 8227 var labelEl = _this.labelEl(); 8228 if (labelEl) { 8229 labelEl.removeEventListener(evtType, handler); 8230 } 8231 }, 8232 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 8233 var labelEl = _this.labelEl(); 8234 if (labelEl) { 8235 labelEl.addEventListener(evtType, handler); 8236 } 8237 } 8238 };
8239 return new foundation_1.MDCFormFieldFoundation(adapter); 8240 }; 8241 return MDCFormField; 8242}(component_1.MDCComponent); 8243exports.MDCFormField = MDCFormField; 8244 8245/***/ }), 8246
8247/***/ "./packages/mdc-form-field/constants.ts": 8248/*!**********************************************!*\ 8249 !*** ./packages/mdc-form-field/constants.ts ***! 8250 \**********************************************/ 8251/*! no static exports found */ 8252/***/ (function(module, exports, __webpack_require__) { 8253 8254"use strict"; 8255 8256/** 8257 * @license 8258 * Copyright 2017 Google Inc. 8259 * 8260 * Permission is hereby granted, free of charge, to any person obtaining a copy 8261 * of this software and associated documentation files (the "Software"), to deal 8262 * in the Software without restriction, including without limitation the rights 8263 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8264 * copies of the Software, and to permit persons to whom the Software is 8265 * furnished to do so, subject to the following conditions: 8266 * 8267 * The above copyright notice and this permission notice shall be included in 8268 * all copies or substantial portions of the Software. 8269 * 8270 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8271 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8272 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8273 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8274 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8275 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8276 * THE SOFTWARE. 8277 */ 8278 8279Object.defineProperty(exports, "__esModule", { value: true }); 8280exports.cssClasses = { 8281 ROOT: 'mdc-form-field' 8282}; 8283exports.strings = { 8284 LABEL_SELECTOR: '.mdc-form-field > label' 8285}; 8286 8287/***/ }), 8288
8289/***/ "./packages/mdc-form-field/foundation.ts": 8290/*!***********************************************!*\ 8291 !*** ./packages/mdc-form-field/foundation.ts ***! 8292 \***********************************************/ 8293/*! no static exports found */ 8294/***/ (function(module, exports, __webpack_require__) { 8295 8296"use strict"; 8297 8298/** 8299 * @license 8300 * Copyright 2017 Google Inc. 8301 * 8302 * Permission is hereby granted, free of charge, to any person obtaining a copy 8303 * of this software and associated documentation files (the "Software"), to deal 8304 * in the Software without restriction, including without limitation the rights 8305 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8306 * copies of the Software, and to permit persons to whom the Software is 8307 * furnished to do so, subject to the following conditions: 8308 * 8309 * The above copyright notice and this permission notice shall be included in 8310 * all copies or substantial portions of the Software. 8311 * 8312 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8313 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8314 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8315 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8316 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8317 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8318 * THE SOFTWARE. 8319 */ 8320 8321var __extends = this && this.__extends || function () { 8322 var _extendStatics = function extendStatics(d, b) { 8323 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8324 d.__proto__ = b; 8325 } || function (d, b) { 8326 for (var p in b) { 8327 if (b.hasOwnProperty(p)) d[p] = b[p]; 8328 } 8329 }; 8330 return _extendStatics(d, b); 8331 }; 8332 return function (d, b) { 8333 _extendStatics(d, b); 8334 function __() { 8335 this.constructor = d; 8336 } 8337 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8338 }; 8339}(); 8340var __assign = this && this.__assign || function () { 8341 __assign = Object.assign || function (t) { 8342 for (var s, i = 1, n = arguments.length; i < n; i++) { 8343 s = arguments[i]; 8344 for (var p in s) { 8345 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 8346 } 8347 } 8348 return t; 8349 }; 8350 return __assign.apply(this, arguments); 8351}; 8352Object.defineProperty(exports, "__esModule", { value: true }); 8353var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 8354var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts"); 8355var MDCFormFieldFoundation = /** @class */function (_super) { 8356 __extends(MDCFormFieldFoundation, _super); 8357 function MDCFormFieldFoundation(adapter) { 8358 var _this = _super.call(this, __assign(__assign({}, MDCFormFieldFoundation.defaultAdapter), adapter)) || this; 8359 _this.click = function () { 8360 _this.handleClick(); 8361 }; 8362 return _this; 8363 } 8364 Object.defineProperty(MDCFormFieldFoundation, "cssClasses", { 8365 get: function get() {
8366 return constants_1.cssClasses; 8367 }, 8368 enumerable: true, 8369 configurable: true 8370 }); 8371 Object.defineProperty(MDCFormFieldFoundation, "strings", { 8372 get: function get() { 8373 return constants_1.strings; 8374 }, 8375 enumerable: true, 8376 configurable: true 8377 }); 8378 Object.defineProperty(MDCFormFieldFoundation, "defaultAdapter", { 8379 get: function get() { 8380 return { 8381 activateInputRipple: function activateInputRipple() { 8382 return undefined; 8383 }, 8384 deactivateInputRipple: function deactivateInputRipple() { 8385 return undefined; 8386 }, 8387 deregisterInteractionHandler: function deregisterInteractionHandler() { 8388 return undefined; 8389 }, 8390 registerInteractionHandler: function registerInteractionHandler() { 8391 return undefined; 8392 } 8393 }; 8394 }, 8395 enumerable: true, 8396 configurable: true 8397 }); 8398 MDCFormFieldFoundation.prototype.init = function () { 8399 this.adapter.registerInteractionHandler('click', this.click); 8400 }; 8401 MDCFormFieldFoundation.prototype.destroy = function () { 8402 this.adapter.deregisterInteractionHandler('click', this.click); 8403 }; 8404 MDCFormFieldFoundation.prototype.handleClick = function () { 8405 var _this = this; 8406 this.adapter.activateInputRipple(); 8407 requestAnimationFrame(function () { 8408 _this.adapter.deactivateInputRipple(); 8409 }); 8410 }; 8411 return MDCFormFieldFoundation; 8412}(foundation_1.MDCFoundation); 8413exports.MDCFormFieldFoundation = MDCFormFieldFoundation; 8414// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 8415exports.default = MDCFormFieldFoundation; 8416 8417/***/ }), 8418
8419/***/ "./packages/mdc-form-field/index.ts": 8420/*!******************************************!*\ 8421 !*** ./packages/mdc-form-field/index.ts ***! 8422 \******************************************/ 8423/*! no static exports found */ 8424/***/ (function(module, exports, __webpack_require__) { 8425 8426"use strict"; 8427 8428/** 8429 * @license 8430 * Copyright 2019 Google Inc. 8431 * 8432 * Permission is hereby granted, free of charge, to any person obtaining a copy 8433 * of this software and associated documentation files (the "Software"), to deal 8434 * in the Software without restriction, including without limitation the rights 8435 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8436 * copies of the Software, and to permit persons to whom the Software is 8437 * furnished to do so, subject to the following conditions: 8438 * 8439 * The above copyright notice and this permission notice shall be included in 8440 * all copies or substantial portions of the Software. 8441 * 8442 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8443 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8444 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8445 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8446 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8447 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8448 * THE SOFTWARE. 8449 */ 8450 8451function __export(m) { 8452 for (var p in m) { 8453 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 8454 } 8455} 8456Object.defineProperty(exports, "__esModule", { value: true }); 8457__export(__webpack_require__(/*! ./component */ "./packages/mdc-form-field/component.ts")); 8458__export(__webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts")); 8459__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts")); 8460 8461/***/ }), 8462
8463/***/ "./packages/mdc-icon-button/component.ts": 8464/*!***********************************************!*\ 8465 !*** ./packages/mdc-icon-button/component.ts ***! 8466 \***********************************************/ 8467/*! no static exports found */ 8468/***/ (function(module, exports, __webpack_require__) { 8469 8470"use strict"; 8471 8472/** 8473 * @license 8474 * Copyright 2018 Google Inc. 8475 * 8476 * Permission is hereby granted, free of charge, to any person obtaining a copy 8477 * of this software and associated documentation files (the "Software"), to deal 8478 * in the Software without restriction, including without limitation the rights 8479 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8480 * copies of the Software, and to permit persons to whom the Software is 8481 * furnished to do so, subject to the following conditions: 8482 * 8483 * The above copyright notice and this permission notice shall be included in 8484 * all copies or substantial portions of the Software. 8485 * 8486 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8487 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8488 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8489 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8490 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8491 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8492 * THE SOFTWARE. 8493 */ 8494 8495var __extends = this && this.__extends || function () { 8496 var _extendStatics = function extendStatics(d, b) { 8497 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8498 d.__proto__ = b; 8499 } || function (d, b) { 8500 for (var p in b) { 8501 if (b.hasOwnProperty(p)) d[p] = b[p]; 8502 } 8503 }; 8504 return _extendStatics(d, b); 8505 }; 8506 return function (d, b) { 8507 _extendStatics(d, b); 8508 function __() { 8509 this.constructor = d; 8510 } 8511 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8512 }; 8513}(); 8514Object.defineProperty(exports, "__esModule", { value: true }); 8515var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 8516var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 8517var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts"); 8518var strings = foundation_1.MDCIconButtonToggleFoundation.strings; 8519var MDCIconButtonToggle = /** @class */function (_super) { 8520 __extends(MDCIconButtonToggle, _super); 8521 function MDCIconButtonToggle() { 8522 var _this = _super !== null && _super.apply(this, arguments) || this; 8523 _this.rippleComponent = _this.createRipple(); 8524 return _this; 8525 } 8526 MDCIconButtonToggle.attachTo = function (root) { 8527 return new MDCIconButtonToggle(root); 8528 }; 8529 MDCIconButtonToggle.prototype.initialSyncWithDOM = function () { 8530 var _this = this; 8531 this.handleClick = function () { 8532 _this.foundation.handleClick(); 8533 }; 8534 this.listen('click', this.handleClick); 8535 }; 8536 MDCIconButtonToggle.prototype.destroy = function () { 8537 this.unlisten('click', this.handleClick); 8538 this.ripple.destroy(); 8539 _super.prototype.destroy.call(this); 8540 }; 8541 MDCIconButtonToggle.prototype.getDefaultFoundation = function () { 8542 var _this = this; 8543 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 8544 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 8545 var adapter = { 8546 addClass: function addClass(className) { 8547 return _this.root.classList.add(className); 8548 }, 8549 hasClass: function hasClass(className) { 8550 return _this.root.classList.contains(className); 8551 }, 8552 notifyChange: function notifyChange(evtData) {
8553 _this.emit(strings.CHANGE_EVENT, evtData); 8554 }, 8555 removeClass: function removeClass(className) { 8556 return _this.root.classList.remove(className); 8557 }, 8558 getAttr: function getAttr(attrName) { 8559 return _this.root.getAttribute(attrName); 8560 }, 8561 setAttr: function setAttr(attrName, attrValue) { 8562 return _this.root.setAttribute(attrName, attrValue); 8563 } 8564 }; 8565 return new foundation_1.MDCIconButtonToggleFoundation(adapter); 8566 }; 8567 Object.defineProperty(MDCIconButtonToggle.prototype, "ripple", { 8568 get: function get() { 8569 return this.rippleComponent; 8570 }, 8571 enumerable: true, 8572 configurable: true 8573 }); 8574 Object.defineProperty(MDCIconButtonToggle.prototype, "on", { 8575 get: function get() { 8576 return this.foundation.isOn(); 8577 }, 8578 set: function set(isOn) { 8579 this.foundation.toggle(isOn); 8580 }, 8581 enumerable: true, 8582 configurable: true 8583 }); 8584 MDCIconButtonToggle.prototype.createRipple = function () { 8585 var ripple = new component_2.MDCRipple(this.root); 8586 ripple.unbounded = true; 8587 return ripple; 8588 }; 8589 return MDCIconButtonToggle; 8590}(component_1.MDCComponent); 8591exports.MDCIconButtonToggle = MDCIconButtonToggle; 8592 8593/***/ }), 8594
8595/***/ "./packages/mdc-icon-button/constants.ts": 8596/*!***********************************************!*\ 8597 !*** ./packages/mdc-icon-button/constants.ts ***! 8598 \***********************************************/ 8599/*! no static exports found */ 8600/***/ (function(module, exports, __webpack_require__) { 8601 8602"use strict"; 8603 8604/** 8605 * @license 8606 * Copyright 2018 Google Inc. 8607 * 8608 * Permission is hereby granted, free of charge, to any person obtaining a copy 8609 * of this software and associated documentation files (the "Software"), to deal 8610 * in the Software without restriction, including without limitation the rights 8611 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8612 * copies of the Software, and to permit persons to whom the Software is 8613 * furnished to do so, subject to the following conditions: 8614 * 8615 * The above copyright notice and this permission notice shall be included in 8616 * all copies or substantial portions of the Software. 8617 * 8618 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8619 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8620 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8621 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8622 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8623 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8624 * THE SOFTWARE. 8625 */ 8626 8627Object.defineProperty(exports, "__esModule", { value: true }); 8628exports.cssClasses = { 8629 ICON_BUTTON_ON: 'mdc-icon-button--on', 8630 ROOT: 'mdc-icon-button' 8631}; 8632exports.strings = { 8633 ARIA_LABEL: 'aria-label', 8634 ARIA_PRESSED: 'aria-pressed', 8635 DATA_ARIA_LABEL_OFF: 'data-aria-label-off', 8636 DATA_ARIA_LABEL_ON: 'data-aria-label-on', 8637 CHANGE_EVENT: 'MDCIconButtonToggle:change' 8638}; 8639 8640/***/ }), 8641
vendor: 3,383 bytes, lines 8642-8720
8642/***/ "./packages/mdc-icon-button/foundation.ts": 8643/*!************************************************!*\ 8644 !*** ./packages/mdc-icon-button/foundation.ts ***! 8645 \************************************************/ 8646/*! no static exports found */ 8647/***/ (function(module, exports, __webpack_require__) { 8648 8649"use strict"; 8650 8651/** 8652 * @license 8653 * Copyright 2018 Google Inc. 8654 * 8655 * Permission is hereby granted, free of charge, to any person obtaining a copy 8656 * of this software and associated documentation files (the "Software"), to deal 8657 * in the Software without restriction, including without limitation the rights 8658 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8659 * copies of the Software, and to permit persons to whom the Software is 8660 * furnished to do so, subject to the following conditions: 8661 * 8662 * The above copyright notice and this permission notice shall be included in 8663 * all copies or substantial portions of the Software. 8664 * 8665 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8666 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8667 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8668 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8669 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8670 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8671 * THE SOFTWARE. 8672 */ 8673 8674var __extends = this && this.__extends || function () { 8675 var _extendStatics = function extendStatics(d, b) { 8676 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8677 d.__proto__ = b; 8678 } || function (d, b) { 8679 for (var p in b) { 8680 if (b.hasOwnProperty(p)) d[p] = b[p]; 8681 } 8682 }; 8683 return _extendStatics(d, b); 8684 }; 8685 return function (d, b) { 8686 _extendStatics(d, b); 8687 function __() { 8688 this.constructor = d; 8689 } 8690 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8691 }; 8692}(); 8693var __assign = this && this.__assign || function () { 8694 __assign = Object.assign || function (t) { 8695 for (var s, i = 1, n = arguments.length; i < n; i++) { 8696 s = arguments[i]; 8697 for (var p in s) { 8698 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 8699 } 8700 } 8701 return t; 8702 }; 8703 return __assign.apply(this, arguments); 8704}; 8705Object.defineProperty(exports, "__esModule", { value: true }); 8706var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 8707var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts"); 8708var MDCIconButtonToggleFoundation = /** @class */function (_super) { 8709 __extends(MDCIconButtonToggleFoundation, _super); 8710 function MDCIconButtonToggleFoundation(adapter) { 8711 var _this = _super.call(this, __assign(__assign({}, MDCIconButtonToggleFoundation.defaultAdapter), adapter)) || this; 8712 /** 8713 * Whether the icon button has an aria label that changes depending on 8714 * toggled state. 8715 */ 8716 _this.hasToggledAriaLabel = false; 8717 return _this; 8718 } 8719 Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", { 8720 get: function get() {
8721 return constants_1.cssClasses; 8722 }, 8723 enumerable: true, 8724 configurable: true 8725 }); 8726 Object.defineProperty(MDCIconButtonToggleFoundation, "strings", { 8727 get: function get() { 8728 return constants_1.strings; 8729 }, 8730 enumerable: true, 8731 configurable: true 8732 }); 8733 Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", { 8734 get: function get() { 8735 return { 8736 addClass: function addClass() { 8737 return undefined; 8738 }, 8739 hasClass: function hasClass() { 8740 return false; 8741 }, 8742 notifyChange: function notifyChange() { 8743 return undefined; 8744 }, 8745 removeClass: function removeClass() { 8746 return undefined; 8747 }, 8748 getAttr: function getAttr() { 8749 return null; 8750 }, 8751 setAttr: function setAttr() { 8752 return undefined; 8753 } 8754 }; 8755 }, 8756 enumerable: true, 8757 configurable: true 8758 }); 8759 MDCIconButtonToggleFoundation.prototype.init = function () { 8760 var ariaLabelOn = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON); 8761 var ariaLabelOff = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF); 8762 if (ariaLabelOn && ariaLabelOff) { 8763 if (this.adapter.getAttr(constants_1.strings.ARIA_PRESSED) !== null) { 8764 throw new Error('MDCIconButtonToggleFoundation: Button should not set ' + '`aria-pressed` if it has a toggled aria label.'); 8765 } 8766 this.hasToggledAriaLabel = true; 8767 } else { 8768 this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, String(this.isOn())); 8769 } 8770 }; 8771 MDCIconButtonToggleFoundation.prototype.handleClick = function () { 8772 this.toggle(); 8773 this.adapter.notifyChange({ isOn: this.isOn() }); 8774 }; 8775 MDCIconButtonToggleFoundation.prototype.isOn = function () {
8776 return this.adapter.hasClass(constants_1.cssClasses.ICON_BUTTON_ON); 8777 }; 8778 MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) { 8779 if (isOn === void 0) { 8780 isOn = !this.isOn(); 8781 } 8782 // Toggle UI based on state. 8783 if (isOn) { 8784 this.adapter.addClass(constants_1.cssClasses.ICON_BUTTON_ON); 8785 } else { 8786 this.adapter.removeClass(constants_1.cssClasses.ICON_BUTTON_ON); 8787 } 8788 // Toggle aria attributes based on state. 8789 if (this.hasToggledAriaLabel) { 8790 var ariaLabel = isOn ? this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON) : this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF); 8791 this.adapter.setAttr(constants_1.strings.ARIA_LABEL, ariaLabel || ''); 8792 } else { 8793 this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, "" + isOn); 8794 } 8795 }; 8796 return MDCIconButtonToggleFoundation; 8797}(foundation_1.MDCFoundation); 8798exports.MDCIconButtonToggleFoundation = MDCIconButtonToggleFoundation; 8799// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 8800exports.default = MDCIconButtonToggleFoundation; 8801 8802/***/ }), 8803
8804/***/ "./packages/mdc-icon-button/index.ts": 8805/*!*******************************************!*\ 8806 !*** ./packages/mdc-icon-button/index.ts ***! 8807 \*******************************************/ 8808/*! no static exports found */ 8809/***/ (function(module, exports, __webpack_require__) { 8810 8811"use strict"; 8812 8813/** 8814 * @license 8815 * Copyright 2019 Google Inc. 8816 * 8817 * Permission is hereby granted, free of charge, to any person obtaining a copy 8818 * of this software and associated documentation files (the "Software"), to deal 8819 * in the Software without restriction, including without limitation the rights 8820 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8821 * copies of the Software, and to permit persons to whom the Software is 8822 * furnished to do so, subject to the following conditions: 8823 * 8824 * The above copyright notice and this permission notice shall be included in 8825 * all copies or substantial portions of the Software. 8826 * 8827 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8828 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8829 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8830 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8831 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8832 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8833 * THE SOFTWARE. 8834 */ 8835 8836function __export(m) { 8837 for (var p in m) { 8838 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 8839 } 8840} 8841Object.defineProperty(exports, "__esModule", { value: true }); 8842__export(__webpack_require__(/*! ./component */ "./packages/mdc-icon-button/component.ts")); 8843__export(__webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts")); 8844__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts")); 8845 8846/***/ }), 8847
8848/***/ "./packages/mdc-line-ripple/component.ts": 8849/*!***********************************************!*\ 8850 !*** ./packages/mdc-line-ripple/component.ts ***! 8851 \***********************************************/ 8852/*! no static exports found */ 8853/***/ (function(module, exports, __webpack_require__) { 8854 8855"use strict"; 8856 8857/** 8858 * @license 8859 * Copyright 2018 Google Inc. 8860 * 8861 * Permission is hereby granted, free of charge, to any person obtaining a copy 8862 * of this software and associated documentation files (the "Software"), to deal 8863 * in the Software without restriction, including without limitation the rights 8864 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8865 * copies of the Software, and to permit persons to whom the Software is 8866 * furnished to do so, subject to the following conditions: 8867 * 8868 * The above copyright notice and this permission notice shall be included in 8869 * all copies or substantial portions of the Software. 8870 * 8871 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8872 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8873 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8874 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8875 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8876 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8877 * THE SOFTWARE. 8878 */ 8879 8880var __extends = this && this.__extends || function () { 8881 var _extendStatics = function extendStatics(d, b) { 8882 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8883 d.__proto__ = b; 8884 } || function (d, b) { 8885 for (var p in b) { 8886 if (b.hasOwnProperty(p)) d[p] = b[p]; 8887 } 8888 }; 8889 return _extendStatics(d, b); 8890 }; 8891 return function (d, b) { 8892 _extendStatics(d, b); 8893 function __() { 8894 this.constructor = d; 8895 } 8896 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8897 }; 8898}(); 8899Object.defineProperty(exports, "__esModule", { value: true }); 8900var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 8901var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts"); 8902var MDCLineRipple = /** @class */function (_super) { 8903 __extends(MDCLineRipple, _super); 8904 function MDCLineRipple() { 8905 return _super !== null && _super.apply(this, arguments) || this; 8906 } 8907 MDCLineRipple.attachTo = function (root) { 8908 return new MDCLineRipple(root); 8909 }; 8910 /** 8911 * Activates the line ripple 8912 */ 8913 MDCLineRipple.prototype.activate = function () { 8914 this.foundation.activate(); 8915 }; 8916 /** 8917 * Deactivates the line ripple 8918 */ 8919 MDCLineRipple.prototype.deactivate = function () { 8920 this.foundation.deactivate(); 8921 }; 8922 /** 8923 * Sets the transform origin given a user's click location. 8924 * The `rippleCenter` is the x-coordinate of the middle of the ripple. 8925 */ 8926 MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) { 8927 this.foundation.setRippleCenter(xCoordinate); 8928 }; 8929 MDCLineRipple.prototype.getDefaultFoundation = function () { 8930 var _this = this; 8931 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 8932 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 8933 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 8934 var adapter = { 8935 addClass: function addClass(className) { 8936 return _this.root.classList.add(className); 8937 }, 8938 removeClass: function removeClass(className) { 8939 return _this.root.classList.remove(className); 8940 }, 8941 hasClass: function hasClass(className) { 8942 return _this.root.classList.contains(className); 8943 }, 8944 setStyle: function setStyle(propertyName, value) { 8945 return _this.root.style.setProperty(propertyName, value); 8946 }, 8947 registerEventHandler: function registerEventHandler(evtType, handler) { 8948 return _this.listen(evtType, handler); 8949 }, 8950 deregisterEventHandler: function deregisterEventHandler(evtType, handler) { 8951 return _this.unlisten(evtType, handler); 8952 } 8953 }; 8954 // tslint:enable:object-literal-sort-keys 8955 return new foundation_1.MDCLineRippleFoundation(adapter); 8956 }; 8957 return MDCLineRipple; 8958}(component_1.MDCComponent); 8959exports.MDCLineRipple = MDCLineRipple; 8960 8961/***/ }), 8962
8963/***/ "./packages/mdc-line-ripple/constants.ts": 8964/*!***********************************************!*\ 8965 !*** ./packages/mdc-line-ripple/constants.ts ***! 8966 \***********************************************/ 8967/*! no static exports found */ 8968/***/ (function(module, exports, __webpack_require__) { 8969 8970"use strict"; 8971 8972/** 8973 * @license 8974 * Copyright 2018 Google Inc. 8975 * 8976 * Permission is hereby granted, free of charge, to any person obtaining a copy 8977 * of this software and associated documentation files (the "Software"), to deal 8978 * in the Software without restriction, including without limitation the rights 8979 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8980 * copies of the Software, and to permit persons to whom the Software is 8981 * furnished to do so, subject to the following conditions: 8982 * 8983 * The above copyright notice and this permission notice shall be included in 8984 * all copies or substantial portions of the Software. 8985 * 8986 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8987 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8988 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8989 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8990 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8991 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8992 * THE SOFTWARE. 8993 */ 8994 8995Object.defineProperty(exports, "__esModule", { value: true });
8996var cssClasses = { 8997 LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active', 8998 LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating' 8999}; 9000exports.cssClasses = cssClasses; 9001 9002/***/ }), 9003
9004/***/ "./packages/mdc-line-ripple/foundation.ts": 9005/*!************************************************!*\ 9006 !*** ./packages/mdc-line-ripple/foundation.ts ***! 9007 \************************************************/ 9008/*! no static exports found */ 9009/***/ (function(module, exports, __webpack_require__) { 9010 9011"use strict"; 9012 9013/** 9014 * @license 9015 * Copyright 2018 Google Inc. 9016 * 9017 * Permission is hereby granted, free of charge, to any person obtaining a copy 9018 * of this software and associated documentation files (the "Software"), to deal 9019 * in the Software without restriction, including without limitation the rights 9020 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9021 * copies of the Software, and to permit persons to whom the Software is 9022 * furnished to do so, subject to the following conditions: 9023 * 9024 * The above copyright notice and this permission notice shall be included in 9025 * all copies or substantial portions of the Software. 9026 * 9027 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9028 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9029 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9030 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9031 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9032 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9033 * THE SOFTWARE. 9034 */ 9035 9036var __extends = this && this.__extends || function () { 9037 var _extendStatics = function extendStatics(d, b) { 9038 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9039 d.__proto__ = b; 9040 } || function (d, b) { 9041 for (var p in b) { 9042 if (b.hasOwnProperty(p)) d[p] = b[p]; 9043 } 9044 }; 9045 return _extendStatics(d, b); 9046 }; 9047 return function (d, b) { 9048 _extendStatics(d, b); 9049 function __() { 9050 this.constructor = d; 9051 } 9052 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9053 }; 9054}(); 9055var __assign = this && this.__assign || function () { 9056 __assign = Object.assign || function (t) { 9057 for (var s, i = 1, n = arguments.length; i < n; i++) { 9058 s = arguments[i]; 9059 for (var p in s) { 9060 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 9061 } 9062 } 9063 return t; 9064 }; 9065 return __assign.apply(this, arguments); 9066}; 9067Object.defineProperty(exports, "__esModule", { value: true }); 9068var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 9069var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts"); 9070var MDCLineRippleFoundation = /** @class */function (_super) { 9071 __extends(MDCLineRippleFoundation, _super); 9072 function MDCLineRippleFoundation(adapter) { 9073 var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this; 9074 _this.transitionEndHandler_ = function (evt) { 9075 return _this.handleTransitionEnd(evt); 9076 }; 9077 return _this; 9078 } 9079 Object.defineProperty(MDCLineRippleFoundation, "cssClasses", { 9080 get: function get() {
9081 return constants_1.cssClasses; 9082 }, 9083 enumerable: true, 9084 configurable: true 9085 }); 9086 Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", { 9087 /** 9088 * See {@link MDCLineRippleAdapter} for typing information on parameters and return types. 9089 */ 9090 get: function get() { 9091 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 9092 return { 9093 addClass: function addClass() { 9094 return undefined; 9095 }, 9096 removeClass: function removeClass() { 9097 return undefined; 9098 }, 9099 hasClass: function hasClass() { 9100 return false; 9101 }, 9102 setStyle: function setStyle() { 9103 return undefined; 9104 }, 9105 registerEventHandler: function registerEventHandler() { 9106 return undefined; 9107 }, 9108 deregisterEventHandler: function deregisterEventHandler() { 9109 return undefined; 9110 } 9111 }; 9112 // tslint:enable:object-literal-sort-keys 9113 }, 9114 enumerable: true, 9115 configurable: true 9116 }); 9117 MDCLineRippleFoundation.prototype.init = function () { 9118 this.adapter.registerEventHandler('transitionend', this.transitionEndHandler_); 9119 }; 9120 MDCLineRippleFoundation.prototype.destroy = function () { 9121 this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler_); 9122 }; 9123 MDCLineRippleFoundation.prototype.activate = function () {
9124 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); 9125 this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE); 9126 }; 9127 MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) { 9128 this.adapter.setStyle('transform-origin', xCoordinate + "px center"); 9129 }; 9130 MDCLineRippleFoundation.prototype.deactivate = function () { 9131 this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); 9132 }; 9133 MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) { 9134 // Wait for the line ripple to be either transparent or opaque 9135 // before emitting the animation end event 9136 var isDeactivating = this.adapter.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); 9137 if (evt.propertyName === 'opacity') { 9138 if (isDeactivating) { 9139 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE); 9140 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); 9141 } 9142 } 9143 }; 9144 return MDCLineRippleFoundation; 9145}(foundation_1.MDCFoundation); 9146exports.MDCLineRippleFoundation = MDCLineRippleFoundation; 9147// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 9148exports.default = MDCLineRippleFoundation; 9149 9150/***/ }), 9151
9152/***/ "./packages/mdc-line-ripple/index.ts": 9153/*!*******************************************!*\ 9154 !*** ./packages/mdc-line-ripple/index.ts ***! 9155 \*******************************************/ 9156/*! no static exports found */ 9157/***/ (function(module, exports, __webpack_require__) { 9158 9159"use strict"; 9160 9161/** 9162 * @license 9163 * Copyright 2019 Google Inc. 9164 * 9165 * Permission is hereby granted, free of charge, to any person obtaining a copy 9166 * of this software and associated documentation files (the "Software"), to deal 9167 * in the Software without restriction, including without limitation the rights 9168 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9169 * copies of the Software, and to permit persons to whom the Software is 9170 * furnished to do so, subject to the following conditions: 9171 * 9172 * The above copyright notice and this permission notice shall be included in 9173 * all copies or substantial portions of the Software. 9174 * 9175 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9176 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9177 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9178 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9179 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9180 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9181 * THE SOFTWARE. 9182 */ 9183 9184function __export(m) { 9185 for (var p in m) { 9186 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 9187 } 9188} 9189Object.defineProperty(exports, "__esModule", { value: true }); 9190__export(__webpack_require__(/*! ./component */ "./packages/mdc-line-ripple/component.ts")); 9191__export(__webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts")); 9192__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts")); 9193 9194/***/ }), 9195
9196/***/ "./packages/mdc-linear-progress/component.ts": 9197/*!***************************************************!*\ 9198 !*** ./packages/mdc-linear-progress/component.ts ***! 9199 \***************************************************/ 9200/*! no static exports found */ 9201/***/ (function(module, exports, __webpack_require__) { 9202 9203"use strict"; 9204 9205/** 9206 * @license 9207 * Copyright 2017 Google Inc. 9208 * 9209 * Permission is hereby granted, free of charge, to any person obtaining a copy 9210 * of this software and associated documentation files (the "Software"), to deal 9211 * in the Software without restriction, including without limitation the rights 9212 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9213 * copies of the Software, and to permit persons to whom the Software is 9214 * furnished to do so, subject to the following conditions: 9215 * 9216 * The above copyright notice and this permission notice shall be included in 9217 * all copies or substantial portions of the Software. 9218 * 9219 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9220 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9221 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9222 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9223 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9224 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9225 * THE SOFTWARE. 9226 */ 9227 9228var __extends = this && this.__extends || function () { 9229 var _extendStatics = function extendStatics(d, b) { 9230 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9231 d.__proto__ = b; 9232 } || function (d, b) { 9233 for (var p in b) { 9234 if (b.hasOwnProperty(p)) d[p] = b[p]; 9235 } 9236 }; 9237 return _extendStatics(d, b); 9238 }; 9239 return function (d, b) { 9240 _extendStatics(d, b); 9241 function __() { 9242 this.constructor = d; 9243 } 9244 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9245 }; 9246}(); 9247Object.defineProperty(exports, "__esModule", { value: true }); 9248var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 9249var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts"); 9250var MDCLinearProgress = /** @class */function (_super) { 9251 __extends(MDCLinearProgress, _super); 9252 function MDCLinearProgress() { 9253 return _super !== null && _super.apply(this, arguments) || this; 9254 } 9255 MDCLinearProgress.attachTo = function (root) { 9256 return new MDCLinearProgress(root); 9257 }; 9258 Object.defineProperty(MDCLinearProgress.prototype, "determinate", { 9259 set: function set(value) { 9260 this.foundation.setDeterminate(value); 9261 }, 9262 enumerable: true, 9263 configurable: true 9264 }); 9265 Object.defineProperty(MDCLinearProgress.prototype, "progress", { 9266 set: function set(value) { 9267 this.foundation.setProgress(value); 9268 }, 9269 enumerable: true, 9270 configurable: true 9271 }); 9272 Object.defineProperty(MDCLinearProgress.prototype, "buffer", { 9273 set: function set(value) { 9274 this.foundation.setBuffer(value); 9275 }, 9276 enumerable: true, 9277 configurable: true 9278 }); 9279 MDCLinearProgress.prototype.open = function () { 9280 this.foundation.open(); 9281 }; 9282 MDCLinearProgress.prototype.close = function () { 9283 this.foundation.close(); 9284 }; 9285 MDCLinearProgress.prototype.initialSyncWithDOM = function () { 9286 var _this = this; 9287 this.root.addEventListener('transitionend', function () { 9288 _this.foundation.handleTransitionEnd(); 9289 }); 9290 }; 9291 MDCLinearProgress.prototype.getDefaultFoundation = function () { 9292 var _this = this; 9293 // DO NOT INLINE this variable. For backward compatibility, foundations take 9294 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 9295 // methods, we need a separate, strongly typed adapter variable. 9296 var adapter = { 9297 addClass: function addClass(className) { 9298 _this.root.classList.add(className); 9299 }, 9300 forceLayout: function forceLayout() { 9301 _this.root.getBoundingClientRect(); 9302 }, 9303 setBufferBarStyle: function setBufferBarStyle(styleProperty, value) { 9304 var bufferBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR); 9305 if (bufferBar) { 9306 bufferBar.style.setProperty(styleProperty, value); 9307 } 9308 }, 9309 setPrimaryBarStyle: function setPrimaryBarStyle(styleProperty, value) { 9310 var primaryBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR); 9311 if (primaryBar) { 9312 primaryBar.style.setProperty(styleProperty, value); 9313 } 9314 }, 9315 hasClass: function hasClass(className) { 9316 return _this.root.classList.contains(className); 9317 }, 9318 removeAttribute: function removeAttribute(attributeName) { 9319 _this.root.removeAttribute(attributeName); 9320 }, 9321 removeClass: function removeClass(className) { 9322 _this.root.classList.remove(className); 9323 }, 9324 setAttribute: function setAttribute(attributeName, value) { 9325 _this.root.setAttribute(attributeName, value); 9326 }, 9327 setStyle: function setStyle(name, value) { 9328 _this.root.style.setProperty(name, value); 9329 }, 9330 attachResizeObserver: function attachResizeObserver(callback) { 9331 var RO = window.ResizeObserver; 9332 if (RO) { 9333 var ro = new RO(callback); 9334 ro.observe(_this.root); 9335 return ro; 9336 } 9337 return null; 9338 }, 9339 getWidth: function getWidth() { 9340 return _this.root.offsetWidth; 9341 } 9342 }; 9343 return new foundation_1.MDCLinearProgressFoundation(adapter); 9344 }; 9345 return MDCLinearProgress; 9346}(component_1.MDCComponent); 9347exports.MDCLinearProgress = MDCLinearProgress; 9348 9349/***/ }), 9350
9351/***/ "./packages/mdc-linear-progress/constants.ts": 9352/*!***************************************************!*\ 9353 !*** ./packages/mdc-linear-progress/constants.ts ***! 9354 \***************************************************/ 9355/*! no static exports found */ 9356/***/ (function(module, exports, __webpack_require__) { 9357 9358"use strict"; 9359 9360/** 9361 * @license 9362 * Copyright 2017 Google Inc. 9363 * 9364 * Permission is hereby granted, free of charge, to any person obtaining a copy 9365 * of this software and associated documentation files (the "Software"), to deal 9366 * in the Software without restriction, including without limitation the rights 9367 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9368 * copies of the Software, and to permit persons to whom the Software is 9369 * furnished to do so, subject to the following conditions: 9370 * 9371 * The above copyright notice and this permission notice shall be included in 9372 * all copies or substantial portions of the Software. 9373 * 9374 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9375 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9376 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9377 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9378 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9379 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9380 * THE SOFTWARE. 9381 */ 9382 9383Object.defineProperty(exports, "__esModule", { value: true }); 9384exports.cssClasses = { 9385 CLOSED_CLASS: 'mdc-linear-progress--closed', 9386 CLOSED_ANIMATION_OFF_CLASS: 'mdc-linear-progress--closed-animation-off', 9387 INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate', 9388 REVERSED_CLASS: 'mdc-linear-progress--reversed', 9389 ANIMATION_READY_CLASS: 'mdc-linear-progress--animation-ready' 9390}; 9391exports.strings = { 9392 ARIA_VALUEMAX: 'aria-valuemax', 9393 ARIA_VALUEMIN: 'aria-valuemin', 9394 ARIA_VALUENOW: 'aria-valuenow', 9395 BUFFER_BAR_SELECTOR: '.mdc-linear-progress__buffer-bar', 9396 FLEX_BASIS: 'flex-basis', 9397 PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar' 9398}; 9399// these are percentages pulled from keyframes.scss 9400exports.animationDimensionPercentages = { 9401 PRIMARY_HALF: .8367142, 9402 PRIMARY_FULL: 2.00611057, 9403 SECONDARY_QUARTER: .37651913, 9404 SECONDARY_HALF: .84386165, 9405 SECONDARY_FULL: 1.60277782 9406}; 9407 9408/***/ }), 9409
9410/***/ "./packages/mdc-linear-progress/foundation.ts": 9411/*!****************************************************!*\ 9412 !*** ./packages/mdc-linear-progress/foundation.ts ***! 9413 \****************************************************/ 9414/*! no static exports found */ 9415/***/ (function(module, exports, __webpack_require__) { 9416 9417"use strict"; 9418 9419/** 9420 * @license 9421 * Copyright 2017 Google Inc. 9422 * 9423 * Permission is hereby granted, free of charge, to any person obtaining a copy 9424 * of this software and associated documentation files (the "Software"), to deal 9425 * in the Software without restriction, including without limitation the rights 9426 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9427 * copies of the Software, and to permit persons to whom the Software is 9428 * furnished to do so, subject to the following conditions: 9429 * 9430 * The above copyright notice and this permission notice shall be included in 9431 * all copies or substantial portions of the Software. 9432 * 9433 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9434 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9435 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9436 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9437 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9438 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9439 * THE SOFTWARE. 9440 */ 9441 9442var __extends = this && this.__extends || function () { 9443 var _extendStatics = function extendStatics(d, b) { 9444 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9445 d.__proto__ = b; 9446 } || function (d, b) { 9447 for (var p in b) { 9448 if (b.hasOwnProperty(p)) d[p] = b[p]; 9449 } 9450 }; 9451 return _extendStatics(d, b); 9452 }; 9453 return function (d, b) { 9454 _extendStatics(d, b); 9455 function __() { 9456 this.constructor = d; 9457 } 9458 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9459 }; 9460}(); 9461var __assign = this && this.__assign || function () { 9462 __assign = Object.assign || function (t) { 9463 for (var s, i = 1, n = arguments.length; i < n; i++) { 9464 s = arguments[i]; 9465 for (var p in s) { 9466 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 9467 } 9468 } 9469 return t; 9470 }; 9471 return __assign.apply(this, arguments); 9472}; 9473var __values = this && this.__values || function (o) { 9474 var s = typeof Symbol === "function" && Symbol.iterator, 9475 m = s && o[s], 9476 i = 0; 9477 if (m) return m.call(o); 9478 if (o && typeof o.length === "number") return { 9479 next: function next() { 9480 if (o && i >= o.length) o = void 0; 9481 return { value: o && o[i++], done: !o }; 9482 } 9483 }; 9484 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 9485}; 9486Object.defineProperty(exports, "__esModule", { value: true }); 9487var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 9488var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 9489var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts"); 9490var MDCLinearProgressFoundation = /** @class */function (_super) { 9491 __extends(MDCLinearProgressFoundation, _super); 9492 function MDCLinearProgressFoundation(adapter) { 9493 var _this = _super.call(this, __assign(__assign({}, MDCLinearProgressFoundation.defaultAdapter), adapter)) || this; 9494 _this.observer = null; 9495 return _this; 9496 } 9497 Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", { 9498 get: function get() {
9499 return constants_1.cssClasses; 9500 }, 9501 enumerable: true, 9502 configurable: true 9503 }); 9504 Object.defineProperty(MDCLinearProgressFoundation, "strings", { 9505 get: function get() { 9506 return constants_1.strings; 9507 }, 9508 enumerable: true, 9509 configurable: true 9510 }); 9511 Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", { 9512 get: function get() { 9513 return { 9514 addClass: function addClass() { 9515 return undefined; 9516 }, 9517 attachResizeObserver: function attachResizeObserver() { 9518 return null; 9519 }, 9520 forceLayout: function forceLayout() { 9521 return undefined; 9522 }, 9523 getWidth: function getWidth() { 9524 return 0; 9525 }, 9526 hasClass: function hasClass() { 9527 return false; 9528 }, 9529 setBufferBarStyle: function setBufferBarStyle() { 9530 return null; 9531 }, 9532 setPrimaryBarStyle: function setPrimaryBarStyle() { 9533 return null; 9534 }, 9535 setStyle: function setStyle() { 9536 return undefined; 9537 }, 9538 removeAttribute: function removeAttribute() { 9539 return undefined; 9540 }, 9541 removeClass: function removeClass() { 9542 return undefined; 9543 }, 9544 setAttribute: function setAttribute() { 9545 return undefined; 9546 } 9547 }; 9548 }, 9549 enumerable: true, 9550 configurable: true 9551 }); 9552 MDCLinearProgressFoundation.prototype.init = function () { 9553 var _this = this; 9554 this.isDeterminate = !this.adapter.hasClass(constants_1.cssClasse
9554s.INDETERMINATE_CLASS); 9555 this.adapter.addClass(constants_1.cssClasses.ANIMATION_READY_CLASS); 9556 this.progress = 0; 9557 this.buffer = 1; 9558 this.observer = this.adapter.attachResizeObserver(function (entries) { 9559 var e_1, _a; 9560 if (_this.isDeterminate) { 9561 return; 9562 } 9563 try { 9564 for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) { 9565 var entry = entries_1_1.value; 9566 if (entry.contentRect) { 9567 _this.calculateAndSetDimensions(entry.contentRect.width); 9568 } 9569 } 9570 } catch (e_1_1) { 9571 e_1 = { error: e_1_1 }; 9572 } finally { 9573 try { 9574 if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1); 9575 } finally { 9576 if (e_1) throw e_1.error; 9577 } 9578 } 9579 }); 9580 if (!this.isDeterminate && this.observer) { 9581 this.calculateAndSetDimensions(this.adapter.getWidth()); 9582 } 9583 }; 9584 MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) { 9585 this.isDeterminate = isDeterminate; 9586 if (this.isDeterminate) {
9587 this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS); 9588 this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString()); 9589 this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMAX, '1'); 9590 this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMIN, '0'); 9591 this.setPrimaryBarProgress(this.progress); 9592 this.setBufferBarProgress(this.buffer); 9593 return; 9594 } 9595 if (this.observer) { 9596 this.calculateAndSetDimensions(this.adapter.getWidth()); 9597 } 9598 this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS); 9599 this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW); 9600 this.adapter.removeAttribute(constants_1.strings.ARIA_VALUEMAX); 9601 this.adapter.removeAttribute(constants_1.strings.ARIA_VALUEMIN); 9602 this.setPrimaryBarProgress(1); 9603 this.setBufferBarProgress(1); 9604 }; 9605 MDCLinearProgressFoundation.prototype.getDeterminate = function () { 9606 return this.isDeterminate; 9607 }; 9608 MDCLinearProgressFoundation.prototype.setProgress = function (value) { 9609 this.progress = value; 9610 if (this.isDeterminate) { 9611 this.setPrimaryBarProgress(value); 9612 this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, value.toString()); 9613 } 9614 }; 9615 MDCLinearProgressFoundation.prototype.getProgress = function () { 9616 return this.progress; 9617 }; 9618 MDCLinearProgressFoundation.prototype.setBuffer = function (value) { 9619 this.buffer = value; 9620 if (this.isDeterminate) { 9621 this.setBufferBarProgress(value); 9622 } 9623 }; 9624 MDCLinearProgressFoundation.prototype.open = function () {
9625 this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS); 9626 this.adapter.removeClass(constants_1.cssClasses.CLOSED_ANIMATION_OFF_CLASS); 9627 }; 9628 MDCLinearProgressFoundation.prototype.close = function () { 9629 this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS); 9630 }; 9631 /** 9632 * Handles the transitionend event emitted after `close()` is called and the 9633 * opacity fades out. This is so that animations are removed only after the 9634 * progress indicator is completely hidden. 9635 */ 9636 MDCLinearProgressFoundation.prototype.handleTransitionEnd = function () { 9637 if (this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS)) { 9638 this.adapter.addClass(constants_1.cssClasses.CLOSED_ANIMATION_OFF_CLASS); 9639 } 9640 }; 9641 MDCLinearProgressFoundation.prototype.destroy = function () { 9642 _super.prototype.destroy.call(this); 9643 if (this.observer) { 9644 this.observer.disconnect(); 9645 } 9646 }; 9647 MDCLinearProgressFoundation.prototype.restartAnimation = function () {
9648 this.adapter.removeClass(constants_1.cssClasses.ANIMATION_READY_CLASS); 9649 this.adapter.forceLayout(); 9650 this.adapter.addClass(constants_1.cssClasses.ANIMATION_READY_CLASS); 9651 }; 9652 MDCLinearProgressFoundation.prototype.setPrimaryBarProgress = function (progressValue) { 9653 var value = "scaleX(" + progressValue + ")"; 9654 // Accessing `window` without a `typeof` check will throw on Node 9655 // environments. 9656 var transformProp = typeof window !== 'undefined' ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; 9657 this.adapter.setPrimaryBarStyle(transformProp, value); 9658 }; 9659 MDCLinearProgressFoundation.prototype.setBufferBarProgress = function (progressValue) { 9660 var value = progressValue * 100 + "%"; 9661 this.adapter.setBufferBarStyle(constants_1.strings.FLEX_BASIS, value); 9662 }; 9663 MDCLinearProgressFoundation.prototype.calculateAndSetDimensions = function (width) { 9664 var primaryHalf = width * constants_1.animationDimensionPercentages.PRIMARY_HALF; 9665 var primaryFull = width * constants_1.animationDimensionPercentages.PRIMARY_FULL; 9666 var secondaryQuarter = width * constants_1.animationDimensionPercentages.SECONDARY_QUARTER; 9667 var secondaryHalf = width * constants_1.animationDimensionPercentages.SECONDARY_HALF; 9668 var secondaryFull = width * constants_1.animationDimensionPercentages.SECONDARY_FULL; 9669 this.adapter.setStyle('--mdc-linear-progress-primary-half', primaryHalf + "px"); 9670 this.adapter.setStyle('--mdc-linear-progress-primary-half-neg', -primaryHalf + "px"); 9671 this.adapter.setStyle('--mdc-linear-progress-primary-full', primaryFull + "px"); 9672 this.adapter.setStyle('--mdc-linear-progress-primary-full-neg', -primaryFull + "px"); 9673 this.adapter.setStyle('--mdc-linear-progress-secondary-quarter', secondaryQuarter + "px"); 9674 this.adapter.setStyle('--mdc-linear-progress-secondary-quarter-neg', -secondaryQuarter + "px"); 9675 this.adapter.setStyle('--mdc-linear-progress-secondary-half', secondaryHalf + "px"); 9676 this.adapter.setStyle('--mdc-linear-progress-secondary-half-neg', -secondaryHalf + "px"); 9677 this.adapter.setStyle('--mdc-linear-progress-secondary-full', secondaryFull + "px"); 9678 this.adapter.setStyle('--mdc-linear-progress-secondary-full-neg', -secondaryFull + "px"); 9679 // need to restart animation for custom props to apply to keyframes 9680 this.restartAnimation(); 9681 }; 9682 return MDCLinearProgressFoundation; 9683}(foundation_1.MDCFoundation); 9684exports.MDCLinearProgressFoundation = MDCLinearProgressFoundation; 9685// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 9686exports.default = MDCLinearProgressFoundation; 9687 9688/***/ }), 9689
9690/***/ "./packages/mdc-linear-progress/index.ts": 9691/*!***********************************************!*\ 9692 !*** ./packages/mdc-linear-progress/index.ts ***! 9693 \***********************************************/ 9694/*! no static exports found */ 9695/***/ (function(module, exports, __webpack_require__) { 9696 9697"use strict"; 9698 9699/** 9700 * @license 9701 * Copyright 2019 Google Inc. 9702 * 9703 * Permission is hereby granted, free of charge, to any person obtaining a copy 9704 * of this software and associated documentation files (the "Software"), to deal 9705 * in the Software without restriction, including without limitation the rights 9706 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9707 * copies of the Software, and to permit persons to whom the Software is 9708 * furnished to do so, subject to the following conditions: 9709 * 9710 * The above copyright notice and this permission notice shall be included in 9711 * all copies or substantial portions of the Software. 9712 * 9713 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9714 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9715 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9716 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9717 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9718 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9719 * THE SOFTWARE. 9720 */ 9721 9722function __export(m) { 9723 for (var p in m) { 9724 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 9725 } 9726} 9727Object.defineProperty(exports, "__esModule", { value: true }); 9728__export(__webpack_require__(/*! ./component */ "./packages/mdc-linear-progress/component.ts")); 9729__export(__webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts")); 9730__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts")); 9731 9732/***/ }), 9733
9734/***/ "./packages/mdc-list/component.ts": 9735/*!****************************************!*\ 9736 !*** ./packages/mdc-list/component.ts ***! 9737 \****************************************/ 9738/*! no static exports found */ 9739/***/ (function(module, exports, __webpack_require__) { 9740 9741"use strict"; 9742 9743/** 9744 * @license 9745 * Copyright 2018 Google Inc. 9746 * 9747 * Permission is hereby granted, free of charge, to any person obtaining a copy 9748 * of this software and associated documentation files (the "Software"), to deal 9749 * in the Software without restriction, including without limitation the rights 9750 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9751 * copies of the Software, and to permit persons to whom the Software is 9752 * furnished to do so, subject to the following conditions: 9753 * 9754 * The above copyright notice and this permission notice shall be included in 9755 * all copies or substantial portions of the Software. 9756 * 9757 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9758 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9759 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9760 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9761 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9762 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9763 * THE SOFTWARE. 9764 */ 9765 9766var __extends = this && this.__extends || function () { 9767 var _extendStatics = function extendStatics(d, b) { 9768 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9769 d.__proto__ = b; 9770 } || function (d, b) { 9771 for (var p in b) { 9772 if (b.hasOwnProperty(p)) d[p] = b[p]; 9773 } 9774 }; 9775 return _extendStatics(d, b); 9776 }; 9777 return function (d, b) { 9778 _extendStatics(d, b); 9779 function __() { 9780 this.constructor = d; 9781 } 9782 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9783 }; 9784}(); 9785Object.defineProperty(exports, "__esModule", { value: true }); 9786var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 9787var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 9788var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); 9789var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts"); 9790var MDCList = /** @class */function (_super) { 9791 __extends(MDCList, _super); 9792 function MDCList() { 9793 return _super !== null && _super.apply(this, arguments) || this; 9794 } 9795 Object.defineProperty(MDCList.prototype, "vertical", { 9796 set: function set(value) { 9797 this.foundation.setVerticalOrientation(value); 9798 }, 9799 enumerable: true, 9800 configurable: true 9801 }); 9802 Object.defineProperty(MDCList.prototype, "listElements", { 9803 get: function get() { 9804 return Array.from(this.root.querySelectorAll("." + this.classNameMap[constants_1.cssClasse
9804s.LIST_ITEM_CLASS])); 9805 }, 9806 enumerable: true, 9807 configurable: true 9808 }); 9809 Object.defineProperty(MDCList.prototype, "wrapFocus", { 9810 set: function set(value) { 9811 this.foundation.setWrapFocus(value); 9812 }, 9813 enumerable: true, 9814 configurable: true 9815 }); 9816 Object.defineProperty(MDCList.prototype, "typeaheadInProgress", { 9817 /** 9818 * @return Whether typeahead is currently matching a user-specified prefix. 9819 */ 9820 get: function get() { 9821 return this.foundation.isTypeaheadInProgress(); 9822 }, 9823 enumerable: true, 9824 configurable: true 9825 }); 9826 Object.defineProperty(MDCList.prototype, "hasTypeahead", { 9827 /** 9828 * Sets whether typeahead functionality is enabled on the list. 9829 * @param hasTypeahead Whether typeahead is enabled. 9830 */ 9831 set: function set(hasTypeahead) { 9832 this.foundation.setHasTypeahead(hasTypeahead); 9833 }, 9834 enumerable: true, 9835 configurable: true 9836 }); 9837 Object.defineProperty(MDCList.prototype, "singleSelection", { 9838 set: function set(isSingleSelectionList) { 9839 this.foundation.setSingleSelection(isSingleSelectionList); 9840 }, 9841 enumerable: true, 9842 configurable: true 9843 }); 9844 Object.defineProperty(MDCList.prototype, "selectedIndex", { 9845 get: function get() { 9846 return this.foundation.getSelectedIndex(); 9847 }, 9848 set: function set(index) { 9849 this.foundation.setSelectedIndex(index); 9850 }, 9851 enumerable: true, 9852 configurable: true 9853 }); 9854 MDCList.attachTo = function (root) { 9855 return new MDCList(root); 9856 }; 9857 MDCList.prototype.initialSyncWithDOM = function () { 9858 this.isEvolutionEnabled = constants_1.evolutionAttribute in this.root.dataset; 9859 this.classNameMap = this.isEvolutionEnabled ? constants_1.evolutionClassNameMap : Object.values(constants_1.cssClasse
9859s).reduce(function (obj, className) { 9860 obj[className] = className; 9861 return obj; 9862 }, {}); 9863 this.handleClick = this.handleClickEvent.bind(this); 9864 this.handleKeydown = this.handleKeydownEvent.bind(this); 9865 this.focusInEventListener = this.handleFocusInEvent.bind(this); 9866 this.focusOutEventListener = this.handleFocusOutEvent.bind(this); 9867 this.listen('keydown', this.handleKeydown); 9868 this.listen('click', this.handleClick); 9869 this.listen('focusin', this.focusInEventListener); 9870 this.listen('focusout', this.focusOutEventListener); 9871 this.layout(); 9872 this.initializeListType(); 9873 this.ensureFocusable(); 9874 }; 9875 MDCList.prototype.destroy = function () { 9876 this.unlisten('keydown', this.handleKeydown); 9877 this.unlisten('click', this.handleClick); 9878 this.unlisten('focusin', this.focusInEventListener); 9879 this.unlisten('focusout', this.focusOutEventListener); 9880 }; 9881 MDCList.prototype.layout = function () { 9882 var direction = this.root.getAttribute(constants_1.strings.ARIA_ORIENTATION); 9883 this.vertical = direction !== constants_1.strings.ARIA_ORIENTATION_HORIZONTAL; 9884 var itemSelector = "." + this.classNameMap[constants_1.cssClasse
9884s.LIST_ITEM_CLASS] + ":not([tabindex])"; 9885 var childSelector = "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + " " + constants_1.strings.FOCUSABLE_CHILD_ELEMENTS; 9886 // List items need to have at least tabindex=-1 to be focusable. 9887 Array.prototype.forEach.call(this.root.querySelectorAll(itemSelector), function (el) { 9888 el.setAttribute('tabindex', '-1'); 9889 }); 9890 // Child button/a elements are not tabbable until the list item is focused. 9891 Array.prototype.forEach.call(this.root.querySelectorAll(childSelector), function (el) { 9892 el.setAttribute('tabindex', '-1'); 9893 }); 9894 if (this.isEvolutionEnabled) { 9895 this.foundation.setUseSelectedAttribute(true); 9896 } 9897 this.foundation.layout(); 9898 }; 9899 /** 9900 * Extracts the primary text from a list item. 9901 * @param item The list item element. 9902 * @return The primary text in the element. 9903 */ 9904 MDCList.prototype.getPrimaryText = function (item) { 9905 var _a; 9906 var primaryText = item.querySelector("." + this.classNameMap[constants_1.cssClasse
9906s.LIST_ITEM_PRIMARY_TEXT_CLASS]); 9907 if (this.isEvolutionEnabled || primaryText) { 9908 return (_a = primaryText === null || primaryText === void 0 ? void 0 : primaryText.textContent) !== null && _a !== void 0 ? _a : ''; 9909 } 9910 var singleLineText = item.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_TEXT_CLASS]); 9911 return singleLineText && singleLineText.textContent || ''; 9912 }; 9913 /** 9914 * Initialize selectedIndex value based on pre-selected list items. 9915 */ 9916 MDCList.prototype.initializeListType = function () { 9917 var _this = this; 9918 this.isInteractive = ponyfill_1.matches(this.root, constants_1.strings.ARIA_INTERACTIVE_ROLES_SELECTOR); 9919 if (this.isEvolutionEnabled && this.isInteractive) { 9920 var selection = Array.from(this.root.querySelectorAll(constants_1.strings.SELECTED_ITEM_SELECTOR), function (listItem) { 9921 return _this.listElements.indexOf(listItem); 9922 }); 9923 if (ponyfill_1.matches(this.root, constants_1.strings.ARIA_MULTI_SELECTABLE_SELECTOR)) { 9924 this.selectedIndex = selection; 9925 } else if (selection.length > 0) { 9926 this.selectedIndex = selection[0]; 9927 } 9928 return; 9929 } 9930 var checkboxListItems = this.root.querySelectorAll(constants_1.strings.ARIA_ROLE_CHECKBOX_SELECTOR); 9931 var radioSelectedListItem = this.root.querySelector(constants_1.strings.ARIA_CHECKED_RADIO_SELECTOR); 9932 if (checkboxListItems.length) { 9933 var preselectedItems = this.root.querySelectorAll(constants_1.strings.ARIA_CHECKED_CHECKBOX_SELECTOR); 9934 this.selectedIndex = Array.from(preselectedItems, function (listItem) { 9935 return _this.listElements.indexOf(listItem); 9936 }); 9937 } else if (radioSelectedListItem) { 9938 this.selectedIndex = this.listElements.indexOf(radioSelectedListItem); 9939 } 9940 }; 9941 /** 9942 * Updates the list item at itemIndex to the desired isEnabled state. 9943 * @param itemIndex Index of the list item 9944 * @param isEnabled Sets the list item to enabled or disabled. 9945 */ 9946 MDCList.prototype.setEnabled = function (itemIndex, isEnabled) { 9947 this.foundation.setEnabled(itemIndex, isEnabled); 9948 }; 9949 /** 9950 * Given the next desired character from the user, adds it to the typeahead 9951 * buffer. Then, attempts to find the next option matching the buffer. Wraps 9952 * around if at the end of options. 9953 * 9954 * @param nextChar The next character to add to the prefix buffer. 9955 * @param startingIndex The index from which to start matching. Defaults to 9956 * the currently focused index. 9957 * @return The index of the matched item. 9958 */ 9959 MDCList.prototype.typeaheadMatchItem = function (nextChar, startingIndex) { 9960 return this.foundation.typeaheadMatchItem(nextChar, startingIndex, /** skipFocus */true); 9961 }; 9962 MDCList.prototype.getDefaultFoundation = function () { 9963 var _this = this; 9964 // DO NOT INLINE this variable. For backward compatibility, foundations take 9965 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 9966 // methods, we need a separate, strongly typed adapter variable. 9967 var adapter = { 9968 addClassForElementIndex: function addClassForElementIndex(index, className) { 9969 var element = _this.listElements[index]; 9970 if (element) { 9971 element.classList.add(_this.classNameMap[className]); 9972 } 9973 }, 9974 focusItemAtIndex: function focusItemAtIndex(index) { 9975 var element = _this.listElements[index]; 9976 if (element) { 9977 element.focus(); 9978 } 9979 }, 9980 getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) { 9981 return _this.listElements[index].getAttribute(attr); 9982 }, 9983 getFocusedElementIndex: function getFocusedElementIndex() { 9984 return _this.listElements.indexOf(document.activeElement); 9985 }, 9986 getListItemCount: function getListItemCount() { 9987 return _this.listElements.length; 9988 }, 9989 getPrimaryTextAtIndex: function getPrimaryTextAtIndex(index) { 9990 return _this.getPrimaryText(_this.listElements[index]); 9991 }, 9992 hasCheckboxAtIndex: function hasCheckboxAtIndex(index) { 9993 var listItem = _this.listElements[index]; 9994 return !!listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR); 9995 }, 9996 hasRadioAtIndex: function hasRadioAtIndex(index) { 9997 var listItem = _this.listElements[index]; 9998 return !!listItem.querySelector(constants_1.strings.RADIO_SELECTOR); 9999 }, 10000 isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) { 10001 var listItem = _this.listElements[index]; 10002 var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR); 10003 return toggleEl.checked; 10004 }, 10005 isFocusInsideList: function isFocusInsideList() { 10006 return _this.root !== document.activeElement && _this.root.contains(document.activeElement); 10007 }, 10008 isRootFocused: function isRootFocused() { 10009 return document.activeElement === _this.root; 10010 }, 10011 listItemAtIndexHasClass: function listItemAtIndexHasClass(index, className) { 10012 return _this.listElements[index].classList.contains(_this.classNameMap[className]); 10013 }, 10014 notifyAction: function notifyAction(index) {
10015 _this.emit(constants_1.strings.ACTION_EVENT, { index: index }, /** shouldBubble */true); 10016 }, 10017 removeClassForElementIndex: function removeClassForElementIndex(index, className) { 10018 var element = _this.listElements[index]; 10019 if (element) { 10020 element.classList.remove(_this.classNameMap[className]); 10021 } 10022 }, 10023 setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { 10024 var element = _this.listElements[index]; 10025 if (element) { 10026 element.setAttribute(attr, value); 10027 } 10028 }, 10029 setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) { 10030 var listItem = _this.listElements[index]; 10031 var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_RADIO_SELECTOR); 10032 toggleEl.checked = isChecked; 10033 var event = document.createEvent('Event'); 10034 event.initEvent('change', true, true); 10035 toggleEl.dispatchEvent(event); 10036 }, 10037 setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { 10038 var element = _this.listElements[listItemIndex]; 10039 var selector = "." + _this.classNameMap[constants_1.cssClasse
10039s.LIST_ITEM_CLASS] + " " + constants_1.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX; 10040 Array.prototype.forEach.call(element.querySelectorAll(selector), function (el) { 10041 el.setAttribute('tabindex', tabIndexValue); 10042 }); 10043 } 10044 }; 10045 return new foundation_1.MDCListFoundation(adapter); 10046 }; 10047 /** 10048 * Ensures that at least one item is focusable if the list is interactive and 10049 * doesn't specify a suitable tabindex. 10050 */ 10051 MDCList.prototype.ensureFocusable = function () { 10052 if (this.isEvolutionEnabled && this.isInteractive) { 10053 if (!this.root.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + "[tabindex=\"0\"]")) { 10054 var index = this.initialFocusIndex(); 10055 if (index !== -1) { 10056 this.listElements[index].tabIndex = 0; 10057 } 10058 } 10059 } 10060 }; 10061 MDCList.prototype.initialFocusIndex = function () { 10062 if (this.selectedIndex instanceof Array && this.selectedIndex.length > 0) { 10063 return this.selectedIndex[0]; 10064 } 10065 if (typeof this.selectedIndex === 'number' && this.selectedIndex !== constants_1.numbers.UNSET_INDEX) { 10066 return this.selectedIndex; 10067 } 10068 var el = this.root.querySelector("." + this.classNameMap[constants_1.cssClasse
10068s.LIST_ITEM_CLASS] + ":not(." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS] + ")"); 10069 if (el === null) { 10070 return -1; 10071 } 10072 return this.getListItemIndex(el); 10073 }; 10074 /** 10075 * Used to figure out which list item this event is targetting. Or returns -1 10076 * if there is no list item 10077 */ 10078 MDCList.prototype.getListItemIndex = function (el) { 10079 var nearestParent = ponyfill_1.closest(el, "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + ", ." + this.classNameMap[constants_1.cssClasses.ROOT]); 10080 // Get the index of the element if it is a list item. 10081 if (nearestParent && ponyfill_1.matches(nearestParent, "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS])) { 10082 return this.listElements.indexOf(nearestParent); 10083 } 10084 return -1; 10085 }; 10086 /** 10087 * Used to figure out which element was clicked before sending the event to 10088 * the foundation. 10089 */ 10090 MDCList.prototype.handleFocusInEvent = function (evt) { 10091 var index = this.getListItemIndex(evt.target); 10092 this.foundation.handleFocusIn(evt, index); 10093 }; 10094 /** 10095 * Used to figure out which element was clicked before sending the event to 10096 * the foundation. 10097 */ 10098 MDCList.prototype.handleFocusOutEvent = function (evt) { 10099 var index = this.getListItemIndex(evt.target); 10100 this.foundation.handleFocusOut(evt, index); 10101 }; 10102 /** 10103 * Used to figure out which element was focused when keydown event occurred 10104 * before sending the event to the foundation. 10105 */ 10106 MDCList.prototype.handleKeydownEvent = function (evt) { 10107 var index = this.getListItemIndex(evt.target); 10108 var target = evt.target; 10109 this.foundation.handleKeydown(evt, target.classList.contains(this.classNameMap[constants_1.cssClasse
10109s.LIST_ITEM_CLASS]), index); 10110 }; 10111 /** 10112 * Used to figure out which element was clicked before sending the event to 10113 * the foundation. 10114 */ 10115 MDCList.prototype.handleClickEvent = function (evt) { 10116 var index = this.getListItemIndex(evt.target); 10117 var target = evt.target; 10118 // Toggle the checkbox only if it's not the target of the event, or the 10119 // checkbox will have 2 change events. 10120 var toggleCheckbox = !ponyfill_1.matches(target, constants_1.strings.CHECKBOX_RADIO_SELECTOR); 10121 this.foundation.handleClick(index, toggleCheckbox); 10122 }; 10123 return MDCList; 10124}(component_1.MDCComponent); 10125exports.MDCList = MDCList; 10126 10127/***/ }), 10128
10129/***/ "./packages/mdc-list/constants.ts": 10130/*!****************************************!*\ 10131 !*** ./packages/mdc-list/constants.ts ***! 10132 \****************************************/ 10133/*! no static exports found */ 10134/***/ (function(module, exports, __webpack_require__) { 10135 10136"use strict"; 10137 10138/** 10139 * @license 10140 * Copyright 2018 Google Inc. 10141 * 10142 * Permission is hereby granted, free of charge, to any person obtaining a copy 10143 * of this software and associated documentation files (the "Software"), to deal 10144 * in the Software without restriction, including without limitation the rights 10145 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10146 * copies of the Software, and to permit persons to whom the Software is 10147 * furnished to do so, subject to the following conditions: 10148 * 10149 * The above copyright notice and this permission notice shall be included in 10150 * all copies or substantial portions of the Software. 10151 * 10152 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10153 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10154 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10155 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10156 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10157 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10158 * THE SOFTWARE. 10159 */ 10160 10161var _a; 10162Object.defineProperty(exports, "__esModule", { value: true });
10163var cssClasses = { 10164 LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated', 10165 LIST_ITEM_CLASS: 'mdc-list-item', 10166 LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled', 10167 LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected', 10168 LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text', 10169 LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text', 10170 ROOT: 'mdc-list' 10171}; 10172exports.cssClasses = cssClasses; 10173var strings = { 10174 ACTION_EVENT: 'MDCList:action', 10175 ARIA_CHECKED: 'aria-checked', 10176 ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]', 10177 ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]', 10178 ARIA_CURRENT: 'aria-current', 10179 ARIA_DISABLED: 'aria-disabled', 10180 ARIA_ORIENTATION: 'aria-orientation', 10181 ARIA_ORIENTATION_HORIZONTAL: 'horizontal', 10182 ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]', 10183 ARIA_SELECTED: 'aria-selected', 10184 ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]', 10185 ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]', 10186 CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]', 10187 CHECKBOX_SELECTOR: 'input[type="checkbox"]', 10188 CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: 'button:not(:disabled), a', 10189 FOCUSABLE_CHILD_ELEMENTS: 'button:not(:disabled), a, input[type="radio"]:not(:disabled), input[type="checkbox"]:not(:disabled)', 10190 RADIO_SELECTOR: 'input[type="radio"]', 10191 SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]' 10192}; 10193exports.strings = strings; 10194var numbers = { 10195 UNSET_INDEX: -1, 10196 TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300 10197}; 10198exports.numbers = numbers; 10199var evolutionClassNameMap = (_a = {}, _a["" + cssClasses.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-evolution-list-item--activated', _a["" + cssClasses.LIST_ITEM_CLASS] = 'mdc-evolution-list-item', _a["" + cssClasses.LIST_ITEM_DISABLED_CLASS] = 'mdc-evolution-list-item--disabled', _a["" + cssClasses.LIST_ITEM_SELECTED_CLASS] = 'mdc-evolution-list-item--selected', _a["" + cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-evolution-list-item__primary-text', _a["" + cssClasses.ROOT] = 'mdc-evolution-list', _a); 10200exports.evolutionClassNameMap = evolutionClassNameMap; 10201var evolutionAttribute = 'evolution'; 10202exports.evolutionAttribute = evolutionAttribute; 10203 10204/***/ }), 10205
10206/***/ "./packages/mdc-list/events.ts": 10207/*!*************************************!*\ 10208 !*** ./packages/mdc-list/events.ts ***! 10209 \*************************************/ 10210/*! no static exports found */ 10211/***/ (function(module, exports, __webpack_require__) { 10212 10213"use strict"; 10214 10215/** 10216 * @license 10217 * Copyright 2020 Google Inc. 10218 * 10219 * Permission is hereby granted, free of charge, to any person obtaining a copy 10220 * of this software and associated documentation files (the "Software"), to deal 10221 * in the Software without restriction, including without limitation the rights 10222 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10223 * copies of the Software, and to permit persons to whom the Software is 10224 * furnished to do so, subject to the following conditions: 10225 * 10226 * The above copyright notice and this permission notice shall be included in 10227 * all copies or substantial portions of the Software. 10228 * 10229 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10230 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10231 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10232 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10233 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10234 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10235 * THE SOFTWARE. 10236 */ 10237 10238Object.defineProperty(exports, "__esModule", { value: true }); 10239var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select']; 10240/**
10241 * Ensures that preventDefault is only called if the containing element 10242 * doesn't consume the event, and it will cause an unintended scroll. 10243 * 10244 * @param evt keyboard event to be prevented. 10245 */ 10246exports.preventDefaultEvent = function (evt) { 10247 var target = evt.target; 10248 if (!target) { 10249 return; 10250 } 10251 var tagName = ("" + target.tagName).toLowerCase(); 10252 if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) { 10253 evt.preventDefault(); 10254 } 10255}; 10256 10257/***/ }), 10258
10259/***/ "./packages/mdc-list/foundation.ts": 10260/*!*****************************************!*\ 10261 !*** ./packages/mdc-list/foundation.ts ***! 10262 \*****************************************/ 10263/*! no static exports found */ 10264/***/ (function(module, exports, __webpack_require__) { 10265 10266"use strict"; 10267 10268/** 10269 * @license 10270 * Copyright 2018 Google Inc. 10271 * 10272 * Permission is hereby granted, free of charge, to any person obtaining a copy 10273 * of this software and associated documentation files (the "Software"), to deal 10274 * in the Software without restriction, including without limitation the rights 10275 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10276 * copies of the Software, and to permit persons to whom the Software is 10277 * furnished to do so, subject to the following conditions: 10278 * 10279 * The above copyright notice and this permission notice shall be included in 10280 * all copies or substantial portions of the Software. 10281 * 10282 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10283 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10284 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10285 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10286 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10287 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10288 * THE SOFTWARE. 10289 */ 10290 10291var __extends = this && this.__extends || function () { 10292 var _extendStatics = function extendStatics(d, b) { 10293 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 10294 d.__proto__ = b; 10295 } || function (d, b) { 10296 for (var p in b) { 10297 if (b.hasOwnProperty(p)) d[p] = b[p]; 10298 } 10299 }; 10300 return _extendStatics(d, b); 10301 }; 10302 return function (d, b) { 10303 _extendStatics(d, b); 10304 function __() { 10305 this.constructor = d; 10306 } 10307 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10308 }; 10309}(); 10310var __assign = this && this.__assign || function () { 10311 __assign = Object.assign || function (t) { 10312 for (var s, i = 1, n = arguments.length; i < n; i++) { 10313 s = arguments[i]; 10314 for (var p in s) { 10315 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 10316 } 10317 } 10318 return t; 10319 }; 10320 return __assign.apply(this, arguments); 10321}; 10322var __importStar = this && this.__importStar || function (mod) { 10323 if (mod && mod.__esModule) return mod; 10324 var result = {}; 10325 if (mod != null) for (var k in mod) { 10326 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 10327 }result["default"] = mod; 10328 return result; 10329}; 10330Object.defineProperty(exports, "__esModule", { value: true }); 10331// TODO(b/152410470): Remove trailing underscores from private properties 10332// tslint:disable:strip-private-property-underscore 10333var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 10334var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 10335var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); 10336var events_1 = __webpack_require__(/*! ./events */ "./packages/mdc-list/events.ts"); 10337var typeahead = __importStar(__webpack_require__(/*! ./typeahead */ "./packages/mdc-list/typeahead.ts")); 10338function isNumberArray(selectedIndex) { 10339 return selectedIndex instanceof Array; 10340} 10341var MDCListFoundation = /** @class */function (_super) { 10342 __extends(MDCListFoundation, _super); 10343 function MDCListFoundation(adapter) { 10344 var _this = _super.call(this, __assign(__assign({}, MDCListFoundation.defaultAdapter), adapter)) || this; 10345 _this.wrapFocus_ = false; 10346 _this.isVertical_ = true; 10347 _this.isSingleSelectionList_ = false; 10348 _this.selectedIndex_ = constants_1.numbers.UNSET_INDEX; 10349 _this.focusedItemIndex = constants_1.numbers.UNSET_INDEX; 10350 _this.useActivatedClass_ = false; 10351 _this.useSelectedAttr_ = false;
10352 _this.ariaCurrentAttrValue_ = null; 10353 _this.isCheckboxList_ = false; 10354 _this.isRadioList_ = false; 10355 _this.hasTypeahead = false; 10356 // Transiently holds current typeahead prefix from user. 10357 _this.typeaheadState = typeahead.initState(); 10358 _this.sortedIndexByFirstChar = new Map(); 10359 return _this; 10360 } 10361 Object.defineProperty(MDCListFoundation, "strings", { 10362 get: function get() { 10363 return constants_1.strings; 10364 }, 10365 enumerable: true, 10366 configurable: true 10367 }); 10368 Object.defineProperty(MDCListFoundation, "cssClasses", { 10369 get: function get() { 10370 return constants_1.cssClasses; 10371 }, 10372 enumerable: true, 10373 configurable: true 10374 }); 10375 Object.defineProperty(MDCListFoundation, "numbers", { 10376 get: function get() { 10377 return constants_1.numbers; 10378 }, 10379 enumerable: true, 10380 configurable: true 10381 }); 10382 Object.defineProperty(MDCListFoundation, "defaultAdapter", { 10383 get: function get() { 10384 return { 10385 addClassForElementIndex: function addClassForElementIndex() { 10386 return undefined; 10387 }, 10388 focusItemAtIndex: function focusItemAtIndex() { 10389 return undefined; 10390 }, 10391 getAttributeForElementIndex: function getAttributeForElementIndex() { 10392 return null; 10393 }, 10394 getFocusedElementIndex: function getFocusedElementIndex() { 10395 return 0; 10396 }, 10397 getListItemCount: function getListItemCount() { 10398 return 0; 10399 }, 10400 hasCheckboxAtIndex: function hasCheckboxAtIndex() { 10401 return false; 10402 }, 10403 hasRadioAtIndex: function hasRadioAtIndex() { 10404 return false; 10405 }, 10406 isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() { 10407 return false; 10408 }, 10409 isFocusInsideList: function isFocusInsideList() { 10410 return false; 10411 }, 10412 isRootFocused: function isRootFocused() { 10413 return false; 10414 }, 10415 listItemAtIndexHasClass: function listItemAtIndexHasClass() { 10416 return false; 10417 }, 10418 notifyAction: function notifyAction() { 10419 return undefined; 10420 }, 10421 removeClassForElementIndex: function removeClassForElementIndex() { 10422 return undefined; 10423 }, 10424 setAttributeForElementIndex: function setAttributeForElementIndex() { 10425 return undefined; 10426 }, 10427 setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() { 10428 return undefined; 10429 }, 10430 setTabIndexForListItemChildren: function setTabIndexForListItemChildren() { 10431 return undefined; 10432 }, 10433 getPrimaryTextAtIndex: function getPrimaryTextAtIndex() { 10434 return ''; 10435 } 10436 }; 10437 }, 10438 enumerable: true, 10439 configurable: true 10440 }); 10441 MDCListFoundation.prototype.layout = function () { 10442 if (this.adapter.getListItemCount() === 0) { 10443 return; 10444 } 10445 // TODO(b/172274142): consider all items when determining the list's type. 10446 if (this.adapter.hasCheckboxAtIndex(0)) { 10447 this.isCheckboxList_ = true; 10448 } else if (this.adapter.hasRadioAtIndex(0)) { 10449 this.isRadioList_ = true; 10450 } else { 10451 this.maybeInitializeSingleSelection(); 10452 } 10453 if (this.hasTypeahead) { 10454 this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex(); 10455 } 10456 }; 10457 /** 10458 * Sets the private wrapFocus_ variable. 10459 */ 10460 MDCListFoundation.prototype.setWrapFocus = function (value) { 10461 this.wrapFocus_ = value; 10462 }; 10463 /** 10464 * Sets the isVertical_ private variable. 10465 */ 10466 MDCListFoundation.prototype.setVerticalOrientation = function (value) { 10467 this.isVertical_ = value; 10468 }; 10469 /** 10470 * Sets the isSingleSelectionList_ private variable. 10471 */ 10472 MDCListFoundation.prototype.setSingleSelection = function (value) { 10473 this.isSingleSelectionList_ = value; 10474 if (value) { 10475 this.maybeInitializeSingleSelection(); 10476 } 10477 }; 10478 /** 10479 * Automatically determines whether the list is single selection list. If so, 10480 * initializes the internal state to match the selected item. 10481 */ 10482 MDCListFoundation.prototype.maybeInitializeSingleSelection = function () { 10483 var listItemsCount = this.adapter.getListItemCount(); 10484 for (var i = 0; i < listItemsCount; i++) { 10485 var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasse
10485s.LIST_ITEM_SELECTED_CLASS); 10486 var hasActivatedClass = this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS); 10487 if (!(hasSelectedClass || hasActivatedClass)) { 10488 continue; 10489 } 10490 if (hasActivatedClass) { 10491 this.setUseActivatedClass(true); 10492 } 10493 this.isSingleSelectionList_ = true; 10494 this.selectedIndex_ = i; 10495 return; 10496 } 10497 }; 10498 /** 10499 * Sets whether typeahead is enabled on the list. 10500 * @param hasTypeahead Whether typeahead is enabled. 10501 */ 10502 MDCListFoundation.prototype.setHasTypeahead = function (hasTypeahead) { 10503 this.hasTypeahead = hasTypeahead; 10504 if (hasTypeahead) { 10505 this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex(); 10506 } 10507 }; 10508 /** 10509 * @return Whether typeahead is currently matching a user-specified prefix. 10510 */ 10511 MDCListFoundation.prototype.isTypeaheadInProgress = function () { 10512 return this.hasTypeahead && typeahead.isTypingInProgress(this.typeaheadState); 10513 }; 10514 /** 10515 * Sets the useActivatedClass_ private variable. 10516 */ 10517 MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) { 10518 this.useActivatedClass_ = useActivated; 10519 }; 10520 /** 10521 * Sets the useSelectedAttr_ private variable. 10522 */ 10523 MDCListFoundation.prototype.setUseSelectedAttribute = function (useSelected) { 10524 this.useSelectedAttr_ = useSelected; 10525 }; 10526 MDCListFoundation.prototype.getSelectedIndex = function () { 10527 return this.selectedIndex_; 10528 }; 10529 MDCListFoundation.prototype.setSelectedIndex = function (index) { 10530 if (!this.isIndexValid_(index)) { 10531 return; 10532 } 10533 if (this.isCheckboxList_) { 10534 this.setCheckboxAtIndex_(index); 10535 } else if (this.isRadioList_) { 10536 this.setRadioAtIndex_(index); 10537 } else { 10538 this.setSingleSelectionAtIndex_(index); 10539 } 10540 }; 10541 /** 10542 * Focus in handler for the list items. 10543 */ 10544 MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) { 10545 if (listItemIndex >= 0) { 10546 this.focusedItemIndex = listItemIndex; 10547 this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '0'); 10548 this.adapter.setTabIndexForListItemChildren(listItemIndex, '0'); 10549 } 10550 }; 10551 /** 10552 * Focus out handler for the list items. 10553 */ 10554 MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) { 10555 var _this = this; 10556 if (listItemIndex >= 0) { 10557 this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '-1'); 10558 this.adapter.setTabIndexForListItemChildren(listItemIndex, '-1'); 10559 } 10560 /** 10561 * Between Focusout & Focusin some browsers do not have focus on any 10562 * element. Setting a delay to wait till the focus is moved to next element. 10563 */ 10564 setTimeout(function () { 10565 if (!_this.adapter.isFocusInsideList()) { 10566 _this.setTabindexToFirstSelectedOrFocusedItem(); 10567 } 10568 }, 0); 10569 }; 10570 /** 10571 * Key handler for the list. 10572 */ 10573 MDCListFoundation.prototype.handleKeydown = function (event, isRootListItem, listItemIndex) { 10574 var _this = this; 10575 var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft'; 10576 var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp'; 10577 var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight'; 10578 var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown'; 10579 var isHome = keyboard_1.normalizeKey(event) === 'Home'; 10580 var isEnd = keyboard_1.normalizeKey(event) === 'End'; 10581 var isEnter = keyboard_1.normalizeKey(event) === 'Enter'; 10582 var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar'; 10583 // Have to check both upper and lower case, because having caps lock on affects the value. 10584 var isLetterA = event.key === 'A' || event.key === 'a'; 10585 if (this.adapter.isRootFocused()) { 10586 if (isArrowUp || isEnd) { 10587 event.preventDefault(); 10588 this.focusLastElement(); 10589 } else if (isArrowDown || isHome) { 10590 event.preventDefault(); 10591 this.focusFirstElement(); 10592 } 10593 if (this.hasTypeahead) { 10594 var handleKeydownOpts = { 10595 event: event, 10596 focusItemAtIndex: function focusItemAtIndex(index) { 10597 _this.focusItemAtIndex(index); 10598 }, 10599 focusedItemIndex: -1, 10600 isTargetListItem: isRootListItem, 10601 sortedIndexByFirstChar: this.sortedIndexByFirstChar, 10602 isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { 10603 return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasse
10603s.LIST_ITEM_DISABLED_CLASS); 10604 } 10605 }; 10606 typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState); 10607 } 10608 return; 10609 } 10610 var currentIndex = this.adapter.getFocusedElementIndex(); 10611 if (currentIndex === -1) { 10612 currentIndex = listItemIndex; 10613 if (currentIndex < 0) { 10614 // If this event doesn't have a mdc-list-item ancestor from the 10615 // current list (not from a sublist), return early. 10616 return; 10617 } 10618 } 10619 if (this.isVertical_ && isArrowDown || !this.isVertical_ && isArrowRight) { 10620 events_1.preventDefaultEvent(event); 10621 this.focusNextElement(currentIndex); 10622 } else if (this.isVertical_ && isArrowUp || !this.isVertical_ && isArrowLeft) { 10623 events_1.preventDefaultEvent(event); 10624 this.focusPrevElement(currentIndex); 10625 } else if (isHome) { 10626 events_1.preventDefaultEvent(event); 10627 this.focusFirstElement(); 10628 } else if (isEnd) { 10629 events_1.preventDefaultEvent(event); 10630 this.focusLastElement(); 10631 } else if (isLetterA && event.ctrlKey && this.isCheckboxList_) { 10632 event.preventDefault(); 10633 this.toggleAll(this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_); 10634 } else if (isEnter || isSpace) { 10635 if (isRootListItem) { 10636 // Return early if enter key is pressed on anchor element which triggers 10637 // synthetic MouseEvent event. 10638 var target = event.target; 10639 if (target && target.tagName === 'A' && isEnter) { 10640 return; 10641 } 10642 events_1.preventDefaultEvent(event); 10643 if (this.adapter.listItemAtIndexHasClass(currentIndex, constants_1.cssClasse
10643s.LIST_ITEM_DISABLED_CLASS)) { 10644 return; 10645 } 10646 if (!this.isTypeaheadInProgress()) { 10647 if (this.isSelectableList_()) { 10648 this.setSelectedIndexOnAction_(currentIndex); 10649 } 10650 this.adapter.notifyAction(currentIndex); 10651 } 10652 } 10653 } 10654 if (this.hasTypeahead) { 10655 var handleKeydownOpts = { 10656 event: event, 10657 focusItemAtIndex: function focusItemAtIndex(index) { 10658 _this.focusItemAtIndex(index); 10659 }, 10660 focusedItemIndex: this.focusedItemIndex, 10661 isTargetListItem: isRootListItem, 10662 sortedIndexByFirstChar: this.sortedIndexByFirstChar, 10663 isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { 10664 return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); 10665 } 10666 }; 10667 typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState); 10668 } 10669 }; 10670 /** 10671 * Click handler for the list. 10672 */ 10673 MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) { 10674 if (index === constants_1.numbers.UNSET_INDEX) { 10675 return; 10676 } 10677 if (this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasse
10677s.LIST_ITEM_DISABLED_CLASS)) { 10678 return; 10679 } 10680 if (this.isSelectableList_()) { 10681 this.setSelectedIndexOnAction_(index, toggleCheckbox); 10682 } 10683 this.adapter.notifyAction(index); 10684 }; 10685 /** 10686 * Focuses the next element on the list. 10687 */ 10688 MDCListFoundation.prototype.focusNextElement = function (index) { 10689 var count = this.adapter.getListItemCount(); 10690 var nextIndex = index + 1; 10691 if (nextIndex >= count) { 10692 if (this.wrapFocus_) { 10693 nextIndex = 0; 10694 } else { 10695 // Return early because last item is already focused. 10696 return index; 10697 } 10698 } 10699 this.focusItemAtIndex(nextIndex); 10700 return nextIndex; 10701 }; 10702 /** 10703 * Focuses the previous element on the list. 10704 */ 10705 MDCListFoundation.prototype.focusPrevElement = function (index) { 10706 var prevIndex = index - 1; 10707 if (prevIndex < 0) { 10708 if (this.wrapFocus_) { 10709 prevIndex = this.adapter.getListItemCount() - 1; 10710 } else { 10711 // Return early because first item is already focused. 10712 return index; 10713 } 10714 } 10715 this.focusItemAtIndex(prevIndex); 10716 return prevIndex; 10717 }; 10718 MDCListFoundation.prototype.focusFirstElement = function () { 10719 this.focusItemAtIndex(0); 10720 return 0; 10721 }; 10722 MDCListFoundation.prototype.focusLastElement = function () { 10723 var lastIndex = this.adapter.getListItemCount() - 1; 10724 this.focusItemAtIndex(lastIndex); 10725 return lastIndex; 10726 }; 10727 MDCListFoundation.prototype.focusInitialElement = function () { 10728 var initialIndex = this.getFirstSelectedOrFocusedItemIndex(); 10729 this.focusItemAtIndex(initialIndex); 10730 return initialIndex; 10731 }; 10732 /** 10733 * @param itemIndex Index of the list item 10734 * @param isEnabled Sets the list item to enabled or disabled. 10735 */ 10736 MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) { 10737 if (!this.isIndexValid_(itemIndex)) { 10738 return; 10739 } 10740 if (isEnabled) { 10741 this.adapter.removeClassForElementIndex(itemIndex, constants_1.cssClasse
10741s.LIST_ITEM_DISABLED_CLASS); 10742 this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'false'); 10743 } else { 10744 this.adapter.addClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); 10745 this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'true'); 10746 } 10747 }; 10748 MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) { 10749 if (this.selectedIndex_ === index) { 10750 return; 10751 } 10752 var selectedClassName = constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS; 10753 if (this.useActivatedClass_) { 10754 selectedClassName = constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS; 10755 } 10756 if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { 10757 this.adapter.removeClassForElementIndex(this.selectedIndex_, selectedClassName); 10758 } 10759 this.setAriaForSingleSelectionAtIndex_(index); 10760 this.setTabindexAtIndex(index); 10761 if (index !== constants_1.numbers.UNSET_INDEX) { 10762 this.adapter.addClassForElementIndex(index, selectedClassName); 10763 } 10764 this.selectedIndex_ = index; 10765 }; 10766 /** 10767 * Sets aria attribute for single selection at given index. 10768 */ 10769 MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) { 10770 // Detect the presence of aria-current and get the value only during list 10771 // initialization when it is in unset state. 10772 if (this.selectedIndex_ === constants_1.numbers.UNSET_INDEX) { 10773 this.ariaCurrentAttrValue_ = this.adapter.getAttributeForElementIndex(index, constants_1.strings.ARIA_CURRENT); 10774 } 10775 var isAriaCurrent = this.ariaCurrentAttrValue_ !== null; 10776 var ariaAttribute = isAriaCurrent ? constants_1.strings.ARIA_CURRENT : constants_1.strings.ARIA_SELECTED; 10777 if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { 10778 this.adapter.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false'); 10779 } 10780 if (index !== constants_1.numbers.UNSET_INDEX) { 10781 var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true'; 10782 this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue); 10783 } 10784 }; 10785 /** 10786 * Returns the attribute to use for indicating selection status. 10787 */ 10788 MDCListFoundation.prototype.getSelectionAttribute = function () { 10789 return this.useSelectedAttr_ ? constants_1.strings.ARIA_SELECTED : constants_1.strings.ARIA_CHECKED; 10790 }; 10791 /** 10792 * Toggles radio at give index. Radio doesn't change the checked state if it 10793 * is already checked. 10794 */ 10795 MDCListFoundation.prototype.setRadioAtIndex_ = function (index) { 10796 var selectionAttribute = this.getSelectionAttribute(); 10797 this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true); 10798 if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { 10799 this.adapter.setAttributeForElementIndex(this.selectedIndex_, selectionAttribute, 'false'); 10800 } 10801 this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true'); 10802 this.selectedIndex_ = index; 10803 }; 10804 MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) { 10805 var selectionAttribute = this.getSelectionAttribute(); 10806 for (var i = 0; i < this.adapter.getListItemCount(); i++) { 10807 var isChecked = false; 10808 if (index.indexOf(i) >= 0) { 10809 isChecked = true; 10810 } 10811 this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked); 10812 this.adapter.setAttributeForElementIndex(i, selectionAttribute, isChecked ? 'true' : 'false'); 10813 } 10814 this.selectedIndex_ = index; 10815 }; 10816 MDCListFoundation.prototype.setTabindexAtIndex = function (index) { 10817 if (this.focusedItemIndex === constants_1.numbers.UNSET_INDEX && index !== 0) { 10818 // If some list item was selected set first list item's tabindex to -1. 10819 // Generally, tabindex is set to 0 on first list item of list that has no 10820 // preselected items. 10821 this.adapter.setAttributeForElementIndex(0, 'tabindex', '-1'); 10822 } else if (this.focusedItemIndex >= 0 && this.focusedItemIndex !== index) { 10823 this.adapter.setAttributeForElementIndex(this.focusedItemIndex, 'tabindex', '-1'); 10824 } 10825 // Set the previous selection's tabindex to -1. We need this because 10826 // in selection menus that are not visible, programmatically setting an 10827 // option will not change focus but will change where tabindex should be 0. 10828 if (!(this.selectedIndex_ instanceof Array) && this.selectedIndex_ !== index) { 10829 this.adapter.setAttributeForElementIndex(this.selectedIndex_, 'tabindex', '-1'); 10830 } 10831 if (index !== constants_1.numbers.UNSET_INDEX) { 10832 this.adapter.setAttributeForElementIndex(index, 'tabindex', '0'); 10833 } 10834 }; 10835 /** 10836 * @return Return true if it is single selectin list, checkbox list or radio 10837 * list. 10838 */ 10839 MDCListFoundation.prototype.isSelectableList_ = function () { 10840 return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_; 10841 }; 10842 MDCListFoundation.prototype.setTabindexToFirstSelectedOrFocusedItem = function () { 10843 var targetIndex = this.getFirstSelectedOrFocusedItemIndex(); 10844 this.setTabindexAtIndex(targetIndex); 10845 }; 10846 MDCListFoundation.prototype.getFirstSelectedOrFocusedItemIndex = function () { 10847 var targetIndex = this.focusedItemIndex >= 0 ? this.focusedItemIndex : 0; 10848 if (this.isSelectableList_()) { 10849 if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { 10850 targetIndex = this.selectedIndex_; 10851 } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) { 10852 targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { 10853 return Math.min(currentIndex, minIndex); 10854 }); 10855 } 10856 } 10857 return targetIndex; 10858 }; 10859 MDCListFoundation.prototype.isIndexValid_ = function (index) { 10860 var _this = this; 10861 if (index instanceof Array) { 10862 if (!this.isCheckboxList_) { 10863 throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list'); 10864 } 10865 if (index.length === 0) { 10866 return true; 10867 } else { 10868 return index.some(function (i) { 10869 return _this.isIndexInRange_(i); 10870 }); 10871 } 10872 } else if (typeof index === 'number') { 10873 if (this.isCheckboxList_) { 10874 throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + index); 10875 } 10876 return this.isIndexInRange_(index) || this.isSingleSelectionList_ && index === constants_1.numbers.UNSET_INDEX; 10877 } else { 10878 return false;
10879 } 10880 }; 10881 MDCListFoundation.prototype.isIndexInRange_ = function (index) { 10882 var listSize = this.adapter.getListItemCount(); 10883 return index >= 0 && index < listSize; 10884 }; 10885 /** 10886 * Sets selected index on user action, toggles checkbox / radio based on 10887 * toggleCheckbox value. User interaction should not toggle list item(s) when 10888 * disabled. 10889 */ 10890 MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) { 10891 if (toggleCheckbox === void 0) { 10892 toggleCheckbox = true; 10893 } 10894 if (this.isCheckboxList_) { 10895 this.toggleCheckboxAtIndex_(index, toggleCheckbox); 10896 } else { 10897 this.setSelectedIndex(index); 10898 } 10899 }; 10900 MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) { 10901 var selectionAttribute = this.getSelectionAttribute(); 10902 var isChecked = this.adapter.isCheckboxCheckedAtIndex(index); 10903 if (toggleCheckbox) { 10904 isChecked = !isChecked; 10905 this.adapter.setCheckedCheckboxOrRadioAtIndex(index, isChecked); 10906 } 10907 this.adapter.setAttributeForElementIndex(index, selectionAttribute, isChecked ? 'true' : 'false'); 10908 // If none of the checkbox items are selected and selectedIndex is not 10909 // initialized then provide a default value. 10910 var selectedIndexes = this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice(); 10911 if (isChecked) { 10912 selectedIndexes.push(index); 10913 } else { 10914 selectedIndexes = selectedIndexes.filter(function (i) { 10915 return i !== index; 10916 }); 10917 } 10918 this.selectedIndex_ = selectedIndexes; 10919 }; 10920 MDCListFoundation.prototype.focusItemAtIndex = function (index) { 10921 this.adapter.focusItemAtIndex(index); 10922 this.focusedItemIndex = index; 10923 }; 10924 MDCListFoundation.prototype.toggleAll = function (currentlySelectedIndexes) { 10925 var count = this.adapter.getListItemCount(); 10926 // If all items are selected, deselect everything. 10927 if (currentlySelectedIndexes.length === count) { 10928 this.setCheckboxAtIndex_([]); 10929 } else { 10930 // Otherwise select all enabled options. 10931 var allIndexes = []; 10932 for (var i = 0; i < count; i++) { 10933 if (!this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasse
10933s.LIST_ITEM_DISABLED_CLASS) || currentlySelectedIndexes.indexOf(i) > -1) { 10934 allIndexes.push(i); 10935 } 10936 } 10937 this.setCheckboxAtIndex_(allIndexes); 10938 } 10939 }; 10940 /** 10941 * Given the next desired character from the user, adds it to the typeahead 10942 * buffer. Then, attempts to find the next option matching the buffer. Wraps 10943 * around if at the end of options. 10944 * 10945 * @param nextChar The next character to add to the prefix buffer. 10946 * @param startingIndex The index from which to start matching. Only relevant 10947 * when starting a new match sequence. To start a new match sequence, 10948 * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer 10949 * to clear after a set interval defined in list foundation. Defaults to 10950 * the currently focused index. 10951 * @return The index of the matched item, or -1 if no match. 10952 */ 10953 MDCListFoundation.prototype.typeaheadMatchItem = function (nextChar, startingIndex, skipFocus) { 10954 var _this = this; 10955 if (skipFocus === void 0) { 10956 skipFocus = false; 10957 } 10958 var opts = { 10959 focusItemAtIndex: function focusItemAtIndex(index) { 10960 _this.focusItemAtIndex(index); 10961 }, 10962 focusedItemIndex: startingIndex ? startingIndex : this.focusedItemIndex, 10963 nextChar: nextChar, 10964 sortedIndexByFirstChar: this.sortedIndexByFirstChar, 10965 skipFocus: skipFocus, 10966 isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { 10967 return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasse
10967s.LIST_ITEM_DISABLED_CLASS); 10968 } 10969 }; 10970 return typeahead.matchItem(opts, this.typeaheadState); 10971 }; 10972 /** 10973 * Initializes the MDCListTextAndIndex data structure by indexing the current 10974 * list items by primary text. 10975 * 10976 * @return The primary texts of all the list items sorted by first character. 10977 */ 10978 MDCListFoundation.prototype.typeaheadInitSortedIndex = function () { 10979 return typeahead.initSortedIndex(this.adapter.getListItemCount(), this.adapter.getPrimaryTextAtIndex); 10980 }; 10981 /** 10982 * Clears the typeahead buffer. 10983 */ 10984 MDCListFoundation.prototype.clearTypeaheadBuffer = function () { 10985 typeahead.clearBuffer(this.typeaheadState); 10986 }; 10987 return MDCListFoundation; 10988}(foundation_1.MDCFoundation); 10989exports.MDCListFoundation = MDCListFoundation; 10990// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 10991exports.default = MDCListFoundation; 10992 10993/***/ }), 10994
10995/***/ "./packages/mdc-list/index.ts": 10996/*!************************************!*\ 10997 !*** ./packages/mdc-list/index.ts ***! 10998 \************************************/ 10999/*! no static exports found */ 11000/***/ (function(module, exports, __webpack_require__) { 11001 11002"use strict"; 11003 11004/** 11005 * @license 11006 * Copyright 2019 Google Inc. 11007 * 11008 * Permission is hereby granted, free of charge, to any person obtaining a copy 11009 * of this software and associated documentation files (the "Software"), to deal 11010 * in the Software without restriction, including without limitation the rights 11011 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11012 * copies of the Software, and to permit persons to whom the Software is 11013 * furnished to do so, subject to the following conditions: 11014 * 11015 * The above copyright notice and this permission notice shall be included in 11016 * all copies or substantial portions of the Software. 11017 * 11018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11021 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11022 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11023 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 11024 * THE SOFTWARE. 11025 */ 11026 11027function __export(m) { 11028 for (var p in m) { 11029 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 11030 } 11031} 11032Object.defineProperty(exports, "__esModule", { value: true }); 11033__export(__webpack_require__(/*! ./component */ "./packages/mdc-list/component.ts")); 11034__export(__webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts")); 11035__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts")); 11036 11037/***/ }), 11038
11039/***/ "./packages/mdc-list/typeahead.ts": 11040/*!****************************************!*\ 11041 !*** ./packages/mdc-list/typeahead.ts ***! 11042 \****************************************/ 11043/*! no static exports found */ 11044/***/ (function(module, exports, __webpack_require__) { 11045 11046"use strict"; 11047 11048/** 11049 * @license 11050 * Copyright 2020 Google Inc. 11051 * 11052 * Permission is hereby granted, free of charge, to any person obtaining a copy 11053 * of this software and associated documentation files (the "Software"), to deal 11054 * in the Software without restriction, including without limitation the rights 11055 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11056 * copies of the Software, and to permit persons to whom the Software is 11057 * furnished to do so, subject to the following conditions: 11058 * 11059 * The above copyright notice and this permission notice shall be included in 11060 * all copies or substantial portions of the Software. 11061 * 11062 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11063 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11064 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11065 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11066 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11067 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 11068 * THE SOFTWARE. 11069 */ 11070 11071Object.defineProperty(exports, "__esModule", { value: true }); 11072var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 11073var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); 11074var events_1 = __webpack_require__(/*! ./events */ "./packages/mdc-list/events.ts"); 11075/** 11076 * Initializes a state object for typeahead. Use the same reference for calls to 11077 * typeahead functions. 11078 * 11079 * @return The current state of the typeahead process. Each state reference 11080 * represents a typeahead instance as the reference is typically mutated 11081 * in-place. 11082 */ 11083function initState() { 11084 var state = { 11085 bufferClearTimeout: 0, 11086 currentFirstChar: '', 11087 sortedIndexCursor: 0, 11088 typeaheadBuffer: '' 11089 }; 11090 return state; 11091} 11092exports.initState = initState; 11093/** 11094 * Initializes typeahead state by indexing the current list items by primary 11095 * text into the sortedIndexByFirstChar data structure. 11096 * 11097 * @param listItemCount numer of items in the list 11098 * @param getPrimaryTextByItemIndex function that returns the primary text at a 11099 * given index 11100 * 11101 * @return Map that maps the first character of the primary text to the full 11102 * list text and it's index 11103 */ 11104function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) { 11105 var sortedIndexByFirstChar = new Map(); 11106 // Aggregate item text to index mapping 11107 for (var i = 0; i < listItemCount; i++) { 11108 var primaryText = getPrimaryTextByItemIndex(i).trim(); 11109 if (!primaryText) { 11110 continue; 11111 } 11112 var firstChar = primaryText[0].toLowerCase(); 11113 if (!sortedIndexByFirstChar.has(firstChar)) { 11114 sortedIndexByFirstChar.set(firstChar, []); 11115 } 11116 sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i }); 11117 } 11118 // Sort the mapping 11119 // TODO(b/157162694): Investigate replacing forEach with Map.values() 11120 sortedIndexByFirstChar.forEach(function (values) { 11121 values.sort(function (first, second) { 11122 return first.index - second.index; 11123 }); 11124 }); 11125 return sortedIndexByFirstChar; 11126} 11127exports.initSortedIndex = initSortedIndex; 11128/** 11129 * Given the next desired character from the user, it attempts to find the next 11130 * list option matching the buffer. Wraps around if at the end of options. 11131 * 11132 * @param opts Options and accessors 11133 * - nextChar - the next character to match against items 11134 * - sortedIndexByFirstChar - output of `initSortedIndex(...)` 11135 * - focusedItemIndex - the index of the currently focused item 11136 * - focusItemAtIndex - function that focuses a list item at given index 11137 * - skipFocus - whether or not to focus the matched item 11138 * - isItemAtIndexDisabled - function that determines whether an item at a 11139 * given index is disabled 11140 * @param state The typeahead state instance. See `initState`. 11141 * 11142 * @return The index of the matched item, or -1 if no match. 11143 */ 11144function matchItem(opts, state) { 11145 var nextChar = opts.nextChar, 11146 focusItemAtIndex = opts.focusItemAtIndex, 11147 sortedIndexByFirstChar = opts.sortedIndexByFirstChar, 11148 focusedItemIndex = opts.focusedItemIndex, 11149 skipFocus = opts.skipFocus, 11150 isItemAtIndexDisabled = opts.isItemAtIndexDisabled; 11151 clearTimeout(state.bufferClearTimeout); 11152 state.bufferClearTimeout = setTimeout(function () { 11153 clearBuffer(state); 11154 }, constants_1.numbers.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS); 11155 state.typeaheadBuffer = state.typeaheadBuffer + nextChar; 11156 var index; 11157 if (state.typeaheadBuffer.length === 1) { 11158 index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state); 11159 } else { 11160 index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state); 11161 } 11162 if (index !== -1 && !skipFocus) { 11163 focusItemAtIndex(index); 11164 } 11165 return index; 11166} 11167exports.matchItem = matchItem; 11168/** 11169 * Matches the user's single input character in the buffer to the 11170 * next option that begins with such character. Wraps around if at 11171 * end of options. Returns -1 if no match is found. 11172 */ 11173function matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state) { 11174 var firstChar = state.typeaheadBuffer[0];
11175 var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar); 11176 if (!itemsMatchingFirstChar) { 11177 return -1; 11178 } 11179 // Has the same firstChar been recently matched? 11180 // Also, did starting index remain the same between key presses? 11181 // If both hold true, simply increment index. 11182 if (firstChar === state.currentFirstChar && itemsMatchingFirstChar[state.sortedIndexCursor].index === focusedItemIndex) { 11183 state.sortedIndexCursor = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length; 11184 var newIndex = itemsMatchingFirstChar[state.sortedIndexCursor].index; 11185 if (!isItemAtIndexDisabled(newIndex)) { 11186 return newIndex; 11187 } 11188 } 11189 // If we're here, it means one of the following happened: 11190 // - either firstChar or startingIndex has changed, invalidating the 11191 // cursor. 11192 // - The next item of typeahead is disabled, so we have to look further. 11193 state.currentFirstChar = firstChar; 11194 var newCursorPosition = -1; 11195 var cursorPosition; 11196 // Find the first non-disabled item as a fallback. 11197 for (cursorPosition = 0; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) { 11198 if (!isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) { 11199 newCursorPosition = cursorPosition; 11200 break; 11201 } 11202 } 11203 // Advance cursor to first item matching the firstChar that is positioned 11204 // after starting item. Cursor is unchanged from fallback if there's no 11205 // such item. 11206 for (; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) { 11207 if (itemsMatchingFirstChar[cursorPosition].index > focusedItemIndex && !isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) { 11208 newCursorPosition = cursorPosition; 11209 break; 11210 } 11211 } 11212 if (newCursorPosition !== -1) { 11213 state.sortedIndexCursor = newCursorPosition; 11214 return itemsMatchingFirstChar[state.sortedIndexCursor].index; 11215 } 11216 return -1; 11217} 11218/** 11219 * Attempts to find the next item that matches all of the typeahead buffer. 11220 * Wraps around if at end of options. Returns -1 if no match is found. 11221 */ 11222function matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state) { 11223 var firstChar = state.typeaheadBuffer[0]; 11224 var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar); 11225 if (!itemsMatchingFirstChar) { 11226 return -1; 11227 } 11228 // Do nothing if text already matches 11229 var startingItem = itemsMatchingFirstChar[state.sortedIndexCursor]; 11230 if (startingItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0 && !isItemAtIndexDisabled(startingItem.index)) { 11231 return startingItem.index; 11232 } 11233 // Find next item that matches completely; if no match, we'll eventually 11234 // loop around to same position 11235 var cursorPosition = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length; 11236 var nextCursorPosition = -1; 11237 while (cursorPosition !== state.sortedIndexCursor) { 11238 var currentItem = itemsMatchingFirstChar[cursorPosition]; 11239 var matches = currentItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0; 11240 var isEnabled = !isItemAtIndexDisabled(currentItem.index); 11241 if (matches && isEnabled) { 11242 nextCursorPosition = cursorPosition; 11243 break; 11244 } 11245 cursorPosition = (cursorPosition + 1) % itemsMatchingFirstChar.length; 11246 } 11247 if (nextCursorPosition !== -1) { 11248 state.sortedIndexCursor = nextCursorPosition; 11249 return itemsMatchingFirstChar[state.sortedIndexCursor].index; 11250 } 11251 return -1; 11252} 11253/** 11254 * Whether or not the given typeahead instaance state is currently typing. 11255 * 11256 * @param state The typeahead state instance. See `initState`. 11257 */ 11258function isTypingInProgress(state) { 11259 return state.typeaheadBuffer.length > 0; 11260} 11261exports.isTypingInProgress = isTypingInProgress; 11262/** 11263 * Clears the typeahaed buffer so that it resets item matching to the first 11264 * character. 11265 * 11266 * @param state The typeahead state instance. See `initState`. 11267 */ 11268function clearBuffer(state) { 11269 state.typeaheadBuffer = ''; 11270} 11271exports.clearBuffer = clearBuffer; 11272/** 11273 * Given a keydown event, it calculates whether or not to automatically focus a 11274 * list item depending on what was typed mimicing the typeahead functionality of 11275 * a standard <select> element that is open. 11276 * 11277 * @param opts Options and accessors 11278 * - event - the KeyboardEvent to handle and parse 11279 * - sortedIndexByFirstChar - output of `initSortedIndex(...)` 11280 * - focusedItemIndex - the index of the currently focused item 11281 * - focusItemAtIndex - function that focuses a list item at given index 11282 * - isItemAtFocusedIndexDisabled - whether or not the currently focused item 11283 * is disabled 11284 * - isTargetListItem - whether or not the event target is a list item 11285 * @param state The typeahead state instance. See `initState`. 11286 * 11287 * @returns index of the item matched by the keydown. -1 if not matched. 11288 */ 11289function handleKeydown(opts, state) { 11290 var event = opts.event, 11291 isTargetListItem = opts.isTargetListItem, 11292 focusedItemIndex = opts.focusedItemIndex, 11293 focusItemAtIndex = opts.focusItemAtIndex, 11294 sortedIndexByFirstChar = opts.sortedIndexByFirstChar, 11295 isItemAtIndexDisabled = opts.isItemAtIndexDisabled; 11296 var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft'; 11297 var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp'; 11298 var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight'; 11299 var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown'; 11300 var isHome = keyboard_1.normalizeKey(event) === 'Home'; 11301 var isEnd = keyboard_1.normalizeKey(event) === 'End'; 11302 var isEnter = keyboard_1.normalizeKey(event) === 'Enter'; 11303 var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar'; 11304 if (isArrowLeft || isArrowUp || isArrowRight || isArrowDown || isHome || isEnd || isEnter) { 11305 return -1; 11306 } 11307 var isCharacterKey = !isSpace && event.key.length === 1; 11308 if (isCharacterKey) { 11309 events_1.preventDefaultEvent(event); 11310 var matchItemOpts = { 11311 focusItemAtIndex: focusItemAtIndex, 11312 focusedItemIndex: focusedItemIndex, 11313 nextChar: event.key.toLowerCase(), 11314 sortedIndexByFirstChar: sortedIndexByFirstChar, 11315 skipFocus: false, 11316 isItemAtIndexDisabled: isItemAtIndexDisabled 11317 }; 11318 return matchItem(matchItemOpts, state); 11319 } 11320 if (!isSpace) { 11321 return -1; 11322 } 11323 if (isTargetListItem) { 11324 events_1.preventDefaultEvent(event); 11325 } 11326 var typeaheadOnListItem = isTargetListItem && isTypingInProgress(state); 11327 if (typeaheadOnListItem) { 11328 var matchItemOpts = { 11329 focusItemAtIndex: focusItemAtIndex, 11330 focusedItemIndex: focusedItemIndex, 11331 nextChar: ' ', 11332 sortedIndexByFirstChar: sortedIndexByFirstChar, 11333 skipFocus: false, 11334 isItemAtIndexDisabled: isItemAtIndexDisabled 11335 }; 11336 // space participates in typeahead matching if in rapid typing mode 11337 return matchItem(matchItemOpts, state); 11338 } 11339 return -1; 11340} 11341exports.handleKeydown = handleKeydown; 11342 11343/***/ }), 11344
11345/***/ "./packages/mdc-menu-surface/component.ts": 11346/*!************************************************!*\ 11347 !*** ./packages/mdc-menu-surface/component.ts ***! 11348 \************************************************/ 11349/*! no static exports found */ 11350/***/ (function(module, exports, __webpack_require__) { 11351 11352"use strict"; 11353 11354/** 11355 * @license 11356 * Copyright 2018 Google Inc. 11357 * 11358 * Permission is hereby granted, free of charge, to any person obtaining a copy 11359 * of this software and associated documentation files (the "Software"), to deal 11360 * in the Software without restriction, including without limitation the rights 11361 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11362 * copies of the Software, and to permit persons to whom the Software is 11363 * furnished to do so, subject to the following conditions: 11364 * 11365 * The above copyright notice and this permission notice shall be included in 11366 * all copies or substantial portions of the Software. 11367 * 11368 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11369 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11370 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11371 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11372 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11373 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 11374 * THE SOFTWARE. 11375 */ 11376 11377var __extends = this && this.__extends || function () { 11378 var _extendStatics = function extendStatics(d, b) { 11379 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 11380 d.__proto__ = b; 11381 } || function (d, b) { 11382 for (var p in b) { 11383 if (b.hasOwnProperty(p)) d[p] = b[p]; 11384 } 11385 }; 11386 return _extendStatics(d, b); 11387 }; 11388 return function (d, b) { 11389 _extendStatics(d, b); 11390 function __() { 11391 this.constructor = d; 11392 } 11393 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 11394 }; 11395}(); 11396Object.defineProperty(exports, "__esModule", { value: true }); 11397var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 11398var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"); 11399var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts"); 11400var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 11401var MDCMenuSurface = /** @class */function (_super) { 11402 __extends(MDCMenuSurface, _super); 11403 function MDCMenuSurface() { 11404 return _super !== null && _super.apply(this, arguments) || this; 11405 } 11406 MDCMenuSurface.attachTo = function (root) { 11407 return new MDCMenuSurface(root); 11408 }; 11409 MDCMenuSurface.prototype.initialSyncWithDOM = function () { 11410 var _this = this; 11411 var parentEl = this.root.parentElement; 11412 this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasse
11412s.ANCHOR) ? parentEl : null; 11413 if (this.root.classList.contains(constants_1.cssClasses.FIXED)) { 11414 this.setFixedPosition(true); 11415 } 11416 this.handleKeydown = function (event) { 11417 _this.foundation.handleKeydown(event); 11418 }; 11419 this.handleBodyClick = function (event) { 11420 _this.foundation.handleBodyClick(event); 11421 }; 11422 // capture so that no race between handleBodyClick and quickOpen when 11423 // menusurface opened on button click which registers this listener 11424 this.registerBodyClickListener = function () { 11425 document.body.addEventListener('click', _this.handleBodyClick, { capture: true }); 11426 }; 11427 this.deregisterBodyClickListener = function () { 11428 document.body.removeEventListener('click', _this.handleBodyClick, { capture: true }); 11429 }; 11430 this.listen('keydown', this.handleKeydown); 11431 this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener); 11432 this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener); 11433 }; 11434 MDCMenuSurface.prototype.destroy = function () { 11435 this.unlisten('keydown', this.handleKeydown); 11436 this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener); 11437 this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener); 11438 _super.prototype.destroy.call(this); 11439 }; 11440 MDCMenuSurface.prototype.isOpen = function () { 11441 return this.foundation.isOpen(); 11442 }; 11443 MDCMenuSurface.prototype.open = function () { 11444 this.foundation.open(); 11445 }; 11446 MDCMenuSurface.prototype.close = function (skipRestoreFocus) { 11447 if (skipRestoreFocus === void 0) { 11448 skipRestoreFocus = false; 11449 } 11450 this.foundation.close(skipRestoreFocus); 11451 }; 11452 Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", { 11453 set: function set(quickOpen) { 11454 this.foundation.setQuickOpen(quickOpen); 11455 }, 11456 enumerable: true, 11457 configurable: true 11458 }); 11459 /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ 11460 MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) { 11461 this.foundation.setIsHoisted(isHoisted); 11462 }; 11463 /** Sets the element that the menu-surface is anchored to. */ 11464 MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) { 11465 this.anchorElement = element; 11466 }; 11467 /** Sets the menu-surface to position: fixed. */ 11468 MDCMenuSurface.prototype.setFixedPosition = function (isFixed) { 11469 if (isFixed) {
11470 this.root.classList.add(constants_1.cssClasses.FIXED); 11471 } else { 11472 this.root.classList.remove(constants_1.cssClasses.FIXED); 11473 } 11474 this.foundation.setFixedPosition(isFixed); 11475 }; 11476 /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */ 11477 MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) { 11478 this.foundation.setAbsolutePosition(x, y); 11479 this.setIsHoisted(true); 11480 }; 11481 /** 11482 * @param corner Default anchor corner alignment of top-left surface corner. 11483 */ 11484 MDCMenuSurface.prototype.setAnchorCorner = function (corner) { 11485 this.foundation.setAnchorCorner(corner); 11486 }; 11487 MDCMenuSurface.prototype.setAnchorMargin = function (margin) { 11488 this.foundation.setAnchorMargin(margin); 11489 }; 11490 MDCMenuSurface.prototype.getDefaultFoundation = function () { 11491 var _this = this; 11492 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 11493 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 11494 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 11495 var adapter = { 11496 addClass: function addClass(className) { 11497 return _this.root.classList.add(className); 11498 }, 11499 removeClass: function removeClass(className) { 11500 return _this.root.classList.remove(className); 11501 }, 11502 hasClass: function hasClass(className) { 11503 return _this.root.classList.contains(className); 11504 }, 11505 hasAnchor: function hasAnchor() { 11506 return !!_this.anchorElement; 11507 }, 11508 notifyClose: function notifyClose() { 11509 return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {}); 11510 }, 11511 notifyClosing: function notifyClosing() { 11512 _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSING_EVENT, {}); 11513 }, 11514 notifyOpen: function notifyOpen() { 11515 return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {}); 11516 }, 11517 isElementInContainer: function isElementInContainer(el) { 11518 return _this.root.contains(el); 11519 }, 11520 isRtl: function isRtl() { 11521 return getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; 11522 }, 11523 setTransformOrigin: function setTransformOrigin(origin) { 11524 var propertyName = util_1.getCorrectPropertyName(window, 'transform') + "-origin"; 11525 _this.root.style.setProperty(propertyName, origin); 11526 }, 11527 isFocused: function isFocused() { 11528 return document.activeElement === _this.root; 11529 }, 11530 saveFocus: function saveFocus() { 11531 _this.previousFocus = document.activeElement; 11532 }, 11533 restoreFocus: function restoreFocus() { 11534 if (_this.root.contains(document.activeElement)) { 11535 if (_this.previousFocus && _this.previousFocus.focus) { 11536 _this.previousFocus.focus(); 11537 } 11538 } 11539 }, 11540 getInnerDimensions: function getInnerDimensions() { 11541 return { 11542 width: _this.root.offsetWidth, 11543 height: _this.root.offsetHeight 11544 }; 11545 }, 11546 getAnchorDimensions: function getAnchorDimensions() { 11547 return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null; 11548 }, 11549 getWindowDimensions: function getWindowDimensions() { 11550 return { width: window.innerWidth, height: window.innerHeight }; 11551 }, 11552 getBodyDimensions: function getBodyDimensions() { 11553 return { width: document.body.clientWidth, height: document.body.clientHeight }; 11554 }, 11555 getWindowScroll: function getWindowScroll() {
11556 return { x: window.pageXOffset, y: window.pageYOffset }; 11557 }, 11558 setPosition: function setPosition(position) { 11559 var rootHTML = _this.root; 11560 rootHTML.style.left = 'left' in position ? position.left + "px" : ''; 11561 rootHTML.style.right = 'right' in position ? position.right + "px" : ''; 11562 rootHTML.style.top = 'top' in position ? position.top + "px" : ''; 11563 rootHTML.style.bottom = 'bottom' in position ? position.bottom + "px" : ''; 11564 }, 11565 setMaxHeight: function setMaxHeight(height) { 11566 _this.root.style.maxHeight = height; 11567 } 11568 }; 11569 // tslint:enable:object-literal-sort-keys 11570 return new foundation_1.MDCMenuSurfaceFoundation(adapter); 11571 }; 11572 return MDCMenuSurface; 11573}(component_1.MDCComponent); 11574exports.MDCMenuSurface = MDCMenuSurface; 11575 11576/***/ }), 11577
11578/***/ "./packages/mdc-menu-surface/constants.ts": 11579/*!************************************************!*\ 11580 !*** ./packages/mdc-menu-surface/constants.ts ***! 11581 \************************************************/ 11582/*! no static exports found */ 11583/***/ (function(module, exports, __webpack_require__) { 11584 11585"use strict"; 11586 11587/** 11588 * @license 11589 * Copyright 2018 Google Inc. 11590 * 11591 * Permission is hereby granted, free of charge, to any person obtaining a copy 11592 * of this software and associated documentation files (the "Software"), to deal 11593 * in the Software without restriction, including without limitation the rights 11594 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11595 * copies of the Software, and to permit persons to whom the Software is 11596 * furnished to do so, subject to the following conditions: 11597 * 11598 * The above copyright notice and this permission notice shall be included in 11599 * all copies or substantial portions of the Software. 11600 * 11601 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11602 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11603 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11604 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11605 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11606 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 11607 * THE SOFTWARE. 11608 */ 11609 11610Object.defineProperty(exports, "__esModule", { value: true });
11611var cssClasses = { 11612 ANCHOR: 'mdc-menu-surface--anchor', 11613 ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed', 11614 ANIMATING_OPEN: 'mdc-menu-surface--animating-open', 11615 FIXED: 'mdc-menu-surface--fixed', 11616 IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below', 11617 OPEN: 'mdc-menu-surface--open', 11618 ROOT: 'mdc-menu-surface' 11619}; 11620exports.cssClasses = cssClasses; 11621// tslint:disable:object-literal-sort-keys 11622var strings = { 11623 CLOSED_EVENT: 'MDCMenuSurface:closed', 11624 CLOSING_EVENT: 'MDCMenuSurface:closing', 11625 OPENED_EVENT: 'MDCMenuSurface:opened', 11626 FOCUSABLE_ELEMENTS: ['button:not(:disabled)', '[href]:not([aria-disabled="true"])', 'input:not(:disabled)', 'select:not(:disabled)', 'textarea:not(:disabled)', '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(', ') 11627}; 11628exports.strings = strings; 11629// tslint:enable:object-literal-sort-keys 11630var numbers = { 11631 /** Total duration of menu-surface open animation. */ 11632 TRANSITION_OPEN_DURATION: 120, 11633 /** Total duration of menu-surface close animation. */ 11634 TRANSITION_CLOSE_DURATION: 75, 11635 /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. Also used as a viewport margin. */ 11636 MARGIN_TO_EDGE: 32, 11637 /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */ 11638 ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67 11639}; 11640exports.numbers = numbers; 11641/** 11642 * Enum for bits in the {@see Corner) bitmap. 11643 */ 11644var CornerBit; 11645(function (CornerBit) { 11646 CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM"; 11647 CornerBit[CornerBit["CENTER"] = 2] = "CENTER"; 11648 CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT"; 11649 CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL"; 11650})(CornerBit || (CornerBit = {})); 11651exports.CornerBit = CornerBit; 11652/** 11653 * Enum for representing an element corner for positioning the menu-surface. 11654 * 11655 * The START constants map to LEFT if element directionality is left 11656 * to right and RIGHT if the directionality is right to left. 11657 * Likewise END maps to RIGHT or LEFT depending on the directionality. 11658 */ 11659var Corner; 11660(function (Corner) { 11661 Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT"; 11662 Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT"; 11663 Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT"; 11664 Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT"; 11665 Corner[Corner["TOP_START"] = 8] = "TOP_START"; 11666 Corner[Corner["TOP_END"] = 12] = "TOP_END"; 11667 Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START"; 11668 Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END"; 11669})(Corner || (Corner = {})); 11670exports.Corner = Corner; 11671 11672/***/ }), 11673
11674/***/ "./packages/mdc-menu-surface/foundation.ts": 11675/*!*************************************************!*\ 11676 !*** ./packages/mdc-menu-surface/foundation.ts ***! 11677 \*************************************************/ 11678/*! no static exports found */ 11679/***/ (function(module, exports, __webpack_require__) { 11680 11681"use strict"; 11682 11683/** 11684 * @license 11685 * Copyright 2018 Google Inc. 11686 * 11687 * Permission is hereby granted, free of charge, to any person obtaining a copy 11688 * of this software and associated documentation files (the "Software"), to deal 11689 * in the Software without restriction, including without limitation the rights 11690 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11691 * copies of the Software, and to permit persons to whom the Software is 11692 * furnished to do so, subject to the following conditions: 11693 * 11694 * The above copyright notice and this permission notice shall be included in 11695 * all copies or substantial portions of the Software. 11696 * 11697 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11698 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11699 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11700 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11701 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11702 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 11703 * THE SOFTWARE. 11704 */ 11705 11706var __extends = this && this.__extends || function () { 11707 var _extendStatics = function extendStatics(d, b) { 11708 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 11709 d.__proto__ = b; 11710 } || function (d, b) { 11711 for (var p in b) { 11712 if (b.hasOwnProperty(p)) d[p] = b[p]; 11713 } 11714 }; 11715 return _extendStatics(d, b); 11716 }; 11717 return function (d, b) { 11718 _extendStatics(d, b); 11719 function __() { 11720 this.constructor = d; 11721 } 11722 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 11723 }; 11724}(); 11725var __assign = this && this.__assign || function () { 11726 __assign = Object.assign || function (t) { 11727 for (var s, i = 1, n = arguments.length; i < n; i++) { 11728 s = arguments[i]; 11729 for (var p in s) { 11730 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 11731 } 11732 } 11733 return t; 11734 }; 11735 return __assign.apply(this, arguments); 11736}; 11737var __values = this && this.__values || function (o) { 11738 var s = typeof Symbol === "function" && Symbol.iterator, 11739 m = s && o[s], 11740 i = 0; 11741 if (m) return m.call(o); 11742 if (o && typeof o.length === "number") return { 11743 next: function next() { 11744 if (o && i >= o.length) o = void 0; 11745 return { value: o && o[i++], done: !o }; 11746 } 11747 }; 11748 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 11749}; 11750Object.defineProperty(exports, "__esModule", { value: true }); 11751var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 11752var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"); 11753var MDCMenuSurfaceFoundation = /** @class */function (_super) { 11754 __extends(MDCMenuSurfaceFoundation, _super); 11755 function MDCMenuSurfaceFoundation(adapter) { 11756 var _this = _super.call(this, __assign(__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this; 11757 _this.isSurfaceOpen = false; 11758 _this.isQuickOpen = false; 11759 _this.isHoistedElement = false; 11760 _this.isFixedPosition = false; 11761 _this.openAnimationEndTimerId = 0; 11762 _this.closeAnimationEndTimerId = 0; 11763 _this.animationRequestId = 0; 11764 _this.anchorCorner = constants_1.Corner.TOP_START; 11765 /** 11766 * Corner of the menu surface to which menu surface is attached to anchor. 11767 * 11768 * Anchor corner --->+----------+ 11769 * | ANCHOR | 11770 * +----------+ 11771 * Origin corner --->+--------------+ 11772 * | | 11773 * | | 11774 * | MENU SURFACE | 11775 * | | 11776 * | | 11777 * +--------------+ 11778 */ 11779 _this.originCorner = constants_1.Corner.TOP_START; 11780 _this.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 }; 11781 _this.position = { x: 0, y: 0 }; 11782 return _this; 11783 }
11784 Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", { 11785 get: function get() { 11786 return constants_1.cssClasses; 11787 }, 11788 enumerable: true, 11789 configurable: true 11790 }); 11791 Object.defineProperty(MDCMenuSurfaceFoundation, "strings", { 11792 get: function get() { 11793 return constants_1.strings; 11794 }, 11795 enumerable: true, 11796 configurable: true 11797 }); 11798 Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", { 11799 get: function get() { 11800 return constants_1.numbers; 11801 }, 11802 enumerable: true, 11803 configurable: true 11804 }); 11805 Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", { 11806 get: function get() { 11807 return constants_1.Corner; 11808 }, 11809 enumerable: true, 11810 configurable: true 11811 }); 11812 Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", { 11813 /** 11814 * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types. 11815 */ 11816 get: function get() { 11817 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 11818 return { 11819 addClass: function addClass() { 11820 return undefined; 11821 }, 11822 removeClass: function removeClass() { 11823 return undefined; 11824 }, 11825 hasClass: function hasClass() { 11826 return false; 11827 }, 11828 hasAnchor: function hasAnchor() { 11829 return false; 11830 }, 11831 isElementInContainer: function isElementInContainer() { 11832 return false; 11833 }, 11834 isFocused: function isFocused() { 11835 return false; 11836 }, 11837 isRtl: function isRtl() { 11838 return false; 11839 }, 11840 getInnerDimensions: function getInnerDimensions() { 11841 return { height: 0, width: 0 }; 11842 }, 11843 getAnchorDimensions: function getAnchorDimensions() { 11844 return null; 11845 }, 11846 getWindowDimensions: function getWindowDimensions() { 11847 return { height: 0, width: 0 }; 11848 }, 11849 getBodyDimensions: function getBodyDimensions() { 11850 return { height: 0, width: 0 }; 11851 }, 11852 getWindowScroll: function getWindowScroll() { 11853 return { x: 0, y: 0 }; 11854 }, 11855 setPosition: function setPosition() { 11856 return undefined; 11857 }, 11858 setMaxHeight: function setMaxHeight() { 11859 return undefined; 11860 }, 11861 setTransformOrigin: function setTransformOrigin() { 11862 return undefined; 11863 }, 11864 saveFocus: function saveFocus() { 11865 return undefined; 11866 }, 11867 restoreFocus: function restoreFocus() { 11868 return undefined; 11869 }, 11870 notifyClose: function notifyClose() { 11871 return undefined; 11872 }, 11873 notifyOpen: function notifyOpen() { 11874 return undefined; 11875 }, 11876 notifyClosing: function notifyClosing() { 11877 return undefined; 11878 } 11879 }; 11880 // tslint:enable:object-literal-sort-keys 11881 }, 11882 enumerable: true, 11883 configurable: true 11884 }); 11885 MDCMenuSurfaceFoundation.prototype.init = function () { 11886 var _a = MDCMenuSurfaceFoundation.cssClasses, 11887 ROOT = _a.ROOT, 11888 OPEN = _a.OPEN; 11889 if (!this.adapter.hasClass(ROOT)) { 11890 throw new Error(ROOT + " class required in root element."); 11891 } 11892 if (this.adapter.hasClass(OPEN)) { 11893 this.isSurfaceOpen = true; 11894 } 11895 }; 11896 MDCMenuSurfaceFoundation.prototype.destroy = function () { 11897 clearTimeout(this.openAnimationEndTimerId); 11898 clearTimeout(this.closeAnimationEndTimerId); 11899 // Cancel any currently running animations. 11900 cancelAnimationFrame(this.animationRequestId); 11901 }; 11902 /** 11903 * @param corner Default anchor corner alignment of top-left menu surface corner. 11904 */
11905 MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) { 11906 this.anchorCorner = corner; 11907 }; 11908 /** 11909 * Flip menu corner horizontally. 11910 */ 11911 MDCMenuSurfaceFoundation.prototype.flipCornerHorizontally = function () { 11912 this.originCorner = this.originCorner ^ constants_1.CornerBit.RIGHT; 11913 }; 11914 /** 11915 * @param margin Set of margin values from anchor. 11916 */ 11917 MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) { 11918 this.anchorMargin.top = margin.top || 0; 11919 this.anchorMargin.right = margin.right || 0; 11920 this.anchorMargin.bottom = margin.bottom || 0; 11921 this.anchorMargin.left = margin.left || 0; 11922 }; 11923 /** Used to indicate if the menu-surface is hoisted to the body. */ 11924 MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) { 11925 this.isHoistedElement = isHoisted; 11926 }; 11927 /** Used to set the menu-surface calculations based on a fixed position menu. */ 11928 MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) { 11929 this.isFixedPosition = isFixedPosition; 11930 }; 11931 /** Sets the menu-surface position on the page. */ 11932 MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) { 11933 this.position.x = this.isFinite(x) ? x : 0; 11934 this.position.y = this.isFinite(y) ? y : 0; 11935 }; 11936 MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) { 11937 this.isQuickOpen = quickOpen; 11938 }; 11939 MDCMenuSurfaceFoundation.prototype.isOpen = function () { 11940 return this.isSurfaceOpen; 11941 }; 11942 /** 11943 * Open the menu surface. 11944 */ 11945 MDCMenuSurfaceFoundation.prototype.open = function () { 11946 var _this = this; 11947 if (this.isSurfaceOpen) { 11948 return; 11949 } 11950 this.adapter.saveFocus(); 11951 if (this.isQuickOpen) { 11952 this.isSurfaceOpen = true; 11953 this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); 11954 this.dimensions = this.adapter.getInnerDimensions(); 11955 this.autoposition(); 11956 this.adapter.notifyOpen(); 11957 } else { 11958 this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); 11959 this.animationRequestId = requestAnimationFrame(function () { 11960 _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); 11961 _this.dimensions = _this.adapter.getInnerDimensions(); 11962 _this.autoposition(); 11963 _this.openAnimationEndTimerId = setTimeout(function () { 11964 _this.openAnimationEndTimerId = 0; 11965 _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); 11966 _this.adapter.notifyOpen(); 11967 }, constants_1.numbers.TRANSITION_OPEN_DURATION); 11968 }); 11969 this.isSurfaceOpen = true; 11970 } 11971 }; 11972 /** 11973 * Closes the menu surface. 11974 */ 11975 MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) { 11976 var _this = this; 11977 if (skipRestoreFocus === void 0) { 11978 skipRestoreFocus = false; 11979 } 11980 if (!this.isSurfaceOpen) { 11981 return; 11982 } 11983 this.adapter.notifyClosing(); 11984 if (this.isQuickOpen) { 11985 this.isSurfaceOpen = false; 11986 if (!skipRestoreFocus) { 11987 this.maybeRestoreFocus(); 11988 } 11989 this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); 11990 this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW); 11991 this.adapter.notifyClose(); 11992 return; 11993 } 11994 this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); 11995 requestAnimationFrame(function () { 11996 _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); 11997 _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW); 11998 _this.closeAnimationEndTimerId = setTimeout(function () { 11999 _this.closeAnimationEndTimerId = 0; 12000 _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasse
12000s.ANIMATING_CLOSED); 12001 _this.adapter.notifyClose(); 12002 }, constants_1.numbers.TRANSITION_CLOSE_DURATION); 12003 }); 12004 this.isSurfaceOpen = false; 12005 if (!skipRestoreFocus) { 12006 this.maybeRestoreFocus(); 12007 } 12008 }; 12009 /** Handle clicks and close if not within menu-surface element. */ 12010 MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) { 12011 var el = evt.target; 12012 if (this.adapter.isElementInContainer(el)) { 12013 return; 12014 } 12015 this.close(); 12016 }; 12017 /** Handle keys that close the surface. */ 12018 MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) { 12019 var keyCode = evt.keyCode, 12020 key = evt.key; 12021 var isEscape = key === 'Escape' || keyCode === 27; 12022 if (isEscape) { 12023 this.close(); 12024 } 12025 }; 12026 MDCMenuSurfaceFoundation.prototype.autoposition = function () { 12027 var _a; 12028 // Compute measurements for autoposition methods reuse. 12029 this.measurements = this.getAutoLayoutmeasurements(); 12030 var corner = this.getoriginCorner(); 12031 var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner); 12032 var verticalAlignment = this.hasBit(corner, constants_1.CornerBit.BOTTOM) ? 'bottom' : 'top'; 12033 var horizontalAlignment = this.hasBit(corner, constants_1.CornerBit.RIGHT) ? 'right' : 'left'; 12034 var horizontalOffset = this.getHorizontalOriginOffset(corner); 12035 var verticalOffset = this.getVerticalOriginOffset(corner); 12036 var _b = this.measurements, 12037 anchorSize = _b.anchorSize, 12038 surfaceSize = _b.surfaceSize; 12039 var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a); 12040 // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner. 12041 if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) { 12042 horizontalAlignment = 'center'; 12043 } 12044 // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element 12045 if (this.isHoistedElement || this.isFixedPosition) { 12046 this.adjustPositionForHoistedElement(position); 12047 } 12048 this.adapter.setTransformOrigin(horizontalAlignment + " " + verticalAlignment); 12049 this.adapter.setPosition(position); 12050 this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : ''); 12051 // If it is opened from the top then add is-open-below class 12052 if (!this.hasBit(corner, constants_1.CornerBit.BOTTOM)) { 12053 this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW); 12054 } 12055 }; 12056 /** 12057 * @return Measurements used to position menu surface popup. 12058 */ 12059 MDCMenuSurfaceFoundation.prototype.getAutoLayoutmeasurements = function () { 12060 var anchorRect = this.adapter.getAnchorDimensions(); 12061 var bodySize = this.adapter.getBodyDimensions(); 12062 var viewportSize = this.adapter.getWindowDimensions(); 12063 var windowScroll = this.adapter.getWindowScroll(); 12064 if (!anchorRect) { 12065 // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together 12066 anchorRect = { 12067 top: this.position.y, 12068 right: this.position.x, 12069 bottom: this.position.y, 12070 left: this.position.x, 12071 width: 0, 12072 height: 0 12073 }; 12074 // tslint:enable:object-literal-sort-keys 12075 } 12076 return { 12077 anchorSize: anchorRect, 12078 bodySize: bodySize, 12079 surfaceSize: this.dimensions, 12080 viewportDistance: { 12081 // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together 12082 top: anchorRect.top, 12083 right: viewportSize.width - anchorRect.right, 12084 bottom: viewportSize.height - anchorRect.bottom, 12085 left: anchorRect.left 12086 }, 12087 viewportSize: viewportSize, 12088 windowScroll: windowScroll 12089 }; 12090 }; 12091 /**
12092 * Computes the corner of the anchor from which to animate and position the 12093 * menu surface. 12094 * 12095 * Only LEFT or RIGHT bit is used to position the menu surface ignoring RTL 12096 * context. E.g., menu surface will be positioned from right side on TOP_END. 12097 */ 12098 MDCMenuSurfaceFoundation.prototype.getoriginCorner = function () { 12099 var corner = this.originCorner; 12100 var _a = this.measurements, 12101 viewportDistance = _a.viewportDistance, 12102 anchorSize = _a.anchorSize, 12103 surfaceSize = _a.surfaceSize; 12104 var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE; 12105 var isAnchoredToBottom = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM); 12106 var availableTop; 12107 var availableBottom; 12108 if (isAnchoredToBottom) { 12109 availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom; 12110 availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom; 12111 } else { 12112 availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top; 12113 availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE + anchorSize.height - this.anchorMargin.top; 12114 } 12115 var isAvailableBottom = availableBottom - surfaceSize.height > 0; 12116 if (!isAvailableBottom && availableTop > availableBottom) { 12117 // Attach bottom side of surface to the anchor. 12118 corner = this.setBit(corner, constants_1.CornerBit.BOTTOM); 12119 } 12120 var isRtl = this.adapter.isRtl(); 12121 var isFlipRtl = this.hasBit(this.anchorCorner, constants_1.CornerBit.FLIP_RTL); 12122 var hasRightBit = this.hasBit(this.anchorCorner, constants_1.CornerBit.RIGHT) || this.hasBit(corner, constants_1.CornerBit.RIGHT); 12123 // Whether surface attached to right side of anchor element. 12124 var isAnchoredToRight = false; 12125 // Anchored to start 12126 if (isRtl && isFlipRtl) { 12127 isAnchoredToRight = !hasRightBit; 12128 } else { 12129 // Anchored to right 12130 isAnchoredToRight = hasRightBit; 12131 } 12132 var availableLeft; 12133 var availableRight; 12134 if (isAnchoredToRight) { 12135 availableLeft = viewportDistance.left + anchorSize.width + this.anchorMargin.right; 12136 availableRight = viewportDistance.right - this.anchorMargin.right; 12137 } else { 12138 availableLeft = viewportDistance.left + this.anchorMargin.left; 12139 availableRight = viewportDistance.right + anchorSize.width - this.anchorMargin.left; 12140 } 12141 var isAvailableLeft = availableLeft - surfaceSize.width > 0; 12142 var isAvailableRight = availableRight - surfaceSize.width > 0; 12143 var isOriginCornerAlignedToEnd = this.hasBit(corner, constants_1.CornerBit.FLIP_RTL) && this.hasBit(corner, constants_1.CornerBit.RIGHT); 12144 if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl || !isAvailableLeft && isOriginCornerAlignedToEnd) { 12145 // Attach left side of surface to the anchor. 12146 corner = this.unsetBit(corner, constants_1.CornerBit.RIGHT); 12147 } else if (isAvailableLeft && isAnchoredToRight && isRtl || isAvailableLeft && !isAnchoredToRight && hasRightBit || !isAvailableRight && availableLeft >= availableRight) { 12148 // Attach right side of surface to the anchor. 12149 corner = this.setBit(corner, constants_1.CornerBit.RIGHT); 12150 } 12151 return corner; 12152 }; 12153 /** 12154 * @param corner Origin corner of the menu surface. 12155 * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set. 12156 */ 12157 MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) { 12158 var viewportDistance = this.measurements.viewportDistance; 12159 var maxHeight = 0; 12160 var isBottomAligned = this.hasBit(corner, constants_1.CornerBit.BOTTOM); 12161 var isBottomAnchored = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM); 12162 var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE; 12163 // When maximum height is not specified, it is handled from CSS. 12164 if (isBottomAligned) { 12165 maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_E
12165DGE; 12166 if (!isBottomAnchored) { 12167 maxHeight += this.measurements.anchorSize.height; 12168 } 12169 } else { 12170 maxHeight = viewportDistance.bottom - this.anchorMargin.bottom + this.measurements.anchorSize.height - MARGIN_TO_EDGE; 12171 if (isBottomAnchored) { 12172 maxHeight -= this.measurements.anchorSize.height; 12173 } 12174 } 12175 return maxHeight; 12176 }; 12177 /** 12178 * @param corner Origin corner of the menu surface. 12179 * @return Horizontal offset of menu surface origin corner from corresponding anchor corner. 12180 */ 12181 MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) { 12182 var anchorSize = this.measurements.anchorSize; 12183 // isRightAligned corresponds to using the 'right' property on the surface. 12184 var isRightAligned = this.hasBit(corner, constants_1.CornerBit.RIGHT); 12185 var avoidHorizontalOverlap = this.hasBit(this.anchorCorner, constants_1.CornerBit.RIGHT); 12186 if (isRightAligned) { 12187 var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.left : this.anchorMargin.right; 12188 // For hoisted or fixed elements, adjust the offset by the difference 12189 // between viewport width and body width so when we calculate the right 12190 // value (`adjustPositionForHoistedElement`) based on the element 12191 // position, the right property is correct. 12192 if (this.isHoistedElement || this.isFixedPosition) { 12193 return rightOffset - (this.measurements.viewportSize.width - this.measurements.bodySize.width); 12194 } 12195 return rightOffset; 12196 } 12197 return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right : this.anchorMargin.left; 12198 }; 12199 /** 12200 * @param corner Origin corner of the menu surface. 12201 * @return Vertical offset of menu surface origin corner from corresponding anchor corner. 12202 */ 12203 MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) { 12204 var anchorSize = this.measurements.anchorSize; 12205 var isBottomAligned = this.hasBit(corner, constants_1.CornerBit.BOTTOM); 12206 var avoidVerticalOverlap = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM); 12207 var y = 0; 12208 if (isBottomAligned) { 12209 y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top : -this.anchorMargin.bottom; 12210 } else { 12211 y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin.bottom : this.anchorMargin.top; 12212 } 12213 return y; 12214 }; 12215 /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */ 12216 MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) { 12217 var e_1, _a; 12218 var _b = this.measurements, 12219 windowScroll = _b.windowScroll, 12220 viewportDistance = _b.viewportDistance; 12221 var props = Object.keys(position); 12222 try { 12223 for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) { 12224 var prop = props_1_1.value; 12225 var value = position[prop] || 0; 12226 // Hoisted surfaces need to have the anchor elements location on the page added to the 12227 // position properties for proper alignment on the body. 12228 value += viewportDistance[prop]; 12229 // Surfaces that are absolutely positioned need to have additional calculations for scroll 12230 // and bottom positioning. 12231 if (!this.isFixedPosition) { 12232 if (prop === 'top') { 12233 value += windowScroll.y; 12234 } else if (prop === 'bottom') { 12235 value -= windowScroll.y; 12236 } else if (prop === 'left') { 12237 value += windowScroll.x; 12238 } else { 12239 // prop === 'right' 12240 value -= windowScroll.x; 12241 } 12242 } 12243 position[prop] = value; 12244 } 12245 } catch (e_1_1) { 12246 e_1 = { error: e_1_1 }; 12247 } finally { 12248 try { 12249 if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1); 12250 } finally { 12251 if (e_1) throw e_1.error; 12252 } 12253 } 12254 }; 12255 /** 12256 * The last focused element when the menu surface was opened should regain focus, if the user is 12257 * focused on or within the menu surface when it is closed. 12258 */
12259 MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () { 12260 var isRootFocused = this.adapter.isFocused(); 12261 var childHasFocus = document.activeElement && this.adapter.isElementInContainer(document.activeElement); 12262 if (isRootFocused || childHasFocus) { 12263 this.adapter.restoreFocus(); 12264 } 12265 }; 12266 MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) { 12267 return Boolean(corner & bit); // tslint:disable-line:no-bitwise 12268 }; 12269 MDCMenuSurfaceFoundation.prototype.setBit = function (corner, bit) { 12270 return corner | bit; // tslint:disable-line:no-bitwise 12271 }; 12272 MDCMenuSurfaceFoundation.prototype.unsetBit = function (corner, bit) { 12273 return corner ^ bit; 12274 }; 12275 /** 12276 * isFinite that doesn't force conversion to number type. 12277 * Equivalent to Number.isFinite in ES2015, which is not supported in IE. 12278 */ 12279 MDCMenuSurfaceFoundation.prototype.isFinite = function (num) { 12280 return typeof num === 'number' && isFinite(num); 12281 }; 12282 return MDCMenuSurfaceFoundation; 12283}(foundation_1.MDCFoundation); 12284exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation; 12285// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 12286exports.default = MDCMenuSurfaceFoundation; 12287 12288/***/ }), 12289
12290/***/ "./packages/mdc-menu-surface/index.ts": 12291/*!********************************************!*\ 12292 !*** ./packages/mdc-menu-surface/index.ts ***! 12293 \********************************************/ 12294/*! no static exports found */ 12295/***/ (function(module, exports, __webpack_require__) { 12296 12297"use strict"; 12298 12299/** 12300 * @license 12301 * Copyright 2019 Google Inc. 12302 * 12303 * Permission is hereby granted, free of charge, to any person obtaining a copy 12304 * of this software and associated documentation files (the "Software"), to deal 12305 * in the Software without restriction, including without limitation the rights 12306 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12307 * copies of the Software, and to permit persons to whom the Software is 12308 * furnished to do so, subject to the following conditions: 12309 * 12310 * The above copyright notice and this permission notice shall be included in 12311 * all copies or substantial portions of the Software. 12312 * 12313 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12314 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12315 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12316 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12317 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12318 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12319 * THE SOFTWARE. 12320 */ 12321 12322function __export(m) { 12323 for (var p in m) { 12324 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 12325 } 12326} 12327Object.defineProperty(exports, "__esModule", { value: true }); 12328__export(__webpack_require__(/*! ./component */ "./packages/mdc-menu-surface/component.ts")); 12329__export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts")); 12330__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts")); 12331 12332/***/ }), 12333
12334/***/ "./packages/mdc-menu/component.ts": 12335/*!****************************************!*\ 12336 !*** ./packages/mdc-menu/component.ts ***! 12337 \****************************************/ 12338/*! no static exports found */ 12339/***/ (function(module, exports, __webpack_require__) { 12340 12341"use strict"; 12342 12343/** 12344 * @license 12345 * Copyright 2018 Google Inc. 12346 * 12347 * Permission is hereby granted, free of charge, to any person obtaining a copy 12348 * of this software and associated documentation files (the "Software"), to deal 12349 * in the Software without restriction, including without limitation the rights 12350 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12351 * copies of the Software, and to permit persons to whom the Software is 12352 * furnished to do so, subject to the following conditions: 12353 * 12354 * The above copyright notice and this permission notice shall be included in 12355 * all copies or substantial portions of the Software. 12356 * 12357 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12358 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12359 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12360 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12361 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12362 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12363 * THE SOFTWARE. 12364 */ 12365 12366var __extends = this && this.__extends || function () { 12367 var _extendStatics = function extendStatics(d, b) { 12368 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 12369 d.__proto__ = b; 12370 } || function (d, b) { 12371 for (var p in b) { 12372 if (b.hasOwnProperty(p)) d[p] = b[p]; 12373 } 12374 }; 12375 return _extendStatics(d, b); 12376 }; 12377 return function (d, b) { 12378 _extendStatics(d, b); 12379 function __() { 12380 this.constructor = d; 12381 } 12382 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 12383 }; 12384}(); 12385Object.defineProperty(exports, "__esModule", { value: true }); 12386// TODO(b/152410470): Remove trailing underscores from private properties 12387// tslint:disable:strip-private-property-underscore 12388var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 12389var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 12390var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts"); 12391var constants_1 = __webpack_require__(/*! @material/list/constants */ "./packages/mdc-list/constants.ts"); 12392var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts"); 12393var component_3 = __webpack_require__(/*! @material/menu-surface/component */ "./packages/mdc-menu-surface/component.ts"); 12394var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts"); 12395var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"); 12396var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts"); 12397var MDCMenu = /** @class */function (_super) { 12398 __extends(MDCMenu, _super); 12399 function MDCMenu() { 12400 return _super !== null && _super.apply(this, arguments) || this; 12401 } 12402 MDCMenu.attachTo = function (root) { 12403 return new MDCMenu(root); 12404 }; 12405 MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) { 12406 if (menuSurfaceFactory === void 0) { 12407 menuSurfaceFactory = function menuSurfaceFactory(el) { 12408 return new component_3.MDCMenuSurface(el); 12409 }; 12410 } 12411 if (listFactory === void 0) { 12412 listFactory = function listFactory(el) { 12413 return new component_2.MDCList(el); 12414 }; 12415 } 12416 this.menuSurfaceFactory_ = menuSurfaceFactory; 12417 this.listFactory_ = listFactory; 12418 }; 12419 MDCMenu.prototype.initialSyncWithDOM = function () { 12420 var _this = this; 12421 this.menuSurface_ = this.menuSurfaceFactory_(this.root); 12422 var list = this.root.querySelector(constants_2.strings.LIST_SELECTOR); 12423 if (list) { 12424 this.list_ = this.listFactory_(list);
12425 this.list_.wrapFocus = true; 12426 } else { 12427 this.list_ = null; 12428 } 12429 this.handleKeydown_ = function (evt) { 12430 return _this.foundation.handleKeydown(evt); 12431 }; 12432 this.handleItemAction_ = function (evt) { 12433 return _this.foundation.handleItemAction(_this.items[evt.detail.index]); 12434 }; 12435 this.handleMenuSurfaceOpened_ = function () { 12436 return _this.foundation.handleMenuSurfaceOpened(); 12437 }; 12438 this.menuSurface_.listen(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_); 12439 this.listen('keydown', this.handleKeydown_); 12440 this.listen(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_); 12441 }; 12442 MDCMenu.prototype.destroy = function () { 12443 if (this.list_) { 12444 this.list_.destroy(); 12445 } 12446 this.menuSurface_.destroy(); 12447 this.menuSurface_.unlisten(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_); 12448 this.unlisten('keydown', this.handleKeydown_); 12449 this.unlisten(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_); 12450 _super.prototype.destroy.call(this); 12451 }; 12452 Object.defineProperty(MDCMenu.prototype, "open", { 12453 get: function get() { 12454 return this.menuSurface_.isOpen(); 12455 }, 12456 set: function set(value) { 12457 if (value) { 12458 this.menuSurface_.open(); 12459 } else { 12460 this.menuSurface_.close(); 12461 } 12462 }, 12463 enumerable: true, 12464 configurable: true 12465 }); 12466 Object.defineProperty(MDCMenu.prototype, "wrapFocus", { 12467 get: function get() { 12468 return this.list_ ? this.list_.wrapFocus : false; 12469 }, 12470 set: function set(value) { 12471 if (this.list_) { 12472 this.list_.wrapFocus = value; 12473 } 12474 }, 12475 enumerable: true, 12476 configurable: true 12477 }); 12478 Object.defineProperty(MDCMenu.prototype, "hasTypeahead", { 12479 /** 12480 * Sets whether the menu has typeahead functionality. 12481 * @param value Whether typeahead is enabled. 12482 */ 12483 set: function set(value) { 12484 if (this.list_) { 12485 this.list_.hasTypeahead = value; 12486 } 12487 }, 12488 enumerable: true, 12489 configurable: true 12490 }); 12491 Object.defineProperty(MDCMenu.prototype, "typeaheadInProgress", { 12492 /** 12493 * @return Whether typeahead logic is currently matching some user prefix. 12494 */ 12495 get: function get() { 12496 return this.list_ ? this.list_.typeaheadInProgress : false; 12497 }, 12498 enumerable: true, 12499 configurable: true 12500 }); 12501 /** 12502 * Given the next desired character from the user, adds it to the typeahead 12503 * buffer. Then, attempts to find the next option matching the buffer. Wraps 12504 * around if at the end of options. 12505 * 12506 * @param nextChar The next character to add to the prefix buffer. 12507 * @param startingIndex The index from which to start matching. Only relevant 12508 * when starting a new match sequence. To start a new match sequence, 12509 * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer 12510 * to clear after a set interval defined in list foundation. Defaults to 12511 * the currently focused index. 12512 * @return The index of the matched item, or -1 if no match. 12513 */ 12514 MDCMenu.prototype.typeaheadMatchItem = function (nextChar, startingIndex) { 12515 if (this.list_) { 12516 return this.list_.typeaheadMatchItem(nextChar, startingIndex); 12517 } 12518 return -1; 12519 }; 12520 /** 12521 * Layout the underlying list element in the case of any dynamic updates 12522 * to its structure. 12523 */ 12524 MDCMenu.prototype.layout = function () { 12525 if (this.list_) { 12526 this.list_.layout(); 12527 } 12528 }; 12529 Object.defineProperty(MDCMenu.prototype, "items", { 12530 /** 12531 * Return the items within the menu. Note that this only contains the set of elements within 12532 * the items container that are proper list items, and not supplemental / presentational DOM 12533 * elements. 12534 */ 12535 get: function get() { 12536 return this.list_ ? this.list_.listElements : []; 12537 }, 12538 enumerable: true, 12539 configurable: true 12540 });
12541 Object.defineProperty(MDCMenu.prototype, "singleSelection", { 12542 /** 12543 * Turns on/off the underlying list's single selection mode. Used mainly 12544 * by select menu. 12545 * 12546 * @param singleSelection Whether to enable single selection mode. 12547 */ 12548 set: function set(singleSelection) { 12549 if (this.list_) { 12550 this.list_.singleSelection = singleSelection; 12551 } 12552 }, 12553 enumerable: true, 12554 configurable: true 12555 }); 12556 Object.defineProperty(MDCMenu.prototype, "selectedIndex", { 12557 /** 12558 * Retrieves the selected index. Only applicable to select menus. 12559 * @return The selected index, which is a number for single selection and 12560 * radio lists, and an array of numbers for checkbox lists. 12561 */ 12562 get: function get() { 12563 return this.list_ ? this.list_.selectedIndex : constants_1.numbers.UNSET_INDEX; 12564 }, 12565 /** 12566 * Sets the selected index of the list. Only applicable to select menus. 12567 * @param index The selected index, which is a number for single selection and 12568 * radio lists, and an array of numbers for checkbox lists. 12569 */ 12570 set: function set(index) { 12571 if (this.list_) { 12572 this.list_.selectedIndex = index; 12573 } 12574 }, 12575 enumerable: true, 12576 configurable: true 12577 }); 12578 Object.defineProperty(MDCMenu.prototype, "quickOpen", { 12579 set: function set(quickOpen) { 12580 this.menuSurface_.quickOpen = quickOpen; 12581 }, 12582 enumerable: true, 12583 configurable: true 12584 }); 12585 /** 12586 * Sets default focus state where the menu should focus every time when menu 12587 * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by 12588 * default. 12589 * @param focusState Default focus state. 12590 */ 12591 MDCMenu.prototype.setDefaultFocusState = function (focusState) { 12592 this.foundation.setDefaultFocusState(focusState); 12593 }; 12594 /** 12595 * @param corner Default anchor corner alignment of top-left menu corner. 12596 */ 12597 MDCMenu.prototype.setAnchorCorner = function (corner) {
12598 this.menuSurface_.setAnchorCorner(corner); 12599 }; 12600 MDCMenu.prototype.setAnchorMargin = function (margin) { 12601 this.menuSurface_.setAnchorMargin(margin); 12602 }; 12603 /** 12604 * Sets the list item as the selected row at the specified index. 12605 * @param index Index of list item within menu. 12606 */ 12607 MDCMenu.prototype.setSelectedIndex = function (index) { 12608 this.foundation.setSelectedIndex(index); 12609 }; 12610 /** 12611 * Sets the enabled state to isEnabled for the menu item at the given index. 12612 * @param index Index of the menu item 12613 * @param isEnabled The desired enabled state of the menu item. 12614 */ 12615 MDCMenu.prototype.setEnabled = function (index, isEnabled) { 12616 this.foundation.setEnabled(index, isEnabled); 12617 }; 12618 /** 12619 * @return The item within the menu at the index specified. 12620 */ 12621 MDCMenu.prototype.getOptionByIndex = function (index) { 12622 var items = this.items; 12623 if (index < items.length) { 12624 return this.items[index]; 12625 } else { 12626 return null; 12627 } 12628 }; 12629 /** 12630 * @param index A menu item's index. 12631 * @return The primary text within the menu at the index specified. 12632 */ 12633 MDCMenu.prototype.getPrimaryTextAtIndex = function (index) { 12634 var item = this.getOptionByIndex(index); 12635 if (item && this.list_) { 12636 return this.list_.getPrimaryText(item) || ''; 12637 } 12638 return ''; 12639 }; 12640 MDCMenu.prototype.setFixedPosition = function (isFixed) { 12641 this.menuSurface_.setFixedPosition(isFixed); 12642 }; 12643 MDCMenu.prototype.setIsHoisted = function (isHoisted) { 12644 this.menuSurface_.setIsHoisted(isHoisted); 12645 }; 12646 MDCMenu.prototype.setAbsolutePosition = function (x, y) { 12647 this.menuSurface_.setAbsolutePosition(x, y); 12648 }; 12649 /** 12650 * Sets the element that the menu-surface is anchored to. 12651 */ 12652 MDCMenu.prototype.setAnchorElement = function (element) { 12653 this.menuSurface_.anchorElement = element; 12654 }; 12655 MDCMenu.prototype.getDefaultFoundation = function () { 12656 var _this = this; 12657 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 12658 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 12659 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 12660 var adapter = { 12661 addClassToElementAtIndex: function addClassToElementAtIndex(index, className) { 12662 var list = _this.items; 12663 list[index].classList.add(className); 12664 }, 12665 removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) { 12666 var list = _this.items; 12667 list[index].classList.remove(className); 12668 }, 12669 addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) { 12670 var list = _this.items; 12671 list[index].setAttribute(attr, value); 12672 }, 12673 removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) { 12674 var list = _this.items; 12675 list[index].removeAttribute(attr); 12676 }, 12677 elementContainsClass: function elementContainsClass(element, className) { 12678 return element.classList.contains(className); 12679 }, 12680 closeSurface: function closeSurface(skipRestoreFocus) { 12681 return _this.menuSurface_.close(skipRestoreFocus); 12682 }, 12683 getElementIndex: function getElementIndex(element) { 12684 return _this.items.indexOf(element); 12685 }, 12686 notifySelected: function notifySelected(evtData) { 12687 return _this.emit(constants_2.strings.SELECTED_EVENT, { 12688 index: evtData.index, 12689 item: _this.items[evtData.index] 12690 }); 12691 }, 12692 getMenuItemCount: function getMenuItemCount() { 12693 return _this.items.length; 12694 }, 12695 focusItemAtIndex: function focusItemAtIndex(index) { 12696 return _this.items[index].focus(); 12697 }, 12698 focusListRoot: function focusListRoot() { 12699 return _this.root.querySelector(constants_2.strings.LIST_SELECTOR).focus(); 12700 }, 12701 isSelectableItemAtIndex: function isSelectableItemAtIndex(index) { 12702 return !!ponyfill_1.closest(_this.items[index], "." + constants_2.cssClasse
12702s.MENU_SELECTION_GROUP); 12703 }, 12704 getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex(index) { 12705 var selectionGroupEl = ponyfill_1.closest(_this.items[index], "." + constants_2.cssClasses.MENU_SELECTION_GROUP); 12706 var selectedItemEl = selectionGroupEl.querySelector("." + constants_2.cssClasses.MENU_SELECTED_LIST_ITEM); 12707 return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1; 12708 } 12709 }; 12710 // tslint:enable:object-literal-sort-keys 12711 return new foundation_3.MDCMenuFoundation(adapter); 12712 }; 12713 return MDCMenu; 12714}(component_1.MDCComponent); 12715exports.MDCMenu = MDCMenu; 12716 12717/***/ }), 12718
12719/***/ "./packages/mdc-menu/constants.ts": 12720/*!****************************************!*\ 12721 !*** ./packages/mdc-menu/constants.ts ***! 12722 \****************************************/ 12723/*! no static exports found */ 12724/***/ (function(module, exports, __webpack_require__) { 12725 12726"use strict"; 12727 12728/** 12729 * @license 12730 * Copyright 2018 Google Inc. 12731 * 12732 * Permission is hereby granted, free of charge, to any person obtaining a copy 12733 * of this software and associated documentation files (the "Software"), to deal 12734 * in the Software without restriction, including without limitation the rights 12735 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12736 * copies of the Software, and to permit persons to whom the Software is 12737 * furnished to do so, subject to the following conditions: 12738 * 12739 * The above copyright notice and this permission notice shall be included in 12740 * all copies or substantial portions of the Software. 12741 * 12742 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12743 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12744 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12745 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12746 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12747 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12748 * THE SOFTWARE. 12749 */ 12750 12751Object.defineProperty(exports, "__esModule", { value: true });
12752var cssClasses = { 12753 MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected', 12754 MENU_SELECTION_GROUP: 'mdc-menu__selection-group', 12755 ROOT: 'mdc-menu' 12756}; 12757exports.cssClasses = cssClasses; 12758var strings = { 12759 ARIA_CHECKED_ATTR: 'aria-checked', 12760 ARIA_DISABLED_ATTR: 'aria-disabled', 12761 CHECKBOX_SELECTOR: 'input[type="checkbox"]', 12762 LIST_SELECTOR: '.mdc-list', 12763 SELECTED_EVENT: 'MDCMenu:selected' 12764}; 12765exports.strings = strings; 12766var numbers = { 12767 FOCUS_ROOT_INDEX: -1 12768}; 12769exports.numbers = numbers; 12770var DefaultFocusState; 12771(function (DefaultFocusState) { 12772 DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE"; 12773 DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT"; 12774 DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM"; 12775 DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM"; 12776})(DefaultFocusState || (DefaultFocusState = {})); 12777exports.DefaultFocusState = DefaultFocusState; 12778 12779/***/ }), 12780
12781/***/ "./packages/mdc-menu/foundation.ts": 12782/*!*****************************************!*\ 12783 !*** ./packages/mdc-menu/foundation.ts ***! 12784 \*****************************************/ 12785/*! no static exports found */ 12786/***/ (function(module, exports, __webpack_require__) { 12787 12788"use strict"; 12789 12790/** 12791 * @license 12792 * Copyright 2018 Google Inc. 12793 * 12794 * Permission is hereby granted, free of charge, to any person obtaining a copy 12795 * of this software and associated documentation files (the "Software"), to deal 12796 * in the Software without restriction, including without limitation the rights 12797 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12798 * copies of the Software, and to permit persons to whom the Software is 12799 * furnished to do so, subject to the following conditions: 12800 * 12801 * The above copyright notice and this permission notice shall be included in 12802 * all copies or substantial portions of the Software. 12803 * 12804 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12805 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12806 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12807 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12808 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12809 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12810 * THE SOFTWARE. 12811 */ 12812 12813var __extends = this && this.__extends || function () { 12814 var _extendStatics = function extendStatics(d, b) { 12815 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 12816 d.__proto__ = b; 12817 } || function (d, b) { 12818 for (var p in b) { 12819 if (b.hasOwnProperty(p)) d[p] = b[p]; 12820 } 12821 }; 12822 return _extendStatics(d, b); 12823 }; 12824 return function (d, b) { 12825 _extendStatics(d, b); 12826 function __() { 12827 this.constructor = d; 12828 } 12829 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 12830 }; 12831}(); 12832var __assign = this && this.__assign || function () { 12833 __assign = Object.assign || function (t) { 12834 for (var s, i = 1, n = arguments.length; i < n; i++) { 12835 s = arguments[i]; 12836 for (var p in s) { 12837 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 12838 } 12839 } 12840 return t; 12841 }; 12842 return __assign.apply(this, arguments); 12843}; 12844Object.defineProperty(exports, "__esModule", { value: true }); 12845var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 12846var constants_1 = __webpack_require__(/*! @material/list/constants */ "./packages/mdc-list/constants.ts"); 12847var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts"); 12848var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"); 12849var MDCMenuFoundation = /** @class */function (_super) { 12850 __extends(MDCMenuFoundation, _super); 12851 function MDCMenuFoundation(adapter) { 12852 var _this = _super.call(this, __assign(__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this; 12853 _this.closeAnimationEndTimerId_ = 0; 12854 _this.defaultFocusState_ = constants_2.DefaultFocusState.LIST_ROOT; 12855 return _this; 12856 } 12857 Object.defineProperty(MDCMenuFoundation, "cssClasses", { 12858 get: function get() { 12859 return constants_2.cssClasses; 12860 }, 12861 enumerable: true, 12862 configurable: true 12863 }); 12864 Object.defineProperty(MDCMenuFoundation, "strings", { 12865 get: function get() { 12866 return constants_2.strings; 12867 }, 12868 enumerable: true, 12869 configurable: true 12870 }); 12871 Object.defineProperty(MDCMenuFoundation, "numbers", { 12872 get: function get() { 12873 return constants_2.numbers; 12874 }, 12875 enumerable: true, 12876 configurable: true 12877 }); 12878 Object.defineProperty(MDCMenuFoundation, "defaultAdapter", { 12879 /** 12880 * @see {@link MDCMenuAdapter} for typing information on parameters and return types. 12881 */ 12882 get: function get() { 12883 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 12884 return { 12885 addClassToElementAtIndex: function addClassToElementAtIndex() { 12886 return undefined; 12887 }, 12888 removeClassFromElementAtIndex: function removeClassFromElementAtIndex() { 12889 return undefined; 12890 }, 12891 addAttributeToElementAtIndex: function addAttributeToElementAtIndex() { 12892 return undefined; 12893 }, 12894 removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() { 12895 return undefined; 12896 }, 12897 elementContainsClass: function elementContainsClass() { 12898 return false;
12899 }, 12900 closeSurface: function closeSurface() { 12901 return undefined; 12902 }, 12903 getElementIndex: function getElementIndex() { 12904 return -1; 12905 }, 12906 notifySelected: function notifySelected() { 12907 return undefined; 12908 }, 12909 getMenuItemCount: function getMenuItemCount() { 12910 return 0; 12911 }, 12912 focusItemAtIndex: function focusItemAtIndex() { 12913 return undefined; 12914 }, 12915 focusListRoot: function focusListRoot() { 12916 return undefined; 12917 }, 12918 getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex() { 12919 return -1; 12920 }, 12921 isSelectableItemAtIndex: function isSelectableItemAtIndex() { 12922 return false; 12923 } 12924 }; 12925 // tslint:enable:object-literal-sort-keys 12926 }, 12927 enumerable: true, 12928 configurable: true 12929 }); 12930 MDCMenuFoundation.prototype.destroy = function () { 12931 if (this.closeAnimationEndTimerId_) { 12932 clearTimeout(this.closeAnimationEndTimerId_); 12933 } 12934 this.adapter.closeSurface(); 12935 }; 12936 MDCMenuFoundation.prototype.handleKeydown = function (evt) { 12937 var key = evt.key, 12938 keyCode = evt.keyCode;
12939 var isTab = key === 'Tab' || keyCode === 9; 12940 if (isTab) { 12941 this.adapter.closeSurface( /** skipRestoreFocus */true); 12942 } 12943 }; 12944 MDCMenuFoundation.prototype.handleItemAction = function (listItem) { 12945 var _this = this; 12946 var index = this.adapter.getElementIndex(listItem); 12947 if (index < 0) { 12948 return; 12949 } 12950 this.adapter.notifySelected({ index: index }); 12951 this.adapter.closeSurface(); 12952 // Wait for the menu to close before adding/removing classes that affect styles. 12953 this.closeAnimationEndTimerId_ = setTimeout(function () { 12954 // Recompute the index in case the menu contents have changed. 12955 var recomputedIndex = _this.adapter.getElementIndex(listItem); 12956 if (recomputedIndex >= 0 && _this.adapter.isSelectableItemAtIndex(recomputedIndex)) { 12957 _this.setSelectedIndex(recomputedIndex); 12958 } 12959 }, foundation_2.MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION); 12960 }; 12961 MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () { 12962 switch (this.defaultFocusState_) { 12963 case constants_2.DefaultFocusState.FIRST_ITEM: 12964 this.adapter.focusItemAtIndex(0); 12965 break; 12966 case constants_2.DefaultFocusState.LAST_ITEM: 12967 this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1); 12968 break; 12969 case constants_2.DefaultFocusState.NONE: 12970 // Do nothing. 12971 break; 12972 default: 12973 this.adapter.focusListRoot(); 12974 break; 12975 } 12976 }; 12977 /** 12978 * Sets default focus state where the menu should focus every time when menu 12979 * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by 12980 * default. 12981 */ 12982 MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) { 12983 this.defaultFocusState_ = focusState; 12984 }; 12985 /** 12986 * Selects the list item at `index` within the menu. 12987 * @param index Index of list item within the menu. 12988 */ 12989 MDCMenuFoundation.prototype.setSelectedIndex = function (index) { 12990 this.validatedIndex_(index); 12991 if (!this.adapter.isSelectableItemAtIndex(index)) { 12992 throw new Error('MDCMenuFoundation: No selection group at specified index.'); 12993 } 12994 var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index); 12995 if (prevSelectedIndex >= 0) { 12996 this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, constants_2.strings.ARIA_CHECKED_ATTR); 12997 this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM); 12998 } 12999 this.adapter.addClassToElementAtIndex(index, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM); 13000 this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_CHECKED_ATTR, 'true'); 13001 }; 13002 /** 13003 * Sets the enabled state to isEnabled for the menu item at the given index. 13004 * @param index Index of the menu item 13005 * @param isEnabled The desired enabled state of the menu item. 13006 */ 13007 MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) { 13008 this.validatedIndex_(index); 13009 if (isEnabled) { 13010 this.adapter.removeClassFromElementAtIndex(index, constants_1.cssClasse
13010s.LIST_ITEM_DISABLED_CLASS); 13011 this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'false'); 13012 } else { 13013 this.adapter.addClassToElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); 13014 this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'true'); 13015 } 13016 }; 13017 MDCMenuFoundation.prototype.validatedIndex_ = function (index) { 13018 var menuSize = this.adapter.getMenuItemCount(); 13019 var isIndexInRange = index >= 0 && index < menuSize; 13020 if (!isIndexInRange) { 13021 throw new Error('MDCMenuFoundation: No list item at specified index.'); 13022 } 13023 }; 13024 return MDCMenuFoundation; 13025}(foundation_1.MDCFoundation); 13026exports.MDCMenuFoundation = MDCMenuFoundation; 13027// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 13028exports.default = MDCMenuFoundation; 13029 13030/***/ }), 13031
13032/***/ "./packages/mdc-menu/index.ts": 13033/*!************************************!*\ 13034 !*** ./packages/mdc-menu/index.ts ***! 13035 \************************************/ 13036/*! no static exports found */ 13037/***/ (function(module, exports, __webpack_require__) { 13038 13039"use strict"; 13040 13041/** 13042 * @license 13043 * Copyright 2019 Google Inc. 13044 * 13045 * Permission is hereby granted, free of charge, to any person obtaining a copy 13046 * of this software and associated documentation files (the "Software"), to deal 13047 * in the Software without restriction, including without limitation the rights 13048 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13049 * copies of the Software, and to permit persons to whom the Software is 13050 * furnished to do so, subject to the following conditions: 13051 * 13052 * The above copyright notice and this permission notice shall be included in 13053 * all copies or substantial portions of the Software. 13054 * 13055 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13056 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13057 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13058 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13059 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13060 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13061 * THE SOFTWARE. 13062 */ 13063 13064function __export(m) { 13065 for (var p in m) { 13066 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 13067 } 13068} 13069Object.defineProperty(exports, "__esModule", { value: true }); 13070var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"); // for backward compatibility 13071exports.Corner = constants_1.Corner; 13072__export(__webpack_require__(/*! ./component */ "./packages/mdc-menu/component.ts")); 13073__export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts")); 13074__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts")); 13075 13076/***/ }), 13077
13078/***/ "./packages/mdc-notched-outline/component.ts": 13079/*!***************************************************!*\ 13080 !*** ./packages/mdc-notched-outline/component.ts ***! 13081 \***************************************************/ 13082/*! no static exports found */ 13083/***/ (function(module, exports, __webpack_require__) { 13084 13085"use strict"; 13086 13087/** 13088 * @license 13089 * Copyright 2017 Google Inc. 13090 * 13091 * Permission is hereby granted, free of charge, to any person obtaining a copy 13092 * of this software and associated documentation files (the "Software"), to deal 13093 * in the Software without restriction, including without limitation the rights 13094 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13095 * copies of the Software, and to permit persons to whom the Software is 13096 * furnished to do so, subject to the following conditions: 13097 * 13098 * The above copyright notice and this permission notice shall be included in 13099 * all copies or substantial portions of the Software. 13100 * 13101 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13102 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13103 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13104 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13105 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13106 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13107 * THE SOFTWARE. 13108 */ 13109 13110var __extends = this && this.__extends || function () { 13111 var _extendStatics = function extendStatics(d, b) { 13112 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 13113 d.__proto__ = b; 13114 } || function (d, b) { 13115 for (var p in b) { 13116 if (b.hasOwnProperty(p)) d[p] = b[p]; 13117 } 13118 }; 13119 return _extendStatics(d, b); 13120 }; 13121 return function (d, b) { 13122 _extendStatics(d, b); 13123 function __() { 13124 this.constructor = d; 13125 } 13126 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13127 }; 13128}(); 13129Object.defineProperty(exports, "__esModule", { value: true }); 13130var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 13131var foundation_1 = __webpack_require__(/*! @material/floating-label/foundation */ "./packages/mdc-floating-label/foundation.ts"); 13132var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"); 13133var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts"); 13134var MDCNotchedOutline = /** @class */function (_super) { 13135 __extends(MDCNotchedOutline, _super); 13136 function MDCNotchedOutline() { 13137 return _super !== null && _super.apply(this, arguments) || this; 13138 } 13139 MDCNotchedOutline.attachTo = function (root) { 13140 return new MDCNotchedOutline(root); 13141 }; 13142 MDCNotchedOutline.prototype.initialSyncWithDOM = function () { 13143 this.notchElement_ = this.root.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR); 13144 var label = this.root.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT); 13145 if (label) { 13146 label.style.transitionDuration = '0s';
13147 this.root.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED); 13148 requestAnimationFrame(function () { 13149 label.style.transitionDuration = ''; 13150 }); 13151 } else { 13152 this.root.classList.add(constants_1.cssClasses.NO_LABEL); 13153 } 13154 }; 13155 /** 13156 * Updates classes and styles to open the notch to the specified width. 13157 * @param notchWidth The notch width in the outline. 13158 */ 13159 MDCNotchedOutline.prototype.notch = function (notchWidth) { 13160 this.foundation.notch(notchWidth); 13161 }; 13162 /** 13163 * Updates classes and styles to close the notch. 13164 */ 13165 MDCNotchedOutline.prototype.closeNotch = function () { 13166 this.foundation.closeNotch(); 13167 }; 13168 MDCNotchedOutline.prototype.getDefaultFoundation = function () { 13169 var _this = this; 13170 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 13171 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 13172 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 13173 var adapter = { 13174 addClass: function addClass(className) { 13175 return _this.root.classList.add(className); 13176 }, 13177 removeClass: function removeClass(className) { 13178 return _this.root.classList.remove(className); 13179 }, 13180 setNotchWidthProperty: function setNotchWidthProperty(width) { 13181 return _this.notchElement_.style.setProperty('width', width + 'px'); 13182 }, 13183 removeNotchWidthProperty: function removeNotchWidthProperty() { 13184 return _this.notchElement_.style.removeProperty('width'); 13185 } 13186 }; 13187 // tslint:enable:object-literal-sort-keys 13188 return new foundation_2.MDCNotchedOutlineFoundation(adapter); 13189 }; 13190 return MDCNotchedOutline; 13191}(component_1.MDCComponent); 13192exports.MDCNotchedOutline = MDCNotchedOutline; 13193 13194/***/ }), 13195
13196/***/ "./packages/mdc-notched-outline/constants.ts": 13197/*!***************************************************!*\ 13198 !*** ./packages/mdc-notched-outline/constants.ts ***! 13199 \***************************************************/ 13200/*! no static exports found */ 13201/***/ (function(module, exports, __webpack_require__) { 13202 13203"use strict"; 13204 13205/** 13206 * @license 13207 * Copyright 2018 Google Inc. 13208 * 13209 * Permission is hereby granted, free of charge, to any person obtaining a copy 13210 * of this software and associated documentation files (the "Software"), to deal 13211 * in the Software without restriction, including without limitation the rights 13212 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13213 * copies of the Software, and to permit persons to whom the Software is 13214 * furnished to do so, subject to the following conditions: 13215 * 13216 * The above copyright notice and this permission notice shall be included in 13217 * all copies or substantial portions of the Software. 13218 * 13219 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13220 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13221 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13222 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13223 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13224 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13225 * THE SOFTWARE. 13226 */ 13227 13228Object.defineProperty(exports, "__esModule", { value: true }); 13229var strings = { 13230 NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch' 13231}; 13232exports.strings = strings; 13233var numbers = { 13234 // This should stay in sync with $mdc-notched-outline-padding * 2. 13235 NOTCH_ELEMENT_PADDING: 8 13236}; 13237exports.numbers = numbers;
13238var cssClasses = { 13239 NO_LABEL: 'mdc-notched-outline--no-label', 13240 OUTLINE_NOTCHED: 'mdc-notched-outline--notched', 13241 OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded' 13242}; 13243exports.cssClasses = cssClasses; 13244 13245/***/ }), 13246
13247/***/ "./packages/mdc-notched-outline/foundation.ts": 13248/*!****************************************************!*\ 13249 !*** ./packages/mdc-notched-outline/foundation.ts ***! 13250 \****************************************************/ 13251/*! no static exports found */ 13252/***/ (function(module, exports, __webpack_require__) { 13253 13254"use strict"; 13255 13256/** 13257 * @license 13258 * Copyright 2017 Google Inc. 13259 * 13260 * Permission is hereby granted, free of charge, to any person obtaining a copy 13261 * of this software and associated documentation files (the "Software"), to deal 13262 * in the Software without restriction, including without limitation the rights 13263 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13264 * copies of the Software, and to permit persons to whom the Software is 13265 * furnished to do so, subject to the following conditions: 13266 * 13267 * The above copyright notice and this permission notice shall be included in 13268 * all copies or substantial portions of the Software. 13269 * 13270 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13271 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13272 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13273 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13274 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13275 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13276 * THE SOFTWARE. 13277 */ 13278 13279var __extends = this && this.__extends || function () { 13280 var _extendStatics = function extendStatics(d, b) { 13281 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 13282 d.__proto__ = b; 13283 } || function (d, b) { 13284 for (var p in b) { 13285 if (b.hasOwnProperty(p)) d[p] = b[p]; 13286 } 13287 }; 13288 return _extendStatics(d, b); 13289 }; 13290 return function (d, b) { 13291 _extendStatics(d, b); 13292 function __() { 13293 this.constructor = d; 13294 } 13295 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13296 }; 13297}(); 13298var __assign = this && this.__assign || function () { 13299 __assign = Object.assign || function (t) { 13300 for (var s, i = 1, n = arguments.length; i < n; i++) { 13301 s = arguments[i]; 13302 for (var p in s) { 13303 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 13304 } 13305 } 13306 return t; 13307 }; 13308 return __assign.apply(this, arguments); 13309}; 13310Object.defineProperty(exports, "__esModule", { value: true }); 13311var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 13312var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"); 13313var MDCNotchedOutlineFoundation = /** @class */function (_super) { 13314 __extends(MDCNotchedOutlineFoundation, _super); 13315 function MDCNotchedOutlineFoundation(adapter) { 13316 return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this; 13317 } 13318 Object.defineProperty(MDCNotchedOutlineFoundation, "strings", { 13319 get: function get() { 13320 return constants_1.strings; 13321 }, 13322 enumerable: true, 13323 configurable: true 13324 }); 13325 Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", { 13326 get: function get() {
13327 return constants_1.cssClasses; 13328 }, 13329 enumerable: true, 13330 configurable: true 13331 }); 13332 Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", { 13333 get: function get() { 13334 return constants_1.numbers; 13335 }, 13336 enumerable: true, 13337 configurable: true 13338 }); 13339 Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", { 13340 /** 13341 * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types. 13342 */ 13343 get: function get() { 13344 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 13345 return { 13346 addClass: function addClass() { 13347 return undefined; 13348 }, 13349 removeClass: function removeClass() { 13350 return undefined; 13351 }, 13352 setNotchWidthProperty: function setNotchWidthProperty() { 13353 return undefined; 13354 }, 13355 removeNotchWidthProperty: function removeNotchWidthProperty() { 13356 return undefined; 13357 } 13358 }; 13359 // tslint:enable:object-literal-sort-keys 13360 }, 13361 enumerable: true, 13362 configurable: true 13363 }); 13364 /** 13365 * Adds the outline notched selector and updates the notch width calculated based off of notchWidth. 13366 */ 13367 MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) { 13368 var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; 13369 if (notchWidth > 0) { 13370 notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right. 13371 } 13372 this.adapter.setNotchWidthProperty(notchWidth); 13373 this.adapter.addClass(OUTLINE_NOTCHED); 13374 }; 13375 /** 13376 * Removes notched outline selector to close the notch in the outline. 13377 */ 13378 MDCNotchedOutlineFoundation.prototype.closeNotch = function () { 13379 var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; 13380 this.adapter.removeClass(OUTLINE_NOTCHED); 13381 this.adapter.removeNotchWidthProperty(); 13382 }; 13383 return MDCNotchedOutlineFoundation; 13384}(foundation_1.MDCFoundation); 13385exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation; 13386// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 13387exports.default = MDCNotchedOutlineFoundation; 13388 13389/***/ }), 13390
13391/***/ "./packages/mdc-notched-outline/index.ts": 13392/*!***********************************************!*\ 13393 !*** ./packages/mdc-notched-outline/index.ts ***! 13394 \***********************************************/ 13395/*! no static exports found */ 13396/***/ (function(module, exports, __webpack_require__) { 13397 13398"use strict"; 13399 13400/** 13401 * @license 13402 * Copyright 2019 Google Inc. 13403 * 13404 * Permission is hereby granted, free of charge, to any person obtaining a copy 13405 * of this software and associated documentation files (the "Software"), to deal 13406 * in the Software without restriction, including without limitation the rights 13407 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13408 * copies of the Software, and to permit persons to whom the Software is 13409 * furnished to do so, subject to the following conditions: 13410 * 13411 * The above copyright notice and this permission notice shall be included in 13412 * all copies or substantial portions of the Software. 13413 * 13414 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13415 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13416 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13417 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13418 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13419 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13420 * THE SOFTWARE. 13421 */ 13422 13423function __export(m) { 13424 for (var p in m) { 13425 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 13426 } 13427} 13428Object.defineProperty(exports, "__esModule", { value: true }); 13429__export(__webpack_require__(/*! ./component */ "./packages/mdc-notched-outline/component.ts")); 13430__export(__webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts")); 13431__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts")); 13432 13433/***/ }), 13434
13435/***/ "./packages/mdc-radio/component.ts": 13436/*!*****************************************!*\ 13437 !*** ./packages/mdc-radio/component.ts ***! 13438 \*****************************************/ 13439/*! no static exports found */ 13440/***/ (function(module, exports, __webpack_require__) { 13441 13442"use strict"; 13443 13444/** 13445 * @license 13446 * Copyright 2016 Google Inc. 13447 * 13448 * Permission is hereby granted, free of charge, to any person obtaining a copy 13449 * of this software and associated documentation files (the "Software"), to deal 13450 * in the Software without restriction, including without limitation the rights 13451 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13452 * copies of the Software, and to permit persons to whom the Software is 13453 * furnished to do so, subject to the following conditions: 13454 * 13455 * The above copyright notice and this permission notice shall be included in 13456 * all copies or substantial portions of the Software. 13457 * 13458 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13459 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13460 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13461 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13462 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13463 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13464 * THE SOFTWARE. 13465 */ 13466 13467var __extends = this && this.__extends || function () { 13468 var _extendStatics = function extendStatics(d, b) { 13469 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 13470 d.__proto__ = b; 13471 } || function (d, b) { 13472 for (var p in b) { 13473 if (b.hasOwnProperty(p)) d[p] = b[p]; 13474 } 13475 }; 13476 return _extendStatics(d, b); 13477 }; 13478 return function (d, b) { 13479 _extendStatics(d, b); 13480 function __() { 13481 this.constructor = d; 13482 } 13483 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13484 }; 13485}(); 13486var __assign = this && this.__assign || function () { 13487 __assign = Object.assign || function (t) { 13488 for (var s, i = 1, n = arguments.length; i < n; i++) { 13489 s = arguments[i]; 13490 for (var p in s) { 13491 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 13492 } 13493 } 13494 return t; 13495 }; 13496 return __assign.apply(this, arguments); 13497}; 13498Object.defineProperty(exports, "__esModule", { value: true }); 13499var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 13500var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 13501var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 13502var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 13503var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts"); 13504var MDCRadio = /** @class */function (_super) { 13505 __extends(MDCRadio, _super); 13506 function MDCRadio() { 13507 var _this = _super !== null && _super.apply(this, arguments) || this; 13508 _this.ripple_ = _this.createRipple_(); 13509 return _this; 13510 } 13511 MDCRadio.attachTo = function (root) { 13512 return new MDCRadio(root); 13513 }; 13514 Object.defineProperty(MDCRadio.prototype, "checked", { 13515 get: function get() { 13516 return this.nativeControl_.checked; 13517 }, 13518 set: function set(checked) { 13519 this.nativeControl_.checked = checked; 13520 }, 13521 enumerable: true, 13522 configurable: true 13523 }); 13524 Object.defineProperty(MDCRadio.prototype, "disabled", { 13525 get: function get() { 13526 return this.nativeControl_.disabled; 13527 }, 13528 set: function set(disabled) { 13529 this.foundation.setDisabled(disabled); 13530 }, 13531 enumerable: true, 13532 configurable: true 13533 }); 13534 Object.defineProperty(MDCRadio.prototype, "value", { 13535 get: function get() { 13536 return this.nativeControl_.value; 13537 }, 13538 set: function set(value) { 13539 this.nativeControl_.value = value; 13540 }, 13541 enumerable: true, 13542 configurable: true 13543 });
13544 Object.defineProperty(MDCRadio.prototype, "ripple", { 13545 get: function get() { 13546 return this.ripple_; 13547 }, 13548 enumerable: true, 13549 configurable: true 13550 }); 13551 MDCRadio.prototype.destroy = function () { 13552 this.ripple_.destroy(); 13553 _super.prototype.destroy.call(this); 13554 }; 13555 MDCRadio.prototype.getDefaultFoundation = function () { 13556 var _this = this; 13557 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 13558 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 13559 var adapter = { 13560 addClass: function addClass(className) { 13561 return _this.root.classList.add(className); 13562 }, 13563 removeClass: function removeClass(className) { 13564 return _this.root.classList.remove(className); 13565 }, 13566 setNativeControlDisabled: function setNativeControlDisabled(disabled) { 13567 return _this.nativeControl_.disabled = disabled; 13568 } 13569 }; 13570 return new foundation_2.MDCRadioFoundation(adapter); 13571 }; 13572 MDCRadio.prototype.createRipple_ = function () { 13573 var _this = this; 13574 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 13575 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 13576 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 13577 var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 13578 return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive()); 13579 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 13580 return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive()); 13581 }, 13582 // Radio buttons technically go "active" whenever there is *any* keyboard interaction. 13583 // This is not the UI we desire. 13584 isSurfaceActive: function isSurfaceActive() { 13585 return false; 13586 }, isUnbounded: function isUnbounded() { 13587 return true; 13588 } }); 13589 // tslint:enable:object-literal-sort-keys 13590 return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter)); 13591 }; 13592 Object.defineProperty(MDCRadio.prototype, "nativeControl_", { 13593 get: function get() { 13594 var NATIVE_CONTROL_SELECTOR = foundation_2.MDCRadioFoundation.strings.NATIVE_CONTROL_SELECTOR; 13595 var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR); 13596 if (!el) { 13597 throw new Error("Radio component requires a " + NATIVE_CONTROL_SELECTOR + " element"); 13598 } 13599 return el; 13600 }, 13601 enumerable: true, 13602 configurable: true 13603 }); 13604 return MDCRadio; 13605}(component_1.MDCComponent); 13606exports.MDCRadio = MDCRadio; 13607 13608/***/ }), 13609
13610/***/ "./packages/mdc-radio/constants.ts": 13611/*!*****************************************!*\ 13612 !*** ./packages/mdc-radio/constants.ts ***! 13613 \*****************************************/ 13614/*! no static exports found */ 13615/***/ (function(module, exports, __webpack_require__) { 13616 13617"use strict"; 13618 13619/** 13620 * @license 13621 * Copyright 2016 Google Inc. 13622 * 13623 * Permission is hereby granted, free of charge, to any person obtaining a copy 13624 * of this software and associated documentation files (the "Software"), to deal 13625 * in the Software without restriction, including without limitation the rights 13626 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13627 * copies of the Software, and to permit persons to whom the Software is 13628 * furnished to do so, subject to the following conditions: 13629 * 13630 * The above copyright notice and this permission notice shall be included in 13631 * all copies or substantial portions of the Software. 13632 * 13633 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13634 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13635 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13636 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13637 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13638 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13639 * THE SOFTWARE. 13640 */ 13641 13642Object.defineProperty(exports, "__esModule", { value: true }); 13643var strings = { 13644 NATIVE_CONTROL_SELECTOR: '.mdc-radio__native-control' 13645}; 13646exports.strings = strings;
13647var cssClasses = { 13648 DISABLED: 'mdc-radio--disabled', 13649 ROOT: 'mdc-radio' 13650}; 13651exports.cssClasses = cssClasses; 13652 13653/***/ }), 13654
13655/***/ "./packages/mdc-radio/foundation.ts": 13656/*!******************************************!*\ 13657 !*** ./packages/mdc-radio/foundation.ts ***! 13658 \******************************************/ 13659/*! no static exports found */ 13660/***/ (function(module, exports, __webpack_require__) { 13661 13662"use strict"; 13663 13664/** 13665 * @license 13666 * Copyright 2016 Google Inc. 13667 * 13668 * Permission is hereby granted, free of charge, to any person obtaining a copy 13669 * of this software and associated documentation files (the "Software"), to deal 13670 * in the Software without restriction, including without limitation the rights 13671 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13672 * copies of the Software, and to permit persons to whom the Software is 13673 * furnished to do so, subject to the following conditions: 13674 * 13675 * The above copyright notice and this permission notice shall be included in 13676 * all copies or substantial portions of the Software. 13677 * 13678 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13679 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13680 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13681 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13682 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13683 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13684 * THE SOFTWARE. 13685 */ 13686 13687var __extends = this && this.__extends || function () { 13688 var _extendStatics = function extendStatics(d, b) { 13689 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 13690 d.__proto__ = b; 13691 } || function (d, b) { 13692 for (var p in b) { 13693 if (b.hasOwnProperty(p)) d[p] = b[p]; 13694 } 13695 }; 13696 return _extendStatics(d, b); 13697 }; 13698 return function (d, b) { 13699 _extendStatics(d, b); 13700 function __() { 13701 this.constructor = d; 13702 } 13703 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13704 }; 13705}(); 13706var __assign = this && this.__assign || function () { 13707 __assign = Object.assign || function (t) { 13708 for (var s, i = 1, n = arguments.length; i < n; i++) { 13709 s = arguments[i]; 13710 for (var p in s) { 13711 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 13712 } 13713 } 13714 return t; 13715 }; 13716 return __assign.apply(this, arguments); 13717}; 13718Object.defineProperty(exports, "__esModule", { value: true }); 13719var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 13720var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts"); 13721var MDCRadioFoundation = /** @class */function (_super) { 13722 __extends(MDCRadioFoundation, _super); 13723 function MDCRadioFoundation(adapter) { 13724 return _super.call(this, __assign(__assign({}, MDCRadioFoundation.defaultAdapter), adapter)) || this; 13725 } 13726 Object.defineProperty(MDCRadioFoundation, "cssClasses", { 13727 get: function get() {
13728 return constants_1.cssClasses; 13729 }, 13730 enumerable: true, 13731 configurable: true 13732 }); 13733 Object.defineProperty(MDCRadioFoundation, "strings", { 13734 get: function get() { 13735 return constants_1.strings; 13736 }, 13737 enumerable: true, 13738 configurable: true 13739 }); 13740 Object.defineProperty(MDCRadioFoundation, "defaultAdapter", { 13741 get: function get() { 13742 return { 13743 addClass: function addClass() { 13744 return undefined; 13745 }, 13746 removeClass: function removeClass() { 13747 return undefined; 13748 }, 13749 setNativeControlDisabled: function setNativeControlDisabled() { 13750 return undefined; 13751 } 13752 }; 13753 }, 13754 enumerable: true, 13755 configurable: true 13756 }); 13757 MDCRadioFoundation.prototype.setDisabled = function (disabled) { 13758 var DISABLED = MDCRadioFoundation.cssClasses.DISABLED; 13759 this.adapter.setNativeControlDisabled(disabled); 13760 if (disabled) { 13761 this.adapter.addClass(DISABLED); 13762 } else { 13763 this.adapter.removeClass(DISABLED); 13764 } 13765 }; 13766 return MDCRadioFoundation; 13767}(foundation_1.MDCFoundation); 13768exports.MDCRadioFoundation = MDCRadioFoundation; 13769// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 13770exports.default = MDCRadioFoundation; 13771 13772/***/ }), 13773
13774/***/ "./packages/mdc-radio/index.ts": 13775/*!*************************************!*\ 13776 !*** ./packages/mdc-radio/index.ts ***! 13777 \*************************************/ 13778/*! no static exports found */ 13779/***/ (function(module, exports, __webpack_require__) { 13780 13781"use strict"; 13782 13783/** 13784 * @license 13785 * Copyright 2019 Google Inc. 13786 * 13787 * Permission is hereby granted, free of charge, to any person obtaining a copy 13788 * of this software and associated documentation files (the "Software"), to deal 13789 * in the Software without restriction, including without limitation the rights 13790 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13791 * copies of the Software, and to permit persons to whom the Software is 13792 * furnished to do so, subject to the following conditions: 13793 * 13794 * The above copyright notice and this permission notice shall be included in 13795 * all copies or substantial portions of the Software. 13796 * 13797 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13798 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13799 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13800 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13801 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13802 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13803 * THE SOFTWARE. 13804 */ 13805 13806function __export(m) { 13807 for (var p in m) { 13808 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 13809 } 13810} 13811Object.defineProperty(exports, "__esModule", { value: true }); 13812__export(__webpack_require__(/*! ./component */ "./packages/mdc-radio/component.ts")); 13813__export(__webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts")); 13814__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts")); 13815 13816/***/ }), 13817
13818/***/ "./packages/mdc-ripple/component.ts": 13819/*!******************************************!*\ 13820 !*** ./packages/mdc-ripple/component.ts ***! 13821 \******************************************/ 13822/*! no static exports found */ 13823/***/ (function(module, exports, __webpack_require__) { 13824 13825"use strict"; 13826 13827/** 13828 * @license 13829 * Copyright 2016 Google Inc. 13830 * 13831 * Permission is hereby granted, free of charge, to any person obtaining a copy 13832 * of this software and associated documentation files (the "Software"), to deal 13833 * in the Software without restriction, including without limitation the rights 13834 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13835 * copies of the Software, and to permit persons to whom the Software is 13836 * furnished to do so, subject to the following conditions: 13837 * 13838 * The above copyright notice and this permission notice shall be included in 13839 * all copies or substantial portions of the Software. 13840 * 13841 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13842 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13843 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13844 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13845 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13846 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13847 * THE SOFTWARE. 13848 */ 13849 13850var __extends = this && this.__extends || function () { 13851 var _extendStatics = function extendStatics(d, b) { 13852 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 13853 d.__proto__ = b; 13854 } || function (d, b) { 13855 for (var p in b) { 13856 if (b.hasOwnProperty(p)) d[p] = b[p]; 13857 } 13858 }; 13859 return _extendStatics(d, b); 13860 }; 13861 return function (d, b) { 13862 _extendStatics(d, b); 13863 function __() { 13864 this.constructor = d; 13865 } 13866 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13867 }; 13868}(); 13869var __importStar = this && this.__importStar || function (mod) { 13870 if (mod && mod.__esModule) return mod; 13871 var result = {}; 13872 if (mod != null) for (var k in mod) { 13873 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 13874 }result["default"] = mod; 13875 return result; 13876}; 13877Object.defineProperty(exports, "__esModule", { value: true }); 13878var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 13879var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 13880var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 13881var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"); 13882var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts")); 13883var MDCRipple = /** @class */function (_super) { 13884 __extends(MDCRipple, _super); 13885 function MDCRipple() { 13886 var _this = _super !== null && _super.apply(this, arguments) || this; 13887 _this.disabled = false; 13888 return _this; 13889 } 13890 MDCRipple.attachTo = function (root, opts) { 13891 if (opts === void 0) { 13892 opts = { isUnbounded: undefined }; 13893 } 13894 var ripple = new MDCRipple(root); 13895 // Only override unbounded behavior if option is explicitly specified 13896 if (opts.isUnbounded !== undefined) { 13897 ripple.unbounded = opts.isUnbounded; 13898 } 13899 return ripple; 13900 }; 13901 MDCRipple.createAdapter = function (instance) { 13902 return { 13903 addClass: function addClass(className) { 13904 return instance.root.classList.add(className); 13905 }, 13906 browserSupportsCssVars: function browserSupportsCssVars() { 13907 return util.supportsCssVariables(window); 13908 }, 13909 computeBoundingRect: function computeBoundingRect() { 13910 return instance.root.getBoundingClientRect(); 13911 }, 13912 containsEventTarget: function containsEventTarget(target) { 13913 return instance.root.contains(target); 13914 }, 13915 deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { 13916 return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive()); 13917 }, 13918 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 13919 return instance.root.removeEventListener(evtType, handler, events_1.applyPassive()); 13920 }, 13921 deregisterResizeHandler: function deregisterResizeHandler(handler) { 13922 return window.removeEventListener('resize', handler); 13923 }, 13924 getWindowPageOffset: function getWindowPageOffset() {
13925 return { x: window.pageXOffset, y: window.pageYOffset }; 13926 }, 13927 isSurfaceActive: function isSurfaceActive() { 13928 return ponyfill_1.matches(instance.root, ':active'); 13929 }, 13930 isSurfaceDisabled: function isSurfaceDisabled() { 13931 return Boolean(instance.disabled); 13932 }, 13933 isUnbounded: function isUnbounded() { 13934 return Boolean(instance.unbounded); 13935 }, 13936 registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { 13937 return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive()); 13938 }, 13939 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 13940 return instance.root.addEventListener(evtType, handler, events_1.applyPassive()); 13941 }, 13942 registerResizeHandler: function registerResizeHandler(handler) { 13943 return window.addEventListener('resize', handler); 13944 }, 13945 removeClass: function removeClass(className) { 13946 return instance.root.classList.remove(className); 13947 }, 13948 updateCssVariable: function updateCssVariable(varName, value) { 13949 return instance.root.style.setProperty(varName, value); 13950 } 13951 }; 13952 }; 13953 Object.defineProperty(MDCRipple.prototype, "unbounded", { 13954 get: function get() { 13955 return Boolean(this.unbounded_); 13956 }, 13957 set: function set(unbounded) { 13958 this.unbounded_ = Boolean(unbounded); 13959 this.setUnbounded_(); 13960 }, 13961 enumerable: true, 13962 configurable: true 13963 }); 13964 MDCRipple.prototype.activate = function () { 13965 this.foundation.activate(); 13966 }; 13967 MDCRipple.prototype.deactivate = function () { 13968 this.foundation.deactivate(); 13969 }; 13970 MDCRipple.prototype.layout = function () { 13971 this.foundation.layout(); 13972 }; 13973 MDCRipple.prototype.getDefaultFoundation = function () { 13974 return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this)); 13975 }; 13976 MDCRipple.prototype.initialSyncWithDOM = function () { 13977 var root = this.root; 13978 this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; 13979 }; 13980 /** 13981 * Closure Compiler throws an access control error when directly accessing a 13982 * protected or private property inside a getter/setter, like unbounded above. 13983 * By accessing the protected property inside a method, we solve that problem. 13984 * That's why this function exists. 13985 */ 13986 MDCRipple.prototype.setUnbounded_ = function () { 13987 this.foundation.setUnbounded(Boolean(this.unbounded_)); 13988 }; 13989 return MDCRipple; 13990}(component_1.MDCComponent); 13991exports.MDCRipple = MDCRipple; 13992 13993/***/ }), 13994
13995/***/ "./packages/mdc-ripple/constants.ts": 13996/*!******************************************!*\ 13997 !*** ./packages/mdc-ripple/constants.ts ***! 13998 \******************************************/ 13999/*! no static exports found */ 14000/***/ (function(module, exports, __webpack_require__) { 14001 14002"use strict"; 14003 14004/** 14005 * @license 14006 * Copyright 2016 Google Inc. 14007 * 14008 * Permission is hereby granted, free of charge, to any person obtaining a copy 14009 * of this software and associated documentation files (the "Software"), to deal 14010 * in the Software without restriction, including without limitation the rights 14011 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14012 * copies of the Software, and to permit persons to whom the Software is 14013 * furnished to do so, subject to the following conditions: 14014 * 14015 * The above copyright notice and this permission notice shall be included in 14016 * all copies or substantial portions of the Software. 14017 * 14018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14021 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14022 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14023 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14024 * THE SOFTWARE. 14025 */ 14026 14027Object.defineProperty(exports, "__esModule", { value: true }); 14028exports.cssClasses = { 14029 // Ripple is a special case where the "root" component is really a "mixin" of sorts, 14030 // given that it's an 'upgrade' to an existing component. That being said it is the root 14031 // CSS class that all other CSS classes derive from. 14032 BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', 14033 FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', 14034 FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', 14035 ROOT: 'mdc-ripple-upgraded', 14036 UNBOUNDED: 'mdc-ripple-upgraded--unbounded' 14037}; 14038exports.strings = { 14039 VAR_FG_SCALE: '--mdc-ripple-fg-scale', 14040 VAR_FG_SIZE: '--mdc-ripple-fg-size', 14041 VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', 14042 VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', 14043 VAR_LEFT: '--mdc-ripple-left', 14044 VAR_TOP: '--mdc-ripple-top' 14045}; 14046exports.numbers = { 14047 DEACTIVATION_TIMEOUT_MS: 225, 14048 FG_DEACTIVATION_MS: 150, 14049 INITIAL_ORIGIN_SCALE: 0.6, 14050 PADDING: 10, 14051 TAP_DELAY_MS: 300 14052}; 14053 14054/***/ }), 14055
14056/***/ "./packages/mdc-ripple/foundation.ts": 14057/*!*******************************************!*\ 14058 !*** ./packages/mdc-ripple/foundation.ts ***! 14059 \*******************************************/ 14060/*! no static exports found */ 14061/***/ (function(module, exports, __webpack_require__) { 14062 14063"use strict"; 14064 14065/** 14066 * @license 14067 * Copyright 2016 Google Inc. 14068 * 14069 * Permission is hereby granted, free of charge, to any person obtaining a copy 14070 * of this software and associated documentation files (the "Software"), to deal 14071 * in the Software without restriction, including without limitation the rights 14072 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14073 * copies of the Software, and to permit persons to whom the Software is 14074 * furnished to do so, subject to the following conditions: 14075 * 14076 * The above copyright notice and this permission notice shall be included in 14077 * all copies or substantial portions of the Software. 14078 * 14079 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14080 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14081 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14082 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14083 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14084 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14085 * THE SOFTWARE. 14086 */ 14087 14088var __extends = this && this.__extends || function () { 14089 var _extendStatics = function extendStatics(d, b) { 14090 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 14091 d.__proto__ = b; 14092 } || function (d, b) { 14093 for (var p in b) { 14094 if (b.hasOwnProperty(p)) d[p] = b[p]; 14095 } 14096 }; 14097 return _extendStatics(d, b); 14098 }; 14099 return function (d, b) { 14100 _extendStatics(d, b); 14101 function __() { 14102 this.constructor = d; 14103 } 14104 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 14105 }; 14106}(); 14107var __assign = this && this.__assign || function () { 14108 __assign = Object.assign || function (t) { 14109 for (var s, i = 1, n = arguments.length; i < n; i++) { 14110 s = arguments[i]; 14111 for (var p in s) { 14112 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 14113 } 14114 } 14115 return t; 14116 }; 14117 return __assign.apply(this, arguments); 14118}; 14119Object.defineProperty(exports, "__esModule", { value: true }); 14120var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 14121var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts"); 14122var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"); 14123// Activation events registered on the root element of each instance for activation 14124var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; 14125// Deactivation events registered on documentElement when a pointer-related down event occurs 14126var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; 14127// simultaneous nested activations 14128var activatedTargets = []; 14129var MDCRippleFoundation = /** @class */function (_super) { 14130 __extends(MDCRippleFoundation, _super); 14131 function MDCRippleFoundation(adapter) { 14132 var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this; 14133 _this.activationAnimationHasEnded_ = false; 14134 _this.activationTimer_ = 0; 14135 _this.fgDeactivationRemovalTimer_ = 0; 14136 _this.fgScale_ = '0'; 14137 _this.frame_ = { width: 0, height: 0 }; 14138 _this.initialSize_ = 0; 14139 _this.layoutFrame_ = 0; 14140 _this.maxRadius_ = 0; 14141 _this.unboundedCoords_ = { left: 0, top: 0 }; 14142 _this.activationState_ = _this.defaultActivationState_(); 14143 _this.activationTimerCallback_ = function () { 14144 _this.activationAnimationHasEnded_ = true; 14145 _this.runDeactivationUXLogicIfReady_(); 14146 }; 14147 _this.activateHandler_ = function (e) { 14148 return _this.activate_(e); 14149 }; 14150 _this.deactivateHandler_ = function () { 14151 return _this.deactivate_(); 14152 }; 14153 _this.focusHandler_ = function () { 14154 return _this.handleFocus(); 14155 }; 14156 _this.blurHandler_ = function () { 14157 return _this.handleBlur(); 14158 }; 14159 _this.resizeHandler_ = function () { 14160 return _this.layout(); 14161 }; 14162 return _this; 14163 }
14164 Object.defineProperty(MDCRippleFoundation, "cssClasses", { 14165 get: function get() { 14166 return constants_1.cssClasses; 14167 }, 14168 enumerable: true, 14169 configurable: true 14170 }); 14171 Object.defineProperty(MDCRippleFoundation, "strings", { 14172 get: function get() { 14173 return constants_1.strings; 14174 }, 14175 enumerable: true, 14176 configurable: true 14177 }); 14178 Object.defineProperty(MDCRippleFoundation, "numbers", { 14179 get: function get() { 14180 return constants_1.numbers; 14181 }, 14182 enumerable: true, 14183 configurable: true 14184 }); 14185 Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { 14186 get: function get() { 14187 return { 14188 addClass: function addClass() { 14189 return undefined; 14190 }, 14191 browserSupportsCssVars: function browserSupportsCssVars() { 14192 return true; 14193 }, 14194 computeBoundingRect: function computeBoundingRect() { 14195 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 14196 }, 14197 containsEventTarget: function containsEventTarget() { 14198 return true; 14199 }, 14200 deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { 14201 return undefined; 14202 }, 14203 deregisterInteractionHandler: function deregisterInteractionHandler() { 14204 return undefined; 14205 }, 14206 deregisterResizeHandler: function deregisterResizeHandler() { 14207 return undefined; 14208 }, 14209 getWindowPageOffset: function getWindowPageOffset() { 14210 return { x: 0, y: 0 }; 14211 }, 14212 isSurfaceActive: function isSurfaceActive() { 14213 return true; 14214 }, 14215 isSurfaceDisabled: function isSurfaceDisabled() { 14216 return true; 14217 }, 14218 isUnbounded: function isUnbounded() { 14219 return true; 14220 }, 14221 registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { 14222 return undefined; 14223 }, 14224 registerInteractionHandler: function registerInteractionHandler() { 14225 return undefined; 14226 }, 14227 registerResizeHandler: function registerResizeHandler() { 14228 return undefined; 14229 }, 14230 removeClass: function removeClass() { 14231 return undefined; 14232 }, 14233 updateCssVariable: function updateCssVariable() { 14234 return undefined; 14235 } 14236 }; 14237 }, 14238 enumerable: true, 14239 configurable: true 14240 }); 14241 MDCRippleFoundation.prototype.init = function () { 14242 var _this = this; 14243 var supportsPressRipple = this.supportsPressRipple_(); 14244 this.registerRootHandlers_(supportsPressRipple); 14245 if (supportsPressRipple) { 14246 var _a = MDCRippleFoundation.cssClasses, 14247 ROOT_1 = _a.ROOT, 14248 UNBOUNDED_1 = _a.UNBOUNDED; 14249 requestAnimationFrame(function () { 14250 _this.adapter.addClass(ROOT_1); 14251 if (_this.adapter.isUnbounded()) { 14252 _this.adapter.addClass(UNBOUNDED_1); 14253 // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple 14254 _this.layoutInternal_(); 14255 } 14256 }); 14257 } 14258 }; 14259 MDCRippleFoundation.prototype.destroy = function () { 14260 var _this = this; 14261 if (this.supportsPressRipple_()) { 14262 if (this.activationTimer_) { 14263 clearTimeout(this.activationTimer_); 14264 this.activationTimer_ = 0; 14265 this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); 14266 } 14267 if (this.fgDeactivationRemovalTimer_) { 14268 clearTimeout(this.fgDeactivationRemovalTimer_); 14269 this.fgDeactivationRemovalTimer_ = 0; 14270 this.adapter.removeClass(MDCRippleFoundation.cssClasse
14270s.FG_DEACTIVATION); 14271 } 14272 var _a = MDCRippleFoundation.cssClasses, 14273 ROOT_2 = _a.ROOT, 14274 UNBOUNDED_2 = _a.UNBOUNDED; 14275 requestAnimationFrame(function () { 14276 _this.adapter.removeClass(ROOT_2); 14277 _this.adapter.removeClass(UNBOUNDED_2); 14278 _this.removeCssVars_(); 14279 }); 14280 } 14281 this.deregisterRootHandlers_(); 14282 this.deregisterDeactivationHandlers_(); 14283 }; 14284 /** 14285 * @param evt Optional event containing position information. 14286 */ 14287 MDCRippleFoundation.prototype.activate = function (evt) { 14288 this.activate_(evt); 14289 }; 14290 MDCRippleFoundation.prototype.deactivate = function () { 14291 this.deactivate_(); 14292 }; 14293 MDCRippleFoundation.prototype.layout = function () { 14294 var _this = this; 14295 if (this.layoutFrame_) { 14296 cancelAnimationFrame(this.layoutFrame_); 14297 } 14298 this.layoutFrame_ = requestAnimationFrame(function () { 14299 _this.layoutInternal_(); 14300 _this.layoutFrame_ = 0; 14301 }); 14302 }; 14303 MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { 14304 var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; 14305 if (unbounded) { 14306 this.adapter.addClass(UNBOUNDED); 14307 } else { 14308 this.adapter.removeClass(UNBOUNDED); 14309 } 14310 }; 14311 MDCRippleFoundation.prototype.handleFocus = function () { 14312 var _this = this; 14313 requestAnimationFrame(function () { 14314 return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); 14315 }); 14316 }; 14317 MDCRippleFoundation.prototype.handleBlur = function () { 14318 var _this = this; 14319 requestAnimationFrame(function () { 14320 return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); 14321 }); 14322 }; 14323 /** 14324 * We compute this property so that we are not querying information about the client 14325 * until the point in time where the foundation requests it. This prevents scenarios where 14326 * client-side feature-detection may happen too early, such as when components are rendered on the server 14327 * and then initialized at mount time on the client. 14328 */ 14329 MDCRippleFoundation.prototype.supportsPressRipple_ = function () { 14330 return this.adapter.browserSupportsCssVars(); 14331 }; 14332 MDCRippleFoundation.prototype.defaultActivationState_ = function () { 14333 return { 14334 activationEvent: undefined, 14335 hasDeactivationUXRun: false, 14336 isActivated: false, 14337 isProgrammatic: false, 14338 wasActivatedByPointer: false, 14339 wasElementMadeActive: false 14340 }; 14341 }; 14342 /** 14343 * supportsPressRipple Passed from init to save a redundant function call 14344 */ 14345 MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { 14346 var _this = this; 14347 if (supportsPressRipple) { 14348 ACTIVATION_EVENT_TYPES.forEach(function (evtType) { 14349 _this.adapter.registerInteractionHandler(evtType, _this.activateHandler_); 14350 }); 14351 if (this.adapter.isUnbounded()) { 14352 this.adapter.registerResizeHandler(this.resizeHandler_); 14353 } 14354 } 14355 this.adapter.registerInteractionHandler('focus', this.focusHandler_); 14356 this.adapter.registerInteractionHandler('blur', this.blurHandler_); 14357 }; 14358 MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { 14359 var _this = this; 14360 if (evt.type === 'keydown') { 14361 this.adapter.registerInteractionHandler('keyup', this.deactivateHandler_); 14362 } else { 14363 POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { 14364 _this.adapter.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); 14365 }); 14366 } 14367 }; 14368 MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { 14369 var _this = this; 14370 ACTIVATION_EVENT_TYPES.forEach(function (evtType) { 14371 _this.adapter.deregisterInteractionHandler(evtType, _this.activateHandler_); 14372 }); 14373 this.adapter.deregisterInteractionHandler('focus', this.focusHandler_); 14374 this.adapter.deregisterInteractionHandler('blur', this.blurHandler_); 14375 if (this.adapter.isUnbounded()) { 14376 this.adapter.deregisterResizeHandler(this.resizeHandler_); 14377 } 14378 }; 14379 MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { 14380 var _this = this; 14381 this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler_); 14382 POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { 14383 _this.adapter.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); 14384 }); 14385 }; 14386 MDCRippleFoundation.prototype.removeCssVars_ = function () { 14387 var _this = this;
14388 var rippleStrings = MDCRippleFoundation.strings; 14389 var keys = Object.keys(rippleStrings); 14390 keys.forEach(function (key) { 14391 if (key.indexOf('VAR_') === 0) { 14392 _this.adapter.updateCssVariable(rippleStrings[key], null); 14393 } 14394 }); 14395 }; 14396 MDCRippleFoundation.prototype.activate_ = function (evt) { 14397 var _this = this; 14398 if (this.adapter.isSurfaceDisabled()) { 14399 return; 14400 } 14401 var activationState = this.activationState_; 14402 if (activationState.isActivated) { 14403 return; 14404 } 14405 // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction 14406 var previousActivationEvent = this.previousActivationEvent_; 14407 var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; 14408 if (isSameInteraction) { 14409 return; 14410 } 14411 activationState.isActivated = true; 14412 activationState.isProgrammatic = evt === undefined; 14413 activationState.activationEvent = evt; 14414 activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); 14415 var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { 14416 return _this.adapter.containsEventTarget(target); 14417 }); 14418 if (hasActivatedChild) { 14419 // Immediately reset activation state, while preserving logic that prevents touch follow-on events 14420 this.resetActivationState_(); 14421 return; 14422 } 14423 if (evt !== undefined) { 14424 activatedTargets.push(evt.target); 14425 this.registerDeactivationHandlers_(evt); 14426 } 14427 activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); 14428 if (activationState.wasElementMadeActive) { 14429 this.animateActivation_(); 14430 } 14431 requestAnimationFrame(function () { 14432 // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples 14433 activatedTargets = []; 14434 if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { 14435 // If space was pressed, try again within an rAF call to detect :active, because different UAs report 14436 // active states inconsistently when they're called within event handling code: 14437 // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 14438 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 14439 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS 14440 // variable is set within a rAF callback for a submit button interaction (#2241). 14441 activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); 14442 if (activationState.wasElementMadeActive) { 14443 _this.animateActivation_(); 14444 } 14445 } 14446 if (!activationState.wasElementMadeActive) { 14447 // Reset activation state immediately if element was not made active. 14448 _this.activationState_ = _this.defaultActivationState_(); 14449 } 14450 }); 14451 }; 14452 MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { 14453 return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true; 14454 }; 14455 MDCRippleFoundation.prototype.animateActivation_ = function () { 14456 var _this = this; 14457 var _a = MDCRippleFoundation.strings, 14458 VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, 14459 VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; 14460 var _b = MDCRippleFoundation.cssClasses, 14461 FG_DEACTIVATION = _b.FG_DEACTIVATION, 14462 FG_ACTIVATION = _b.FG_ACTIVATION; 14463 var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; 14464 this.layoutInternal_(); 14465 var translateStart = ''; 14466 var translateEnd = ''; 14467 if (!this.adapter.isUnbounded()) { 14468 var _c = this.getFgTranslationCoordinates_(), 14469 startPoint = _c.startPoint, 14470 endPoint = _c.endPoint; 14471 translateStart = startPoint.x + "px, " + startPoint.y + "px"; 14472 translateEnd = endPoint.x + "px, " + endPoint.y + "px"; 14473 } 14474 this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); 14475 this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); 14476 // Cancel any ongoing activation/deactivation animations 14477 clearTimeout(this.activationTimer_); 14478 clearTimeout(this.fgDeactivationRemovalTimer_); 14479 this.rmBoundedActivationClasses_(); 14480 this.adapter.removeClass(FG_DEACTIVATION); 14481 // Force layout in order to re-trigger the animation.
14482 this.adapter.computeBoundingRect(); 14483 this.adapter.addClass(FG_ACTIVATION); 14484 this.activationTimer_ = setTimeout(function () { 14485 return _this.activationTimerCallback_(); 14486 }, DEACTIVATION_TIMEOUT_MS); 14487 }; 14488 MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { 14489 var _a = this.activationState_, 14490 activationEvent = _a.activationEvent, 14491 wasActivatedByPointer = _a.wasActivatedByPointer; 14492 var startPoint; 14493 if (wasActivatedByPointer) { 14494 startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect()); 14495 } else { 14496 startPoint = { 14497 x: this.frame_.width / 2, 14498 y: this.frame_.height / 2 14499 }; 14500 } 14501 // Center the element around the start point. 14502 startPoint = { 14503 x: startPoint.x - this.initialSize_ / 2, 14504 y: startPoint.y - this.initialSize_ / 2 14505 }; 14506 var endPoint = { 14507 x: this.frame_.width / 2 - this.initialSize_ / 2, 14508 y: this.frame_.height / 2 - this.initialSize_ / 2 14509 }; 14510 return { startPoint: startPoint, endPoint: endPoint }; 14511 }; 14512 MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { 14513 var _this = this; 14514 // This method is called both when a pointing device is released, and when the activation animation ends. 14515 // The deactivation animation should only run after both of those occur. 14516 var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; 14517 var _a = this.activationState_, 14518 hasDeactivationUXRun = _a.hasDeactivationUXRun, 14519 isActivated = _a.isActivated; 14520 var activationHasEnded = hasDeactivationUXRun || !isActivated; 14521 if (activationHasEnded && this.activationAnimationHasEnded_) { 14522 this.rmBoundedActivationClasses_(); 14523 this.adapter.addClass(FG_DEACTIVATION); 14524 this.fgDeactivationRemovalTimer_ = setTimeout(function () { 14525 _this.adapter.removeClass(FG_DEACTIVATION); 14526 }, constants_1.numbers.FG_DEACTIVATION_MS); 14527 } 14528 }; 14529 MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { 14530 var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; 14531 this.adapter.removeClass(FG_ACTIVATION); 14532 this.activationAnimationHasEnded_ = false; 14533 this.adapter.computeBoundingRect(); 14534 }; 14535 MDCRippleFoundation.prototype.resetActivationState_ = function () { 14536 var _this = this; 14537 this.previousActivationEvent_ = this.activationState_.activationEvent; 14538 this.activationState_ = this.defaultActivationState_(); 14539 // Touch devices may fire additional events for the same interaction within a short time. 14540 // Store the previous event until it's safe to assume that subsequent events are for new interactions. 14541 setTimeout(function () { 14542 return _this.previousActivationEvent_ = undefined; 14543 }, MDCRippleFoundation.numbers.TAP_DELAY_MS); 14544 }; 14545 MDCRippleFoundation.prototype.deactivate_ = function () { 14546 var _this = this; 14547 var activationState = this.activationState_; 14548 // This can happen in scenarios such as when you have a keyup event that blurs the element. 14549 if (!activationState.isActivated) { 14550 return; 14551 } 14552 var state = __assign({}, activationState); 14553 if (activationState.isProgrammatic) { 14554 requestAnimationFrame(function () { 14555 return _this.animateDeactivation_(state); 14556 }); 14557 this.resetActivationState_(); 14558 } else { 14559 this.deregisterDeactivationHandlers_(); 14560 requestAnimationFrame(function () { 14561 _this.activationState_.hasDeactivationUXRun = true; 14562 _this.animateDeactivation_(state); 14563 _this.resetActivationState_(); 14564 }); 14565 } 14566 }; 14567 MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { 14568 var wasActivatedByPointer = _a.wasActivatedByPointer, 14569 wasElementMadeActive = _a.wasElementMadeActive; 14570 if (wasActivatedByPointer || wasElementMadeActive) { 14571 this.runDeactivationUXLogicIfReady_(); 14572 } 14573 }; 14574 MDCRippleFoundation.prototype.layoutInternal_ = function () { 14575 var _this = this;
14576 this.frame_ = this.adapter.computeBoundingRect(); 14577 var maxDim = Math.max(this.frame_.height, this.frame_.width); 14578 // Surface diameter is treated differently for unbounded vs. bounded ripples. 14579 // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately 14580 // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically 14581 // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter 14582 // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via 14583 // `overflow: hidden`. 14584 var getBoundedRadius = function getBoundedRadius() { 14585 var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); 14586 return hypotenuse + MDCRippleFoundation.numbers.PADDING; 14587 }; 14588 this.maxRadius_ = this.adapter.isUnbounded() ? maxDim : getBoundedRadius(); 14589 // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform 14590 var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); 14591 // Unbounded ripple size should always be even number to equally center align. 14592 if (this.adapter.isUnbounded() && initialSize % 2 !== 0) { 14593 this.initialSize_ = initialSize - 1; 14594 } else { 14595 this.initialSize_ = initialSize; 14596 } 14597 this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; 14598 this.updateLayoutCssVars_(); 14599 }; 14600 MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { 14601 var _a = MDCRippleFoundation.strings, 14602 VAR_FG_SIZE = _a.VAR_FG_SIZE, 14603 VAR_LEFT = _a.VAR_LEFT, 14604 VAR_TOP = _a.VAR_TOP, 14605 VAR_FG_SCALE = _a.VAR_FG_SCALE; 14606 this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); 14607 this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale_); 14608 if (this.adapter.isUnbounded()) { 14609 this.unboundedCoords_ = { 14610 left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), 14611 top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) 14612 }; 14613 this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); 14614 this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); 14615 } 14616 }; 14617 return MDCRippleFoundation; 14618}(foundation_1.MDCFoundation); 14619exports.MDCRippleFoundation = MDCRippleFoundation; 14620// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 14621exports.default = MDCRippleFoundation; 14622 14623/***/ }), 14624
14625/***/ "./packages/mdc-ripple/index.ts": 14626/*!**************************************!*\ 14627 !*** ./packages/mdc-ripple/index.ts ***! 14628 \**************************************/ 14629/*! no static exports found */ 14630/***/ (function(module, exports, __webpack_require__) { 14631 14632"use strict"; 14633 14634/** 14635 * @license 14636 * Copyright 2019 Google Inc. 14637 * 14638 * Permission is hereby granted, free of charge, to any person obtaining a copy 14639 * of this software and associated documentation files (the "Software"), to deal 14640 * in the Software without restriction, including without limitation the rights 14641 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14642 * copies of the Software, and to permit persons to whom the Software is 14643 * furnished to do so, subject to the following conditions: 14644 * 14645 * The above copyright notice and this permission notice shall be included in 14646 * all copies or substantial portions of the Software. 14647 * 14648 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14649 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14650 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14651 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14652 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14653 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14654 * THE SOFTWARE. 14655 */ 14656 14657function __export(m) { 14658 for (var p in m) { 14659 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 14660 } 14661} 14662var __importStar = this && this.__importStar || function (mod) { 14663 if (mod && mod.__esModule) return mod; 14664 var result = {}; 14665 if (mod != null) for (var k in mod) { 14666 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 14667 }result["default"] = mod; 14668 return result; 14669}; 14670Object.defineProperty(exports, "__esModule", { value: true }); 14671var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts")); 14672exports.util = util; 14673__export(__webpack_require__(/*! ./component */ "./packages/mdc-ripple/component.ts")); 14674__export(__webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts")); 14675__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts")); 14676 14677/***/ }), 14678
14679/***/ "./packages/mdc-ripple/util.ts": 14680/*!*************************************!*\ 14681 !*** ./packages/mdc-ripple/util.ts ***! 14682 \*************************************/ 14683/*! no static exports found */ 14684/***/ (function(module, exports, __webpack_require__) { 14685 14686"use strict"; 14687 14688 14689Object.defineProperty(exports, "__esModule", { value: true }); 14690/** 14691 * Stores result from supportsCssVariables to avoid redundant processing to 14692 * detect CSS custom variable support. 14693 */ 14694var supportsCssVariables_; 14695function supportsCssVariables(windowObj, forceRefresh) { 14696 if (forceRefresh === void 0) { 14697 forceRefresh = false; 14698 } 14699 var CSS = windowObj.CSS; 14700 var supportsCssVars = supportsCssVariables_; 14701 if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { 14702 return supportsCssVariables_; 14703 } 14704 var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; 14705 if (!supportsFunctionPresent) { 14706 return false; 14707 } 14708 var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); 14709 // See: https://bugs.webkit.org/show_bug.cgi?id=154669 14710 // See: README section on Safari 14711 var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); 14712 supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus; 14713 if (!forceRefresh) { 14714 supportsCssVariables_ = supportsCssVars; 14715 } 14716 return supportsCssVars; 14717} 14718exports.supportsCssVariables = supportsCssVariables; 14719function getNormalizedEventCoords(evt, pageOffset, clientRect) { 14720 if (!evt) { 14721 return { x: 0, y: 0 }; 14722 } 14723 var x = pageOffset.x, 14724 y = pageOffset.y; 14725 var documentX = x + clientRect.left; 14726 var documentY = y + clientRect.top; 14727 var normalizedX; 14728 var normalizedY; 14729 // Determine touch point relative to the ripple container. 14730 if (evt.type === 'touchstart') { 14731 var touchEvent = evt; 14732 normalizedX = touchEvent.changedTouches[0].pageX - documentX; 14733 normalizedY = touchEvent.changedTouches[0].pageY - documentY; 14734 } else { 14735 var mouseEvent = evt; 14736 normalizedX = mouseEvent.pageX - documentX; 14737 normalizedY = mouseEvent.pageY - documentY; 14738 } 14739 return { x: normalizedX, y: normalizedY }; 14740} 14741exports.getNormalizedEventCoords = getNormalizedEventCoords; 14742 14743/***/ }), 14744
14745/***/ "./packages/mdc-segmented-button/index.ts": 14746/*!************************************************!*\ 14747 !*** ./packages/mdc-segmented-button/index.ts ***! 14748 \************************************************/ 14749/*! no static exports found */ 14750/***/ (function(module, exports, __webpack_require__) { 14751 14752"use strict"; 14753 14754/** 14755 * @license 14756 * Copyright 2020 Google Inc. 14757 * 14758 * Permission is hereby granted, free of charge, to any person obtaining a copy 14759 * of this software and associated documentation files (the "Software"), to deal 14760 * in the Software without restriction, including without limitation the rights 14761 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14762 * copies of the Software, and to permit persons to whom the Software is 14763 * furnished to do so, subject to the following conditions: 14764 * 14765 * The above copyright notice and this permission notice shall be included in 14766 * all copies or substantial portions of the Software. 14767 * 14768 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14769 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14770 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14771 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14772 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14773 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14774 * THE SOFTWARE. 14775 */ 14776 14777function __export(m) { 14778 for (var p in m) { 14779 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 14780 } 14781} 14782Object.defineProperty(exports, "__esModule", { value: true }); 14783__export(__webpack_require__(/*! ./segmented-button/index */ "./packages/mdc-segmented-button/segmented-button/index.ts")); 14784__export(__webpack_require__(/*! ./segment/index */ "./packages/mdc-segmented-button/segment/index.ts")); 14785 14786/***/ }), 14787
14788/***/ "./packages/mdc-segmented-button/segment/component.ts": 14789/*!************************************************************!*\ 14790 !*** ./packages/mdc-segmented-button/segment/component.ts ***! 14791 \************************************************************/ 14792/*! no static exports found */ 14793/***/ (function(module, exports, __webpack_require__) { 14794 14795"use strict"; 14796 14797/** 14798 * @license 14799 * Copyright 2020 Google Inc. 14800 * 14801 * Permission is hereby granted, free of charge, to any person obtaining a copy 14802 * of this software and associated documentation files (the "Software"), to deal 14803 * in the Software without restriction, including without limitation the rights 14804 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14805 * copies of the Software, and to permit persons to whom the Software is 14806 * furnished to do so, subject to the following conditions: 14807 * 14808 * The above copyright notice and this permission notice shall be included in 14809 * all copies or substantial portions of the Software. 14810 * 14811 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14812 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14813 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14814 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14815 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14816 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14817 * THE SOFTWARE. 14818 */ 14819 14820var __extends = this && this.__extends || function () { 14821 var _extendStatics = function extendStatics(d, b) { 14822 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 14823 d.__proto__ = b; 14824 } || function (d, b) { 14825 for (var p in b) { 14826 if (b.hasOwnProperty(p)) d[p] = b[p]; 14827 } 14828 }; 14829 return _extendStatics(d, b); 14830 }; 14831 return function (d, b) { 14832 _extendStatics(d, b); 14833 function __() { 14834 this.constructor = d; 14835 } 14836 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 14837 }; 14838}(); 14839var __assign = this && this.__assign || function () { 14840 __assign = Object.assign || function (t) { 14841 for (var s, i = 1, n = arguments.length; i < n; i++) { 14842 s = arguments[i]; 14843 for (var p in s) { 14844 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 14845 } 14846 } 14847 return t; 14848 }; 14849 return __assign.apply(this, arguments); 14850}; 14851Object.defineProperty(exports, "__esModule", { value: true }); 14852var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 14853var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 14854var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 14855var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-segmented-button/segment/constants.ts"); 14856var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-segmented-button/segment/foundation.ts"); 14857/** 14858 * Implementation of MDCSegmentedButtonSegmentFoundation 14859 */ 14860var MDCSegmentedButtonSegment = /** @class */function (_super) { 14861 __extends(MDCSegmentedButtonSegment, _super); 14862 function MDCSegmentedButtonSegment() { 14863 return _super !== null && _super.apply(this, arguments) || this; 14864 } 14865 Object.defineProperty(MDCSegmentedButtonSegment.prototype, "ripple", { 14866 get: function get() { 14867 return this.rippleComponent; 14868 }, 14869 enumerable: true, 14870 configurable: true 14871 }); 14872 MDCSegmentedButtonSegment.attachTo = function (root) { 14873 return new MDCSegmentedButtonSegment(root); 14874 }; 14875 MDCSegmentedButtonSegment.prototype.initialize = function (rippleFactory) { 14876 var _this = this; 14877 if (rippleFactory === void 0) { 14878 rippleFactory = function rippleFactory(el, foundation) { 14879 return new component_2.MDCRipple(el, foundation); 14880 }; 14881 } 14882 var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect
14882() { 14883 return _this.foundation.getDimensions(); 14884 } }); 14885 this.rippleComponent = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter)); 14886 }; 14887 MDCSegmentedButtonSegment.prototype.initialSyncWithDOM = function () { 14888 var _this = this; 14889 this.handleClick = function () { 14890 _this.foundation.handleClick(); 14891 }; 14892 this.listen(constants_1.events.CLICK, this.handleClick); 14893 }; 14894 MDCSegmentedButtonSegment.prototype.destroy = function () { 14895 this.ripple.destroy(); 14896 this.unlisten(constants_1.events.CLICK, this.handleClick); 14897 _super.prototype.destroy.call(this); 14898 }; 14899 MDCSegmentedButtonSegment.prototype.getDefaultFoundation = function () { 14900 var _this = this; 14901 // DO NOT INLINE this variable. For backward compatibility, foundations take 14902 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 14903 // methods, we need a separate, strongly typed adapter variable. 14904 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 14905 var adapter = { 14906 isSingleSelect: function isSingleSelect() { 14907 return _this.isSingleSelect; 14908 }, 14909 getAttr: function getAttr(attrName) { 14910 return _this.root.getAttribute(attrName); 14911 }, 14912 setAttr: function setAttr(attrName, value) { 14913 _this.root.setAttribute(attrName, value); 14914 }, 14915 addClass: function addClass(className) { 14916 _this.root.classList.add(className); 14917 }, 14918 removeClass: function removeClass(className) { 14919 _this.root.classList.remove(className); 14920 }, 14921 hasClass: function hasClass(className) { 14922 return _this.root.classList.contains(className); 14923 }, 14924 notifySelectedChange: function notifySelectedChange(selected) { 14925 _this.emit(constants_1.events.SELECTED, { 14926 index: _this.index, 14927 selected: selected, 14928 segmentId: _this.getSegmentId() 14929 }, true /* shouldBubble */); 14930 }, 14931 getRootBoundingClientRect: function getRootBoundingClientRect() { 14932 return _this.root.getBoundingClientRect(); 14933 } 14934 }; 14935 return new foundation_2.MDCSegmentedButtonSegmentFoundation(adapter); 14936 }; 14937 /** 14938 * Sets segment's index value 14939 * 14940 * @param index Segment's index within wrapping segmented button 14941 */ 14942 MDCSegmentedButtonSegment.prototype.setIndex = function (index) { 14943 this.index = index; 14944 }; 14945 /** 14946 * Sets segment's isSingleSelect value 14947 * 14948 * @param isSingleSelect True if wrapping segmented button is single select 14949 */ 14950 MDCSegmentedButtonSegment.prototype.setIsSingleSelect = function (isSingleSelect) { 14951 this.isSingleSelect = isSingleSelect; 14952 }; 14953 /** 14954 * @return Returns true if segment is currently selected, otherwise returns 14955 * false 14956 */ 14957 MDCSegmentedButtonSegment.prototype.isSelected = function () { 14958 return this.foundation.isSelected(); 14959 }; 14960 /** 14961 * Sets segment to be selected 14962 */ 14963 MDCSegmentedButtonSegment.prototype.setSelected = function () { 14964 this.foundation.setSelected(); 14965 }; 14966 /** 14967 * Sets segment to be not selected 14968 */ 14969 MDCSegmentedButtonSegment.prototype.setUnselected = function () { 14970 this.foundation.setUnselected(); 14971 }; 14972 /** 14973 * @return Returns segment's segmentId if it was set by client 14974 */ 14975 MDCSegmentedButtonSegment.prototype.getSegmentId = function () { 14976 return this.foundation.getSegmentId(); 14977 }; 14978 return MDCSegmentedButtonSegment; 14979}(component_1.MDCComponent); 14980exports.MDCSegmentedButtonSegment = MDCSegmentedButtonSegment; 14981 14982/***/ }), 14983
14984/***/ "./packages/mdc-segmented-button/segment/constants.ts": 14985/*!************************************************************!*\ 14986 !*** ./packages/mdc-segmented-button/segment/constants.ts ***! 14987 \************************************************************/ 14988/*! no static exports found */ 14989/***/ (function(module, exports, __webpack_require__) { 14990 14991"use strict"; 14992 14993/** 14994 * @license 14995 * Copyright 2020 Google Inc. 14996 * 14997 * Permission is hereby granted, free of charge, to any person obtaining a copy 14998 * of this software and associated documentation files (the "Software"), to deal 14999 * in the Software without restriction, including without limitation the rights 15000 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15001 * copies of the Software, and to permit persons to whom the Software is 15002 * furnished to do so, subject to the following conditions: 15003 * 15004 * The above copyright notice and this permission notice shall be included in 15005 * all copies or substantial portions of the Software. 15006 * 15007 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15008 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15009 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15010 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15011 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15012 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15013 * THE SOFTWARE. 15014 */ 15015 15016Object.defineProperty(exports, "__esModule", { value: true }); 15017/** 15018 * Boolean strings for segment 15019 */ 15020exports.booleans = { 15021 TRUE: 'true', 15022 FALSE: 'false' 15023}; 15024/** 15025 * Attributes referenced by segment 15026 */ 15027exports.attributes = { 15028 ARIA_CHECKED: 'aria-checked', 15029 ARIA_PRESSED: 'aria-pressed', 15030 DATA_SEGMENT_ID: 'data-segment-id' 15031}; 15032/** 15033 * Events received or emitted by segment 15034 */ 15035exports.events = { 15036 CLICK: 'click', 15037 SELECTED: 'selected' 15038}; 15039/** 15040 * Style classes for segment 15041 */ 15042exports.cssClasses = { 15043 SELECTED: 'mdc-segmented-button__segment--selected' 15044}; 15045 15046/***/ }), 15047
15048/***/ "./packages/mdc-segmented-button/segment/foundation.ts": 15049/*!*************************************************************!*\ 15050 !*** ./packages/mdc-segmented-button/segment/foundation.ts ***! 15051 \*************************************************************/ 15052/*! no static exports found */ 15053/***/ (function(module, exports, __webpack_require__) { 15054 15055"use strict"; 15056 15057/** 15058 * @license 15059 * Copyright 2020 Google Inc. 15060 * 15061 * Permission is hereby granted, free of charge, to any person obtaining a copy 15062 * of this software and associated documentation files (the "Software"), to deal 15063 * in the Software without restriction, including without limitation the rights 15064 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15065 * copies of the Software, and to permit persons to whom the Software is 15066 * furnished to do so, subject to the following conditions: 15067 * 15068 * The above copyright notice and this permission notice shall be included in 15069 * all copies or substantial portions of the Software. 15070 * 15071 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15072 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15073 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15074 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15075 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15076 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15077 * THE SOFTWARE. 15078 */ 15079 15080var __extends = this && this.__extends || function () { 15081 var _extendStatics = function extendStatics(d, b) { 15082 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 15083 d.__proto__ = b; 15084 } || function (d, b) { 15085 for (var p in b) { 15086 if (b.hasOwnProperty(p)) d[p] = b[p]; 15087 } 15088 }; 15089 return _extendStatics(d, b); 15090 }; 15091 return function (d, b) { 15092 _extendStatics(d, b); 15093 function __() { 15094 this.constructor = d; 15095 } 15096 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15097 }; 15098}(); 15099var __assign = this && this.__assign || function () { 15100 __assign = Object.assign || function (t) { 15101 for (var s, i = 1, n = arguments.length; i < n; i++) { 15102 s = arguments[i]; 15103 for (var p in s) { 15104 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 15105 } 15106 } 15107 return t; 15108 }; 15109 return __assign.apply(this, arguments); 15110}; 15111Object.defineProperty(exports, "__esModule", { value: true }); 15112var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 15113var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-segmented-button/segment/constants.ts"); 15114var emptyClientRect = { 15115 bottom: 0, 15116 height: 0, 15117 left: 0, 15118 right: 0, 15119 top: 0, 15120 width: 0 15121}; 15122var MDCSegmentedButtonSegmentFoundation = /** @class */function (_super) { 15123 __extends(MDCSegmentedButtonSegmentFoundation, _super); 15124 function MDCSegmentedButtonSegmentFoundation(adapter) { 15125 return _super.call(this, __assign(__assign({}, MDCSegmentedButtonSegmentFoundation.defaultAdapter), adapter)) || this; 15126 } 15127 Object.defineProperty(MDCSegmentedButtonSegmentFoundation, "defaultAdapter", { 15128 get: function get() { 15129 return { 15130 isSingleSelect: function isSingleSelect() { 15131 return false; 15132 }, getAttr: function getAttr() { 15133 return ''; 15134 }, setAttr: function setAttr() { 15135 return undefined; 15136 }, 15137 addClass: function addClass() { 15138 return undefined; 15139 }, removeClass: function removeClass() { 15140 return undefined; 15141 }, 15142 hasClass: function hasClass() { 15143 return false; 15144 }, 15145 notifySelectedChange: function notifySelectedChange() { 15146 return undefined; 15147 }, 15148 getRootBoundingClientRect: function getRootBoundingClientRect() { 15149 return emptyClientRect; 15150 } 15151 }; 15152 }, 15153 enumerable: true, 15154 configurable: true 15155 }); 15156 /** 15157 * @return Returns true if segment is currently selected, otherwise returns 15158 * false 15159 */ 15160 MDCSegmentedButtonSegmentFoundation.prototype.isSelected = function () {
15161 return this.adapter.hasClass(constants_1.cssClasses.SELECTED); 15162 }; 15163 /** 15164 * Sets segment to be selected 15165 */ 15166 MDCSegmentedButtonSegmentFoundation.prototype.setSelected = function () { 15167 this.adapter.addClass(constants_1.cssClasses.SELECTED); 15168 this.setAriaAttr(constants_1.booleans.TRUE); 15169 }; 15170 /** 15171 * Sets segment to be not selected 15172 */ 15173 MDCSegmentedButtonSegmentFoundation.prototype.setUnselected = function () { 15174 this.adapter.removeClass(constants_1.cssClasses.SELECTED); 15175 this.setAriaAttr(constants_1.booleans.FALSE); 15176 }; 15177 /** 15178 * @return Returns segment's segmentId if it was set by client 15179 */ 15180 MDCSegmentedButtonSegmentFoundation.prototype.getSegmentId = function () { 15181 var _a; 15182 return (_a = this.adapter.getAttr(constants_1.attributes.DATA_SEGMENT_ID)) !== null && _a !== void 0 ? _a : undefined; 15183 }; 15184 /** 15185 * Called when segment is clicked. If the wrapping segmented button is single 15186 * select, doesn't allow segment to be set to not selected. Otherwise, toggles 15187 * segment's selected status. Finally, emits event to wrapping segmented 15188 * button. 15189 * 15190 * @event selected With detail - SegmentDetail 15191 */ 15192 MDCSegmentedButtonSegmentFoundation.prototype.handleClick = function () { 15193 if (this.adapter.isSingleSelect()) { 15194 this.setSelected(); 15195 } else { 15196 this.toggleSelection(); 15197 } 15198 this.adapter.notifySelectedChange(this.isSelected()); 15199 }; 15200 /** 15201 * @return Returns bounding rectangle for ripple effect 15202 */ 15203 MDCSegmentedButtonSegmentFoundation.prototype.getDimensions = function () { 15204 return this.adapter.getRootBoundingClientRect(); 15205 }; 15206 /** 15207 * Sets segment from not selected to selected, or selected to not selected 15208 */ 15209 MDCSegmentedButtonSegmentFoundation.prototype.toggleSelection = function () { 15210 if (this.isSelected()) { 15211 this.setUnselected(); 15212 } else { 15213 this.setSelected(); 15214 } 15215 }; 15216 /** 15217 * Sets appropriate aria attribute, based on wrapping segmented button's 15218 * single selected value, to new value 15219 * 15220 * @param value Value that represents selected status 15221 */ 15222 MDCSegmentedButtonSegmentFoundation.prototype.setAriaAttr = function (value) { 15223 if (this.adapter.isSingleSelect()) { 15224 this.adapter.setAttr(constants_1.attributes.ARIA_CHECKED, value); 15225 } else { 15226 this.adapter.setAttr(constants_1.attributes.ARIA_PRESSED, value); 15227 } 15228 }; 15229 return MDCSegmentedButtonSegmentFoundation; 15230}(foundation_1.MDCFoundation); 15231exports.MDCSegmentedButtonSegmentFoundation = MDCSegmentedButtonSegmentFoundation; 15232 15233/***/ }), 15234
15235/***/ "./packages/mdc-segmented-button/segment/index.ts": 15236/*!********************************************************!*\ 15237 !*** ./packages/mdc-segmented-button/segment/index.ts ***! 15238 \********************************************************/ 15239/*! no static exports found */ 15240/***/ (function(module, exports, __webpack_require__) { 15241 15242"use strict"; 15243 15244/** 15245 * @license 15246 * Copyright 2020 Google Inc. 15247 * 15248 * Permission is hereby granted, free of charge, to any person obtaining a copy 15249 * of this software and associated documentation files (the "Software"), to deal 15250 * in the Software without restriction, including without limitation the rights 15251 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15252 * copies of the Software, and to permit persons to whom the Software is 15253 * furnished to do so, subject to the following conditions: 15254 * 15255 * The above copyright notice and this permission notice shall be included in 15256 * all copies or substantial portions of the Software. 15257 * 15258 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15259 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15260 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15261 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15262 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15263 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15264 * THE SOFTWARE. 15265 */ 15266 15267function __export(m) { 15268 for (var p in m) { 15269 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 15270 } 15271} 15272Object.defineProperty(exports, "__esModule", { value: true }); 15273__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-segmented-button/segment/foundation.ts")); 15274__export(__webpack_require__(/*! ./component */ "./packages/mdc-segmented-button/segment/component.ts")); 15275 15276/***/ }), 15277
15278/***/ "./packages/mdc-segmented-button/segmented-button/component.ts": 15279/*!*********************************************************************!*\ 15280 !*** ./packages/mdc-segmented-button/segmented-button/component.ts ***! 15281 \*********************************************************************/ 15282/*! no static exports found */ 15283/***/ (function(module, exports, __webpack_require__) { 15284 15285"use strict"; 15286 15287/** 15288 * @license 15289 * Copyright 2020 Google Inc. 15290 * 15291 * Permission is hereby granted, free of charge, to any person obtaining a copy 15292 * of this software and associated documentation files (the "Software"), to deal 15293 * in the Software without restriction, including without limitation the rights 15294 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15295 * copies of the Software, and to permit persons to whom the Software is 15296 * furnished to do so, subject to the following conditions: 15297 * 15298 * The above copyright notice and this permission notice shall be included in 15299 * all copies or substantial portions of the Software. 15300 * 15301 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15302 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15303 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15304 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15305 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15306 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15307 * THE SOFTWARE. 15308 */ 15309 15310var __extends = this && this.__extends || function () { 15311 var _extendStatics = function extendStatics(d, b) { 15312 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 15313 d.__proto__ = b; 15314 } || function (d, b) { 15315 for (var p in b) { 15316 if (b.hasOwnProperty(p)) d[p] = b[p]; 15317 } 15318 }; 15319 return _extendStatics(d, b); 15320 }; 15321 return function (d, b) { 15322 _extendStatics(d, b); 15323 function __() { 15324 this.constructor = d; 15325 } 15326 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15327 }; 15328}(); 15329Object.defineProperty(exports, "__esModule", { value: true }); 15330var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 15331var component_2 = __webpack_require__(/*! ../segment/component */ "./packages/mdc-segmented-button/segment/component.ts"); 15332var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-segmented-button/segmented-button/constants.ts"); 15333var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-segmented-button/segmented-button/foundation.ts"); 15334// TODO(b/152410470): Remove trailing underscores from private properties 15335// tslint:disable:strip-private-property-underscore 15336var MDCSegmentedButton = /** @class */function (_super) { 15337 __extends(MDCSegmentedButton, _super); 15338 function MDCSegmentedButton() { 15339 return _super !== null && _super.apply(this, arguments) || this; 15340 } 15341 MDCSegmentedButton.attachTo = function (root) { 15342 return new MDCSegmentedButton(root); 15343 }; 15344 Object.defineProperty(MDCSegmentedButton.prototype, "segments", { 15345 get: function get() { 15346 return this.segments_.slice(); 15347 }, 15348 enumerable: true, 15349 configurable: true 15350 }); 15351 // initialSyncWithDOM 15352 MDCSegmentedButton.prototype.initialize = function (segmentFactory) { 15353 if (segmentFactory === void 0) { 15354 segmentFactory = function segmentFactory(el) { 15355 return new component_2.MDCSegmentedButtonSegment(el); 15356 }; 15357 } 15358 this.segmentFactory = segmentFactory; 15359 this.segments_ = this.instantiateSegments(this.segmentFactory); 15360 }; 15361 /** 15362 * @param segmentFactory Factory to create new child segments 15363 * @return Returns list of child segments found in DOM 15364 */ 15365 MDCSegmentedButton.prototype.instantiateSegments = function (segmentFactory) { 15366 var segmentElements = [].slice.call(this.root.querySelectorAll(constants_1.selectors.SEGMENT)); 15367 return segmentElements.map(function (el) { 15368 return segmentFactory(el); 15369 }); 15370 }; 15371 MDCSegmentedButton.prototype.initialSyncWithDOM = function () { 15372 var _this = this; 15373 this.handleSelected = function (event) { 15374 _this.foundation.handleSelected(event.detail); 15375 }; 15376 this.listen(constants_1.events.SELECTED, this.handleSelected); 15377 var isSingleSelect = this.foundation.isSingleSelect(); 15378 this.segments_.forEach(function (segment, index) { 15379 segment.setIndex(index); 15380 segment.setIsSingleSelect(isSingleSelect); 15381 }); 15382 var selectedSegments = this.segments_.filter(function (segment) { 15383 return segment.isSelected(); 15384 }); 15385 if (isSingleSelect && selectedSegments.length == 0 && this.segments_.length > 0) { 15386 throw new Error('No segment selected in singleSelect mdc-segmented-button'); 15387 } else if (isSingleSelect && selectedSegments.length > 1) { 15388 throw new Error('Multiple segments selected in singleSelect mdc-segmented-button'); 15389 } 15390 }; 15391 MDCSegmentedButton.prototype.destroy = function () { 15392 this.segments_.forEach(function (segment) { 15393 segment.destroy(); 15394 }); 15395 this.unlisten(constants_1.events.SELECTED, this.handleSelected); 15396 _super.prototype.destroy.call(this); 15397 }; 15398 MDCSegmentedButton.prototype.getDefaultFoundation = function () { 15399 var _this = this; 15400 var adapter = { 15401 hasClass: function hasClass(className) { 15402 return _this.root.classList.contains(className); 15403 }, 15404 getSegments: function getSegments() { 15405 return _this.mappedSegments(); 15406 }, 15407 selectSegment: function selectSegment(indexOrSegmentId) { 15408 var segmentDetail = _this.mappedSegments().find(function (_segmentDetail) { 15409 return _segmentDetail.index === indexOrSegmentId || _segmentDetail.segmentId === indexOrSegmentId; 15410 }); 15411 if (segmentDetail) { 15412 _this.segments_[segmentDetail.index].setSelected(); 15413 } 15414 }, 15415 unselectSegment: function unselectSegment(indexOrSegmentId) { 15416 var segmentDetail = _this.mappedSegments().find(function (_segmentDetail) { 15417 return _segmentDetail.index === indexOrSegmentId || _segmentDetail.segmentId === indexOrSegmentId; 15418 }); 15419 if (segmentDetail) { 15420 _this.segments_[segmentDetail.index].setUnselected(); 15421 } 15422 }, 15423 notifySelectedChange: function notifySelectedChange(detail) {
15424 _this.emit(constants_1.events.CHANGE, detail, true /* shouldBubble */); 15425 } 15426 }; 15427 return new foundation_1.MDCSegmentedButtonFoundation(adapter); 15428 }; 15429 /** 15430 * @return Returns readonly list of selected child segments as SegmentDetails 15431 */ 15432 MDCSegmentedButton.prototype.getSelectedSegments = function () { 15433 return this.foundation.getSelectedSegments(); 15434 }; 15435 /** 15436 * Sets identified segment to be selected 15437 * 15438 * @param indexOrSegmentId Number index or string segmentId that identifies 15439 * child segment 15440 */ 15441 MDCSegmentedButton.prototype.selectSegment = function (indexOrSegmentId) { 15442 this.foundation.selectSegment(indexOrSegmentId); 15443 }; 15444 /** 15445 * Sets identified segment to be not selected 15446 * 15447 * @param indexOrSegmentId Number index or string segmentId that identifies 15448 * child segment 15449 */ 15450 MDCSegmentedButton.prototype.unselectSegment = function (indexOrSegmentId) { 15451 this.foundation.unselectSegment(indexOrSegmentId); 15452 }; 15453 /** 15454 * @param indexOrSegmentId Number index or string segmentId that identifies 15455 * child segment 15456 * @return Returns true if identified child segment is currently selected, 15457 * otherwise returns false 15458 */ 15459 MDCSegmentedButton.prototype.isSegmentSelected = function (indexOrSegmentId) { 15460 return this.foundation.isSegmentSelected(indexOrSegmentId); 15461 }; 15462 /** 15463 * @return Returns child segments mapped to readonly SegmentDetail list 15464 */ 15465 MDCSegmentedButton.prototype.mappedSegments = function () { 15466 return this.segments_.map(function (segment, index) { 15467 return { 15468 index: index, 15469 selected: segment.isSelected(), 15470 segmentId: segment.getSegmentId() 15471 }; 15472 }); 15473 }; 15474 return MDCSegmentedButton; 15475}(component_1.MDCComponent); 15476exports.MDCSegmentedButton = MDCSegmentedButton; 15477 15478/***/ }), 15479
15480/***/ "./packages/mdc-segmented-button/segmented-button/constants.ts": 15481/*!*********************************************************************!*\ 15482 !*** ./packages/mdc-segmented-button/segmented-button/constants.ts ***! 15483 \*********************************************************************/ 15484/*! no static exports found */ 15485/***/ (function(module, exports, __webpack_require__) { 15486 15487"use strict"; 15488 15489/** 15490 * @license 15491 * Copyright 2020 Google Inc. 15492 * 15493 * Permission is hereby granted, free of charge, to any person obtaining a copy 15494 * of this software and associated documentation files (the "Software"), to deal 15495 * in the Software without restriction, including without limitation the rights 15496 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15497 * copies of the Software, and to permit persons to whom the Software is 15498 * furnished to do so, subject to the following conditions: 15499 * 15500 * The above copyright notice and this permission notice shall be included in 15501 * all copies or substantial portions of the Software. 15502 * 15503 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15504 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15505 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15506 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15507 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15508 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15509 * THE SOFTWARE. 15510 */ 15511 15512Object.defineProperty(exports, "__esModule", { value: true }); 15513/** 15514 * Selectors used by segmented-button 15515 */ 15516exports.selectors = { 15517 SEGMENT: '.mdc-segmented-button__segment' 15518}; 15519/** 15520 * Events received or emitted by segmented-button 15521 */ 15522exports.events = { 15523 SELECTED: 'selected', 15524 CHANGE: 'change' 15525}; 15526/** 15527 * Style classes for segmented-button 15528 */ 15529exports.cssClasses = { 15530 SINGLE_SELECT: 'mdc-segmented-button--single-select' 15531}; 15532 15533/***/ }), 15534
15535/***/ "./packages/mdc-segmented-button/segmented-button/foundation.ts": 15536/*!**********************************************************************!*\ 15537 !*** ./packages/mdc-segmented-button/segmented-button/foundation.ts ***! 15538 \**********************************************************************/ 15539/*! no static exports found */ 15540/***/ (function(module, exports, __webpack_require__) { 15541 15542"use strict"; 15543 15544/** 15545 * @license 15546 * Copyright 2020 Google Inc. 15547 * 15548 * Permission is hereby granted, free of charge, to any person obtaining a copy 15549 * of this software and associated documentation files (the "Software"), to deal 15550 * in the Software without restriction, including without limitation the rights 15551 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15552 * copies of the Software, and to permit persons to whom the Software is 15553 * furnished to do so, subject to the following conditions: 15554 * 15555 * The above copyright notice and this permission notice shall be included in 15556 * all copies or substantial portions of the Software. 15557 * 15558 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15559 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15560 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15561 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15562 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15563 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15564 * THE SOFTWARE. 15565 */ 15566 15567var __extends = this && this.__extends || function () { 15568 var _extendStatics = function extendStatics(d, b) { 15569 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 15570 d.__proto__ = b; 15571 } || function (d, b) { 15572 for (var p in b) { 15573 if (b.hasOwnProperty(p)) d[p] = b[p]; 15574 } 15575 }; 15576 return _extendStatics(d, b); 15577 }; 15578 return function (d, b) { 15579 _extendStatics(d, b); 15580 function __() { 15581 this.constructor = d; 15582 } 15583 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15584 }; 15585}(); 15586var __assign = this && this.__assign || function () { 15587 __assign = Object.assign || function (t) { 15588 for (var s, i = 1, n = arguments.length; i < n; i++) { 15589 s = arguments[i]; 15590 for (var p in s) { 15591 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 15592 } 15593 } 15594 return t; 15595 }; 15596 return __assign.apply(this, arguments); 15597}; 15598var __values = this && this.__values || function (o) { 15599 var s = typeof Symbol === "function" && Symbol.iterator, 15600 m = s && o[s], 15601 i = 0; 15602 if (m) return m.call(o); 15603 if (o && typeof o.length === "number") return { 15604 next: function next() { 15605 if (o && i >= o.length) o = void 0; 15606 return { value: o && o[i++], done: !o }; 15607 } 15608 }; 15609 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 15610}; 15611Object.defineProperty(exports, "__esModule", { value: true }); 15612var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 15613var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-segmented-button/segmented-button/constants.ts"); 15614var MDCSegmentedButtonFoundation = /** @class */function (_super) { 15615 __extends(MDCSegmentedButtonFoundation, _super); 15616 function MDCSegmentedButtonFoundation(adapter) { 15617 return _super.call(this, __assign(__assign({}, MDCSegmentedButtonFoundation.defaultAdapter), adapter)) || this; 15618 } 15619 Object.defineProperty(MDCSegmentedButtonFoundation, "defaultAdapter", { 15620 get: function get() { 15621 return { 15622 hasClass: function hasClass() { 15623 return false; 15624 }, getSegments: function getSegments() { 15625 return []; 15626 }, 15627 selectSegment: function selectSegment() { 15628 return undefined; 15629 }, 15630 unselectSegment: function unselectSegment() { 15631 return undefined; 15632 }, 15633 notifySelectedChange: function notifySelectedChange() { 15634 return undefined; 15635 } 15636 }; 15637 }, 15638 enumerable: true, 15639 configurable: true 15640 }); 15641 /** 15642 * Sets identified child segment to be selected 15643 * 15644 * @param indexOrSegmentId Number index or string segmentId that identifies 15645 * child segment 15646 */ 15647 MDCSegmentedButtonFoundation.prototype.selectSegment = function (indexOrSegmentId) { 15648 this.adapter.selectSegment(indexOrSegmentId); 15649 }; 15650 /** 15651 * Sets identified child segment to be not selected 15652 * 15653 * @param indexOrSegmentId Number index or string segmentId that identifies 15654 * child segment 15655 */ 15656 MDCSegmentedButtonFoundation.prototype.unselectSegment = function (indexOrSegmentId) { 15657 this.adapter.unselectSegment(indexOrSegmentId); 15658 }; 15659 /** 15660 * @return Returns currently selected child segments as readonly list of 15661 * SegmentDetails 15662 */ 15663 MDCSegmentedButtonFoundation.prototype.getSelectedSegments = function () { 15664 return this.adapter.getSegments().filter(function (segmentDetail) { 15665 return segmentDetail.selected; 15666 }); 15667 }; 15668 /** 15669 * @param indexOrSegmentId Number index or string segmentId that identifies 15670 * child segment 15671 * @return Returns true if identified child segment is currently selected, 15672 * otherwise returns false 15673 */ 15674 MDCSegmentedButtonFoundation.prototype.isSegmentSelected = function (indexOrSegmentId) { 15675 return this.adapter.getSegments().some(function (segmentDetail) { 15676 return (segmentDetail.index === indexOrSegmentId || segmentDetail.segmentId === indexOrSegmentId) && segmentDetail.selected; 15677 }); 15678 }; 15679 /** 15680 * @return Returns true if segmented button is single select, otherwise 15681 * returns false 15682 */ 15683 MDCSegmentedButtonFoundation.prototype.isSingleSelect = function () {
15684 return this.adapter.hasClass(constants_1.cssClasses.SINGLE_SELECT); 15685 }; 15686 /** 15687 * Called when child segment's selected status may have changed. If segmented 15688 * button is single select, unselects all child segments other than identified 15689 * child segment. Finally, emits event to client. 15690 * 15691 * @param detail Child segment affected represented as SegmentDetail 15692 * @event change With detail - SegmentDetail 15693 */ 15694 MDCSegmentedButtonFoundation.prototype.handleSelected = function (detail) { 15695 if (this.isSingleSelect()) { 15696 this.unselectPrevSelected(detail.index); 15697 } 15698 this.adapter.notifySelectedChange(detail); 15699 }; 15700 /** 15701 * Sets all child segments to be not selected except for child segment 15702 * identified by index 15703 * 15704 * @param index Index of child segment to not unselect 15705 */ 15706 MDCSegmentedButtonFoundation.prototype.unselectPrevSelected = function (index) { 15707 var e_1, _a; 15708 try { 15709 for (var _b = __values(this.getSelectedSegments()), _c = _b.next(); !_c.done; _c = _b.next()) { 15710 var selectedSegment = _c.value; 15711 if (selectedSegment.index !== index) { 15712 this.unselectSegment(selectedSegment.index); 15713 } 15714 } 15715 } catch (e_1_1) { 15716 e_1 = { error: e_1_1 }; 15717 } finally { 15718 try { 15719 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 15720 } finally { 15721 if (e_1) throw e_1.error; 15722 } 15723 } 15724 }; 15725 return MDCSegmentedButtonFoundation; 15726}(foundation_1.MDCFoundation); 15727exports.MDCSegmentedButtonFoundation = MDCSegmentedButtonFoundation; 15728 15729/***/ }), 15730
15731/***/ "./packages/mdc-segmented-button/segmented-button/index.ts": 15732/*!*****************************************************************!*\ 15733 !*** ./packages/mdc-segmented-button/segmented-button/index.ts ***! 15734 \*****************************************************************/ 15735/*! no static exports found */ 15736/***/ (function(module, exports, __webpack_require__) { 15737 15738"use strict"; 15739 15740/** 15741 * @license 15742 * Copyright 2020 Google Inc. 15743 * 15744 * Permission is hereby granted, free of charge, to any person obtaining a copy 15745 * of this software and associated documentation files (the "Software"), to deal 15746 * in the Software without restriction, including without limitation the rights 15747 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15748 * copies of the Software, and to permit persons to whom the Software is 15749 * furnished to do so, subject to the following conditions: 15750 * 15751 * The above copyright notice and this permission notice shall be included in 15752 * all copies or substantial portions of the Software. 15753 * 15754 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15755 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15756 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15757 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15758 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15759 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15760 * THE SOFTWARE. 15761 */ 15762 15763function __export(m) { 15764 for (var p in m) { 15765 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 15766 } 15767} 15768Object.defineProperty(exports, "__esModule", { value: true }); 15769__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-segmented-button/segmented-button/foundation.ts")); 15770__export(__webpack_require__(/*! ./component */ "./packages/mdc-segmented-button/segmented-button/component.ts")); 15771 15772/***/ }), 15773
15774/***/ "./packages/mdc-select/component.ts": 15775/*!******************************************!*\ 15776 !*** ./packages/mdc-select/component.ts ***! 15777 \******************************************/ 15778/*! no static exports found */ 15779/***/ (function(module, exports, __webpack_require__) { 15780 15781"use strict"; 15782 15783/** 15784 * @license 15785 * Copyright 2016 Google Inc. 15786 * 15787 * Permission is hereby granted, free of charge, to any person obtaining a copy 15788 * of this software and associated documentation files (the "Software"), to deal 15789 * in the Software without restriction, including without limitation the rights 15790 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15791 * copies of the Software, and to permit persons to whom the Software is 15792 * furnished to do so, subject to the following conditions: 15793 * 15794 * The above copyright notice and this permission notice shall be included in 15795 * all copies or substantial portions of the Software. 15796 * 15797 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15798 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15799 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15800 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15801 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15802 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15803 * THE SOFTWARE. 15804 */ 15805 15806var __extends = this && this.__extends || function () { 15807 var _extendStatics = function extendStatics(d, b) { 15808 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 15809 d.__proto__ = b; 15810 } || function (d, b) { 15811 for (var p in b) { 15812 if (b.hasOwnProperty(p)) d[p] = b[p]; 15813 } 15814 }; 15815 return _extendStatics(d, b); 15816 }; 15817 return function (d, b) { 15818 _extendStatics(d, b); 15819 function __() { 15820 this.constructor = d; 15821 } 15822 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15823 }; 15824}(); 15825var __assign = this && this.__assign || function () { 15826 __assign = Object.assign || function (t) { 15827 for (var s, i = 1, n = arguments.length; i < n; i++) { 15828 s = arguments[i]; 15829 for (var p in s) { 15830 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 15831 } 15832 } 15833 return t; 15834 }; 15835 return __assign.apply(this, arguments); 15836}; 15837var __importStar = this && this.__importStar || function (mod) { 15838 if (mod && mod.__esModule) return mod; 15839 var result = {}; 15840 if (mod != null) for (var k in mod) { 15841 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 15842 }result["default"] = mod; 15843 return result; 15844}; 15845Object.defineProperty(exports, "__esModule", { value: true }); 15846var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 15847var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts"); 15848var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts"); 15849var menuSurfaceConstants = __importStar(__webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts")); 15850var component_4 = __webpack_require__(/*! @material/menu/component */ "./packages/mdc-menu/component.ts"); 15851var menuConstants = __importStar(__webpack_require__(/*! @material/menu/constants */ "./packages/mdc-menu/constants.ts")); 15852var component_5 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts"); 15853var component_6 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 15854var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 15855var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"); 15856var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts");
15857var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-select/helper-text/component.ts"); 15858var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-select/icon/component.ts"); 15859var MDCSelect = /** @class */function (_super) { 15860 __extends(MDCSelect, _super); 15861 function MDCSelect() { 15862 return _super !== null && _super.apply(this, arguments) || this; 15863 } 15864 MDCSelect.attachTo = function (root) { 15865 return new MDCSelect(root); 15866 }; 15867 MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) { 15868 if (labelFactory === void 0) { 15869 labelFactory = function labelFactory(el) { 15870 return new component_2.MDCFloatingLabel(el); 15871 }; 15872 } 15873 if (lineRippleFactory === void 0) { 15874 lineRippleFactory = function lineRippleFactory(el) { 15875 return new component_3.MDCLineRipple(el); 15876 }; 15877 } 15878 if (outlineFactory === void 0) { 15879 outlineFactory = function outlineFactory(el) { 15880 return new component_5.MDCNotchedOutline(el); 15881 }; 15882 } 15883 if (menuFactory === void 0) { 15884 menuFactory = function menuFactory(el) { 15885 return new component_4.MDCMenu(el); 15886 }; 15887 } 15888 if (iconFactory === void 0) { 15889 iconFactory = function iconFactory(el) { 15890 return new component_8.MDCSelectIcon(el); 15891 }; 15892 } 15893 if (helperTextFactory === void 0) { 15894 helperTextFactory = function helperTextFactory(el) { 15895 return new component_7.MDCSelectHelperText(el); 15896 }; 15897 } 15898 this.selectAnchor = this.root.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR); 15899 this.selectedText = this.root.querySelector(constants_1.strings.SELECTED_TEXT_SELECTOR); 15900 this.hiddenInput = this.root.querySelector(constants_1.strings.HIDDEN_INPUT_SELECTOR); 15901 if (!this.selectedText) { 15902 throw new Error('MDCSelect: Missing required element: The following selector must be present: ' + ("'" + constants_1.strings.SELECTED_TEXT_SELECTOR + "'")); 15903 } 15904 if (this.selectAnchor.hasAttribute(constants_1.strings.ARIA_CONTROLS)) { 15905 var helperTextElement = document.getElementById(this.selectAnchor.getAttribute(constants_1.strings.ARIA_CONTROLS)); 15906 if (helperTextElement) { 15907 this.helperText = helperTextFactory(helperTextElement); 15908 } 15909 } 15910 this.menuSetup(menuFactory); 15911 var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR); 15912 this.label = labelElement ? labelFactory(labelElement) : null; 15913 var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR); 15914 this.lineRipple = lineRippleElement ? lineRippleFactory(lineRippleElement) : null; 15915 var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR); 15916 this.outline = outlineElement ? outlineFactory(outlineElement) : null; 15917 var leadingIcon = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR); 15918 if (leadingIcon) { 15919 this.leadingIcon = iconFactory(leadingIcon); 15920 }
15921 if (!this.root.classList.contains(constants_1.cssClasses.OUTLINED)) { 15922 this.ripple = this.createRipple(); 15923 } 15924 }; 15925 /** 15926 * Initializes the select's event listeners and internal state based 15927 * on the environment's state. 15928 */ 15929 MDCSelect.prototype.initialSyncWithDOM = function () { 15930 var _this = this; 15931 this.handleFocus = function () { 15932 _this.foundation.handleFocus(); 15933 }; 15934 this.handleBlur = function () { 15935 _this.foundation.handleBlur(); 15936 }; 15937 this.handleClick = function (evt) { 15938 _this.selectAnchor.focus(); 15939 _this.foundation.handleClick(_this.getNormalizedXCoordinate(evt)); 15940 }; 15941 this.handleKeydown = function (evt) { 15942 _this.foundation.handleKeydown(evt); 15943 }; 15944 this.handleMenuItemAction = function (evt) { 15945 _this.foundation.handleMenuItemAction(evt.detail.index); 15946 }; 15947 this.handleMenuOpened = function () { 15948 _this.foundation.handleMenuOpened(); 15949 }; 15950 this.handleMenuClosed = function () { 15951 _this.foundation.handleMenuClosed(); 15952 }; 15953 this.handleMenuClosing = function () { 15954 _this.foundation.handleMenuClosing(); 15955 }; 15956 this.selectAnchor.addEventListener('focus', this.handleFocus); 15957 this.selectAnchor.addEventListener('blur', this.handleBlur); 15958 this.selectAnchor.addEventListener('click', this.handleClick); 15959 this.selectAnchor.addEventListener('keydown', this.handleKeydown); 15960 this.menu.listen(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed); 15961 this.menu.listen(menuSurfaceConstants.strings.CLOSING_EVENT, this.handleMenuClosing); 15962 this.menu.listen(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened); 15963 this.menu.listen(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction); 15964 if (this.hiddenInput) { 15965 if (this.hiddenInput.value) { 15966 // If the hidden input already has a value, use it to restore the 15967 // select's value. This can happen e.g. if the user goes back or (in 15968 // some browsers) refreshes the page. 15969 this.foundation.setValue(this.hiddenInput.value, /** skipNotify */true); 15970 this.foundation.layout(); 15971 return; 15972 } 15973 this.hiddenInput.value = this.value; 15974 } 15975 }; 15976 MDCSelect.prototype.destroy = function () { 15977 this.selectAnchor.removeEventListener('focus', this.handleFocus); 15978 this.selectAnchor.removeEventListener('blur', this.handleBlur); 15979 this.selectAnchor.removeEventListener('keydown', this.handleKeydown); 15980 this.selectAnchor.removeEventListener('click', this.handleClick); 15981 this.menu.unlisten(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed); 15982 this.menu.unlisten(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened); 15983 this.menu.unlisten(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction); 15984 this.menu.destroy(); 15985 if (this.ripple) { 15986 this.ripple.destroy(); 15987 } 15988 if (this.outline) { 15989 this.outline.destroy(); 15990 } 15991 if (this.leadingIcon) { 15992 this.leadingIcon.destroy(); 15993 } 15994 if (this.helperText) { 15995 this.helperText.destroy(); 15996 } 15997 _super.prototype.destroy.call(this); 15998 }; 15999 Object.defineProperty(MDCSelect.prototype, "value", { 16000 get: function get() { 16001 return this.foundation.getValue(); 16002 }, 16003 set: function set(value) { 16004 this.foundation.setValue(value); 16005 }, 16006 enumerable: true, 16007 configurable: true 16008 }); 16009 Object.defineProperty(MDCSelect.prototype, "selectedIndex", { 16010 get: function get() { 16011 return this.foundation.getSelectedIndex(); 16012 }, 16013 set: function set(selectedIndex) { 16014 this.foundation.setSelectedIndex(selectedIndex, /** closeMenu */true); 16015 }, 16016 enumerable: true, 16017 configurable: true 16018 });
16019 Object.defineProperty(MDCSelect.prototype, "disabled", { 16020 get: function get() { 16021 return this.foundation.getDisabled(); 16022 }, 16023 set: function set(disabled) { 16024 this.foundation.setDisabled(disabled); 16025 if (this.hiddenInput) { 16026 this.hiddenInput.disabled = disabled; 16027 } 16028 }, 16029 enumerable: true, 16030 configurable: true 16031 }); 16032 Object.defineProperty(MDCSelect.prototype, "leadingIconAriaLabel", { 16033 set: function set(label) { 16034 this.foundation.setLeadingIconAriaLabel(label); 16035 }, 16036 enumerable: true, 16037 configurable: true 16038 }); 16039 Object.defineProperty(MDCSelect.prototype, "leadingIconContent", { 16040 /** 16041 * Sets the text content of the leading icon. 16042 */ 16043 set: function set(content) { 16044 this.foundation.setLeadingIconContent(content); 16045 }, 16046 enumerable: true, 16047 configurable: true 16048 }); 16049 Object.defineProperty(MDCSelect.prototype, "helperTextContent", { 16050 /** 16051 * Sets the text content of the helper text. 16052 */ 16053 set: function set(content) { 16054 this.foundation.setHelperTextContent(content); 16055 }, 16056 enumerable: true, 16057 configurable: true 16058 }); 16059 Object.defineProperty(MDCSelect.prototype, "useDefaultValidation", { 16060 /** 16061 * Enables or disables the default validation scheme where a required select 16062 * must be non-empty. Set to false for custom validation. 16063 * @param useDefaultValidation Set this to false to ignore default 16064 * validation scheme. 16065 */ 16066 set: function set(useDefaultValidation) { 16067 this.foundation.setUseDefaultValidation(useDefaultValidation); 16068 }, 16069 enumerable: true, 16070 configurable: true 16071 }); 16072 Object.defineProperty(MDCSelect.prototype, "valid", { 16073 /** 16074 * Checks if the select is in a valid state. 16075 */ 16076 get: function get() { 16077 return this.foundation.isValid(); 16078 }, 16079 /** 16080 * Sets the current invalid state of the select. 16081 */ 16082 set: function set(isValid) { 16083 this.foundation.setValid(isValid); 16084 }, 16085 enumerable: true, 16086 configurable: true 16087 }); 16088 Object.defineProperty(MDCSelect.prototype, "required", { 16089 /** 16090 * Returns whether the select is required. 16091 */ 16092 get: function get() { 16093 return this.foundation.getRequired(); 16094 }, 16095 /** 16096 * Sets the control to the required state. 16097 */ 16098 set: function set(isRequired) { 16099 this.foundation.setRequired(isRequired); 16100 }, 16101 enumerable: true, 16102 configurable: true 16103 }); 16104 /** 16105 * Re-calculates if the notched outline should be notched and if the label 16106 * should float. 16107 */ 16108 MDCSelect.prototype.layout = function () { 16109 this.foundation.layout(); 16110 }; 16111 /** 16112 * Synchronizes the list of options with the state of the foundation. Call 16113 * this whenever menu options are dynamically updated. 16114 */ 16115 MDCSelect.prototype.layoutOptions = function () { 16116 this.foundation.layoutOptions(); 16117 this.menu.layout(); 16118 // Update cached menuItemValues for adapter. 16119 this.menuItemValues = this.menu.items.map(function (el) { 16120 return el.getAttribute(constants_1.strings.VALUE_ATTR) || ''; 16121 }); 16122 if (this.hiddenInput) { 16123 this.hiddenInput.value = this.value; 16124 } 16125 }; 16126 MDCSelect.prototype.getDefaultFoundation = function () { 16127 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 16128 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 16129 var adapter = __assign(__assign(__assign(__assign({}, this.getSelectAdapterMethods()), this.getCommonAdapterMethods()), this.getOutlineAdapterMethods()), this.getLabelAdapterMethods()); 16130 return new foundation_2.MDCSelectFoundation(adapter, this.getFoundationMap()); 16131 }; 16132 /** 16133 * Handles setup for the menu. 16134 */ 16135 MDCSelect.prototype.menuSetup = function (menuFactory) { 16136 this.menuElement = this.root.querySelector(constants_1.strings.MENU_SELECTOR); 16137 this.menu = menuFactory(this.menuElement); 16138 this.menu.hasTypeahead = true; 16139 this.menu.singleSelection = true; 16140 this.menuItemValues = this.menu.items.map(function (el) { 16141 return el.getAttribute(constants_1.strings.VALUE_ATTR) || ''; 16142 }); 16143 }; 16144 MDCSelect.prototype.createRipple = function () { 16145 var _this = this; 16146 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 16147 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 16148 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 16149 var adapter = __assign(__assign({}, component_6.MDCRipple.createAdapter({ root: this.selectAnchor })), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 16150 _this.selectAnchor.addEventListener(evtType, handler); 16151 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 16152 _this.selectAnchor.removeEventListener(evtType, handler); 16153 } }); 16154 // tslint:enable:object-literal-sort-keys 16155 return new component_6.MDCRipple(this.selectAnchor, new foundation_1.MDCRippleFoundation(adapter)); 16156 }; 16157 MDCSelect.prototype.getSelectAdapterMethods = function () { 16158 var _this = this; 16159 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 16160 return { 16161 getMenuItemAttr: function getMenuItemAttr(menuItem, attr) { 16162 return menuItem.getAttribute(attr); 16163 }, 16164 setSelectedText: function setSelectedText(text) { 16165 _this.selectedText.textContent = text; 16166 }, 16167 isSelectAnchorFocused: function isSelectAnchorFocused() { 16168 return document.activeElement === _this.selectAnchor; 16169 }, 16170 getSelectAnchorAttr: function getSelectAnchorAttr(attr) { 16171 return _this.selectAnchor.getAttribute(attr); 16172 }, 16173 setSelectAnchorAttr: function setSelectAnchorAttr(attr, value) { 16174 _this.selectAnchor.setAttribute(attr, value); 16175 }, 16176 removeSelectAnchorAttr: function removeSelectAnchorAttr(attr) { 16177 _this.selectAnchor.removeAttribute(attr); 16178 }, 16179 addMenuClass: function addMenuClass(className) { 16180 _this.menuElement.classList.add(className); 16181 }, 16182 removeMenuClass: function removeMenuClass(className) { 16183 _this.menuElement.classList.remove(className); 16184 }, 16185 openMenu: function openMenu() { 16186 _this.menu.open = true; 16187 }, 16188 closeMenu: function closeMenu() { 16189 _this.menu.open = false;
16190 }, 16191 getAnchorElement: function getAnchorElement() { 16192 return _this.root.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR); 16193 }, 16194 setMenuAnchorElement: function setMenuAnchorElement(anchorEl) { 16195 _this.menu.setAnchorElement(anchorEl); 16196 }, 16197 setMenuAnchorCorner: function setMenuAnchorCorner(anchorCorner) { 16198 _this.menu.setAnchorCorner(anchorCorner); 16199 }, 16200 setMenuWrapFocus: function setMenuWrapFocus(wrapFocus) { 16201 _this.menu.wrapFocus = wrapFocus; 16202 }, 16203 getSelectedIndex: function getSelectedIndex() { 16204 var index = _this.menu.selectedIndex; 16205 return index instanceof Array ? index[0] : index; 16206 }, 16207 setSelectedIndex: function setSelectedIndex(index) { 16208 _this.menu.selectedIndex = index; 16209 }, 16210 focusMenuItemAtIndex: function focusMenuItemAtIndex(index) { 16211 _this.menu.items[index].focus(); 16212 }, 16213 getMenuItemCount: function getMenuItemCount() { 16214 return _this.menu.items.length; 16215 }, 16216 // Cache menu item values. layoutOptions() updates this cache.
16217 getMenuItemValues: function getMenuItemValues() { 16218 return _this.menuItemValues; 16219 }, 16220 getMenuItemTextAtIndex: function getMenuItemTextAtIndex(index) { 16221 return _this.menu.getPrimaryTextAtIndex(index); 16222 }, 16223 isTypeaheadInProgress: function isTypeaheadInProgress() { 16224 return _this.menu.typeaheadInProgress; 16225 }, 16226 typeaheadMatchItem: function typeaheadMatchItem(nextChar, startingIndex) { 16227 return _this.menu.typeaheadMatchItem(nextChar, startingIndex); 16228 } 16229 }; 16230 // tslint:enable:object-literal-sort-keys 16231 }; 16232 MDCSelect.prototype.getCommonAdapterMethods = function () { 16233 var _this = this; 16234 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 16235 return { 16236 addClass: function addClass(className) { 16237 _this.root.classList.add(className); 16238 }, 16239 removeClass: function removeClass(className) { 16240 _this.root.classList.remove(className); 16241 }, 16242 hasClass: function hasClass(className) { 16243 return _this.root.classList.contains(className); 16244 }, 16245 setRippleCenter: function setRippleCenter(normalizedX) { 16246 _this.lineRipple && _this.lineRipple.setRippleCenter(normalizedX); 16247 }, 16248 activateBottomLine: function activateBottomLine() { 16249 _this.lineRipple && _this.lineRipple.activate(); 16250 }, 16251 deactivateBottomLine: function deactivateBottomLine() { 16252 _this.lineRipple && _this.lineRipple.deactivate(); 16253 }, 16254 notifyChange: function notifyChange(value) { 16255 var index = _this.selectedIndex; 16256 _this.emit(constants_1.strings.CHANGE_EVENT, { value: value, index: index }, true /* shouldBubble */); 16257 if (_this.hiddenInput) { 16258 _this.hiddenInput.value = value; 16259 } 16260 } 16261 }; 16262 // tslint:enable:object-literal-sort-keys 16263 }; 16264 MDCSelect.prototype.getOutlineAdapterMethods = function () { 16265 var _this = this; 16266 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 16267 return { 16268 hasOutline: function hasOutline() { 16269 return Boolean(_this.outline); 16270 }, 16271 notchOutline: function notchOutline(labelWidth) { 16272 _this.outline && _this.outline.notch(labelWidth); 16273 }, 16274 closeOutline: function closeOutline() { 16275 _this.outline && _this.outline.closeNotch(); 16276 } 16277 }; 16278 // tslint:enable:object-literal-sort-keys 16279 }; 16280 MDCSelect.prototype.getLabelAdapterMethods = function () { 16281 var _this = this; 16282 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 16283 return { 16284 hasLabel: function hasLabel() { 16285 return !!_this.label; 16286 }, 16287 floatLabel: function floatLabel(shouldFloat) { 16288 _this.label && _this.label.float(shouldFloat); 16289 }, 16290 getLabelWidth: function getLabelWidth() { 16291 return _this.label ? _this.label.getWidth() : 0; 16292 }, 16293 setLabelRequired: function setLabelRequired(isRequired) { 16294 _this.label && _this.label.setRequired(isRequired); 16295 } 16296 }; 16297 // tslint:enable:object-literal-sort-keys 16298 }; 16299 /** 16300 * Calculates where the line ripple should start based on the x coordinate within the component. 16301 */ 16302 MDCSelect.prototype.getNormalizedXCoordinate = function (evt) { 16303 var targetClientRect = evt.target.getBoundingClientRect(); 16304 var xCoordinate = this.isTouchEvent(evt) ? evt.touches[0].clientX : evt.clientX; 16305 return xCoordinate - targetClientRect.left; 16306 }; 16307 MDCSelect.prototype.isTouchEvent = function (evt) { 16308 return Boolean(evt.touches); 16309 }; 16310 /** 16311 * Returns a map of all subcomponents to subfoundations. 16312 */ 16313 MDCSelect.prototype.getFoundationMap = function () { 16314 return { 16315 helperText: this.helperText ? this.helperText.foundationForSelect : undefined, 16316 leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForSelect : undefined 16317 }; 16318 }; 16319 return MDCSelect; 16320}(component_1.MDCComponent); 16321exports.MDCSelect = MDCSelect; 16322 16323/***/ }), 16324
16325/***/ "./packages/mdc-select/constants.ts": 16326/*!******************************************!*\ 16327 !*** ./packages/mdc-select/constants.ts ***! 16328 \******************************************/ 16329/*! no static exports found */ 16330/***/ (function(module, exports, __webpack_require__) { 16331 16332"use strict"; 16333 16334/** 16335 * @license 16336 * Copyright 2016 Google Inc. 16337 * 16338 * Permission is hereby granted, free of charge, to any person obtaining a copy 16339 * of this software and associated documentation files (the "Software"), to deal 16340 * in the Software without restriction, including without limitation the rights 16341 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16342 * copies of the Software, and to permit persons to whom the Software is 16343 * furnished to do so, subject to the following conditions: 16344 * 16345 * The above copyright notice and this permission notice shall be included in 16346 * all copies or substantial portions of the Software. 16347 * 16348 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16349 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16350 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16351 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16352 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16353 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16354 * THE SOFTWARE. 16355 */ 16356 16357Object.defineProperty(exports, "__esModule", { value: true });
16358var cssClasses = { 16359 ACTIVATED: 'mdc-select--activated', 16360 DISABLED: 'mdc-select--disabled', 16361 FOCUSED: 'mdc-select--focused', 16362 INVALID: 'mdc-select--invalid', 16363 MENU_INVALID: 'mdc-select__menu--invalid', 16364 OUTLINED: 'mdc-select--outlined', 16365 REQUIRED: 'mdc-select--required', 16366 ROOT: 'mdc-select', 16367 WITH_LEADING_ICON: 'mdc-select--with-leading-icon' 16368}; 16369exports.cssClasses = cssClasses; 16370var strings = { 16371 ARIA_CONTROLS: 'aria-controls', 16372 ARIA_DESCRIBEDBY: 'aria-describedby', 16373 ARIA_SELECTED_ATTR: 'aria-selected', 16374 CHANGE_EVENT: 'MDCSelect:change', 16375 HIDDEN_INPUT_SELECTOR: 'input[type="hidden"]', 16376 LABEL_SELECTOR: '.mdc-floating-label', 16377 LEADING_ICON_SELECTOR: '.mdc-select__icon', 16378 LINE_RIPPLE_SELECTOR: '.mdc-line-ripple', 16379 MENU_SELECTOR: '.mdc-select__menu', 16380 OUTLINE_SELECTOR: '.mdc-notched-outline', 16381 SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text', 16382 SELECT_ANCHOR_SELECTOR: '.mdc-select__anchor', 16383 VALUE_ATTR: 'data-value' 16384}; 16385exports.strings = strings; 16386var numbers = { 16387 LABEL_SCALE: 0.75, 16388 UNSET_INDEX: -1, 16389 CLICK_DEBOUNCE_TIMEOUT_MS: 330 16390}; 16391exports.numbers = numbers; 16392 16393/***/ }), 16394
16395/***/ "./packages/mdc-select/foundation.ts": 16396/*!*******************************************!*\ 16397 !*** ./packages/mdc-select/foundation.ts ***! 16398 \*******************************************/ 16399/*! no static exports found */ 16400/***/ (function(module, exports, __webpack_require__) { 16401 16402"use strict"; 16403 16404/** 16405 * @license 16406 * Copyright 2016 Google Inc. 16407 * 16408 * Permission is hereby granted, free of charge, to any person obtaining a copy 16409 * of this software and associated documentation files (the "Software"), to deal 16410 * in the Software without restriction, including without limitation the rights 16411 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16412 * copies of the Software, and to permit persons to whom the Software is 16413 * furnished to do so, subject to the following conditions: 16414 * 16415 * The above copyright notice and this permission notice shall be included in 16416 * all copies or substantial portions of the Software. 16417 * 16418 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16419 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16420 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16421 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16422 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16423 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16424 * THE SOFTWARE. 16425 */ 16426 16427var __extends = this && this.__extends || function () { 16428 var _extendStatics = function extendStatics(d, b) { 16429 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 16430 d.__proto__ = b; 16431 } || function (d, b) { 16432 for (var p in b) { 16433 if (b.hasOwnProperty(p)) d[p] = b[p]; 16434 } 16435 }; 16436 return _extendStatics(d, b); 16437 }; 16438 return function (d, b) { 16439 _extendStatics(d, b); 16440 function __() { 16441 this.constructor = d; 16442 } 16443 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 16444 }; 16445}(); 16446var __assign = this && this.__assign || function () { 16447 __assign = Object.assign || function (t) { 16448 for (var s, i = 1, n = arguments.length; i < n; i++) { 16449 s = arguments[i]; 16450 for (var p in s) { 16451 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 16452 } 16453 } 16454 return t; 16455 }; 16456 return __assign.apply(this, arguments); 16457}; 16458Object.defineProperty(exports, "__esModule", { value: true }); 16459var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 16460var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 16461var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"); 16462var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"); 16463var MDCSelectFoundation = /** @class */function (_super) { 16464 __extends(MDCSelectFoundation, _super); 16465 /* istanbul ignore next: optional argument is not a branch statement */ 16466 /** 16467 * @param adapter 16468 * @param foundationMap Map from subcomponent names to their subfoundations. 16469 */ 16470 function MDCSelectFoundation(adapter, foundationMap) { 16471 if (foundationMap === void 0) { 16472 foundationMap = {}; 16473 } 16474 var _this = _super.call(this, __assign(__assign({}, MDCSelectFoundation.defaultAdapter), adapter)) || this; 16475 // Disabled state 16476 _this.disabled = false; 16477 // isMenuOpen is used to track the state of the menu by listening to the 16478 // MDCMenuSurface:closed event For reference, menu.open will return false if 16479 // the menu is still closing, but isMenuOpen returns false only after the menu 16480 // has closed 16481 _this.isMenuOpen = false; 16482 // By default, select is invalid if it is required but no value is selected. 16483 _this.useDefaultValidation = true; 16484 _this.customValidity = true; 16485 _this.lastSelectedIndex = constants_2.numbers.UNSET_INDEX; 16486 _this.clickDebounceTimeout = 0; 16487 _this.recentlyClicked = false;
16488 _this.leadingIcon = foundationMap.leadingIcon; 16489 _this.helperText = foundationMap.helperText; 16490 return _this; 16491 } 16492 Object.defineProperty(MDCSelectFoundation, "cssClasses", { 16493 get: function get() { 16494 return constants_2.cssClasses; 16495 }, 16496 enumerable: true, 16497 configurable: true 16498 }); 16499 Object.defineProperty(MDCSelectFoundation, "numbers", { 16500 get: function get() { 16501 return constants_2.numbers; 16502 }, 16503 enumerable: true, 16504 configurable: true 16505 }); 16506 Object.defineProperty(MDCSelectFoundation, "strings", { 16507 get: function get() { 16508 return constants_2.strings; 16509 }, 16510 enumerable: true, 16511 configurable: true 16512 }); 16513 Object.defineProperty(MDCSelectFoundation, "defaultAdapter", { 16514 /** 16515 * See {@link MDCSelectAdapter} for typing information on parameters and return types. 16516 */ 16517 get: function get() { 16518 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 16519 return { 16520 addClass: function addClass() { 16521 return undefined; 16522 }, 16523 removeClass: function removeClass() { 16524 return undefined; 16525 }, 16526 hasClass: function hasClass() { 16527 return false; 16528 }, 16529 activateBottomLine: function activateBottomLine() { 16530 return undefined; 16531 }, 16532 deactivateBottomLine: function deactivateBottomLine() { 16533 return undefined; 16534 }, 16535 getSelectedIndex: function getSelectedIndex() { 16536 return -1; 16537 }, 16538 setSelectedIndex: function setSelectedIndex() { 16539 return undefined; 16540 }, 16541 hasLabel: function hasLabel() { 16542 return false; 16543 }, 16544 floatLabel: function floatLabel() { 16545 return undefined; 16546 }, 16547 getLabelWidth: function getLabelWidth() { 16548 return 0; 16549 }, 16550 setLabelRequired: function setLabelRequired() { 16551 return undefined; 16552 }, 16553 hasOutline: function hasOutline() { 16554 return false; 16555 }, 16556 notchOutline: function notchOutline() { 16557 return undefined; 16558 }, 16559 closeOutline: function closeOutline() { 16560 return undefined; 16561 }, 16562 setRippleCenter: function setRippleCenter() { 16563 return undefined; 16564 }, 16565 notifyChange: function notifyChange() { 16566 return undefined; 16567 }, 16568 setSelectedText: function setSelectedText() { 16569 return undefined; 16570 }, 16571 isSelectAnchorFocused: function isSelectAnchorFocused() { 16572 return false; 16573 }, 16574 getSelectAnchorAttr: function getSelectAnchorAttr() { 16575 return ''; 16576 }, 16577 setSelectAnchorAttr: function setSelectAnchorAttr() { 16578 return undefined; 16579 }, 16580 removeSelectAnchorAttr: function removeSelectAnchorAttr() { 16581 return undefined; 16582 }, 16583 addMenuClass: function addMenuClass() { 16584 return undefined; 16585 }, 16586 removeMenuClass: function removeMenuClass() { 16587 return undefined; 16588 }, 16589 openMenu: function openMenu() { 16590 return undefined; 16591 }, 16592 closeMenu: function closeMenu() { 16593 return undefined; 16594 }, 16595 getAnchorElement: function getAnchorElement() { 16596 return null; 16597 }, 16598 setMenuAnchorElement: function setMenuAnchorElement() { 16599 return undefined; 16600 }, 16601 setMenuAnchorCorner: function setMenuAnchorCorner() { 16602 return undefined; 16603 }, 16604 setMenuWrapFocus: function setMenuWrapFocus() { 16605 return undefined; 16606 }, 16607 focusMenuItemAtIndex: function focusMenuItemAtIndex() { 16608 return undefined; 16609 }, 16610 getMenuItemCount: function getMenuItemCount() { 16611 return 0; 16612 },
16613 getMenuItemValues: function getMenuItemValues() { 16614 return []; 16615 }, 16616 getMenuItemTextAtIndex: function getMenuItemTextAtIndex() { 16617 return ''; 16618 }, 16619 isTypeaheadInProgress: function isTypeaheadInProgress() { 16620 return false; 16621 }, 16622 typeaheadMatchItem: function typeaheadMatchItem() { 16623 return -1; 16624 } 16625 }; 16626 // tslint:enable:object-literal-sort-keys 16627 }, 16628 enumerable: true, 16629 configurable: true 16630 }); 16631 /** Returns the index of the currently selected menu item, or -1 if none. */ 16632 MDCSelectFoundation.prototype.getSelectedIndex = function () { 16633 return this.adapter.getSelectedIndex(); 16634 }; 16635 MDCSelectFoundation.prototype.setSelectedIndex = function (index, closeMenu, skipNotify) { 16636 if (closeMenu === void 0) { 16637 closeMenu = false; 16638 } 16639 if (skipNotify === void 0) { 16640 skipNotify = false; 16641 } 16642 if (index >= this.adapter.getMenuItemCount()) { 16643 return; 16644 } 16645 if (index === constants_2.numbers.UNSET_INDEX) { 16646 this.adapter.setSelectedText(''); 16647 } else { 16648 this.adapter.setSelectedText(this.adapter.getMenuItemTextAtIndex(index).trim()); 16649 } 16650 this.adapter.setSelectedIndex(index); 16651 if (closeMenu) { 16652 this.adapter.closeMenu(); 16653 } 16654 if (!skipNotify && this.lastSelectedIndex !== index) { 16655 this.handleChange(); 16656 } 16657 this.lastSelectedIndex = index; 16658 }; 16659 MDCSelectFoundation.prototype.setValue = function (value, skipNotify) { 16660 if (skipNotify === void 0) { 16661 skipNotify = false; 16662 }
16663 var index = this.adapter.getMenuItemValues().indexOf(value); 16664 this.setSelectedIndex(index, /** closeMenu */false, skipNotify); 16665 }; 16666 MDCSelectFoundation.prototype.getValue = function () { 16667 var index = this.adapter.getSelectedIndex(); 16668 var menuItemValues = this.adapter.getMenuItemValues(); 16669 return index !== constants_2.numbers.UNSET_INDEX ? menuItemValues[index] : ''; 16670 }; 16671 MDCSelectFoundation.prototype.getDisabled = function () { 16672 return this.disabled; 16673 }; 16674 MDCSelectFoundation.prototype.setDisabled = function (isDisabled) { 16675 this.disabled = isDisabled; 16676 if (this.disabled) { 16677 this.adapter.addClass(constants_2.cssClasses.DISABLED); 16678 this.adapter.closeMenu(); 16679 } else { 16680 this.adapter.removeClass(constants_2.cssClasses.DISABLED); 16681 } 16682 if (this.leadingIcon) { 16683 this.leadingIcon.setDisabled(this.disabled); 16684 } 16685 if (this.disabled) { 16686 // Prevent click events from focusing select. Simply pointer-events: none 16687 // is not enough since screenreader clicks may bypass this. 16688 this.adapter.removeSelectAnchorAttr('tabindex'); 16689 } else { 16690 this.adapter.setSelectAnchorAttr('tabindex', '0'); 16691 } 16692 this.adapter.setSelectAnchorAttr('aria-disabled', this.disabled.toString()); 16693 }; 16694 /** Opens the menu. */ 16695 MDCSelectFoundation.prototype.openMenu = function () { 16696 this.adapter.addClass(constants_2.cssClasses.ACTIVATED); 16697 this.adapter.openMenu(); 16698 this.isMenuOpen = true; 16699 this.adapter.setSelectAnchorAttr('aria-expanded', 'true'); 16700 }; 16701 /** 16702 * @param content Sets the content of the helper text. 16703 */ 16704 MDCSelectFoundation.prototype.setHelperTextContent = function (content) { 16705 if (this.helperText) { 16706 this.helperText.setContent(content); 16707 } 16708 }; 16709 /** 16710 * Re-calculates if the notched outline should be notched and if the label 16711 * should float. 16712 */ 16713 MDCSelectFoundation.prototype.layout = function () { 16714 if (this.adapter.hasLabel()) { 16715 var optionHasValue = this.getValue().length > 0; 16716 var isFocused = this.adapter.hasClass(constants_2.cssClasses.FOCUSED); 16717 var shouldFloatAndNotch = optionHasValue || isFocused; 16718 var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED); 16719 this.notchOutline(shouldFloatAndNotch); 16720 this.adapter.floatLabel(shouldFloatAndNotch); 16721 this.adapter.setLabelRequired(isRequired); 16722 } 16723 }; 16724 /** 16725 * Synchronizes the list of options with the state of the foundation. Call 16726 * this whenever menu options are dynamically updated. 16727 */ 16728 MDCSelectFoundation.prototype.layoutOptions = function () {
16729 var menuItemValues = this.adapter.getMenuItemValues(); 16730 var selectedIndex = menuItemValues.indexOf(this.getValue()); 16731 this.setSelectedIndex(selectedIndex, /** closeMenu */false, /** skipNotify */true); 16732 }; 16733 MDCSelectFoundation.prototype.handleMenuOpened = function () { 16734 if (this.adapter.getMenuItemValues().length === 0) { 16735 return; 16736 } 16737 // Menu should open to the last selected element, should open to first menu item otherwise. 16738 var selectedIndex = this.getSelectedIndex(); 16739 var focusItemIndex = selectedIndex >= 0 ? selectedIndex : 0; 16740 this.adapter.focusMenuItemAtIndex(focusItemIndex); 16741 }; 16742 MDCSelectFoundation.prototype.handleMenuClosing = function () { 16743 this.adapter.setSelectAnchorAttr('aria-expanded', 'false'); 16744 }; 16745 MDCSelectFoundation.prototype.handleMenuClosed = function () { 16746 this.adapter.removeClass(constants_2.cssClasses.ACTIVATED); 16747 this.isMenuOpen = false; 16748 // Unfocus the select if menu is closed without a selection 16749 if (!this.adapter.isSelectAnchorFocused()) { 16750 this.blur(); 16751 } 16752 }; 16753 /** 16754 * Handles value changes, via change event or programmatic updates. 16755 */ 16756 MDCSelectFoundation.prototype.handleChange = function () { 16757 this.layout(); 16758 this.adapter.notifyChange(this.getValue()); 16759 var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED); 16760 if (isRequired && this.useDefaultValidation) { 16761 this.setValid(this.isValid()); 16762 } 16763 }; 16764 MDCSelectFoundation.prototype.handleMenuItemAction = function (index) { 16765 this.setSelectedIndex(index, /** closeMenu */true); 16766 }; 16767 /** 16768 * Handles focus events from select element. 16769 */ 16770 MDCSelectFoundation.prototype.handleFocus = function () { 16771 this.adapter.addClass(constants_2.cssClasses.FOCUSED); 16772 this.layout(); 16773 this.adapter.activateBottomLine(); 16774 }; 16775 /** 16776 * Handles blur events from select element. 16777 */ 16778 MDCSelectFoundation.prototype.handleBlur = function () { 16779 if (this.isMenuOpen) { 16780 return; 16781 } 16782 this.blur(); 16783 }; 16784 MDCSelectFoundation.prototype.handleClick = function (normalizedX) { 16785 if (this.disabled || this.recentlyClicked) { 16786 return; 16787 } 16788 this.setClickDebounceTimeout(); 16789 if (this.isMenuOpen) { 16790 this.adapter.closeMenu(); 16791 return; 16792 } 16793 this.adapter.setRippleCenter(normalizedX); 16794 this.openMenu(); 16795 }; 16796 /** 16797 * Handles keydown events on select element. Depending on the type of 16798 * character typed, does typeahead matching or opens menu. 16799 */ 16800 MDCSelectFoundation.prototype.handleKeydown = function (event) { 16801 if (this.isMenuOpen || !this.adapter.hasClass(constants_2.cssClasses.FOCUSED)) { 16802 return; 16803 } 16804 var isEnter = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ENTER; 16805 var isSpace = keyboard_1.normalizeKey(event) === keyboard_1.KEY.SPACEBAR; 16806 var arrowUp = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ARROW_UP; 16807 var arrowDown = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ARROW_DOWN; 16808 // Typeahead 16809 if (!isSpace && event.key && event.key.length === 1 || isSpace && this.adapter.isTypeaheadInProgress()) { 16810 var key = isSpace ? ' ' : event.key; 16811 var typeaheadNextIndex = this.adapter.typeaheadMatchItem(key, this.getSelectedIndex()); 16812 if (typeaheadNextIndex >= 0) { 16813 this.setSelectedIndex(typeaheadNextIndex); 16814 } 16815 event.preventDefault(); 16816 return; 16817 } 16818 if (!isEnter && !isSpace && !arrowUp && !arrowDown) { 16819 return; 16820 } 16821 // Increment/decrement index as necessary and open menu.
16822 if (arrowUp && this.getSelectedIndex() > 0) { 16823 this.setSelectedIndex(this.getSelectedIndex() - 1); 16824 } else if (arrowDown && this.getSelectedIndex() < this.adapter.getMenuItemCount() - 1) { 16825 this.setSelectedIndex(this.getSelectedIndex() + 1); 16826 } 16827 this.openMenu(); 16828 event.preventDefault(); 16829 }; 16830 /** 16831 * Opens/closes the notched outline. 16832 */ 16833 MDCSelectFoundation.prototype.notchOutline = function (openNotch) { 16834 if (!this.adapter.hasOutline()) { 16835 return; 16836 } 16837 var isFocused = this.adapter.hasClass(constants_2.cssClasses.FOCUSED); 16838 if (openNotch) { 16839 var labelScale = constants_2.numbers.LABEL_SCALE; 16840 var labelWidth = this.adapter.getLabelWidth() * labelScale; 16841 this.adapter.notchOutline(labelWidth); 16842 } else if (!isFocused) { 16843 this.adapter.closeOutline(); 16844 } 16845 }; 16846 /** 16847 * Sets the aria label of the leading icon. 16848 */ 16849 MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) { 16850 if (this.leadingIcon) { 16851 this.leadingIcon.setAriaLabel(label); 16852 } 16853 }; 16854 /** 16855 * Sets the text content of the leading icon. 16856 */ 16857 MDCSelectFoundation.prototype.setLeadingIconContent = function (content) { 16858 if (this.leadingIcon) { 16859 this.leadingIcon.setContent(content); 16860 } 16861 }; 16862 MDCSelectFoundation.prototype.setUseDefaultValidation = function (useDefaultValidation) { 16863 this.useDefaultValidation = useDefaultValidation; 16864 }; 16865 MDCSelectFoundation.prototype.setValid = function (isValid) { 16866 if (!this.useDefaultValidation) { 16867 this.customValidity = isValid; 16868 } 16869 this.adapter.setSelectAnchorAttr('aria-invalid', (!isValid).toString()); 16870 if (isValid) { 16871 this.adapter.removeClass(constants_2.cssClasses.INVALID); 16872 this.adapter.removeMenuClass(constants_2.cssClasses.MENU_INVALID); 16873 } else { 16874 this.adapter.addClass(constants_2.cssClasses.INVALID); 16875 this.adapter.addMenuClass(constants_2.cssClasses.MENU_INVALID); 16876 } 16877 this.syncHelperTextValidity(isValid); 16878 }; 16879 MDCSelectFoundation.prototype.isValid = function () { 16880 if (this.useDefaultValidation && this.adapter.hasClass(constants_2.cssClasses.REQUIRED) && !this.adapter.hasClass(constants_2.cssClasses.DISABLED)) { 16881 // See notes for required attribute under https://www.w3.org/TR/html52/sec-forms.html#the-select-element 16882 // TL;DR: Invalid if no index is selected, or if the first index is selected and has an empty value. 16883 return this.getSelectedIndex() !== constants_2.numbers.UNSET_INDEX && (this.getSelectedIndex() !== 0 || Boolean(this.getValue())); 16884 } 16885 return this.customValidity; 16886 }; 16887 MDCSelectFoundation.prototype.setRequired = function (isRequired) { 16888 if (isRequired) { 16889 this.adapter.addClass(constants_2.cssClasses.REQUIRED); 16890 } else { 16891 this.adapter.removeClass(constants_2.cssClasses.REQUIRED); 16892 } 16893 this.adapter.setSelectAnchorAttr('aria-required', isRequired.toString()); 16894 this.adapter.setLabelRequired(isRequired); 16895 }; 16896 MDCSelectFoundation.prototype.getRequired = function () { 16897 return this.adapter.getSelectAnchorAttr('aria-required') === 'true'; 16898 }; 16899 MDCSelectFoundation.prototype.init = function () { 16900 var anchorEl = this.adapter.getAnchorElement(); 16901 if (anchorEl) { 16902 this.adapter.setMenuAnchorElement(anchorEl); 16903 this.adapter.setMenuAnchorCorner(constants_1.Corner.BOTTOM_START); 16904 } 16905 this.adapter.setMenuWrapFocus(false); 16906 this.setDisabled(this.adapter.hasClass(constants_2.cssClasses.DISABLED)); 16907 this.syncHelperTextValidity(!this.adapter.hasClass(constants_2.cssClasses.INVALID)); 16908 this.layout(); 16909 this.layoutOptions(); 16910 }; 16911 /** 16912 * Unfocuses the select component. 16913 */ 16914 MDCSelectFoundation.prototype.blur = function () {
16915 this.adapter.removeClass(constants_2.cssClasses.FOCUSED); 16916 this.layout(); 16917 this.adapter.deactivateBottomLine(); 16918 var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED); 16919 if (isRequired && this.useDefaultValidation) { 16920 this.setValid(this.isValid()); 16921 } 16922 }; 16923 MDCSelectFoundation.prototype.syncHelperTextValidity = function (isValid) { 16924 if (!this.helperText) { 16925 return; 16926 } 16927 this.helperText.setValidity(isValid); 16928 var helperTextVisible = this.helperText.isVisible(); 16929 var helperTextId = this.helperText.getId(); 16930 if (helperTextVisible && helperTextId) { 16931 this.adapter.setSelectAnchorAttr(constants_2.strings.ARIA_DESCRIBEDBY, helperTextId); 16932 } else { 16933 // Needed because screenreaders will read labels pointed to by 16934 // `aria-describedby` even if they are `aria-hidden`. 16935 this.adapter.removeSelectAnchorAttr(constants_2.strings.ARIA_DESCRIBEDBY); 16936 } 16937 }; 16938 MDCSelectFoundation.prototype.setClickDebounceTimeout = function () { 16939 var _this = this; 16940 clearTimeout(this.clickDebounceTimeout); 16941 this.clickDebounceTimeout = setTimeout(function () { 16942 _this.recentlyClicked = false; 16943 }, constants_2.numbers.CLICK_DEBOUNCE_TIMEOUT_MS); 16944 this.recentlyClicked = true; 16945 }; 16946 return MDCSelectFoundation; 16947}(foundation_1.MDCFoundation); 16948exports.MDCSelectFoundation = MDCSelectFoundation; 16949// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 16950exports.default = MDCSelectFoundation; 16951 16952/***/ }), 16953
16954/***/ "./packages/mdc-select/helper-text/component.ts": 16955/*!******************************************************!*\ 16956 !*** ./packages/mdc-select/helper-text/component.ts ***! 16957 \******************************************************/ 16958/*! no static exports found */ 16959/***/ (function(module, exports, __webpack_require__) { 16960 16961"use strict"; 16962 16963/** 16964 * @license 16965 * Copyright 2018 Google Inc. 16966 * 16967 * Permission is hereby granted, free of charge, to any person obtaining a copy 16968 * of this software and associated documentation files (the "Software"), to deal 16969 * in the Software without restriction, including without limitation the rights 16970 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16971 * copies of the Software, and to permit persons to whom the Software is 16972 * furnished to do so, subject to the following conditions: 16973 * 16974 * The above copyright notice and this permission notice shall be included in 16975 * all copies or substantial portions of the Software. 16976 * 16977 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16978 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16979 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16980 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16981 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16982 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16983 * THE SOFTWARE. 16984 */ 16985 16986var __extends = this && this.__extends || function () { 16987 var _extendStatics = function extendStatics(d, b) { 16988 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 16989 d.__proto__ = b; 16990 } || function (d, b) { 16991 for (var p in b) { 16992 if (b.hasOwnProperty(p)) d[p] = b[p]; 16993 } 16994 }; 16995 return _extendStatics(d, b); 16996 }; 16997 return function (d, b) { 16998 _extendStatics(d, b); 16999 function __() { 17000 this.constructor = d; 17001 } 17002 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 17003 }; 17004}(); 17005Object.defineProperty(exports, "__esModule", { value: true }); 17006var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 17007var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts"); 17008var MDCSelectHelperText = /** @class */function (_super) { 17009 __extends(MDCSelectHelperText, _super); 17010 function MDCSelectHelperText() { 17011 return _super !== null && _super.apply(this, arguments) || this; 17012 } 17013 MDCSelectHelperText.attachTo = function (root) { 17014 return new MDCSelectHelperText(root); 17015 }; 17016 Object.defineProperty(MDCSelectHelperText.prototype, "foundationForSelect", { 17017 // Provided for access by MDCSelect component 17018 get: function get() { 17019 return this.foundation; 17020 }, 17021 enumerable: true, 17022 configurable: true 17023 }); 17024 MDCSelectHelperText.prototype.getDefaultFoundation = function () { 17025 var _this = this; 17026 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 17027 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 17028 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 17029 var adapter = { 17030 addClass: function addClass(className) { 17031 return _this.root.classList.add(className); 17032 }, 17033 removeClass: function removeClass(className) { 17034 return _this.root.classList.remove(className); 17035 }, 17036 hasClass: function hasClass(className) { 17037 return _this.root.classList.contains(className); 17038 }, 17039 getAttr: function getAttr(attr) { 17040 return _this.root.getAttribute(attr); 17041 }, 17042 setAttr: function setAttr(attr, value) { 17043 return _this.root.setAttribute(attr, value); 17044 }, 17045 removeAttr: function removeAttr(attr) { 17046 return _this.root.removeAttribute(attr); 17047 }, 17048 setContent: function setContent(content) { 17049 _this.root.textContent = content; 17050 } 17051 }; 17052 // tslint:enable:object-literal-sort-keys 17053 return new foundation_1.MDCSelectHelperTextFoundation(adapter); 17054 }; 17055 return MDCSelectHelperText; 17056}(component_1.MDCComponent); 17057exports.MDCSelectHelperText = MDCSelectHelperText; 17058 17059/***/ }), 17060
17061/***/ "./packages/mdc-select/helper-text/constants.ts": 17062/*!******************************************************!*\ 17063 !*** ./packages/mdc-select/helper-text/constants.ts ***! 17064 \******************************************************/ 17065/*! no static exports found */ 17066/***/ (function(module, exports, __webpack_require__) { 17067 17068"use strict"; 17069 17070/** 17071 * @license 17072 * Copyright 2018 Google Inc. 17073 * 17074 * Permission is hereby granted, free of charge, to any person obtaining a copy 17075 * of this software and associated documentation files (the "Software"), to deal 17076 * in the Software without restriction, including without limitation the rights 17077 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17078 * copies of the Software, and to permit persons to whom the Software is 17079 * furnished to do so, subject to the following conditions: 17080 * 17081 * The above copyright notice and this permission notice shall be included in 17082 * all copies or substantial portions of the Software. 17083 * 17084 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17085 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17086 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17087 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17088 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17089 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17090 * THE SOFTWARE. 17091 */ 17092 17093Object.defineProperty(exports, "__esModule", { value: true }); 17094var strings = { 17095 ARIA_HIDDEN: 'aria-hidden', 17096 ROLE: 'role' 17097}; 17098exports.strings = strings;
17099var cssClasses = { 17100 HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg', 17101 HELPER_TEXT_VALIDATION_MSG_PERSISTENT: 'mdc-select-helper-text--validation-msg-persistent' 17102}; 17103exports.cssClasses = cssClasses; 17104 17105/***/ }), 17106
17107/***/ "./packages/mdc-select/helper-text/foundation.ts": 17108/*!*******************************************************!*\ 17109 !*** ./packages/mdc-select/helper-text/foundation.ts ***! 17110 \*******************************************************/ 17111/*! no static exports found */ 17112/***/ (function(module, exports, __webpack_require__) { 17113 17114"use strict"; 17115 17116/** 17117 * @license 17118 * Copyright 2018 Google Inc. 17119 * 17120 * Permission is hereby granted, free of charge, to any person obtaining a copy 17121 * of this software and associated documentation files (the "Software"), to deal 17122 * in the Software without restriction, including without limitation the rights 17123 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17124 * copies of the Software, and to permit persons to whom the Software is 17125 * furnished to do so, subject to the following conditions: 17126 * 17127 * The above copyright notice and this permission notice shall be included in 17128 * all copies or substantial portions of the Software. 17129 * 17130 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17131 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17132 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17133 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17134 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17135 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17136 * THE SOFTWARE. 17137 */ 17138 17139var __extends = this && this.__extends || function () { 17140 var _extendStatics = function extendStatics(d, b) { 17141 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 17142 d.__proto__ = b; 17143 } || function (d, b) { 17144 for (var p in b) { 17145 if (b.hasOwnProperty(p)) d[p] = b[p]; 17146 } 17147 }; 17148 return _extendStatics(d, b); 17149 }; 17150 return function (d, b) { 17151 _extendStatics(d, b); 17152 function __() { 17153 this.constructor = d; 17154 } 17155 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 17156 }; 17157}(); 17158var __assign = this && this.__assign || function () { 17159 __assign = Object.assign || function (t) { 17160 for (var s, i = 1, n = arguments.length; i < n; i++) { 17161 s = arguments[i]; 17162 for (var p in s) { 17163 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 17164 } 17165 } 17166 return t; 17167 }; 17168 return __assign.apply(this, arguments); 17169}; 17170Object.defineProperty(exports, "__esModule", { value: true }); 17171var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 17172var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts"); 17173var MDCSelectHelperTextFoundation = /** @class */function (_super) { 17174 __extends(MDCSelectHelperTextFoundation, _super); 17175 function MDCSelectHelperTextFoundation(adapter) { 17176 return _super.call(this, __assign(__assign({}, MDCSelectHelperTextFoundation.defaultAdapter), adapter)) || this; 17177 } 17178 Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", { 17179 get: function get() {
17180 return constants_1.cssClasses; 17181 }, 17182 enumerable: true, 17183 configurable: true 17184 }); 17185 Object.defineProperty(MDCSelectHelperTextFoundation, "strings", { 17186 get: function get() { 17187 return constants_1.strings; 17188 }, 17189 enumerable: true, 17190 configurable: true 17191 }); 17192 Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", { 17193 /** 17194 * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types. 17195 */ 17196 get: function get() { 17197 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 17198 return { 17199 addClass: function addClass() { 17200 return undefined; 17201 }, 17202 removeClass: function removeClass() { 17203 return undefined; 17204 }, 17205 hasClass: function hasClass() { 17206 return false; 17207 }, 17208 setAttr: function setAttr() { 17209 return undefined; 17210 }, 17211 getAttr: function getAttr() { 17212 return null; 17213 }, 17214 removeAttr: function removeAttr() { 17215 return undefined; 17216 }, 17217 setContent: function setContent() { 17218 return undefined; 17219 } 17220 }; 17221 // tslint:enable:object-literal-sort-keys 17222 }, 17223 enumerable: true, 17224 configurable: true 17225 }); 17226 /** 17227 * @return The ID of the helper text, or null if none is set. 17228 */ 17229 MDCSelectHelperTextFoundation.prototype.getId = function () { 17230 return this.adapter.getAttr('id'); 17231 }; 17232 /** 17233 * @return Whether the helper text is currently visible. 17234 */ 17235 MDCSelectHelperTextFoundation.prototype.isVisible = function () { 17236 return this.adapter.getAttr(constants_1.strings.ARIA_HIDDEN) !== 'true'; 17237 }; 17238 /** 17239 * Sets the content of the helper text field. 17240 */ 17241 MDCSelectHelperTextFoundation.prototype.setContent = function (content) { 17242 this.adapter.setContent(content); 17243 }; 17244 /** 17245 * Sets the helper text to act as a validation message. 17246 * By default, validation messages are hidden when the select is valid and 17247 * visible when the select is invalid. 17248 * 17249 * @param isValidation True to make the helper text act as an error validation 17250 * message. 17251 */ 17252 MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) { 17253 if (isValidation) {
17254 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 17255 } else { 17256 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 17257 } 17258 }; 17259 /** 17260 * Sets the persistency of the validation helper text. 17261 * This keeps the validation message visible even if the select is valid, 17262 * though it will be displayed in the normal (grey) color. 17263 */ 17264 MDCSelectHelperTextFoundation.prototype.setValidationMsgPersistent = function (isPersistent) { 17265 if (isPersistent) { 17266 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT); 17267 } else { 17268 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT); 17269 } 17270 }; 17271 /** 17272 * When acting as a validation message, shows/hides the helper text and 17273 * triggers alerts as necessary based on the select's validity. 17274 */ 17275 MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) { 17276 var isValidationMsg = this.adapter.hasClass(constants_1.cssClasse
17276s.HELPER_TEXT_VALIDATION_MSG); 17277 if (!isValidationMsg) { 17278 // Non-validating helper-text is always displayed and does not participate 17279 // in validation logic. 17280 return; 17281 } 17282 var isPersistentValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT); 17283 // Validating helper text is displayed if select is invalid, unless it is 17284 // set as persistent, in which case it always displays. 17285 var msgShouldDisplay = !selectIsValid || isPersistentValidationMsg; 17286 if (msgShouldDisplay) { 17287 this.showToScreenReader(); 17288 // In addition to displaying, also trigger an alert if the select 17289 // has become invalid. 17290 if (!selectIsValid) { 17291 this.adapter.setAttr(constants_1.strings.ROLE, 'alert'); 17292 } else { 17293 this.adapter.removeAttr(constants_1.strings.ROLE); 17294 } 17295 return; 17296 } 17297 // Hide everything. 17298 this.adapter.removeAttr(constants_1.strings.ROLE); 17299 this.hide(); 17300 }; 17301 /** 17302 * Makes the helper text visible to screen readers. 17303 */ 17304 MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () { 17305 this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN); 17306 }; 17307 /** 17308 * Hides the help text from screen readers. 17309 */ 17310 MDCSelectHelperTextFoundation.prototype.hide = function () { 17311 this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true'); 17312 }; 17313 return MDCSelectHelperTextFoundation; 17314}(foundation_1.MDCFoundation); 17315exports.MDCSelectHelperTextFoundation = MDCSelectHelperTextFoundation; 17316// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 17317exports.default = MDCSelectHelperTextFoundation; 17318 17319/***/ }), 17320
17321/***/ "./packages/mdc-select/helper-text/index.ts": 17322/*!**************************************************!*\ 17323 !*** ./packages/mdc-select/helper-text/index.ts ***! 17324 \**************************************************/ 17325/*! no static exports found */ 17326/***/ (function(module, exports, __webpack_require__) { 17327 17328"use strict"; 17329 17330/** 17331 * @license 17332 * Copyright 2019 Google Inc. 17333 * 17334 * Permission is hereby granted, free of charge, to any person obtaining a copy 17335 * of this software and associated documentation files (the "Software"), to deal 17336 * in the Software without restriction, including without limitation the rights 17337 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17338 * copies of the Software, and to permit persons to whom the Software is 17339 * furnished to do so, subject to the following conditions: 17340 * 17341 * The above copyright notice and this permission notice shall be included in 17342 * all copies or substantial portions of the Software. 17343 * 17344 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17345 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17346 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17347 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17348 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17349 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17350 * THE SOFTWARE. 17351 */ 17352 17353function __export(m) { 17354 for (var p in m) { 17355 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 17356 } 17357} 17358Object.defineProperty(exports, "__esModule", { value: true }); 17359__export(__webpack_require__(/*! ./component */ "./packages/mdc-select/helper-text/component.ts")); 17360__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts")); 17361var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
17362exports.helperTextCssClasses = constants_1.cssClasses; 17363exports.helperTextStrings = constants_1.strings; 17364 17365/***/ }), 17366
17367/***/ "./packages/mdc-select/icon/component.ts": 17368/*!***********************************************!*\ 17369 !*** ./packages/mdc-select/icon/component.ts ***! 17370 \***********************************************/ 17371/*! no static exports found */ 17372/***/ (function(module, exports, __webpack_require__) { 17373 17374"use strict"; 17375 17376/** 17377 * @license 17378 * Copyright 2018 Google Inc. 17379 * 17380 * Permission is hereby granted, free of charge, to any person obtaining a copy 17381 * of this software and associated documentation files (the "Software"), to deal 17382 * in the Software without restriction, including without limitation the rights 17383 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17384 * copies of the Software, and to permit persons to whom the Software is 17385 * furnished to do so, subject to the following conditions: 17386 * 17387 * The above copyright notice and this permission notice shall be included in 17388 * all copies or substantial portions of the Software. 17389 * 17390 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17391 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17392 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17393 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17394 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17395 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17396 * THE SOFTWARE. 17397 */ 17398 17399var __extends = this && this.__extends || function () { 17400 var _extendStatics = function extendStatics(d, b) { 17401 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 17402 d.__proto__ = b; 17403 } || function (d, b) { 17404 for (var p in b) { 17405 if (b.hasOwnProperty(p)) d[p] = b[p]; 17406 } 17407 }; 17408 return _extendStatics(d, b); 17409 }; 17410 return function (d, b) { 17411 _extendStatics(d, b); 17412 function __() { 17413 this.constructor = d; 17414 } 17415 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 17416 }; 17417}(); 17418Object.defineProperty(exports, "__esModule", { value: true }); 17419var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 17420var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts"); 17421var MDCSelectIcon = /** @class */function (_super) { 17422 __extends(MDCSelectIcon, _super); 17423 function MDCSelectIcon() { 17424 return _super !== null && _super.apply(this, arguments) || this; 17425 } 17426 MDCSelectIcon.attachTo = function (root) { 17427 return new MDCSelectIcon(root); 17428 }; 17429 Object.defineProperty(MDCSelectIcon.prototype, "foundationForSelect", { 17430 // Provided for access by MDCSelect component 17431 get: function get() { 17432 return this.foundation; 17433 }, 17434 enumerable: true, 17435 configurable: true 17436 }); 17437 MDCSelectIcon.prototype.getDefaultFoundation = function () { 17438 var _this = this; 17439 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 17440 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 17441 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 17442 var adapter = { 17443 getAttr: function getAttr(attr) { 17444 return _this.root.getAttribute(attr); 17445 }, 17446 setAttr: function setAttr(attr, value) { 17447 return _this.root.setAttribute(attr, value); 17448 }, 17449 removeAttr: function removeAttr(attr) { 17450 return _this.root.removeAttribute(attr); 17451 }, 17452 setContent: function setContent(content) { 17453 _this.root.textContent = content; 17454 }, 17455 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 17456 return _this.listen(evtType, handler); 17457 }, 17458 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 17459 return _this.unlisten(evtType, handler); 17460 }, 17461 notifyIconAction: function notifyIconAction() {
17462 return _this.emit(foundation_1.MDCSelectIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */); 17463 } 17464 }; 17465 // tslint:enable:object-literal-sort-keys 17466 return new foundation_1.MDCSelectIconFoundation(adapter); 17467 }; 17468 return MDCSelectIcon; 17469}(component_1.MDCComponent); 17470exports.MDCSelectIcon = MDCSelectIcon; 17471 17472/***/ }), 17473
17474/***/ "./packages/mdc-select/icon/constants.ts": 17475/*!***********************************************!*\ 17476 !*** ./packages/mdc-select/icon/constants.ts ***! 17477 \***********************************************/ 17478/*! no static exports found */ 17479/***/ (function(module, exports, __webpack_require__) { 17480 17481"use strict"; 17482 17483/** 17484 * @license 17485 * Copyright 2018 Google Inc. 17486 * 17487 * Permission is hereby granted, free of charge, to any person obtaining a copy 17488 * of this software and associated documentation files (the "Software"), to deal 17489 * in the Software without restriction, including without limitation the rights 17490 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17491 * copies of the Software, and to permit persons to whom the Software is 17492 * furnished to do so, subject to the following conditions: 17493 * 17494 * The above copyright notice and this permission notice shall be included in 17495 * all copies or substantial portions of the Software. 17496 * 17497 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17498 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17499 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17500 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17501 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17502 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17503 * THE SOFTWARE. 17504 */ 17505 17506Object.defineProperty(exports, "__esModule", { value: true }); 17507var strings = { 17508 ICON_EVENT: 'MDCSelect:icon', 17509 ICON_ROLE: 'button' 17510}; 17511exports.strings = strings; 17512 17513/***/ }), 17514
17515/***/ "./packages/mdc-select/icon/foundation.ts": 17516/*!************************************************!*\ 17517 !*** ./packages/mdc-select/icon/foundation.ts ***! 17518 \************************************************/ 17519/*! no static exports found */ 17520/***/ (function(module, exports, __webpack_require__) { 17521 17522"use strict"; 17523 17524/** 17525 * @license 17526 * Copyright 2018 Google Inc. 17527 * 17528 * Permission is hereby granted, free of charge, to any person obtaining a copy 17529 * of this software and associated documentation files (the "Software"), to deal 17530 * in the Software without restriction, including without limitation the rights 17531 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17532 * copies of the Software, and to permit persons to whom the Software is 17533 * furnished to do so, subject to the following conditions: 17534 * 17535 * The above copyright notice and this permission notice shall be included in 17536 * all copies or substantial portions of the Software. 17537 * 17538 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17539 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17540 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17541 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17542 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17543 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17544 * THE SOFTWARE. 17545 */ 17546 17547var __extends = this && this.__extends || function () { 17548 var _extendStatics = function extendStatics(d, b) { 17549 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 17550 d.__proto__ = b; 17551 } || function (d, b) { 17552 for (var p in b) { 17553 if (b.hasOwnProperty(p)) d[p] = b[p]; 17554 } 17555 }; 17556 return _extendStatics(d, b); 17557 }; 17558 return function (d, b) { 17559 _extendStatics(d, b); 17560 function __() { 17561 this.constructor = d; 17562 } 17563 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 17564 }; 17565}(); 17566var __assign = this && this.__assign || function () { 17567 __assign = Object.assign || function (t) { 17568 for (var s, i = 1, n = arguments.length; i < n; i++) { 17569 s = arguments[i]; 17570 for (var p in s) { 17571 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 17572 } 17573 } 17574 return t; 17575 }; 17576 return __assign.apply(this, arguments); 17577}; 17578Object.defineProperty(exports, "__esModule", { value: true }); 17579var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 17580var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts"); 17581var INTERACTION_EVENTS = ['click', 'keydown']; 17582var MDCSelectIconFoundation = /** @class */function (_super) { 17583 __extends(MDCSelectIconFoundation, _super); 17584 function MDCSelectIconFoundation(adapter) { 17585 var _this = _super.call(this, __assign(__assign({}, MDCSelectIconFoundation.defaultAdapter), adapter)) || this; 17586 _this.savedTabIndex_ = null; 17587 _this.interactionHandler_ = function (evt) { 17588 return _this.handleInteraction(evt); 17589 }; 17590 return _this; 17591 } 17592 Object.defineProperty(MDCSelectIconFoundation, "strings", { 17593 get: function get() { 17594 return constants_1.strings; 17595 }, 17596 enumerable: true, 17597 configurable: true 17598 }); 17599 Object.defineProperty(MDCSelectIconFoundation, "defaultAdapter", { 17600 /** 17601 * See {@link MDCSelectIconAdapter} for typing information on parameters and return types. 17602 */ 17603 get: function get() { 17604 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 17605 return { 17606 getAttr: function getAttr() { 17607 return null; 17608 }, 17609 setAttr: function setAttr() { 17610 return undefined; 17611 }, 17612 removeAttr: function removeAttr() { 17613 return undefined; 17614 }, 17615 setContent: function setContent() { 17616 return undefined; 17617 }, 17618 registerInteractionHandler: function registerInteractionHandler() { 17619 return undefined; 17620 }, 17621 deregisterInteractionHandler: function deregisterInteractionHandler() { 17622 return undefined; 17623 }, 17624 notifyIconAction: function notifyIconAction() { 17625 return undefined; 17626 } 17627 }; 17628 // tslint:enable:object-literal-sort-keys 17629 }, 17630 enumerable: true, 17631 configurable: true 17632 }); 17633 MDCSelectIconFoundation.prototype.init = function () { 17634 var _this = this; 17635 this.savedTabIndex_ = this.adapter.getAttr('tabindex');
17636 INTERACTION_EVENTS.forEach(function (evtType) { 17637 _this.adapter.registerInteractionHandler(evtType, _this.interactionHandler_); 17638 }); 17639 }; 17640 MDCSelectIconFoundation.prototype.destroy = function () { 17641 var _this = this; 17642 INTERACTION_EVENTS.forEach(function (evtType) { 17643 _this.adapter.deregisterInteractionHandler(evtType, _this.interactionHandler_); 17644 }); 17645 }; 17646 MDCSelectIconFoundation.prototype.setDisabled = function (disabled) { 17647 if (!this.savedTabIndex_) { 17648 return; 17649 } 17650 if (disabled) { 17651 this.adapter.setAttr('tabindex', '-1'); 17652 this.adapter.removeAttr('role'); 17653 } else { 17654 this.adapter.setAttr('tabindex', this.savedTabIndex_); 17655 this.adapter.setAttr('role', constants_1.strings.ICON_ROLE); 17656 } 17657 }; 17658 MDCSelectIconFoundation.prototype.setAriaLabel = function (label) { 17659 this.adapter.setAttr('aria-label', label); 17660 }; 17661 MDCSelectIconFoundation.prototype.setContent = function (content) { 17662 this.adapter.setContent(content); 17663 }; 17664 MDCSelectIconFoundation.prototype.handleInteraction = function (evt) { 17665 var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13; 17666 if (evt.type === 'click' || isEnterKey) { 17667 this.adapter.notifyIconAction(); 17668 } 17669 }; 17670 return MDCSelectIconFoundation; 17671}(foundation_1.MDCFoundation); 17672exports.MDCSelectIconFoundation = MDCSelectIconFoundation; 17673// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 17674exports.default = MDCSelectIconFoundation; 17675 17676/***/ }), 17677
17678/***/ "./packages/mdc-select/icon/index.ts": 17679/*!*******************************************!*\ 17680 !*** ./packages/mdc-select/icon/index.ts ***! 17681 \*******************************************/ 17682/*! no static exports found */ 17683/***/ (function(module, exports, __webpack_require__) { 17684 17685"use strict"; 17686 17687/** 17688 * @license 17689 * Copyright 2019 Google Inc. 17690 * 17691 * Permission is hereby granted, free of charge, to any person obtaining a copy 17692 * of this software and associated documentation files (the "Software"), to deal 17693 * in the Software without restriction, including without limitation the rights 17694 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17695 * copies of the Software, and to permit persons to whom the Software is 17696 * furnished to do so, subject to the following conditions: 17697 * 17698 * The above copyright notice and this permission notice shall be included in 17699 * all copies or substantial portions of the Software. 17700 * 17701 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17702 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17703 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17704 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17705 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17706 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17707 * THE SOFTWARE. 17708 */ 17709 17710function __export(m) { 17711 for (var p in m) { 17712 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 17713 } 17714} 17715Object.defineProperty(exports, "__esModule", { value: true }); 17716__export(__webpack_require__(/*! ./component */ "./packages/mdc-select/icon/component.ts")); 17717__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts")); 17718var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts"); 17719exports.iconStrings = constants_1.strings; 17720 17721/***/ }), 17722
17723/***/ "./packages/mdc-select/index.ts": 17724/*!**************************************!*\ 17725 !*** ./packages/mdc-select/index.ts ***! 17726 \**************************************/ 17727/*! no static exports found */ 17728/***/ (function(module, exports, __webpack_require__) { 17729 17730"use strict"; 17731 17732/** 17733 * @license 17734 * Copyright 2019 Google Inc. 17735 * 17736 * Permission is hereby granted, free of charge, to any person obtaining a copy 17737 * of this software and associated documentation files (the "Software"), to deal 17738 * in the Software without restriction, including without limitation the rights 17739 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17740 * copies of the Software, and to permit persons to whom the Software is 17741 * furnished to do so, subject to the following conditions: 17742 * 17743 * The above copyright notice and this permission notice shall be included in 17744 * all copies or substantial portions of the Software. 17745 * 17746 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17747 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17748 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17749 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17750 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17751 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17752 * THE SOFTWARE. 17753 */ 17754 17755function __export(m) { 17756 for (var p in m) { 17757 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 17758 } 17759} 17760Object.defineProperty(exports, "__esModule", { value: true }); 17761__export(__webpack_require__(/*! ./component */ "./packages/mdc-select/component.ts")); 17762__export(__webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts")); 17763__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts")); 17764__export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-select/helper-text/index.ts")); 17765__export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-select/icon/index.ts")); 17766 17767/***/ }), 17768
17769/***/ "./packages/mdc-slider/component.ts": 17770/*!******************************************!*\ 17771 !*** ./packages/mdc-slider/component.ts ***! 17772 \******************************************/ 17773/*! no static exports found */ 17774/***/ (function(module, exports, __webpack_require__) { 17775 17776"use strict"; 17777 17778/** 17779 * @license 17780 * Copyright 2020 Google Inc. 17781 * 17782 * Permission is hereby granted, free of charge, to any person obtaining a copy 17783 * of this software and associated documentation files (the "Software"), to deal 17784 * in the Software without restriction, including without limitation the rights 17785 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17786 * copies of the Software, and to permit persons to whom the Software is 17787 * furnished to do so, subject to the following conditions: 17788 * 17789 * The above copyright notice and this permission notice shall be included in 17790 * all copies or substantial portions of the Software. 17791 * 17792 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17793 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17794 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17795 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17796 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17797 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17798 * THE SOFTWARE. 17799 */ 17800 17801var __extends = this && this.__extends || function () { 17802 var _extendStatics = function extendStatics(d, b) { 17803 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 17804 d.__proto__ = b; 17805 } || function (d, b) { 17806 for (var p in b) { 17807 if (b.hasOwnProperty(p)) d[p] = b[p]; 17808 } 17809 }; 17810 return _extendStatics(d, b); 17811 }; 17812 return function (d, b) { 17813 _extendStatics(d, b); 17814 function __() { 17815 this.constructor = d; 17816 } 17817 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 17818 }; 17819}(); 17820var __assign = this && this.__assign || function () { 17821 __assign = Object.assign || function (t) { 17822 for (var s, i = 1, n = arguments.length; i < n; i++) { 17823 s = arguments[i]; 17824 for (var p in s) { 17825 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 17826 } 17827 } 17828 return t; 17829 }; 17830 return __assign.apply(this, arguments); 17831}; 17832Object.defineProperty(exports, "__esModule", { value: true }); 17833var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 17834var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 17835var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 17836var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 17837var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 17838var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"); 17839var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts"); 17840var types_1 = __webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts"); 17841/** Vanilla JS implementation of slider component. */ 17842var MDCSlider = /** @class */function (_super) { 17843 __extends(MDCSlider, _super); 17844 function MDCSlider() { 17845 var _this = _super !== null && _super.apply(this, arguments) || this; 17846 _this.skipInitialUIUpdate = false; 17847 // Function that maps a slider value to the value of the `aria-valuetext` 17848 // attribute on the thumb element. 17849 _this.valueToAriaValueTextFn = null; 17850 return _this; 17851 } 17852 MDCSlider.attachTo = function (root, options) { 17853 if (options === void 0) { 17854 options = {}; 17855 } 17856 return new MDCSlider(root, undefined, options); 17857 }; 17858 MDCSlider.prototype.getDefaultFoundation = function () { 17859 var _this = this; 17860 // tslint:disable:object-literal-sort-keys Methods should be in the same 17861 // order as the adapter interface. 17862 var adapter = { 17863 hasClass: function hasClass(className) { 17864 return _this.root.classList.contains(className); 17865 }, 17866 addClass: function addClass(className) { 17867 _this.root.classList.add(className); 17868 }, 17869 removeClass: function removeClass(className) { 17870 _this.root.classList.remove(className); 17871 }, 17872 addThumbClass: function addThumbClass(className, thumb) { 17873 _this.getThumbEl(thumb).classList.add(className); 17874 }, 17875 removeThumbClass: function removeThumbClass(className, thumb) { 17876 _this.getThumbEl(thumb).classList.remove(className); 17877 }, 17878 getAttribute: function getAttribute(attribute) { 17879 return _this.root.getAttribute(attribute); 17880 }, 17881 getInputValue: function getInputValue(thumb) { 17882 return _this.getInput(thumb).value; 17883 }, 17884 setInputValue: function setInputValue(value, thumb) { 17885 _this.getInput(thumb).value = value; 17886 }, 17887 getInputAttribute: function getInputAttribute(attribute, thumb) { 17888 return _this.getInput(thumb).getAttribute(attribute); 17889 }, 17890 setInputAttribute: function setInputAttribute(attribute, value, thumb) { 17891 _this.getInput(thumb).setAttribute(attribute, value); 17892 }, 17893 removeInputAttribute: function removeInputAttribute(attribute, thumb) { 17894 _this.getInput(thumb).removeAttribute(attribute); 17895 }, 17896 focusInput: function focusInput(thumb) { 17897 _this.getInput(thumb).focus(); 17898 }, 17899 isInputFocused: function isInputFocused(thumb) { 17900 return _this.getInput(thumb) === document.activeElement; 17901 }, 17902 getThumbKnobWidth: function getThumbKnobWidth(thumb) { 17903 return _this.getThumbEl(thumb).querySelector("." + constants_1.cssClasse
17903s.THUMB_KNOB).getBoundingClientRect().width; 17904 }, 17905 getThumbBoundingClientRect: function getThumbBoundingClientRect(thumb) { 17906 return _this.getThumbEl(thumb).getBoundingClientRect(); 17907 }, 17908 getBoundingClientRect: function getBoundingClientRect() { 17909 return _this.root.getBoundingClientRect(); 17910 }, 17911 isRTL: function isRTL() { 17912 return getComputedStyle(_this.root).direction === 'rtl'; 17913 }, 17914 setThumbStyleProperty: function setThumbStyleProperty(propertyName, value, thumb) { 17915 _this.getThumbEl(thumb).style.setProperty(propertyName, value); 17916 }, 17917 removeThumbStyleProperty: function removeThumbStyleProperty(propertyName, thumb) { 17918 _this.getThumbEl(thumb).style.removeProperty(propertyName); 17919 }, 17920 setTrackActiveStyleProperty: function setTrackActiveStyleProperty(propertyName, value) { 17921 _this.trackActive.style.setProperty(propertyName, value); 17922 }, 17923 removeTrackActiveStyleProperty: function removeTrackActiveStyleProperty(propertyName) { 17924 _this.trackActive.style.removeProperty(propertyName); 17925 }, 17926 setValueIndicatorText: function setValueIndicatorText(value, thumb) { 17927 var valueIndicatorEl = _this.getThumbEl(thumb).querySelector("." + constants_1.cssClasse
17927s.VALUE_INDICATOR_TEXT); 17928 valueIndicatorEl.textContent = String(value); 17929 }, 17930 getValueToAriaValueTextFn: function getValueToAriaValueTextFn() { 17931 return _this.valueToAriaValueTextFn; 17932 }, 17933 updateTickMarks: function updateTickMarks(tickMarks) { 17934 var tickMarksContainer = _this.root.querySelector("." + constants_1.cssClasses.TICK_MARKS_CONTAINER); 17935 if (!tickMarksContainer) { 17936 tickMarksContainer = document.createElement('div'); 17937 tickMarksContainer.classList.add(constants_1.cssClasses.TICK_MARKS_CONTAINER); 17938 var track = _this.root.querySelector("." + constants_1.cssClasses.TRACK); 17939 track.appendChild(tickMarksContainer); 17940 } 17941 if (tickMarks.length !== tickMarksContainer.children.length) { 17942 tickMarksContainer.innerHTML = ''; 17943 _this.addTickMarks(tickMarksContainer, tickMarks); 17944 } else { 17945 _this.updateTickMarks(tickMarksContainer, tickMarks); 17946 } 17947 }, 17948 setPointerCapture: function setPointerCapture(pointerId) { 17949 _this.root.setPointerCapture(pointerId); 17950 }, 17951 emitChangeEvent: function emitChangeEvent(value, thumb) { 17952 _this.emit(constants_1.events.CHANGE, { value: value, thumb: thumb }); 17953 }, 17954 emitInputEvent: function emitInputEvent(value, thumb) { 17955 _this.emit(constants_1.events.INPUT, { value: value, thumb: thumb }); 17956 }, 17957 emitDragStartEvent: function emitDragStartEvent(_, thumb) { 17958 // Emitting event is not yet implemented. See issue: 17959 // https://github.com/material-components/material-components-web/issues/6448 17960 _this.getRipple(thumb).activate(); 17961 }, 17962 emitDragEndEvent: function emitDragEndEvent(_, thumb) { 17963 // Emitting event is not yet implemented. See issue: 17964 // https://github.com/material-components/material-components-web/issues/6448 17965 _this.getRipple(thumb).deactivate(); 17966 }, 17967 registerEventHandler: function registerEventHandler(evtType, handler) { 17968 _this.listen(evtType, handler); 17969 }, 17970 deregisterEventHandler: function deregisterEventHandler(evtType, handler) { 17971 _this.unlisten(evtType, handler); 17972 }, 17973 registerThumbEventHandler: function registerThumbEventHandler(thumb, evtType, handler) { 17974 _this.getThumbEl(thumb).addEventListener(evtType, handler); 17975 }, 17976 deregisterThumbEventHandler: function deregisterThumbEventHandler(thumb, evtType, handler) { 17977 _this.getThumbEl(thumb).removeEventListener(evtType, handler); 17978 }, 17979 registerInputEventHandler: function registerInputEventHandler(thumb, evtType, handler) { 17980 _this.getInput(thumb).addEventListener(evtType, handler); 17981 }, 17982 deregisterInputEventHandler: function deregisterInputEventHandler(thumb, evtType, handler) { 17983 _this.getInput(thumb).removeEventListener(evtType, handler); 17984 }, 17985 registerBodyEventHandler: function registerBodyEventHandler(evtType, handler) { 17986 document.body.addEventListener(evtType, handler); 17987 }, 17988 deregisterBodyEventHandler: function deregisterBodyEventHandler(evtType, handler) { 17989 document.body.removeEventListener(evtType, handler); 17990 }, 17991 registerWindowEventHandler: function registerWindowEventHandler(evtType, handler) { 17992 window.addEventListener(evtType, handler); 17993 }, 17994 deregisterWindowEventHandler: function deregisterWindowEventHandler(evtType, handler) { 17995 window.removeEventListener(evtType, handler); 17996 } 17997 }; 17998 return new foundation_2.MDCSliderFoundation(adapter); 17999 }; 18000 /** 18001 * Initializes component, with the following options: 18002 * - `skipInitialUIUpdate`: Whether to skip updating the UI when initially 18003 * syncing with the DOM. This should be enabled when the slider position 18004 * is set before component initialization. 18005 */ 18006 MDCSlider.prototype.initialize = function (_a) { 18007 var skipInitialUIUpdate = (_a === void 0 ? {}
18007 : _a).skipInitialUIUpdate; 18008 this.inputs = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.INPUT)); 18009 this.thumbs = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.THUMB)); 18010 this.trackActive = this.root.querySelector("." + constants_1.cssClasses.TRACK_ACTIVE); 18011 this.ripples = this.createRipples(); 18012 if (skipInitialUIUpdate) { 18013 this.skipInitialUIUpdate = true; 18014 } 18015 }; 18016 MDCSlider.prototype.initialSyncWithDOM = function () { 18017 this.foundation.layout({ skipUpdateUI: this.skipInitialUIUpdate }); 18018 }; 18019 /** Redraws UI based on DOM (e.g. element dimensions, RTL). */ 18020 MDCSlider.prototype.layout = function () { 18021 this.foundation.layout(); 18022 }; 18023 MDCSlider.prototype.getValueStart = function () { 18024 return this.foundation.getValueStart(); 18025 }; 18026 MDCSlider.prototype.setValueStart = function (valueStart) { 18027 this.foundation.setValueStart(valueStart); 18028 }; 18029 MDCSlider.prototype.getValue = function () { 18030 return this.foundation.getValue(); 18031 }; 18032 MDCSlider.prototype.setValue = function (value) { 18033 this.foundation.setValue(value); 18034 }; 18035 /** @return Slider disabled state. */ 18036 MDCSlider.prototype.getDisabled = function () { 18037 return this.foundation.getDisabled(); 18038 }; 18039 /** Sets slider disabled state. */ 18040 MDCSlider.prototype.setDisabled = function (disabled) { 18041 this.foundation.setDisabled(disabled); 18042 }; 18043 /** 18044 * Sets a function that maps the slider value to the value of the 18045 * `aria-valuetext` attribute on the thumb element. 18046 */ 18047 MDCSlider.prototype.setValueToAriaValueTextFn = function (mapFn) { 18048 this.valueToAriaValueTextFn = mapFn; 18049 }; 18050 MDCSlider.prototype.getThumbEl = function (thumb) { 18051 return thumb === types_1.Thumb.END ? this.thumbs[this.thumbs.length - 1] : this.thumbs[0]; 18052 }; 18053 MDCSlider.prototype.getInput = function (thumb) { 18054 return thumb === types_1.Thumb.END ? this.inputs[this.inputs.length - 1] : this.inputs[0]; 18055 }; 18056 MDCSlider.prototype.getRipple = function (thumb) { 18057 return thumb === types_1.Thumb.END ? this.ripples[this.ripples.length - 1] : this.ripples[0]; 18058 }; 18059 /** Adds tick mark elements to the given container. */ 18060 MDCSlider.prototype.addTickMarks = function (tickMarkContainer, tickMarks) { 18061 var fragment = document.createDocumentFragment(); 18062 for (var i = 0; i < tickMarks.length; i++) { 18063 var div = document.createElement('div'); 18064 var tickMarkClass = tickMarks[i] === types_1.TickMark.ACTIVE ? constants_1.cssClasse
18064s.TICK_MARK_ACTIVE : constants_1.cssClasses.TICK_MARK_INACTIVE; 18065 div.classList.add(tickMarkClass); 18066 fragment.appendChild(div); 18067 } 18068 tickMarkContainer.appendChild(fragment); 18069 }; 18070 /** Updates tick mark elements' classes in the given container. */ 18071 MDCSlider.prototype.updateTickMarks = function (tickMarkContainer, tickMarks) { 18072 var tickMarkEls = Array.from(tickMarkContainer.children); 18073 for (var i = 0; i < tickMarkEls.length; i++) { 18074 if (tickMarks[i] === types_1.TickMark.ACTIVE) { 18075 tickMarkEls[i].classList.add(constants_1.cssClasses.TICK_MARK_ACTIVE); 18076 tickMarkEls[i].classList.remove(constants_1.cssClasses.TICK_MARK_INACTIVE); 18077 } else { 18078 tickMarkEls[i].classList.add(constants_1.cssClasses.TICK_MARK_INACTIVE); 18079 tickMarkEls[i].classList.remove(constants_1.cssClasses.TICK_MARK_ACTIVE); 18080 } 18081 } 18082 }; 18083 /** Initializes thumb ripples. */ 18084 MDCSlider.prototype.createRipples = function () { 18085 var ripples = []; 18086 var rippleSurfaces = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasse
18086s.THUMB)); 18087 var _loop_1 = function _loop_1(i) { 18088 var rippleSurface = rippleSurfaces[i]; 18089 // Use the corresponding input as the focus source for the ripple (i.e. 18090 // when the input is focused, the ripple is in the focused state). 18091 var input = this_1.inputs[i]; 18092 var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this_1)), { addClass: function addClass(className) { 18093 rippleSurface.classList.add(className); 18094 }, computeBoundingRect: function computeBoundingRect() { 18095 return rippleSurface.getBoundingClientRect(); 18096 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 18097 input.removeEventListener(evtType, handler); 18098 }, isSurfaceActive: function isSurfaceActive() { 18099 return ponyfill_1.matches(input, ':active'); 18100 }, isUnbounded: function isUnbounded() { 18101 return true; 18102 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 18103 input.addEventListener(evtType, handler, events_1.applyPassive()); 18104 }, removeClass: function removeClass(className) { 18105 rippleSurface.classList.remove(className); 18106 }, updateCssVariable: function updateCssVariable(varName, value) { 18107 rippleSurface.style.setProperty(varName, value); 18108 } }); 18109 var ripple = new component_2.MDCRipple(rippleSurface, new foundation_1.MDCRippleFoundation(adapter)); 18110 ripple.unbounded = true; 18111 ripples.push(ripple); 18112 }; 18113 var this_1 = this; 18114 for (var i = 0; i < rippleSurfaces.length; i++) { 18115 _loop_1(i); 18116 } 18117 return ripples; 18118 }; 18119 return MDCSlider; 18120}(component_1.MDCComponent); 18121exports.MDCSlider = MDCSlider; 18122 18123/***/ }), 18124
18125/***/ "./packages/mdc-slider/constants.ts": 18126/*!******************************************!*\ 18127 !*** ./packages/mdc-slider/constants.ts ***! 18128 \******************************************/ 18129/*! no static exports found */ 18130/***/ (function(module, exports, __webpack_require__) { 18131 18132"use strict"; 18133 18134/** 18135 * @license 18136 * Copyright 2020 Google Inc. 18137 * 18138 * Permission is hereby granted, free of charge, to any person obtaining a copy 18139 * of this software and associated documentation files (the "Software"), to deal 18140 * in the Software without restriction, including without limitation the rights 18141 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18142 * copies of the Software, and to permit persons to whom the Software is 18143 * furnished to do so, subject to the following conditions: 18144 * 18145 * The above copyright notice and this permission notice shall be included in 18146 * all copies or substantial portions of the Software. 18147 * 18148 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18149 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18150 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18151 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18152 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18153 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18154 * THE SOFTWARE. 18155 */ 18156 18157Object.defineProperty(exports, "__esModule", { value: true }); 18158/** Slider element classes. */ 18159exports.cssClasses = { 18160 DISABLED: 'mdc-slider--disabled', 18161 DISCRETE: 'mdc-slider--discrete', 18162 INPUT: 'mdc-slider__input', 18163 RANGE: 'mdc-slider--range', 18164 THUMB: 'mdc-slider__thumb', 18165 THUMB_KNOB: 'mdc-slider__thumb-knob', 18166 // Class added to the top thumb (for overlapping thumbs in range slider).
18167 THUMB_TOP: 'mdc-slider__thumb--top', 18168 THUMB_WITH_INDICATOR: 'mdc-slider__thumb--with-indicator', 18169 TICK_MARKS: 'mdc-slider--tick-marks', 18170 TICK_MARKS_CONTAINER: 'mdc-slider__tick-marks', 18171 TICK_MARK_ACTIVE: 'mdc-slider__tick-mark--active', 18172 TICK_MARK_INACTIVE: 'mdc-slider__tick-mark--inactive', 18173 TRACK: 'mdc-slider__track', 18174 // The active track fill element that will be scaled as the value changes. 18175 TRACK_ACTIVE: 'mdc-slider__track--active_fill', 18176 VALUE_INDICATOR_TEXT: 'mdc-slider__value-indicator-text' 18177}; 18178/** Slider numbers. */ 18179exports.numbers = { 18180 // Default step size. 18181 STEP_SIZE: 1, 18182 // Minimum absolute difference between clientX of move event / down event 18183 // for which to update thumb, in the case of overlapping thumbs. 18184 // This is needed to reduce chances of choosing the thumb based on 18185 // pointer jitter. 18186 THUMB_UPDATE_MIN_PX: 5 18187}; 18188/** Slider attributes. */ 18189exports.attributes = { 18190 ARIA_DISABLED: 'aria-disabled', 18191 ARIA_VALUEMAX: 'aria-valuemax', 18192 ARIA_VALUEMIN: 'aria-valuemin', 18193 ARIA_VALUENOW: 'aria-valuenow', 18194 ARIA_VALUETEXT: 'aria-valuetext', 18195 INPUT_DISABLED: 'disabled', 18196 INPUT_MIN: 'min', 18197 INPUT_MAX: 'max', 18198 INPUT_VALUE: 'value', 18199 INPUT_STEP: 'step' 18200}; 18201/** Slider events. */ 18202exports.events = { 18203 CHANGE: 'MDCSlider:change', 18204 INPUT: 'MDCSlider:input' 18205}; 18206 18207/***/ }), 18208
18209/***/ "./packages/mdc-slider/foundation.ts": 18210/*!*******************************************!*\ 18211 !*** ./packages/mdc-slider/foundation.ts ***! 18212 \*******************************************/ 18213/*! no static exports found */ 18214/***/ (function(module, exports, __webpack_require__) { 18215 18216"use strict"; 18217 18218/** 18219 * @license 18220 * Copyright 2020 Google Inc. 18221 * 18222 * Permission is hereby granted, free of charge, to any person obtaining a copy 18223 * of this software and associated documentation files (the "Software"), to deal 18224 * in the Software without restriction, including without limitation the rights 18225 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18226 * copies of the Software, and to permit persons to whom the Software is 18227 * furnished to do so, subject to the following conditions: 18228 * 18229 * The above copyright notice and this permission notice shall be included in 18230 * all copies or substantial portions of the Software. 18231 * 18232 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18233 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18234 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18235 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18236 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18237 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18238 * THE SOFTWARE. 18239 */ 18240 18241var __extends = this && this.__extends || function () { 18242 var _extendStatics = function extendStatics(d, b) { 18243 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 18244 d.__proto__ = b; 18245 } || function (d, b) { 18246 for (var p in b) { 18247 if (b.hasOwnProperty(p)) d[p] = b[p]; 18248 } 18249 }; 18250 return _extendStatics(d, b); 18251 }; 18252 return function (d, b) { 18253 _extendStatics(d, b); 18254 function __() { 18255 this.constructor = d; 18256 } 18257 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 18258 }; 18259}(); 18260var __assign = this && this.__assign || function () { 18261 __assign = Object.assign || function (t) { 18262 for (var s, i = 1, n = arguments.length; i < n; i++) { 18263 s = arguments[i]; 18264 for (var p in s) { 18265 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 18266 } 18267 } 18268 return t; 18269 }; 18270 return __assign.apply(this, arguments); 18271}; 18272Object.defineProperty(exports, "__esModule", { value: true }); 18273var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 18274var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 18275var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"); 18276var types_1 = __webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts"); 18277// Accessing `window` without a `typeof` check will throw on Node environments. 18278var HAS_WINDOW = typeof window !== 'undefined'; 18279/** 18280 * Foundation class for slider. Responsibilities include: 18281 * - Updating slider values (internal state and DOM updates) based on client 18282 * 'x' position. 18283 * - Updating DOM after slider property updates (e.g. min, max). 18284 */ 18285var MDCSliderFoundation = /** @class */function (_super) { 18286 __extends(MDCSliderFoundation, _super); 18287 function MDCSliderFoundation(adapter) { 18288 var _this = _super.call(this, __assign(__assign({}, MDCSliderFoundation.defaultAdapter), adapter)) || this; 18289 // Whether the initial styles (to position the thumb, before component 18290 // initialization) have been removed. 18291 _this.initialStylesRemoved = false; 18292 _this.isDisabled = false; 18293 _this.isDiscrete = false; 18294 _this.step = constants_1.numbers.STEP_SIZE; 18295 _this.hasTickMarks = false; 18296 // The following properties are only set for range sliders. 18297 _this.isRange = false; 18298 // Tracks the thumb being moved across a slider pointer interaction (down, 18299 // move event). 18300 _this.thumb = null; 18301 // `clientX` from the most recent down event. Used in subsequent move 18302 // events to determine which thumb to move (in the case of 18303 // overlapping thumbs). 18304 _this.downEventClientX = null;
18305 // Width of the start thumb knob. 18306 _this.startThumbKnobWidth = 0; 18307 // Width of the end thumb knob. 18308 _this.endThumbKnobWidth = 0; 18309 return _this; 18310 } 18311 Object.defineProperty(MDCSliderFoundation, "defaultAdapter", { 18312 get: function get() { 18313 // tslint:disable:object-literal-sort-keys Methods should be in the same 18314 // order as the adapter interface. 18315 return { 18316 hasClass: function hasClass() { 18317 return false; 18318 }, 18319 addClass: function addClass() { 18320 return undefined; 18321 }, 18322 removeClass: function removeClass() { 18323 return undefined; 18324 }, 18325 addThumbClass: function addThumbClass() { 18326 return undefined; 18327 }, 18328 removeThumbClass: function removeThumbClass() { 18329 return undefined; 18330 }, 18331 getAttribute: function getAttribute() { 18332 return null; 18333 }, 18334 getInputValue: function getInputValue() { 18335 return ''; 18336 }, 18337 setInputValue: function setInputValue() { 18338 return undefined; 18339 }, 18340 getInputAttribute: function getInputAttribute() { 18341 return null; 18342 }, 18343 setInputAttribute: function setInputAttribute() { 18344 return null; 18345 }, 18346 removeInputAttribute: function removeInputAttribute() { 18347 return null; 18348 }, 18349 focusInput: function focusInput() { 18350 return undefined; 18351 }, 18352 isInputFocused: function isInputFocused() { 18353 return false; 18354 }, 18355 getThumbKnobWidth: function getThumbKnobWidth() { 18356 return 0; 18357 }, 18358 getThumbBoundingClientRect: function getThumbBoundingClientRect() { 18359 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 18360 }, 18361 getBoundingClientRect: function getBoundingClientRect() { 18362 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 18363 }, 18364 isRTL: function isRTL() { 18365 return false; 18366 }, 18367 setThumbStyleProperty: function setThumbStyleProperty() { 18368 return undefined; 18369 }, 18370 removeThumbStyleProperty: function removeThumbStyleProperty() { 18371 return undefined; 18372 }, 18373 setTrackActiveStyleProperty: function setTrackActiveStyleProperty() { 18374 return undefined; 18375 }, 18376 removeTrackActiveStyleProperty: function removeTrackActiveStyleProperty() { 18377 return undefined; 18378 }, 18379 setValueIndicatorText: function setValueIndicatorText() { 18380 return undefined; 18381 }, 18382 getValueToAriaValueTextFn: function getValueToAriaValueTextFn() { 18383 return null; 18384 }, 18385 updateTickMarks: function updateTickMarks() { 18386 return undefined; 18387 }, 18388 setPointerCapture: function setPointerCapture() { 18389 return undefined; 18390 }, 18391 emitChangeEvent: function emitChangeEvent() { 18392 return undefined; 18393 }, 18394 emitInputEvent: function emitInputEvent() { 18395 return undefined; 18396 }, 18397 emitDragStartEvent: function emitDragStartEvent() { 18398 return undefined; 18399 }, 18400 emitDragEndEvent: function emitDragEndEvent() { 18401 return undefined; 18402 }, 18403 registerEventHandler: function registerEventHandler() { 18404 return undefined; 18405 }, 18406 deregisterEventHandler: function deregisterEventHandler() { 18407 return undefined; 18408 }, 18409 registerThumbEventHandler: function registerThumbEventHandler() { 18410 return undefined; 18411 }, 18412 deregisterThumbEventHandler: function deregisterThumbEventHandler() { 18413 return undefined; 18414 }, 18415 registerInputEventHandler: function registerInputEventHandler() { 18416 return undefined; 18417 }, 18418 deregisterInputEventHandler: function deregisterInputEventHandler() { 18419 return undefined; 18420 }, 18421 registerBodyEventHandler: function registerBodyEventHandler() { 18422 return undefined; 18423 }, 18424 deregisterBodyEventHandler: function deregisterBodyEventHandler() { 18425 return undefined; 18426 }, 18427 registerWindowEventHandler: function registerWindowEventHandler() { 18428 return undefined; 18429 }, 18430 deregisterWindowEventHandler: function deregisterWindowEventHandler() { 18431 return undefined; 18432 } 18433 }; 18434 // tslint:enable:object-literal-sort-keys 18435 }, 18436 enumerable: true, 18437 configurable: true 18438 }); 18439 MDCSliderFoundation.prototype.init = function () { 18440 var _this = this; 18441 this.isDisabled = this.adapter.hasClass(constants_1.cssClasse
18441s.DISABLED); 18442 this.isDiscrete = this.adapter.hasClass(constants_1.cssClasses.DISCRETE); 18443 this.hasTickMarks = this.adapter.hasClass(constants_1.cssClasses.TICK_MARKS); 18444 this.isRange = this.adapter.hasClass(constants_1.cssClasses.RANGE); 18445 var min = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_MIN, this.isRange ? types_1.Thumb.START : types_1.Thumb.END), constants_1.attributes.INPUT_MIN); 18446 var max = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_MAX, types_1.Thumb.END), constants_1.attributes.INPUT_MAX); 18447 var value = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_VALUE, types_1.Thumb.END), constants_1.attributes.INPUT_VALUE); 18448 var valueStart = this.isRange ? this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_VALUE, types_1.Thumb.START), constants_1.attributes.INPUT_VALUE) : min; 18449 this.validateProperties({ min: min, max: max, value: value, valueStart: valueStart }); 18450 this.min = min; 18451 this.max = max; 18452 this.value = value; 18453 this.valueStart = valueStart; 18454 this.valueBeforeDownEvent = value; 18455 this.valueStartBeforeDownEvent = valueStart; 18456 var stepAttr = this.adapter.getInputAttribute(constants_1.attributes.INPUT_STEP, types_1.Thumb.END); 18457 if (stepAttr) { 18458 this.step = this.convertAttributeValueToNumber(stepAttr, constants_1.attributes.INPUT_STEP); 18459 } 18460 if (this.step <= 0) { 18461 throw new Error("MDCSliderFoundation: step must be a positive number. " + ("Current step: " + this.step)); 18462 } 18463 this.mousedownOrTouchstartListener = this.handleMousedownOrTouchstart.bind(this); 18464 this.moveListener = this.handleMove.bind(this); 18465 this.pointerdownListener = this.handlePointerdown.bind(this); 18466 this.pointerupListener = this.handlePointerup.bind(this); 18467 this.thumbMouseenterListener = this.handleThumbMouseenter.bind(this); 18468 this.thumbMouseleaveListener = this.handleThumbMouseleave.bind(this); 18469 this.inputStartChangeListener = function () { 18470 _this.handleInputChange(types_1.Thumb.START); 18471 }; 18472 this.inputEndChangeListener = function () { 18473 _this.handleInputChange(types_1.Thumb.END); 18474 }; 18475 this.inputStartFocusListener = function () { 18476 _this.handleInputFocus(types_1.Thumb.START); 18477 }; 18478 this.inputEndFocusListener = function () { 18479 _this.handleInputFocus(types_1.Thumb.END); 18480 }; 18481 this.inputStartBlurListener = function () { 18482 _this.handleInputBlur(types_1.Thumb.START); 18483 }; 18484 this.inputEndBlurListener = function () { 18485 _this.handleInputBlur(types_1.Thumb.END); 18486 }; 18487 this.resizeListener = this.handleResize.bind(this); 18488 this.registerEventHandlers(); 18489 }; 18490 MDCSliderFoundation.prototype.destroy = function () { 18491 this.deregisterEventHandlers(); 18492 }; 18493 MDCSliderFoundation.prototype.getMin = function () { 18494 return this.min; 18495 }; 18496 MDCSliderFoundation.prototype.getMax = function () { 18497 return this.max; 18498 }; 18499 /** 18500 * - For single point sliders, returns the thumb value. 18501 * - For range (two-thumb) sliders, returns the end thumb's value. 18502 */ 18503 MDCSliderFoundation.prototype.getValue = function () { 18504 return this.value; 18505 }; 18506 /** 18507 * - For single point sliders, sets the thumb value. 18508 * - For range (two-thumb) sliders, sets the end thumb's value. 18509 */ 18510 MDCSliderFoundation.prototype.setValue = function (value) { 18511 if (this.isRange && value < this.valueStart) { 18512 throw new Error("end thumb value (" + value + ") must be >= start thumb " + ("value (" + this.valueStart + ")")); 18513 } 18514 this.updateValue(value, types_1.Thumb.END); 18515 }; 18516 /** 18517 * Only applicable for range sliders. 18518 * @return The start thumb's value. 18519 */ 18520 MDCSliderFoundation.prototype.getValueStart = function () { 18521 if (!this.isRange) { 18522 throw new Error('`valueStart` is only applicable for range sliders.'); 18523 } 18524 return this.valueStart; 18525 }; 18526 /** 18527 * Only applicable for range sliders. Sets the start thumb's value. 18528 */ 18529 MDCSliderFoundation.prototype.setValueStart = function (valueStart) { 18530 if (!this.isRange) { 18531 throw new Error('`valueStart` is only applicable for range sliders.'); 18532 } 18533 if (this.isRange && valueStart > this.value) { 18534 throw new Error("start thumb value (" + valueStart + ") must be <= end thumb " + ("value (" + this.value + ")")); 18535 }
18536 this.updateValue(valueStart, types_1.Thumb.START); 18537 }; 18538 MDCSliderFoundation.prototype.getStep = function () { 18539 return this.step; 18540 }; 18541 MDCSliderFoundation.prototype.getDisabled = function () { 18542 return this.isDisabled; 18543 }; 18544 /** 18545 * Sets disabled state, including updating styles and thumb tabindex. 18546 */ 18547 MDCSliderFoundation.prototype.setDisabled = function (disabled) { 18548 this.isDisabled = disabled; 18549 if (disabled) { 18550 this.adapter.addClass(constants_1.cssClasses.DISABLED); 18551 if (this.isRange) { 18552 this.adapter.setInputAttribute(constants_1.attributes.INPUT_DISABLED, '', types_1.Thumb.START); 18553 } 18554 this.adapter.setInputAttribute(constants_1.attributes.INPUT_DISABLED, '', types_1.Thumb.END); 18555 } else { 18556 this.adapter.removeClass(constants_1.cssClasses.DISABLED); 18557 if (this.isRange) { 18558 this.adapter.removeInputAttribute(constants_1.attributes.INPUT_DISABLED, types_1.Thumb.START); 18559 } 18560 this.adapter.removeInputAttribute(constants_1.attributes.INPUT_DISABLED, types_1.Thumb.END); 18561 } 18562 }; 18563 /** @return Whether the slider is a range slider. */ 18564 MDCSliderFoundation.prototype.getIsRange = function () { 18565 return this.isRange; 18566 }; 18567 /** 18568 * - Syncs slider boundingClientRect with the current DOM. 18569 * - Updates UI based on internal state. 18570 */ 18571 MDCSliderFoundation.prototype.layout = function (_a) { 18572 var skipUpdateUI = (_a === void 0 ? {} : _a).skipUpdateUI; 18573 this.rect = this.adapter.getBoundingClientRect(); 18574 if (this.isRange) { 18575 this.startThumbKnobWidth = this.adapter.getThumbKnobWidth(types_1.Thumb.START); 18576 this.endThumbKnobWidth = this.adapter.getThumbKnobWidth(types_1.Thumb.END); 18577 } 18578 if (!skipUpdateUI) { 18579 this.updateUI(); 18580 } 18581 }; 18582 /** Handles resize events on the window. */ 18583 MDCSliderFoundation.prototype.handleResize = function () { 18584 this.layout(); 18585 }; 18586 /** 18587 * Handles pointer down events on the slider root element. 18588 */ 18589 MDCSliderFoundation.prototype.handleDown = function (event) { 18590 if (this.isDisabled) return; 18591 this.valueStartBeforeDownEvent = this.valueStart; 18592 this.valueBeforeDownEvent = this.value; 18593 var clientX = event.clientX != null ? event.clientX : event.targetTouches[0].clientX; 18594 this.downEventClientX = clientX; 18595 var value = this.mapClientXOnSliderScale(clientX); 18596 this.thumb = this.getThumbFromDownEvent(clientX, value); 18597 if (this.thumb === null) return; 18598 this.handleDragStart(event, value, this.thumb); 18599 // Presses within the range do not invoke slider updates. 18600 var newValueInCurrentRange = this.isRange && value >= this.valueStart && value <= this.value; 18601 if (newValueInCurrentRange) return; 18602 this.updateValue(value, this.thumb, { emitInputEvent: true }); 18603 }; 18604 /** 18605 * Handles pointer move events on the slider root element. 18606 */ 18607 MDCSliderFoundation.prototype.handleMove = function (event) { 18608 if (this.isDisabled) return; 18609 // Prevent scrolling. 18610 event.preventDefault(); 18611 var clientX = event.clientX != null ? event.clientX : event.targetTouches[0].clientX; 18612 var dragAlreadyStarted = this.thumb != null; 18613 this.thumb = this.getThumbFromMoveEvent(clientX); 18614 if (this.thumb === null) return; 18615 var value = this.mapClientXOnSliderScale(clientX); 18616 if (!dragAlreadyStarted) { 18617 this.handleDragStart(event, value, this.thumb); 18618 this.adapter.emitDragStartEvent(value, this.thumb); 18619 } 18620 this.updateValue(value, this.thumb, { emitInputEvent: true }); 18621 }; 18622 /** 18623 * Handles pointer up events on the slider root element. 18624 */ 18625 MDCSliderFoundation.prototype.handleUp = function () { 18626 if (this.isDisabled || this.thumb === null) return; 18627 var oldValue = this.thumb === types_1.Thumb.START ? this.valueStartBeforeDownEvent : this.valueBeforeDownEvent; 18628 var newValue = this.thumb === types_1.Thumb.START ? this.valueStart : this.value; 18629 if (oldValue !== newValue) { 18630 this.adapter.emitChangeEvent(newValue, this.thumb); 18631 } 18632 this.adapter.emitDragEndEvent(newValue, this.thumb); 18633 this.thumb = null; 18634 }; 18635 /** 18636 * For range, discrete slider, shows the value indicator on both thumbs. 18637 */ 18638 MDCSliderFoundation.prototype.handleThumbMouseenter = function () { 18639 if (!this.isDiscrete || !this.isRange) return;
18640 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.START); 18641 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.END); 18642 }; 18643 /** 18644 * For range, discrete slider, hides the value indicator on both thumbs. 18645 */ 18646 MDCSliderFoundation.prototype.handleThumbMouseleave = function () { 18647 if (!this.isDiscrete || !this.isRange) return; 18648 if (this.adapter.isInputFocused(types_1.Thumb.START) || this.adapter.isInputFocused(types_1.Thumb.END)) { 18649 // Leave value indicator shown if either input is focused. 18650 return; 18651 } 18652 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.START); 18653 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.END); 18654 }; 18655 MDCSliderFoundation.prototype.handleMousedownOrTouchstart = function (event) { 18656 var _this = this; 18657 var moveEventType = event.type === 'mousedown' ? 'mousemove' : 'touchmove'; 18658 // After a down event on the slider root, listen for move events on 18659 // body (so the slider value is updated for events outside of the 18660 // slider root). 18661 this.adapter.registerBodyEventHandler(moveEventType, this.moveListener); 18662 var upHandler = function upHandler() { 18663 _this.handleUp(); 18664 // Once the drag is finished (up event on body), remove the move 18665 // handler. 18666 _this.adapter.deregisterBodyEventHandler(moveEventType, _this.moveListener); 18667 // Also stop listening for subsequent up events. 18668 _this.adapter.deregisterEventHandler('mouseup', upHandler); 18669 _this.adapter.deregisterEventHandler('touchend', upHandler); 18670 }; 18671 this.adapter.registerBodyEventHandler('mouseup', upHandler); 18672 this.adapter.registerBodyEventHandler('touchend', upHandler); 18673 this.handleDown(event); 18674 }; 18675 MDCSliderFoundation.prototype.handlePointerdown = function (event) { 18676 this.adapter.setPointerCapture(event.pointerId); 18677 this.adapter.registerEventHandler('pointermove', this.moveListener); 18678 this.handleDown(event); 18679 }; 18680 /** 18681 * Handles input `change` event by setting internal slider value to match 18682 * input's new value. 18683 */ 18684 MDCSliderFoundation.prototype.handleInputChange = function (thumb) { 18685 var value = Number(this.adapter.getInputValue(thumb)); 18686 if (thumb === types_1.Thumb.START) { 18687 this.setValueStart(value); 18688 } else { 18689 this.setValue(value); 18690 } 18691 this.adapter.emitChangeEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb); 18692 }; 18693 /** Shows value indicator on thumb(s). */ 18694 MDCSliderFoundation.prototype.handleInputFocus = function (thumb) { 18695 if (!this.isDiscrete) return;
18696 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, thumb); 18697 if (this.isRange) { 18698 var otherThumb = thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START; 18699 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, otherThumb); 18700 } 18701 }; 18702 /** Removes value indicator from thumb(s). */ 18703 MDCSliderFoundation.prototype.handleInputBlur = function (thumb) { 18704 if (!this.isDiscrete) return; 18705 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, thumb); 18706 if (this.isRange) { 18707 var otherThumb = thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START; 18708 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, otherThumb); 18709 } 18710 }; 18711 /** 18712 * Emits custom dragStart event, along with focusing the underlying input. 18713 */ 18714 MDCSliderFoundation.prototype.handleDragStart = function (event, value, thumb) { 18715 this.adapter.focusInput(thumb); 18716 // Prevent the input (that we just focused) from losing focus. 18717 event.preventDefault(); 18718 this.adapter.emitDragStartEvent(value, thumb); 18719 }; 18720 /** 18721 * @return The thumb to be moved based on initial down event. 18722 */ 18723 MDCSliderFoundation.prototype.getThumbFromDownEvent = function (clientX, value) { 18724 // For single point slider, thumb to be moved is always the END (only) 18725 // thumb. 18726 if (!this.isRange) return types_1.Thumb.END; 18727 // Check if event press point is in the bounds of any thumb. 18728 var thumbStartRect = this.adapter.getThumbBoundingClientRect(types_1.Thumb.START); 18729 var thumbEndRect = this.adapter.getThumbBoundingClientRect(types_1.Thumb.END); 18730 var inThumbStartBounds = clientX >= thumbStartRect.left && clientX <= thumbStartRect.right; 18731 var inThumbEndBounds = clientX >= thumbEndRect.left && clientX <= thumbEndRect.right; 18732 if (inThumbStartBounds && inThumbEndBounds) { 18733 // Thumbs overlapping. Thumb to be moved cannot be determined yet. 18734 return null; 18735 } 18736 // If press is in bounds for either thumb on down event, that's the thumb 18737 // to be moved. 18738 if (inThumbStartBounds) { 18739 return types_1.Thumb.START; 18740 } 18741 if (inThumbEndBounds) { 18742 return types_1.Thumb.END; 18743 } 18744 // Otherwise, if press occurred outside of the range, return either start 18745 // or end thumb based on which the press is closer to. 18746 if (value < this.valueStart) { 18747 return types_1.Thumb.START; 18748 } 18749 if (value > this.value) { 18750 return types_1.Thumb.END; 18751 } 18752 return null; 18753 }; 18754 /** 18755 * @return The thumb to be moved based on move event (based on drag 18756 * direction from original down event). Only applicable if thumbs 18757 * were overlapping in the down event. 18758 */ 18759 MDCSliderFoundation.prototype.getThumbFromMoveEvent = function (clientX) { 18760 // Thumb has already been chosen. 18761 if (this.thumb !== null) return this.thumb; 18762 if (this.downEventClientX === null) { 18763 throw new Error('`downEventClientX` is null after move event.'); 18764 } 18765 var moveDistanceUnderThreshold = Math.abs(this.downEventClientX - clientX) < constants_1.numbers.THUMB_UPDATE_MIN_PX; 18766 if (moveDistanceUnderThreshold) return this.thumb; 18767 var draggedThumbToLeft = clientX < this.downEventClientX; 18768 if (draggedThumbToLeft) { 18769 return this.adapter.isRTL() ? types_1.Thumb.END : types_1.Thumb.START; 18770 } else { 18771 return this.adapter.isRTL() ? types_1.Thumb.START : types_1.Thumb.END; 18772 } 18773 }; 18774 /** 18775 * Updates UI based on internal state. 18776 * @param thumb Thumb whose value is being updated. If undefined, UI is 18777 * updated for both thumbs based on current internal state. 18778 */ 18779 MDCSliderFoundation.prototype.updateUI = function (thumb) { 18780 this.updateThumbAndInputAttributes(thumb); 18781 this.updateThumbAndTrackUI(thumb);
18782 this.updateValueIndicatorUI(thumb); 18783 this.updateTickMarksUI(); 18784 }; 18785 /** 18786 * Updates thumb and input attributes based on current value. 18787 * @param thumb Thumb whose aria attributes to update. 18788 */ 18789 MDCSliderFoundation.prototype.updateThumbAndInputAttributes = function (thumb) { 18790 if (!thumb) return; 18791 var value = this.isRange && thumb === types_1.Thumb.START ? this.valueStart : this.value; 18792 var valueStr = String(value); 18793 this.adapter.setInputAttribute(constants_1.attributes.INPUT_VALUE, valueStr, thumb); 18794 if (this.isRange && thumb === types_1.Thumb.START) { 18795 this.adapter.setInputAttribute(constants_1.attributes.INPUT_MIN, valueStr, types_1.Thumb.END); 18796 } else if (this.isRange && thumb === types_1.Thumb.END) { 18797 this.adapter.setInputAttribute(constants_1.attributes.INPUT_MAX, valueStr, types_1.Thumb.START); 18798 } 18799 // Sync attribute with property. 18800 if (this.adapter.getInputValue(thumb) !== valueStr) { 18801 this.adapter.setInputValue(valueStr, thumb); 18802 } 18803 var valueToAriaValueTextFn = this.adapter.getValueToAriaValueTextFn(); 18804 if (valueToAriaValueTextFn) { 18805 this.adapter.setInputAttribute(constants_1.attributes.ARIA_VALUETEXT, valueToAriaValueTextFn(value), thumb); 18806 } 18807 }; 18808 /** 18809 * Updates value indicator UI based on current value. 18810 * @param thumb Thumb whose value indicator to update. If undefined, all 18811 * thumbs' value indicators are updated. 18812 */ 18813 MDCSliderFoundation.prototype.updateValueIndicatorUI = function (thumb) { 18814 if (!this.isDiscrete) return; 18815 var value = this.isRange && thumb === types_1.Thumb.START ? this.valueStart : this.value; 18816 this.adapter.setValueIndicatorText(value, thumb === types_1.Thumb.START ? types_1.Thumb.START : types_1.Thumb.END); 18817 if (!thumb && this.isRange) { 18818 this.adapter.setValueIndicatorText(this.valueStart, types_1.Thumb.START); 18819 } 18820 }; 18821 /** 18822 * Updates tick marks UI within slider, based on current min, max, and step. 18823 */ 18824 MDCSliderFoundation.prototype.updateTickMarksUI = function () { 18825 if (!this.isDiscrete || !this.hasTickMarks) return; 18826 var numTickMarksInactiveStart = (this.valueStart - this.min) / this.step; 18827 var numTickMarksActive = (this.value - this.valueStart) / this.step + 1; 18828 var numTickMarksInactiveEnd = (this.max - this.value) / this.step; 18829 var tickMarksInactiveStart = Array.from({ length: numTickMarksInactiveStart }).fill(types_1.TickMark.INACTIVE); 18830 var tickMarksActive = Array.from({ length: numTickMarksActive }).fill(types_1.TickMark.ACTIVE); 18831 var tickMarksInactiveEnd = Array.from({ length: numTickMarksInactiveEnd }).fill(types_1.TickMark.INACTIVE); 18832 this.adapter.updateTickMarks(tickMarksInactiveStart.concat(tickMarksActive).concat(tickMarksInactiveEnd)); 18833 }; 18834 /** Maps clientX to a value on the slider scale. */ 18835 MDCSliderFoundation.prototype.mapClientXOnSliderScale = function (clientX) { 18836 var xPos = clientX - this.rect.left; 18837 var pctComplete = xPos / this.rect.width; 18838 if (this.adapter.isRTL()) { 18839 pctComplete = 1 - pctComplete; 18840 } 18841 // Fit the percentage complete between the range [min,max] 18842 // by remapping from [0, 1] to [min, min+(max-min)]. 18843 var value = this.min + pctComplete * (this.max - this.min); 18844 if (value === this.max || value === this.min) { 18845 return value; 18846 } 18847 return this.quantize(value); 18848 }; 18849 /** 18850 * Updates slider value (internal state and UI) based on the given value. 18851 */ 18852 MDCSliderFoundation.prototype.updateValue = function (value, thumb, _a) { 18853 var _b = _a === void 0 ? {} : _a, 18854 emitInputEvent = _b.emitInputEvent, 18855 emitChangeEvent = _b.emitChangeEvent; 18856 value = this.clampValue(value, thumb); 18857 if (this.isRange && thumb === types_1.Thumb.START) { 18858 // Exit early if current value is the same as the new value. 18859 if (this.valueStart === value) return; 18860 this.valueStart = value; 18861 } else { 18862 // Exit early if current value is the same as the new value. 18863 if (this.value === value) return; 18864 this.value = value; 18865 } 18866 this.updateUI(thumb); 18867 if (emitInputEvent) { 18868 this.adapter.emitInputEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb); 18869 } 18870 if (emitChangeEvent) { 18871 this.adapter.emitChangeEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb); 18872 } 18873 }; 18874 /** Calculates the quantized value based on step value. */ 18875 MDCSliderFoundation.prototype.quantize = function (value) { 18876 var numSteps = Math.round(value / this.step); 18877 return numSteps * this.step; 18878 }; 18879 /** 18880 * Clamps the given value for the given thumb based on slider properties: 18881 * - Restricts value within [min, max]. 18882 * - If range slider, clamp start value <= end value, and 18883 * end value >= start value. 18884 */ 18885 MDCSliderFoundation.prototype.clampValue = function (value, thumb) { 18886 // Clamp value to [min, max] range. 18887 value = Math.min(Math.max(value, this.min), this.max); 18888 var thumbStartMovedPastThumbEnd = this.isRange && thumb === types_1.Thumb.START && value > this.value; 18889 if (thumbStartMovedPastThumbEnd) { 18890 return this.value; 18891 } 18892 var thumbEndMovedPastThumbStart = this.isRange && thumb === types_1.Thumb.END && value < this.valueStart; 18893 if (thumbEndMovedPastThumbStart) { 18894 return this.valueStart; 18895 } 18896 return value; 18897 }; 18898 /** 18899 * Updates the active track and thumb style properties to reflect current 18900 * value. 18901 */ 18902 MDCSliderFoundation.prototype.updateThumbAndTrackUI = function (thumb) { 18903 var _this = this; 18904 var _a = this, 18905 max = _a.max, 18906 min = _a.min; 18907 var pctComplete = (this.value - this.valueStart) / (max - min);
18908 var rangePx = pctComplete * this.rect.width; 18909 var isRtl = this.adapter.isRTL(); 18910 var transformProp = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; 18911 if (this.isRange) { 18912 var thumbLeftPos_1 = this.adapter.isRTL() ? (max - this.value) / (max - min) * this.rect.width : (this.valueStart - min) / (max - min) * this.rect.width; 18913 var thumbRightPos_1 = thumbLeftPos_1 + rangePx; 18914 requestAnimationFrame(function () { 18915 // Set active track styles, accounting for animation direction by 18916 // setting `transform-origin`. 18917 var trackAnimatesFromRight = !isRtl && thumb === types_1.Thumb.START || isRtl && thumb !== types_1.Thumb.START; 18918 if (trackAnimatesFromRight) { 18919 _this.adapter.setTrackActiveStyleProperty('transform-origin', 'right'); 18920 _this.adapter.setTrackActiveStyleProperty('left', 'unset'); 18921 _this.adapter.setTrackActiveStyleProperty('right', _this.rect.width - thumbRightPos_1 + "px"); 18922 } else { 18923 _this.adapter.setTrackActiveStyleProperty('transform-origin', 'left'); 18924 _this.adapter.setTrackActiveStyleProperty('right', 'unset'); 18925 _this.adapter.setTrackActiveStyleProperty('left', thumbLeftPos_1 + "px"); 18926 } 18927 _this.adapter.setTrackActiveStyleProperty(transformProp, "scaleX(" + pctComplete + ")"); 18928 // Set thumb styles. 18929 var thumbStartPos = isRtl ? thumbRightPos_1 : thumbLeftPos_1; 18930 var thumbEndPos = _this.adapter.isRTL() ? thumbLeftPos_1 : thumbRightPos_1; 18931 if (thumb === types_1.Thumb.START || !thumb || !_this.initialStylesRemoved) { 18932 _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbStartPos + "px)", types_1.Thumb.START); 18933 } 18934 if (thumb === types_1.Thumb.END || !thumb || !_this.initialStylesRemoved) { 18935 _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbEndPos + "px)", types_1.Thumb.END); 18936 } 18937 _this.removeInitialStyles(isRtl); 18938 _this.updateOverlappingThumbsUI(thumbStartPos, thumbEndPos, thumb); 18939 }); 18940 } else { 18941 requestAnimationFrame(function () { 18942 var thumbStartPos = isRtl ? _this.rect.width - rangePx : rangePx; 18943 _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbStartPos + "px)", types_1.Thumb.END); 18944 _this.adapter.setTrackActiveStyleProperty(transformProp, "scaleX(" + pctComplete + ")"); 18945 _this.removeInitialStyles(isRtl); 18946 }); 18947 } 18948 }; 18949 /** 18950 * Removes initial inline styles if not already removed. `left:<...>%` 18951 * inline styles can be added to position the thumb correctly before JS 18952 * initialization. However, they need to be removed before the JS starts 18953 * positioning the thumb. This is because the JS uses 18954 * `transform:translateX(<...>)px` (for performance reasons) to position 18955 * the thumb (which is not possible for initial styles since we need the 18956 * bounding rect measurements). 18957 */ 18958 MDCSliderFoundation.prototype.removeInitialStyles = function (isRtl) { 18959 if (this.initialStylesRemoved) return; 18960 // Remove thumb position properties that were added for initial render. 18961 var position = isRtl ? 'right' : 'left'; 18962 this.adapter.removeThumbStyleProperty(position, types_1.Thumb.END); 18963 if (this.isRange) { 18964 this.adapter.removeThumbStyleProperty(position, types_1.Thumb.START); 18965 } 18966 this.initialStylesRemoved = true; 18967 this.resetTrackAndThumbAnimation(); 18968 }; 18969 /** 18970 * Resets track/thumb animation to prevent animation when adding 18971 * `transform` styles to thumb initially. 18972 */ 18973 MDCSliderFoundation.prototype.resetTrackAndThumbAnimation = function () { 18974 var _this = this; 18975 if (!this.isDiscrete) return; 18976 // Set transition properties to default (no animation), so that the 18977 // newly added `transform` styles do not animate thumb/track from 18978 // their default positions. 18979 var transitionProp = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transition') : 'transition'; 18980 var transitionDefault = 'all 0s ease 0s'; 18981 this.adapter.setThumbStyleProperty(transitionProp, transitionDefault, types_1.Thumb.END); 18982 if (this.isRange) { 18983 this.adapter.setThumbStyleProperty(transitionProp, transitionDefault, types_1.Thumb.START); 18984 } 18985 this.adapter.setTrackActiveStyleProperty(transitionProp, transitionDefault); 18986 // In the next frame, remove the transition inline styles we just 18987 // added, such that any animations added in the CSS can now take effect. 18988 requestAnimationFrame(function () { 18989 _this.adapter.removeThumbStyleProperty(transitionProp, types_1.Thumb.END); 18990 _this.adapter.removeTrackActiveStyleProperty(transitionProp); 18991 if (_this.isRange) { 18992 _this.adapter.removeThumbStyleProperty(transitionProp, types_1.Thumb.START); 18993 } 18994 }); 18995 }; 18996 /** 18997 * Adds THUMB_TOP class to active thumb if thumb knobs overlap; otherwise 18998 * removes THUMB_TOP class from both thumbs. 18999 * @param thumb Thumb that is active (being moved). 19000 */ 19001 MDCSliderFoundation.prototype.updateOverlappingThumbsUI = function (thumbStartPos, thumbEndPos, thumb) { 19002 var thumbsOverlap = false;
19003 if (this.adapter.isRTL()) { 19004 var startThumbLeftEdge = thumbStartPos - this.startThumbKnobWidth / 2; 19005 var endThumbRightEdge = thumbEndPos + this.endThumbKnobWidth / 2; 19006 thumbsOverlap = endThumbRightEdge >= startThumbLeftEdge; 19007 } else { 19008 var startThumbRightEdge = thumbStartPos + this.startThumbKnobWidth / 2; 19009 var endThumbLeftEdge = thumbEndPos - this.endThumbKnobWidth / 2; 19010 thumbsOverlap = startThumbRightEdge >= endThumbLeftEdge; 19011 } 19012 if (thumbsOverlap) { 19013 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_TOP, 19014 // If no thumb was dragged (in the case of initial layout), end 19015 // thumb is on top by default. 19016 thumb || types_1.Thumb.END); 19017 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START); 19018 } else { 19019 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, types_1.Thumb.START);
19020 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, types_1.Thumb.END); 19021 } 19022 }; 19023 /** 19024 * Converts attribute value to a number, e.g. '100' => 100. Throws errors 19025 * for invalid values. 19026 * @param attributeValue Attribute value, e.g. 100. 19027 * @param attributeName Attribute name, e.g. `aria-valuemax`. 19028 */ 19029 MDCSliderFoundation.prototype.convertAttributeValueToNumber = function (attributeValue, attributeName) { 19030 if (attributeValue === null) { 19031 throw new Error("MDCSliderFoundation: `" + attributeName + "` must be non-null."); 19032 } 19033 var value = Number(attributeValue); 19034 if (isNaN(value)) { 19035 throw new Error("MDCSliderFoundation: `" + attributeName + "` value is " + ("`" + attributeValue + "`, but must be a number.")); 19036 } 19037 return value; 19038 }; 19039 /** Checks that the given properties are valid slider values. */ 19040 MDCSliderFoundation.prototype.validateProperties = function (_a) { 19041 var min = _a.min, 19042 max = _a.max, 19043 value = _a.value, 19044 valueStart = _a.valueStart; 19045 if (min >= max) { 19046 throw new Error("MDCSliderFoundation: min must be strictly less than max. " + ("Current: [min: " + min + ", max: " + max + "]")); 19047 } 19048 if (this.isRange) { 19049 if (value < min || value > max || valueStart < min || valueStart > max) { 19050 throw new Error("MDCSliderFoundation: values must be in [min, max] range. " + ("Current values: [start value: " + valueStart + ", end value: " + value + "]")); 19051 } 19052 if (valueStart > value) { 19053 throw new Error("MDCSliderFoundation: start value must be <= end value. " + ("Current values: [start value: " + valueStart + ", end value: " + value + "]")); 19054 } 19055 } else { 19056 // Single point slider. 19057 if (value < min || value > max) { 19058 throw new Error("MDCSliderFoundation: value must be in [min, max] range. " + ("Current value: " + value)); 19059 } 19060 } 19061 }; 19062 MDCSliderFoundation.prototype.registerEventHandlers = function () { 19063 this.adapter.registerWindowEventHandler('resize', this.resizeListener); 19064 if (MDCSliderFoundation.SUPPORTS_POINTER_EVENTS) { 19065 // If supported, use pointer events API with #setPointerCapture. 19066 this.adapter.registerEventHandler('pointerdown', this.pointerdownListener); 19067 this.adapter.registerEventHandler('pointerup', this.pointerupListener); 19068 } else { 19069 // Otherwise, fall back to mousedown/touchstart events. 19070 this.adapter.registerEventHandler('mousedown', this.mousedownOrTouchstartListener); 19071 this.adapter.registerEventHandler('touchstart', this.mousedownOrTouchstartListener); 19072 } 19073 if (this.isRange) { 19074 this.adapter.registerThumbEventHandler(types_1.Thumb.START, 'mouseenter', this.thumbMouseenterListener); 19075 this.adapter.registerThumbEventHandler(types_1.Thumb.START, 'mouseleave', this.thumbMouseleaveListener); 19076 this.adapter.registerInputEventHandler(types_1.Thumb.START, 'change', this.inputStartChangeListener); 19077 this.adapter.registerInputEventHandler(types_1.Thumb.START, 'focus', this.inputStartFocusListener); 19078 this.adapter.registerInputEventHandler(types_1.Thumb.START, 'blur', this.inputStartBlurListener); 19079 } 19080 this.adapter.registerThumbEventHandler(types_1.Thumb.END, 'mouseenter', this.thumbMouseenterListener); 19081 this.adapter.registerThumbEventHandler(types_1.Thumb.END, 'mouseleave', this.thumbMouseleaveListener); 19082 this.adapter.registerInputEventHandler(types_1.Thumb.END, 'change', this.inputEndChangeListener); 19083 this.adapter.registerInputEventHandler(types_1.Thumb.END, 'focus', this.inputEndFocusListener); 19084 this.adapter.registerInputEventHandler(types_1.Thumb.END, 'blur', this.inputEndBlurListener); 19085 }; 19086 MDCSliderFoundation.prototype.deregisterEventHandlers = function () { 19087 this.adapter.deregisterWindowEventHandler('resize', this.resizeListener); 19088 if (MDCSliderFoundation.SUPPORTS_POINTER_EVENTS) { 19089 this.adapter.deregisterEventHandler('pointerdown', this.pointerdownListener); 19090 this.adapter.deregisterEventHandler('pointerup', this.pointerupListener); 19091 } else { 19092 this.adapter.deregisterEventHandler('mousedown', this.mousedownOrTouchstartListener); 19093 this.adapter.deregisterEventHandler('touchstart', this.mousedownOrTouchstartListener); 19094 } 19095 if (this.isRange) { 19096 this.adapter.deregisterThumbEventHandler(types_1.Thumb.START, 'mouseenter', this.thumbMouseenterListener); 19097 this.adapter.deregisterThumbEventHandler(types_1.Thumb.START, 'mouseleave', this.thumbMouseleaveListener); 19098 this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'change', this.inputStartChangeListener); 19099 this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'focus', this.inputStartFocusListener); 19100 this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'blur', this.inputStartBlurListener); 19101 } 19102 this.adapter.deregisterThumbEventHandler(types_1.Thumb.END, 'mouseenter', this.thumbMouseenterListener); 19103 this.adapter.deregisterThumbEventHandler(types_1.Thumb.END, 'mouseleave', this.thumbMouseleaveListener); 19104 this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'change', this.inputEndChangeListener); 19105 this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'focu
19105s', this.inputEndFocusListener); 19106 this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'blur', this.inputEndBlurListener); 19107 }; 19108 MDCSliderFoundation.prototype.handlePointerup = function () { 19109 this.handleUp(); 19110 this.adapter.deregisterEventHandler('pointermove', this.moveListener); 19111 }; 19112 MDCSliderFoundation.SUPPORTS_POINTER_EVENTS = HAS_WINDOW && Boolean(window.PointerEvent) && 19113 // #setPointerCapture is buggy on iOS, so we can't use pointer events 19114 // until the following bug is fixed: 19115 // https://bugs.webkit.org/show_bug.cgi?id=220196 19116 !isIOS(); 19117 return MDCSliderFoundation; 19118}(foundation_1.MDCFoundation); 19119exports.MDCSliderFoundation = MDCSliderFoundation; 19120function isIOS() { 19121 // Source: 19122 // https://stackoverflow.com/questions/9038625/detect-if-device-is-ios 19123 return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) 19124 // iPad on iOS 13 detection 19125 || navigator.userAgent.includes('Mac') && 'ontouchend' in document; 19126} 19127 19128/***/ }), 19129
19130/***/ "./packages/mdc-slider/index.ts": 19131/*!**************************************!*\ 19132 !*** ./packages/mdc-slider/index.ts ***! 19133 \**************************************/ 19134/*! no static exports found */ 19135/***/ (function(module, exports, __webpack_require__) { 19136 19137"use strict"; 19138 19139/** 19140 * @license 19141 * Copyright 2020 Google Inc. 19142 * 19143 * Permission is hereby granted, free of charge, to any person obtaining a copy 19144 * of this software and associated documentation files (the "Software"), to deal 19145 * in the Software without restriction, including without limitation the rights 19146 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19147 * copies of the Software, and to permit persons to whom the Software is 19148 * furnished to do so, subject to the following conditions: 19149 * 19150 * The above copyright notice and this permission notice shall be included in 19151 * all copies or substantial portions of the Software. 19152 * 19153 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19154 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19155 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19156 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19157 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19158 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19159 * THE SOFTWARE. 19160 */ 19161 19162function __export(m) { 19163 for (var p in m) { 19164 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 19165 } 19166} 19167Object.defineProperty(exports, "__esModule", { value: true }); 19168__export(__webpack_require__(/*! ./component */ "./packages/mdc-slider/component.ts")); 19169__export(__webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts")); 19170__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts")); 19171__export(__webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts")); 19172 19173/***/ }), 19174
19175/***/ "./packages/mdc-slider/types.ts": 19176/*!**************************************!*\ 19177 !*** ./packages/mdc-slider/types.ts ***! 19178 \**************************************/ 19179/*! no static exports found */ 19180/***/ (function(module, exports, __webpack_require__) { 19181 19182"use strict"; 19183 19184/** 19185 * @license 19186 * Copyright 2020 Google Inc. 19187 * 19188 * Permission is hereby granted, free of charge, to any person obtaining a copy 19189 * of this software and associated documentation files (the "Software"), to deal 19190 * in the Software without restriction, including without limitation the rights 19191 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19192 * copies of the Software, and to permit persons to whom the Software is 19193 * furnished to do so, subject to the following conditions: 19194 * 19195 * The above copyright notice and this permission notice shall be included in 19196 * all copies or substantial portions of the Software. 19197 * 19198 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19199 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19200 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19201 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19202 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19203 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19204 * THE SOFTWARE. 19205 */ 19206 19207Object.defineProperty(exports, "__esModule", { value: true }); 19208/** Tick mark enum, for discrete sliders. */ 19209var TickMark; 19210(function (TickMark) { 19211 TickMark[TickMark["ACTIVE"] = 0] = "ACTIVE"; 19212 TickMark[TickMark["INACTIVE"] = 1] = "INACTIVE"; 19213})(TickMark = exports.TickMark || (exports.TickMark = {})); 19214/** 19215 * Thumb types: range slider has two thumbs (START, END) whereas single point 19216 * slider only has one thumb (END). 19217 */ 19218var Thumb; 19219(function (Thumb) { 19220 // Thumb at start of slider (e.g. in LTR mode, left thumb on range slider). 19221 Thumb[Thumb["START"] = 1] = "START"; 19222 // Thumb at end of slider (e.g. in LTR mode, right thumb on range slider, 19223 // or only thumb on single point slider). 19224 Thumb[Thumb["END"] = 2] = "END"; 19225})(Thumb = exports.Thumb || (exports.Thumb = {})); 19226 19227/***/ }), 19228
19229/***/ "./packages/mdc-snackbar/component.ts": 19230/*!********************************************!*\ 19231 !*** ./packages/mdc-snackbar/component.ts ***! 19232 \********************************************/ 19233/*! no static exports found */ 19234/***/ (function(module, exports, __webpack_require__) { 19235 19236"use strict"; 19237 19238/** 19239 * @license 19240 * Copyright 2018 Google Inc. 19241 * 19242 * Permission is hereby granted, free of charge, to any person obtaining a copy 19243 * of this software and associated documentation files (the "Software"), to deal 19244 * in the Software without restriction, including without limitation the rights 19245 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19246 * copies of the Software, and to permit persons to whom the Software is 19247 * furnished to do so, subject to the following conditions: 19248 * 19249 * The above copyright notice and this permission notice shall be included in 19250 * all copies or substantial portions of the Software. 19251 * 19252 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19253 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19254 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19255 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19256 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19257 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19258 * THE SOFTWARE. 19259 */ 19260 19261var __extends = this && this.__extends || function () { 19262 var _extendStatics = function extendStatics(d, b) { 19263 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 19264 d.__proto__ = b; 19265 } || function (d, b) { 19266 for (var p in b) { 19267 if (b.hasOwnProperty(p)) d[p] = b[p]; 19268 } 19269 }; 19270 return _extendStatics(d, b); 19271 }; 19272 return function (d, b) { 19273 _extendStatics(d, b); 19274 function __() { 19275 this.constructor = d; 19276 } 19277 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 19278 }; 19279}(); 19280var __importStar = this && this.__importStar || function (mod) { 19281 if (mod && mod.__esModule) return mod; 19282 var result = {}; 19283 if (mod != null) for (var k in mod) { 19284 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 19285 }result["default"] = mod; 19286 return result; 19287}; 19288Object.defineProperty(exports, "__esModule", { value: true }); 19289var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 19290var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 19291var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"); 19292var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts"); 19293var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts")); 19294var SURFACE_SELECTOR = constants_1.strings.SURFACE_SELECTOR, 19295 LABEL_SELECTOR = constants_1.strings.LABEL_SELECTOR, 19296 ACTION_SELECTOR = constants_1.strings.ACTION_SELECTOR, 19297 DISMISS_SELECTOR = constants_1.strings.DISMISS_SELECTOR, 19298 OPENING_EVENT = constants_1.strings.OPENING_EVENT, 19299 OPENED_EVENT = constants_1.strings.OPENED_EVENT, 19300 CLOSING_EVENT = constants_1.strings.CLOSING_EVENT, 19301 CLOSED_EVENT = constants_1.strings.CLOSED_EVENT; 19302var MDCSnackbar = /** @class */function (_super) { 19303 __extends(MDCSnackbar, _super); 19304 function MDCSnackbar() { 19305 return _super !== null && _super.apply(this, arguments) || this; 19306 } 19307 MDCSnackbar.attachTo = function (root) { 19308 return new MDCSnackbar(root); 19309 }; 19310 MDCSnackbar.prototype.initialize = function (announcerFactory) { 19311 if (announcerFactory === void 0) { 19312 announcerFactory = function announcerFactory() { 19313 return util.announce; 19314 }; 19315 } 19316 this.announce_ = announcerFactory(); 19317 }; 19318 MDCSnackbar.prototype.initialSyncWithDOM = function () { 19319 var _this = this; 19320 this.surfaceEl_ = this.root.querySelector(SURFACE_SELECTOR); 19321 this.labelEl_ = this.root.querySelector(LABEL_SELECTOR); 19322 this.actionEl_ = this.root.querySelector(ACTION_SELECTOR); 19323 this.handleKeyDown_ = function (evt) { 19324 return _this.foundation.handleKeyDown(evt); 19325 }; 19326 this.handleSurfaceClick_ = function (evt) { 19327 var target = evt.target; 19328 if (_this.isActionButton_(target)) { 19329 _this.foundation.handleActionButtonClick(evt); 19330 } else if (_this.isActionIcon_(target)) {
19331 _this.foundation.handleActionIconClick(evt); 19332 } 19333 }; 19334 this.registerKeyDownHandler_(this.handleKeyDown_); 19335 this.registerSurfaceClickHandler_(this.handleSurfaceClick_); 19336 }; 19337 MDCSnackbar.prototype.destroy = function () { 19338 _super.prototype.destroy.call(this); 19339 this.deregisterKeyDownHandler_(this.handleKeyDown_); 19340 this.deregisterSurfaceClickHandler_(this.handleSurfaceClick_); 19341 }; 19342 MDCSnackbar.prototype.open = function () { 19343 this.foundation.open(); 19344 }; 19345 /** 19346 * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the 19347 * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom 19348 * client-specific values may also be used if desired. 19349 */ 19350 MDCSnackbar.prototype.close = function (reason) { 19351 if (reason === void 0) { 19352 reason = ''; 19353 } 19354 this.foundation.close(reason); 19355 }; 19356 MDCSnackbar.prototype.getDefaultFoundation = function () { 19357 var _this = this; 19358 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 19359 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 19360 var adapter = { 19361 addClass: function addClass(className) { 19362 return _this.root.classList.add(className); 19363 }, 19364 announce: function announce() { 19365 return _this.announce_(_this.labelEl_); 19366 }, 19367 notifyClosed: function notifyClosed(reason) { 19368 return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {}); 19369 }, 19370 notifyClosing: function notifyClosing(reason) { 19371 return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {}); 19372 }, 19373 notifyOpened: function notifyOpened() { 19374 return _this.emit(OPENED_EVENT, {}); 19375 }, 19376 notifyOpening: function notifyOpening() { 19377 return _this.emit(OPENING_EVENT, {}); 19378 }, 19379 removeClass: function removeClass(className) { 19380 return _this.root.classList.remove(className); 19381 } 19382 }; 19383 return new foundation_1.MDCSnackbarFoundation(adapter); 19384 }; 19385 Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", { 19386 get: function get() { 19387 return this.foundation.getTimeoutMs(); 19388 }, 19389 set: function set(timeoutMs) { 19390 this.foundation.setTimeoutMs(timeoutMs); 19391 }, 19392 enumerable: true, 19393 configurable: true 19394 }); 19395 Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", { 19396 get: function get() { 19397 return this.foundation.getCloseOnEscape(); 19398 }, 19399 set: function set(closeOnEscape) { 19400 this.foundation.setCloseOnEscape(closeOnEscape); 19401 }, 19402 enumerable: true, 19403 configurable: true 19404 }); 19405 Object.defineProperty(MDCSnackbar.prototype, "isOpen", { 19406 get: function get() { 19407 return this.foundation.isOpen(); 19408 }, 19409 enumerable: true, 19410 configurable: true 19411 }); 19412 Object.defineProperty(MDCSnackbar.prototype, "labelText", { 19413 get: function get() { 19414 // This property only returns null if the node is a document, DOCTYPE, or notation. 19415 // On Element nodes, it always returns a string. 19416 return this.labelEl_.textContent; 19417 }, 19418 set: function set(labelText) { 19419 this.labelEl_.textContent = labelText; 19420 }, 19421 enumerable: true, 19422 configurable: true 19423 }); 19424 Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", { 19425 get: function get() { 19426 return this.actionEl_.textContent; 19427 }, 19428 set: function set(actionButtonText) { 19429 this.actionEl_.textContent = actionButtonText; 19430 }, 19431 enumerable: true, 19432 configurable: true 19433 }); 19434 MDCSnackbar.prototype.registerKeyDownHandler_ = function (handler) { 19435 this.listen('keydown', handler); 19436 };
19437 MDCSnackbar.prototype.deregisterKeyDownHandler_ = function (handler) { 19438 this.unlisten('keydown', handler); 19439 }; 19440 MDCSnackbar.prototype.registerSurfaceClickHandler_ = function (handler) { 19441 this.surfaceEl_.addEventListener('click', handler); 19442 }; 19443 MDCSnackbar.prototype.deregisterSurfaceClickHandler_ = function (handler) { 19444 this.surfaceEl_.removeEventListener('click', handler); 19445 }; 19446 MDCSnackbar.prototype.isActionButton_ = function (target) { 19447 return Boolean(ponyfill_1.closest(target, ACTION_SELECTOR)); 19448 }; 19449 MDCSnackbar.prototype.isActionIcon_ = function (target) { 19450 return Boolean(ponyfill_1.closest(target, DISMISS_SELECTOR)); 19451 }; 19452 return MDCSnackbar; 19453}(component_1.MDCComponent); 19454exports.MDCSnackbar = MDCSnackbar; 19455 19456/***/ }), 19457
19458/***/ "./packages/mdc-snackbar/constants.ts": 19459/*!********************************************!*\ 19460 !*** ./packages/mdc-snackbar/constants.ts ***! 19461 \********************************************/ 19462/*! no static exports found */ 19463/***/ (function(module, exports, __webpack_require__) { 19464 19465"use strict"; 19466 19467/** 19468 * @license 19469 * Copyright 2018 Google Inc. 19470 * 19471 * Permission is hereby granted, free of charge, to any person obtaining a copy 19472 * of this software and associated documentation files (the "Software"), to deal 19473 * in the Software without restriction, including without limitation the rights 19474 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19475 * copies of the Software, and to permit persons to whom the Software is 19476 * furnished to do so, subject to the following conditions: 19477 * 19478 * The above copyright notice and this permission notice shall be included in 19479 * all copies or substantial portions of the Software. 19480 * 19481 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19482 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19483 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19484 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19485 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19486 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19487 * THE SOFTWARE. 19488 */ 19489 19490Object.defineProperty(exports, "__esModule", { value: true });
19491var cssClasses = { 19492 CLOSING: 'mdc-snackbar--closing', 19493 OPEN: 'mdc-snackbar--open', 19494 OPENING: 'mdc-snackbar--opening' 19495}; 19496exports.cssClasses = cssClasses; 19497var strings = { 19498 ACTION_SELECTOR: '.mdc-snackbar__action', 19499 ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text', 19500 CLOSED_EVENT: 'MDCSnackbar:closed', 19501 CLOSING_EVENT: 'MDCSnackbar:closing', 19502 DISMISS_SELECTOR: '.mdc-snackbar__dismiss', 19503 LABEL_SELECTOR: '.mdc-snackbar__label', 19504 OPENED_EVENT: 'MDCSnackbar:opened', 19505 OPENING_EVENT: 'MDCSnackbar:opening', 19506 REASON_ACTION: 'action', 19507 REASON_DISMISS: 'dismiss', 19508 SURFACE_SELECTOR: '.mdc-snackbar__surface' 19509}; 19510exports.strings = strings; 19511var numbers = { 19512 DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000, 19513 INDETERMINATE: -1, 19514 MAX_AUTO_DISMISS_TIMEOUT_MS: 10000, 19515 MIN_AUTO_DISMISS_TIMEOUT_MS: 4000, 19516 // These variables need to be kept in sync with the values in _variables.scss. 19517 SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75, 19518 SNACKBAR_ANIMATION_OPEN_TIME_MS: 150, 19519 /** 19520 * Number of milliseconds to wait between temporarily clearing the label text 19521 * in the DOM and subsequently restoring it. This is necessary to force IE 11 19522 * to pick up the `aria-live` content change and announce it to the user. 19523 */ 19524 ARIA_LIVE_DELAY_MS: 1000 19525}; 19526exports.numbers = numbers; 19527 19528/***/ }), 19529
vendor: 2,762 bytes, lines 19530-19595
19530/***/ "./packages/mdc-snackbar/foundation.ts": 19531/*!*********************************************!*\ 19532 !*** ./packages/mdc-snackbar/foundation.ts ***! 19533 \*********************************************/ 19534/*! no static exports found */ 19535/***/ (function(module, exports, __webpack_require__) { 19536 19537"use strict"; 19538 19539/** 19540 * @license 19541 * Copyright 2018 Google Inc. 19542 * 19543 * Permission is hereby granted, free of charge, to any person obtaining a copy 19544 * of this software and associated documentation files (the "Software"), to deal 19545 * in the Software without restriction, including without limitation the rights 19546 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19547 * copies of the Software, and to permit persons to whom the Software is 19548 * furnished to do so, subject to the following conditions: 19549 * 19550 * The above copyright notice and this permission notice shall be included in 19551 * all copies or substantial portions of the Software. 19552 * 19553 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19554 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19555 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19556 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19557 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19558 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19559 * THE SOFTWARE. 19560 */ 19561 19562var __extends = this && this.__extends || function () { 19563 var _extendStatics = function extendStatics(d, b) { 19564 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 19565 d.__proto__ = b; 19566 } || function (d, b) { 19567 for (var p in b) { 19568 if (b.hasOwnProperty(p)) d[p] = b[p]; 19569 } 19570 }; 19571 return _extendStatics(d, b); 19572 }; 19573 return function (d, b) { 19574 _extendStatics(d, b); 19575 function __() { 19576 this.constructor = d; 19577 } 19578 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 19579 }; 19580}(); 19581var __assign = this && this.__assign || function () { 19582 __assign = Object.assign || function (t) { 19583 for (var s, i = 1, n = arguments.length; i < n; i++) { 19584 s = arguments[i]; 19585 for (var p in s) { 19586 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 19587 } 19588 } 19589 return t; 19590 }; 19591 return __assign.apply(this, arguments); 19592}; 19593Object.defineProperty(exports, "__esModule", { value: true }); 19594var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 19595var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
19596var OPENING = constants_1.cssClasses.OPENING, 19597 OPEN = constants_1.cssClasses.OPEN, 19598 CLOSING = constants_1.cssClasses.CLOSING; 19599var REASON_ACTION = constants_1.strings.REASON_ACTION, 19600 REASON_DISMISS = constants_1.strings.REASON_DISMISS; 19601var MDCSnackbarFoundation = /** @class */function (_super) { 19602 __extends(MDCSnackbarFoundation, _super); 19603 function MDCSnackbarFoundation(adapter) { 19604 var _this = _super.call(this, __assign(__assign({}, MDCSnackbarFoundation.defaultAdapter), adapter)) || this; 19605 _this.isOpen_ = false; 19606 _this.animationFrame_ = 0; 19607 _this.animationTimer_ = 0; 19608 _this.autoDismissTimer_ = 0; 19609 _this.autoDismissTimeoutMs_ = constants_1.numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS; 19610 _this.closeOnEscape_ = true; 19611 return _this; 19612 } 19613 Object.defineProperty(MDCSnackbarFoundation, "cssClasses", { 19614 get: function get() { 19615 return constants_1.cssClasses; 19616 }, 19617 enumerable: true, 19618 configurable: true 19619 }); 19620 Object.defineProperty(MDCSnackbarFoundation, "strings", { 19621 get: function get() { 19622 return constants_1.strings; 19623 }, 19624 enumerable: true, 19625 configurable: true 19626 }); 19627 Object.defineProperty(MDCSnackbarFoundation, "numbers", { 19628 get: function get() { 19629 return constants_1.numbers; 19630 }, 19631 enumerable: true, 19632 configurable: true 19633 }); 19634 Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", { 19635 get: function get() { 19636 return { 19637 addClass: function addClass() { 19638 return undefined; 19639 }, 19640 announce: function announce() { 19641 return undefined; 19642 }, 19643 notifyClosed: function notifyClosed() { 19644 return undefined; 19645 }, 19646 notifyClosing: function notifyClosing() { 19647 return undefined; 19648 }, 19649 notifyOpened: function notifyOpened() { 19650 return undefined; 19651 }, 19652 notifyOpening: function notifyOpening() { 19653 return undefined; 19654 }, 19655 removeClass: function removeClass() { 19656 return undefined; 19657 } 19658 }; 19659 }, 19660 enumerable: true, 19661 configurable: true 19662 }); 19663 MDCSnackbarFoundation.prototype.destroy = function () { 19664 this.clearAutoDismissTimer_(); 19665 cancelAnimationFrame(this.animationFrame_); 19666 this.animationFrame_ = 0; 19667 clearTimeout(this.animationTimer_); 19668 this.animationTimer_ = 0; 19669 this.adapter.removeClass(OPENING); 19670 this.adapter.removeClass(OPEN); 19671 this.adapter.removeClass(CLOSING); 19672 }; 19673 MDCSnackbarFoundation.prototype.open = function () { 19674 var _this = this; 19675 this.clearAutoDismissTimer_(); 19676 this.isOpen_ = true; 19677 this.adapter.notifyOpening(); 19678 this.adapter.removeClass(CLOSING); 19679 this.adapter.addClass(OPENING); 19680 this.adapter.announce(); 19681 // Wait a frame once display is no longer "none", to establish basis for animation 19682 this.runNextAnimationFrame_(function () { 19683 _this.adapter.addClass(OPEN); 19684 _this.animationTimer_ = setTimeout(function () { 19685 var timeoutMs = _this.getTimeoutMs(); 19686 _this.handleAnimationTimerEnd_(); 19687 _this.adapter.notifyOpened(); 19688 if (timeoutMs !== constants_1.numbers.INDETERMINATE) { 19689 _this.autoDismissTimer_ = setTimeout(function () { 19690 _this.close(REASON_DISMISS); 19691 }, timeoutMs); 19692 } 19693 }, constants_1.numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS); 19694 }); 19695 }; 19696 /** 19697 * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the 19698 * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom 19699 * client-specific values may also be used if desired. 19700 */ 19701 MDCSnackbarFoundation.prototype.close = function (reason) { 19702 var _this = this; 19703 if (reason === void 0) { 19704 reason = ''; 19705 } 19706 if (!this.isOpen_) { 19707 // Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed 19708 return; 19709 } 19710 cancelAnimationFrame(this.animationFrame_); 19711 this.animationFrame_ = 0; 19712 this.clearAutoDismissTimer_(); 19713 this.isOpen_ = false;
19714 this.adapter.notifyClosing(reason); 19715 this.adapter.addClass(constants_1.cssClasses.CLOSING); 19716 this.adapter.removeClass(constants_1.cssClasses.OPEN); 19717 this.adapter.removeClass(constants_1.cssClasses.OPENING); 19718 clearTimeout(this.animationTimer_); 19719 this.animationTimer_ = setTimeout(function () { 19720 _this.handleAnimationTimerEnd_(); 19721 _this.adapter.notifyClosed(reason); 19722 }, constants_1.numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS); 19723 }; 19724 MDCSnackbarFoundation.prototype.isOpen = function () { 19725 return this.isOpen_; 19726 }; 19727 MDCSnackbarFoundation.prototype.getTimeoutMs = function () { 19728 return this.autoDismissTimeoutMs_; 19729 }; 19730 MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) { 19731 // Use shorter variable names to make the code more readable 19732 var minValue = constants_1.numbers.MIN_AUTO_DISMISS_TIMEOUT_MS; 19733 var maxValue = constants_1.numbers.MAX_AUTO_DISMISS_TIMEOUT_MS; 19734 var indeterminateValue = constants_1.numbers.INDETERMINATE; 19735 if (timeoutMs === constants_1.numbers.INDETERMINATE || timeoutMs <= maxValue && timeoutMs >= minValue) { 19736 this.autoDismissTimeoutMs_ = timeoutMs; 19737 } else { 19738 throw new Error("\n timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + "\n (or " + indeterminateValue + " to disable), but got '" + timeoutMs + "'"); 19739 } 19740 }; 19741 MDCSnackbarFoundation.prototype.getCloseOnEscape = function () { 19742 return this.closeOnEscape_; 19743 }; 19744 MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) { 19745 this.closeOnEscape_ = closeOnEscape; 19746 }; 19747 MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) { 19748 var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27; 19749 if (isEscapeKey && this.getCloseOnEscape()) { 19750 this.close(REASON_DISMISS); 19751 } 19752 }; 19753 MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) { 19754 this.close(REASON_ACTION); 19755 }; 19756 MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) { 19757 this.close(REASON_DISMISS); 19758 }; 19759 MDCSnackbarFoundation.prototype.clearAutoDismissTimer_ = function () { 19760 clearTimeout(this.autoDismissTimer_); 19761 this.autoDismissTimer_ = 0; 19762 }; 19763 MDCSnackbarFoundation.prototype.handleAnimationTimerEnd_ = function () { 19764 this.animationTimer_ = 0;
19765 this.adapter.removeClass(constants_1.cssClasses.OPENING); 19766 this.adapter.removeClass(constants_1.cssClasses.CLOSING); 19767 }; 19768 /** 19769 * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. 19770 */ 19771 MDCSnackbarFoundation.prototype.runNextAnimationFrame_ = function (callback) { 19772 var _this = this; 19773 cancelAnimationFrame(this.animationFrame_); 19774 this.animationFrame_ = requestAnimationFrame(function () { 19775 _this.animationFrame_ = 0; 19776 clearTimeout(_this.animationTimer_); 19777 _this.animationTimer_ = setTimeout(callback, 0); 19778 }); 19779 }; 19780 return MDCSnackbarFoundation; 19781}(foundation_1.MDCFoundation); 19782exports.MDCSnackbarFoundation = MDCSnackbarFoundation; 19783// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 19784exports.default = MDCSnackbarFoundation; 19785 19786/***/ }), 19787
19788/***/ "./packages/mdc-snackbar/index.ts": 19789/*!****************************************!*\ 19790 !*** ./packages/mdc-snackbar/index.ts ***! 19791 \****************************************/ 19792/*! no static exports found */ 19793/***/ (function(module, exports, __webpack_require__) { 19794 19795"use strict"; 19796 19797/** 19798 * @license 19799 * Copyright 2019 Google Inc. 19800 * 19801 * Permission is hereby granted, free of charge, to any person obtaining a copy 19802 * of this software and associated documentation files (the "Software"), to deal 19803 * in the Software without restriction, including without limitation the rights 19804 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19805 * copies of the Software, and to permit persons to whom the Software is 19806 * furnished to do so, subject to the following conditions: 19807 * 19808 * The above copyright notice and this permission notice shall be included in 19809 * all copies or substantial portions of the Software. 19810 * 19811 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19812 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19813 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19814 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19815 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19816 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19817 * THE SOFTWARE. 19818 */ 19819 19820function __export(m) { 19821 for (var p in m) { 19822 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 19823 } 19824} 19825var __importStar = this && this.__importStar || function (mod) { 19826 if (mod && mod.__esModule) return mod; 19827 var result = {}; 19828 if (mod != null) for (var k in mod) { 19829 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 19830 }result["default"] = mod; 19831 return result; 19832}; 19833Object.defineProperty(exports, "__esModule", { value: true }); 19834var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts")); 19835exports.util = util; 19836__export(__webpack_require__(/*! ./component */ "./packages/mdc-snackbar/component.ts")); 19837__export(__webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts")); 19838__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts")); 19839 19840/***/ }), 19841
19842/***/ "./packages/mdc-snackbar/util.ts": 19843/*!***************************************!*\ 19844 !*** ./packages/mdc-snackbar/util.ts ***! 19845 \***************************************/ 19846/*! no static exports found */ 19847/***/ (function(module, exports, __webpack_require__) { 19848 19849"use strict"; 19850 19851/** 19852 * @license 19853 * Copyright 2018 Google Inc. 19854 * 19855 * Permission is hereby granted, free of charge, to any person obtaining a copy 19856 * of this software and associated documentation files (the "Software"), to deal 19857 * in the Software without restriction, including without limitation the rights 19858 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19859 * copies of the Software, and to permit persons to whom the Software is 19860 * furnished to do so, subject to the following conditions: 19861 * 19862 * The above copyright notice and this permission notice shall be included in 19863 * all copies or substantial portions of the Software. 19864 * 19865 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19866 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19867 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19868 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19869 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19870 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19871 * THE SOFTWARE. 19872 */ 19873 19874Object.defineProperty(exports, "__esModule", { value: true }); 19875var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"); 19876var ARIA_LIVE_DELAY_MS = constants_1.numbers.ARIA_LIVE_DELAY_MS; 19877var ARIA_LIVE_LABEL_TEXT_ATTR = constants_1.strings.ARIA_LIVE_LABEL_TEXT_ATTR; 19878function announce(ariaEl, labelEl) { 19879 if (labelEl === void 0) { 19880 labelEl = ariaEl; 19881 } 19882 var priority = ariaEl.getAttribute('aria-live'); 19883 // Trim text to ignore ` ` (see below). 19884 // textContent is only null if the node is a document, DOCTYPE, or notation. 19885 var labelText = labelEl.textContent.trim(); 19886 if (!labelText || !priority) { 19887 return; 19888 } 19889 // Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice. 19890 ariaEl.setAttribute('aria-live', 'off'); 19891 // Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers. 19892 // `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars 19893 // sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first. 19894 // Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event, 19895 // so screen readers won't announce the second message unless we first clear `textContent`. 19896 // 19897 // We have to clear the label text two different ways to make it work in all browsers and screen readers: 19898 // 19899 // 1. `textContent = ''` is required for IE11 + JAWS 19900 // 2. `innerHTML = ' '` is required for Chrome + JAWS and NVDA 19901 // 19902 // All other browser/screen reader combinations support both methods. 19903 // 19904 // The wrapper `<span>` visually hides the space character so that it doesn't cause jank when added/removed. 19905 // N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change. 19906 // 19907 // This technique has been tested in: 19908 // 19909 // * JAWS 2019: 19910 // - Chrome 70 19911 // - Firefox 60 (ESR) 19912 // - IE 11 19913 // * NVDA 2018: 19914 // - Chrome 70 19915 // - Firefox 60 (ESR) 19916 // - IE 11 19917 // * ChromeVox 53 19918 labelEl.textContent = ''; 19919 labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;"> </span>'; 19920 // Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element. 19921 // CSS generated content is normally announced by screen readers 19922 // (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/); 19923 // however, `aria-live` is turned off, so this DOM update will be ignored by screen readers. 19924 labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText); 19925 setTimeout(function () { 19926 // Allow screen readers to announce changes to the DOM again. 19927 ariaEl.setAttribute('aria-live', priority); 19928 // Remove the message from the ::before pseudo-element. 19929 labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR); 19930 // Restore the original label text, which will be announced by screen readers. 19931 labelEl.textContent = labelText; 19932 }, ARIA_LIVE_DELAY_MS); 19933} 19934exports.announce = announce; 19935 19936/***/ }), 19937
19938/***/ "./packages/mdc-switch/component.ts": 19939/*!******************************************!*\ 19940 !*** ./packages/mdc-switch/component.ts ***! 19941 \******************************************/ 19942/*! no static exports found */ 19943/***/ (function(module, exports, __webpack_require__) { 19944 19945"use strict"; 19946 19947/** 19948 * @license 19949 * Copyright 2018 Google Inc. 19950 * 19951 * Permission is hereby granted, free of charge, to any person obtaining a copy 19952 * of this software and associated documentation files (the "Software"), to deal 19953 * in the Software without restriction, including without limitation the rights 19954 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19955 * copies of the Software, and to permit persons to whom the Software is 19956 * furnished to do so, subject to the following conditions: 19957 * 19958 * The above copyright notice and this permission notice shall be included in 19959 * all copies or substantial portions of the Software. 19960 * 19961 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19962 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19963 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19964 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19965 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19966 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19967 * THE SOFTWARE. 19968 */ 19969 19970var __extends = this && this.__extends || function () { 19971 var _extendStatics = function extendStatics(d, b) { 19972 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 19973 d.__proto__ = b; 19974 } || function (d, b) { 19975 for (var p in b) { 19976 if (b.hasOwnProperty(p)) d[p] = b[p]; 19977 } 19978 }; 19979 return _extendStatics(d, b); 19980 }; 19981 return function (d, b) { 19982 _extendStatics(d, b); 19983 function __() { 19984 this.constructor = d; 19985 } 19986 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 19987 }; 19988}(); 19989var __assign = this && this.__assign || function () { 19990 __assign = Object.assign || function (t) { 19991 for (var s, i = 1, n = arguments.length; i < n; i++) { 19992 s = arguments[i]; 19993 for (var p in s) { 19994 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 19995 } 19996 } 19997 return t; 19998 }; 19999 return __assign.apply(this, arguments); 20000}; 20001var __read = this && this.__read || function (o, n) { 20002 var m = typeof Symbol === "function" && o[Symbol.iterator]; 20003 if (!m) return o; 20004 var i = m.call(o), 20005 r, 20006 ar = [], 20007 e; 20008 try { 20009 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { 20010 ar.push(r.value); 20011 } 20012 } catch (error) { 20013 e = { error: error }; 20014 } finally { 20015 try { 20016 if (r && !r.done && (m = i["return"])) m.call(i); 20017 } finally { 20018 if (e) throw e.error; 20019 } 20020 } 20021 return ar; 20022}; 20023var __spread = this && this.__spread || function () { 20024 for (var ar = [], i = 0; i < arguments.length; i++) { 20025 ar = ar.concat(__read(arguments[i])); 20026 }return ar; 20027}; 20028Object.defineProperty(exports, "__esModule", { value: true }); 20029var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 20030var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 20031var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 20032var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 20033var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 20034var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts"); 20035var MDCSwitch = /** @class */function (_super) { 20036 __extends(MDCSwitch, _super); 20037 function MDCSwitch() { 20038 var _this = _super !== null && _super.apply(this, arguments) || this; 20039 _this.ripple_ = _this.createRipple_(); 20040 return _this; 20041 } 20042 MDCSwitch.attachTo = function (root) { 20043 return new MDCSwitch(root); 20044 }; 20045 MDCSwitch.prototype.destroy = function () { 20046 _super.prototype.destroy.call(this); 20047 this.ripple_.destroy(); 20048 this.nativeControl_.removeEventListener('change', this.changeHandler_); 20049 }; 20050 MDCSwitch.prototype.initialSyncWithDOM = function () { 20051 var _this = this; 20052 this.changeHandler_ = function () { 20053 var _a; 20054 var args = []; 20055 for (var _i = 0; _i < arguments.length; _i++) { 20056 args[_i] = arguments[_i]; 20057 } 20058 return (_a = _this.foundation).handleChange.apply(_a, __spread(args)); 20059 }; 20060 this.nativeControl_.addEventListener('change', this.changeHandler_); 20061 // Sometimes the checked state of the input element is saved in the history. 20062 // The switch styling should match the checked state of the input element. 20063 // Do an initial sync between the native control and the foundation. 20064 this.checked = this.checked; 20065 }; 20066 MDCSwitch.prototype.getDefaultFoundation = function () { 20067 var _this = this; 20068 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 20069 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 20070 var adapter = { 20071 addClass: function addClass(className) { 20072 return _this.root.classList.add(className); 20073 }, 20074 removeClass: function removeClass(className) { 20075 return _this.root.classList.remove(className); 20076 }, 20077 setNativeControlChecked: function setNativeControlChecked(checked) { 20078 return _this.nativeControl_.checked = checked; 20079 }, 20080 setNativeControlDisabled: function setNativeControlDisabled(disabled) { 20081 return _this.nativeControl_.disabled = disabled; 20082 }, 20083 setNativeControlAttr: function setNativeControlAttr(attr, value) { 20084 return _this.nativeControl_.setAttribute(attr, value); 20085 } 20086 }; 20087 return new foundation_2.MDCSwitchFoundation(adapter); 20088 };
20089 Object.defineProperty(MDCSwitch.prototype, "ripple", { 20090 get: function get() { 20091 return this.ripple_; 20092 }, 20093 enumerable: true, 20094 configurable: true 20095 }); 20096 Object.defineProperty(MDCSwitch.prototype, "checked", { 20097 get: function get() { 20098 return this.nativeControl_.checked; 20099 }, 20100 set: function set(checked) { 20101 this.foundation.setChecked(checked); 20102 }, 20103 enumerable: true, 20104 configurable: true 20105 }); 20106 Object.defineProperty(MDCSwitch.prototype, "disabled", { 20107 get: function get() { 20108 return this.nativeControl_.disabled; 20109 }, 20110 set: function set(disabled) { 20111 this.foundation.setDisabled(disabled); 20112 }, 20113 enumerable: true, 20114 configurable: true 20115 }); 20116 MDCSwitch.prototype.createRipple_ = function () { 20117 var _this = this; 20118 var RIPPLE_SURFACE_SELECTOR = foundation_2.MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR; 20119 var rippleSurface = this.root.querySelector(RIPPLE_SURFACE_SELECTOR); 20120 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 20121 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 20122 var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { addClass: function addClass(className) { 20123 return rippleSurface.classList.add(className); 20124 }, computeBoundingRect: function computeBoundingRect() { 20125 return rippleSurface.getBoundingClientRect(); 20126 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 20127 _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive()); 20128 }, isSurfaceActive: function isSurfaceActive() { 20129 return ponyfill_1.matches(_this.nativeControl_, ':active'); 20130 }, isUnbounded: function isUnbounded() { 20131 return true; 20132 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 20133 _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive()); 20134 }, removeClass: function removeClass(className) { 20135 rippleSurface.classList.remove(className); 20136 }, updateCssVariable: function updateCssVariable(varName, value) { 20137 rippleSurface.style.setProperty(varName, value); 20138 } }); 20139 return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter)); 20140 }; 20141 Object.defineProperty(MDCSwitch.prototype, "nativeControl_", { 20142 get: function get() { 20143 var NATIVE_CONTROL_SELECTOR = foundation_2.MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR; 20144 return this.root.querySelector(NATIVE_CONTROL_SELECTOR); 20145 }, 20146 enumerable: true, 20147 configurable: true 20148 }); 20149 return MDCSwitch; 20150}(component_1.MDCComponent); 20151exports.MDCSwitch = MDCSwitch; 20152 20153/***/ }), 20154
20155/***/ "./packages/mdc-switch/constants.ts": 20156/*!******************************************!*\ 20157 !*** ./packages/mdc-switch/constants.ts ***! 20158 \******************************************/ 20159/*! no static exports found */ 20160/***/ (function(module, exports, __webpack_require__) { 20161 20162"use strict"; 20163 20164/** 20165 * @license 20166 * Copyright 2018 Google Inc. 20167 * 20168 * Permission is hereby granted, free of charge, to any person obtaining a copy 20169 * of this software and associated documentation files (the "Software"), to deal 20170 * in the Software without restriction, including without limitation the rights 20171 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20172 * copies of the Software, and to permit persons to whom the Software is 20173 * furnished to do so, subject to the following conditions: 20174 * 20175 * The above copyright notice and this permission notice shall be included in 20176 * all copies or substantial portions of the Software. 20177 * 20178 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20179 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20180 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20181 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20182 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20183 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20184 * THE SOFTWARE. 20185 */ 20186 20187Object.defineProperty(exports, "__esModule", { value: true }); 20188/** CSS classes used by the switch. */
20189var cssClasses = { 20190 /** Class used for a switch that is in the "checked" (on) position. */ 20191 CHECKED: 'mdc-switch--checked', 20192 /** Class used for a switch that is disabled. */ 20193 DISABLED: 'mdc-switch--disabled' 20194}; 20195exports.cssClasses = cssClasses; 20196/** String constants used by the switch. */ 20197var strings = { 20198 /** Aria attribute for checked or unchecked state of switch */ 20199 ARIA_CHECKED_ATTR: 'aria-checked', 20200 /** A CSS selector used to locate the native HTML control for the switch. */ 20201 NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control', 20202 /** A CSS selector used to locate the ripple surface element for the switch. */ 20203 RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay' 20204}; 20205exports.strings = strings; 20206 20207/***/ }), 20208
20209/***/ "./packages/mdc-switch/foundation.ts": 20210/*!*******************************************!*\ 20211 !*** ./packages/mdc-switch/foundation.ts ***! 20212 \*******************************************/ 20213/*! no static exports found */ 20214/***/ (function(module, exports, __webpack_require__) { 20215 20216"use strict"; 20217 20218/** 20219 * @license 20220 * Copyright 2018 Google Inc. 20221 * 20222 * Permission is hereby granted, free of charge, to any person obtaining a copy 20223 * of this software and associated documentation files (the "Software"), to deal 20224 * in the Software without restriction, including without limitation the rights 20225 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20226 * copies of the Software, and to permit persons to whom the Software is 20227 * furnished to do so, subject to the following conditions: 20228 * 20229 * The above copyright notice and this permission notice shall be included in 20230 * all copies or substantial portions of the Software. 20231 * 20232 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20233 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20234 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20235 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20236 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20237 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20238 * THE SOFTWARE. 20239 */ 20240 20241var __extends = this && this.__extends || function () { 20242 var _extendStatics = function extendStatics(d, b) { 20243 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 20244 d.__proto__ = b; 20245 } || function (d, b) { 20246 for (var p in b) { 20247 if (b.hasOwnProperty(p)) d[p] = b[p]; 20248 } 20249 }; 20250 return _extendStatics(d, b); 20251 }; 20252 return function (d, b) { 20253 _extendStatics(d, b); 20254 function __() { 20255 this.constructor = d; 20256 } 20257 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 20258 }; 20259}(); 20260var __assign = this && this.__assign || function () { 20261 __assign = Object.assign || function (t) { 20262 for (var s, i = 1, n = arguments.length; i < n; i++) { 20263 s = arguments[i]; 20264 for (var p in s) { 20265 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 20266 } 20267 } 20268 return t; 20269 }; 20270 return __assign.apply(this, arguments); 20271}; 20272Object.defineProperty(exports, "__esModule", { value: true }); 20273var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 20274var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts"); 20275var MDCSwitchFoundation = /** @class */function (_super) { 20276 __extends(MDCSwitchFoundation, _super); 20277 function MDCSwitchFoundation(adapter) { 20278 return _super.call(this, __assign(__assign({}, MDCSwitchFoundation.defaultAdapter), adapter)) || this; 20279 } 20280 Object.defineProperty(MDCSwitchFoundation, "strings", { 20281 /** The string constants used by the switch. */ 20282 get: function get() { 20283 return constants_1.strings; 20284 }, 20285 enumerable: true, 20286 configurable: true 20287 }); 20288 Object.defineProperty(MDCSwitchFoundation, "cssClasses", { 20289 /** The CSS classes used by the switch. */ 20290 get: function get() {
20291 return constants_1.cssClasses; 20292 }, 20293 enumerable: true, 20294 configurable: true 20295 }); 20296 Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", { 20297 /** The default Adapter for the switch. */ 20298 get: function get() { 20299 return { 20300 addClass: function addClass() { 20301 return undefined; 20302 }, 20303 removeClass: function removeClass() { 20304 return undefined; 20305 }, 20306 setNativeControlChecked: function setNativeControlChecked() { 20307 return undefined; 20308 }, 20309 setNativeControlDisabled: function setNativeControlDisabled() { 20310 return undefined; 20311 }, 20312 setNativeControlAttr: function setNativeControlAttr() { 20313 return undefined; 20314 } 20315 }; 20316 }, 20317 enumerable: true, 20318 configurable: true 20319 }); 20320 /** Sets the checked state of the switch. */ 20321 MDCSwitchFoundation.prototype.setChecked = function (checked) { 20322 this.adapter.setNativeControlChecked(checked); 20323 this.updateAriaChecked_(checked); 20324 this.updateCheckedStyling_(checked); 20325 }; 20326 /** Sets the disabled state of the switch. */ 20327 MDCSwitchFoundation.prototype.setDisabled = function (disabled) { 20328 this.adapter.setNativeControlDisabled(disabled); 20329 if (disabled) {
20330 this.adapter.addClass(constants_1.cssClasses.DISABLED); 20331 } else { 20332 this.adapter.removeClass(constants_1.cssClasses.DISABLED); 20333 } 20334 }; 20335 /** Handles the change event for the switch native control. */ 20336 MDCSwitchFoundation.prototype.handleChange = function (evt) { 20337 var nativeControl = evt.target; 20338 this.updateAriaChecked_(nativeControl.checked); 20339 this.updateCheckedStyling_(nativeControl.checked); 20340 }; 20341 /** Updates the styling of the switch based on its checked state. */ 20342 MDCSwitchFoundation.prototype.updateCheckedStyling_ = function (checked) { 20343 if (checked) { 20344 this.adapter.addClass(constants_1.cssClasses.CHECKED); 20345 } else { 20346 this.adapter.removeClass(constants_1.cssClasses.CHECKED); 20347 } 20348 }; 20349 MDCSwitchFoundation.prototype.updateAriaChecked_ = function (checked) { 20350 this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, "" + !!checked); 20351 }; 20352 return MDCSwitchFoundation; 20353}(foundation_1.MDCFoundation); 20354exports.MDCSwitchFoundation = MDCSwitchFoundation; 20355// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 20356exports.default = MDCSwitchFoundation; 20357 20358/***/ }), 20359
20360/***/ "./packages/mdc-switch/index.ts": 20361/*!**************************************!*\ 20362 !*** ./packages/mdc-switch/index.ts ***! 20363 \**************************************/ 20364/*! no static exports found */ 20365/***/ (function(module, exports, __webpack_require__) { 20366 20367"use strict"; 20368 20369/** 20370 * @license 20371 * Copyright 2019 Google Inc. 20372 * 20373 * Permission is hereby granted, free of charge, to any person obtaining a copy 20374 * of this software and associated documentation files (the "Software"), to deal 20375 * in the Software without restriction, including without limitation the rights 20376 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20377 * copies of the Software, and to permit persons to whom the Software is 20378 * furnished to do so, subject to the following conditions: 20379 * 20380 * The above copyright notice and this permission notice shall be included in 20381 * all copies or substantial portions of the Software. 20382 * 20383 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20384 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20385 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20386 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20387 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20388 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20389 * THE SOFTWARE. 20390 */ 20391 20392function __export(m) { 20393 for (var p in m) { 20394 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 20395 } 20396} 20397Object.defineProperty(exports, "__esModule", { value: true }); 20398__export(__webpack_require__(/*! ./component */ "./packages/mdc-switch/component.ts")); 20399__export(__webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts")); 20400__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts")); 20401 20402/***/ }), 20403
20404/***/ "./packages/mdc-tab-bar/component.ts": 20405/*!*******************************************!*\ 20406 !*** ./packages/mdc-tab-bar/component.ts ***! 20407 \*******************************************/ 20408/*! no static exports found */ 20409/***/ (function(module, exports, __webpack_require__) { 20410 20411"use strict"; 20412 20413/** 20414 * @license 20415 * Copyright 2018 Google Inc. 20416 * 20417 * Permission is hereby granted, free of charge, to any person obtaining a copy 20418 * of this software and associated documentation files (the "Software"), to deal 20419 * in the Software without restriction, including without limitation the rights 20420 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20421 * copies of the Software, and to permit persons to whom the Software is 20422 * furnished to do so, subject to the following conditions: 20423 * 20424 * The above copyright notice and this permission notice shall be included in 20425 * all copies or substantial portions of the Software. 20426 * 20427 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20428 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20429 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20430 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20431 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20432 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20433 * THE SOFTWARE. 20434 */ 20435 20436var __extends = this && this.__extends || function () { 20437 var _extendStatics = function extendStatics(d, b) { 20438 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 20439 d.__proto__ = b; 20440 } || function (d, b) { 20441 for (var p in b) { 20442 if (b.hasOwnProperty(p)) d[p] = b[p]; 20443 } 20444 }; 20445 return _extendStatics(d, b); 20446 }; 20447 return function (d, b) { 20448 _extendStatics(d, b); 20449 function __() { 20450 this.constructor = d; 20451 } 20452 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 20453 }; 20454}(); 20455Object.defineProperty(exports, "__esModule", { value: true }); 20456var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 20457var component_2 = __webpack_require__(/*! @material/tab-scroller/component */ "./packages/mdc-tab-scroller/component.ts"); 20458var component_3 = __webpack_require__(/*! @material/tab/component */ "./packages/mdc-tab/component.ts"); 20459var foundation_1 = __webpack_require__(/*! @material/tab/foundation */ "./packages/mdc-tab/foundation.ts"); 20460var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts"); 20461var strings = foundation_2.MDCTabBarFoundation.strings; 20462var tabIdCounter = 0; 20463var MDCTabBar = /** @class */function (_super) { 20464 __extends(MDCTabBar, _super); 20465 function MDCTabBar() { 20466 return _super !== null && _super.apply(this, arguments) || this; 20467 } 20468 MDCTabBar.attachTo = function (root) { 20469 return new MDCTabBar(root); 20470 }; 20471 Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", { 20472 set: function set(focusOnActivate) { 20473 this.tabList_.forEach(function (tab) { 20474 return tab.focusOnActivate = focusOnActivate; 20475 }); 20476 }, 20477 enumerable: true, 20478 configurable: true 20479 }); 20480 Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", { 20481 set: function set(useAutomaticActivation) { 20482 this.foundation.setUseAutomaticActivation(useAutomaticActivation); 20483 }, 20484 enumerable: true, 20485 configurable: true 20486 }); 20487 MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) { 20488 if (tabFactory === void 0) { 20489 tabFactory = function tabFactory(el) { 20490 return new component_3.MDCTab(el); 20491 }; 20492 } 20493 if (tabScrollerFactory === void 0) { 20494 tabScrollerFactory = function tabScrollerFactory(el) { 20495 return new component_2.MDCTabScroller(el); 20496 }; 20497 } 20498 this.tabList_ = this.instantiateTabs_(tabFactory); 20499 this.tabScroller_ = this.instantiateTabScroller_(tabScrollerFactory); 20500 }; 20501 MDCTabBar.prototype.initialSyncWithDOM = function () { 20502 var _this = this; 20503 this.handleTabInteraction_ = function (evt) { 20504 return _this.foundation.handleTabInteraction(evt); 20505 }; 20506 this.handleKeyDown_ = function (evt) { 20507 return _this.foundation.handleKeyDown(evt); 20508 }; 20509 this.listen(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_); 20510 this.listen('keydown', this.handleKeyDown_); 20511 for (var i = 0; i < this.tabList_.length; i++) { 20512 if (this.tabList_[i].active) { 20513 this.scrollIntoView(i); 20514 break; 20515 } 20516 } 20517 }; 20518 MDCTabBar.prototype.destroy = function () { 20519 _super.prototype.destroy.call(this); 20520 this.unlisten(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_); 20521 this.unlisten('keydown', this.handleKeyDown_); 20522 this.tabList_.forEach(function (tab) { 20523 return tab.destroy(); 20524 }); 20525 if (this.tabScroller_) { 20526 this.tabScroller_.destroy(); 20527 } 20528 }; 20529 MDCTabBar.prototype.getDefaultFoundation = function () { 20530 var _this = this; 20531 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 20532 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 20533 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 20534 var adapter = { 20535 scrollTo: function scrollTo(scrollX) { 20536 return _this.tabScroller_.scrollTo(scrollX); 20537 }, 20538 incrementScroll: function incrementScroll(scrollXIncrement) { 20539 return _this.tabScroller_.incrementScroll(scrollXIncrement); 20540 }, 20541 getScrollPosition: function getScrollPosition() { 20542 return _this.tabScroller_.getScrollPosition(); 20543 },
20544 getScrollContentWidth: function getScrollContentWidth() { 20545 return _this.tabScroller_.getScrollContentWidth(); 20546 }, 20547 getOffsetWidth: function getOffsetWidth() { 20548 return _this.root.offsetWidth; 20549 }, 20550 isRTL: function isRTL() { 20551 return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; 20552 }, 20553 setActiveTab: function setActiveTab(index) { 20554 return _this.foundation.activateTab(index); 20555 }, 20556 activateTabAtIndex: function activateTabAtIndex(index, clientRect) { 20557 return _this.tabList_[index].activate(clientRect); 20558 }, 20559 deactivateTabAtIndex: function deactivateTabAtIndex(index) { 20560 return _this.tabList_[index].deactivate(); 20561 }, 20562 focusTabAtIndex: function focusTabAtIndex(index) { 20563 return _this.tabList_[index].focus(); 20564 }, 20565 getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex(index) { 20566 return _this.tabList_[index].computeIndicatorClientRect(); 20567 }, 20568 getTabDimensionsAtIndex: function getTabDimensionsAtIndex(index) { 20569 return _this.tabList_[index].computeDimensions(); 20570 }, 20571 getPreviousActiveTabIndex: function getPreviousActiveTabIndex() { 20572 for (var i = 0; i < _this.tabList_.length; i++) { 20573 if (_this.tabList_[i].active) { 20574 return i; 20575 } 20576 } 20577 return -1; 20578 }, 20579 getFocusedTabIndex: function getFocusedTabIndex() { 20580 var tabElements = _this.getTabElements_(); 20581 var activeElement = document.activeElement; 20582 return tabElements.indexOf(activeElement); 20583 }, 20584 getIndexOfTabById: function getIndexOfTabById(id) { 20585 for (var i = 0; i < _this.tabList_.length; i++) { 20586 if (_this.tabList_[i].id === id) { 20587 return i; 20588 } 20589 } 20590 return -1; 20591 }, 20592 getTabListLength: function getTabListLength() { 20593 return _this.tabList_.length; 20594 }, 20595 notifyTabActivated: function notifyTabActivated(index) { 20596 return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true); 20597 } 20598 }; 20599 // tslint:enable:object-literal-sort-keys 20600 return new foundation_2.MDCTabBarFoundation(adapter); 20601 }; 20602 /** 20603 * Activates the tab at the given index 20604 * @param index The index of the tab 20605 */ 20606 MDCTabBar.prototype.activateTab = function (index) { 20607 this.foundation.activateTab(index); 20608 }; 20609 /** 20610 * Scrolls the tab at the given index into view 20611 * @param index THe index of the tab 20612 */ 20613 MDCTabBar.prototype.scrollIntoView = function (index) { 20614 this.foundation.scrollIntoView(index); 20615 }; 20616 /** 20617 * Returns all the tab elements in a nice clean array 20618 */ 20619 MDCTabBar.prototype.getTabElements_ = function () { 20620 return [].slice.call(this.root.querySelectorAll(strings.TAB_SELECTOR)); 20621 }; 20622 /** 20623 * Instantiates tab components on all child tab elements 20624 */ 20625 MDCTabBar.prototype.instantiateTabs_ = function (tabFactory) { 20626 return this.getTabElements_().map(function (el) { 20627 el.id = el.id || "mdc-tab-" + ++tabIdCounter; 20628 return tabFactory(el); 20629 }); 20630 }; 20631 /** 20632 * Instantiates tab scroller component on the child tab scroller element 20633 */ 20634 MDCTabBar.prototype.instantiateTabScroller_ = function (tabScrollerFactory) { 20635 var tabScrollerElement = this.root.querySelector(strings.TAB_SCROLLER_SELECTOR); 20636 if (tabScrollerElement) { 20637 return tabScrollerFactory(tabScrollerElement); 20638 } 20639 return null; 20640 }; 20641 return MDCTabBar; 20642}(component_1.MDCComponent); 20643exports.MDCTabBar = MDCTabBar; 20644 20645/***/ }), 20646
20647/***/ "./packages/mdc-tab-bar/constants.ts": 20648/*!*******************************************!*\ 20649 !*** ./packages/mdc-tab-bar/constants.ts ***! 20650 \*******************************************/ 20651/*! no static exports found */ 20652/***/ (function(module, exports, __webpack_require__) { 20653 20654"use strict"; 20655 20656/** 20657 * @license 20658 * Copyright 2018 Google Inc. 20659 * 20660 * Permission is hereby granted, free of charge, to any person obtaining a copy 20661 * of this software and associated documentation files (the "Software"), to deal 20662 * in the Software without restriction, including without limitation the rights 20663 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20664 * copies of the Software, and to permit persons to whom the Software is 20665 * furnished to do so, subject to the following conditions: 20666 * 20667 * The above copyright notice and this permission notice shall be included in 20668 * all copies or substantial portions of the Software. 20669 * 20670 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20671 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20672 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20673 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20674 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20675 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20676 * THE SOFTWARE. 20677 */ 20678 20679Object.defineProperty(exports, "__esModule", { value: true }); 20680var strings = { 20681 ARROW_LEFT_KEY: 'ArrowLeft', 20682 ARROW_RIGHT_KEY: 'ArrowRight', 20683 END_KEY: 'End',
20684 ENTER_KEY: 'Enter', 20685 HOME_KEY: 'Home', 20686 SPACE_KEY: 'Space', 20687 TAB_ACTIVATED_EVENT: 'MDCTabBar:activated', 20688 TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller', 20689 TAB_SELECTOR: '.mdc-tab' 20690}; 20691exports.strings = strings; 20692var numbers = { 20693 ARROW_LEFT_KEYCODE: 37, 20694 ARROW_RIGHT_KEYCODE: 39, 20695 END_KEYCODE: 35, 20696 ENTER_KEYCODE: 13, 20697 EXTRA_SCROLL_AMOUNT: 20, 20698 HOME_KEYCODE: 36, 20699 SPACE_KEYCODE: 32 20700}; 20701exports.numbers = numbers; 20702 20703/***/ }), 20704
20705/***/ "./packages/mdc-tab-bar/foundation.ts": 20706/*!********************************************!*\ 20707 !*** ./packages/mdc-tab-bar/foundation.ts ***! 20708 \********************************************/ 20709/*! no static exports found */ 20710/***/ (function(module, exports, __webpack_require__) { 20711 20712"use strict"; 20713 20714/** 20715 * @license 20716 * Copyright 2018 Google Inc. 20717 * 20718 * Permission is hereby granted, free of charge, to any person obtaining a copy 20719 * of this software and associated documentation files (the "Software"), to deal 20720 * in the Software without restriction, including without limitation the rights 20721 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20722 * copies of the Software, and to permit persons to whom the Software is 20723 * furnished to do so, subject to the following conditions: 20724 * 20725 * The above copyright notice and this permission notice shall be included in 20726 * all copies or substantial portions of the Software. 20727 * 20728 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20729 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20730 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20731 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20732 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20733 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20734 * THE SOFTWARE. 20735 */ 20736 20737var __extends = this && this.__extends || function () { 20738 var _extendStatics = function extendStatics(d, b) { 20739 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 20740 d.__proto__ = b; 20741 } || function (d, b) { 20742 for (var p in b) { 20743 if (b.hasOwnProperty(p)) d[p] = b[p]; 20744 } 20745 }; 20746 return _extendStatics(d, b); 20747 }; 20748 return function (d, b) { 20749 _extendStatics(d, b); 20750 function __() { 20751 this.constructor = d; 20752 } 20753 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 20754 }; 20755}(); 20756var __assign = this && this.__assign || function () { 20757 __assign = Object.assign || function (t) { 20758 for (var s, i = 1, n = arguments.length; i < n; i++) { 20759 s = arguments[i]; 20760 for (var p in s) { 20761 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 20762 } 20763 } 20764 return t; 20765 }; 20766 return __assign.apply(this, arguments); 20767}; 20768Object.defineProperty(exports, "__esModule", { value: true }); 20769var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 20770var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts"); 20771var ACCEPTABLE_KEYS = new Set(); 20772// IE11 has no support for new Set with iterable so we need to initialize this by hand 20773ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_LEFT_KEY); 20774ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_RIGHT_KEY); 20775ACCEPTABLE_KEYS.add(constants_1.strings.END_KEY); 20776ACCEPTABLE_KEYS.add(constants_1.strings.HOME_KEY); 20777ACCEPTABLE_KEYS.add(constants_1.strings.ENTER_KEY); 20778ACCEPTABLE_KEYS.add(constants_1.strings.SPACE_KEY); 20779var KEYCODE_MAP = new Map(); 20780// IE11 has no support for new Map with iterable so we need to initialize this by hand 20781KEYCODE_MAP.set(constants_1.numbers.ARROW_LEFT_KEYCODE, constants_1.strings.ARROW_LEFT_KEY); 20782KEYCODE_MAP.set(constants_1.numbers.ARROW_RIGHT_KEYCODE, constants_1.strings.ARROW_RIGHT_KEY); 20783KEYCODE_MAP.set(constants_1.numbers.END_KEYCODE, constants_1.strings.END_KEY); 20784KEYCODE_MAP.set(constants_1.numbers.HOME_KEYCODE, constants_1.strings.HOME_KEY); 20785KEYCODE_MAP.set(constants_1.numbers.ENTER_KEYCODE, constants_1.strings.ENTER_KEY); 20786KEYCODE_MAP.set(constants_1.numbers.SPACE_KEYCODE, constants_1.strings.SPACE_KEY); 20787var MDCTabBarFoundation = /** @class */function (_super) { 20788 __extends(MDCTabBarFoundation, _super); 20789 function MDCTabBarFoundation(adapter) { 20790 var _this = _super.call(this, __assign(__assign({}, MDCTabBarFoundation.defaultAdapter), adapter)) || this; 20791 _this.useAutomaticActivation_ = false;
20792 return _this; 20793 } 20794 Object.defineProperty(MDCTabBarFoundation, "strings", { 20795 get: function get() { 20796 return constants_1.strings; 20797 }, 20798 enumerable: true, 20799 configurable: true 20800 }); 20801 Object.defineProperty(MDCTabBarFoundation, "numbers", { 20802 get: function get() { 20803 return constants_1.numbers; 20804 }, 20805 enumerable: true, 20806 configurable: true 20807 }); 20808 Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", { 20809 get: function get() { 20810 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 20811 return { 20812 scrollTo: function scrollTo() { 20813 return undefined; 20814 }, 20815 incrementScroll: function incrementScroll() { 20816 return undefined; 20817 }, 20818 getScrollPosition: function getScrollPosition() { 20819 return 0; 20820 }, 20821 getScrollContentWidth: function getScrollContentWidth() { 20822 return 0; 20823 }, 20824 getOffsetWidth: function getOffsetWidth() { 20825 return 0; 20826 }, 20827 isRTL: function isRTL() { 20828 return false; 20829 },
20830 setActiveTab: function setActiveTab() { 20831 return undefined; 20832 }, 20833 activateTabAtIndex: function activateTabAtIndex() { 20834 return undefined; 20835 }, 20836 deactivateTabAtIndex: function deactivateTabAtIndex() { 20837 return undefined; 20838 }, 20839 focusTabAtIndex: function focusTabAtIndex() { 20840 return undefined; 20841 }, 20842 getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex() { 20843 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 20844 }, 20845 getTabDimensionsAtIndex: function getTabDimensionsAtIndex() { 20846 return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 }; 20847 }, 20848 getPreviousActiveTabIndex: function getPreviousActiveTabIndex() { 20849 return -1; 20850 }, 20851 getFocusedTabIndex: function getFocusedTabIndex() { 20852 return -1; 20853 }, 20854 getIndexOfTabById: function getIndexOfTabById() { 20855 return -1; 20856 }, 20857 getTabListLength: function getTabListLength() { 20858 return 0; 20859 }, 20860 notifyTabActivated: function notifyTabActivated() { 20861 return undefined; 20862 } 20863 }; 20864 // tslint:enable:object-literal-sort-keys 20865 }, 20866 enumerable: true, 20867 configurable: true 20868 }); 20869 /** 20870 * Switches between automatic and manual activation modes. 20871 * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples. 20872 */ 20873 MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) { 20874 this.useAutomaticActivation_ = useAutomaticActivation; 20875 }; 20876 MDCTabBarFoundation.prototype.activateTab = function (index) { 20877 var previousActiveIndex = this.adapter.getPreviousActiveTabIndex(); 20878 if (!this.indexIsInRange_(index) || index === previousActiveIndex) { 20879 return; 20880 } 20881 var previousClientRect; 20882 if (previousActiveIndex !== -1) { 20883 this.adapter.deactivateTabAtIndex(previousActiveIndex); 20884 previousClientRect = this.adapter.getTabIndicatorClientRectAtIndex(previousActiveIndex); 20885 } 20886 this.adapter.activateTabAtIndex(index, previousClientRect); 20887 this.scrollIntoView(index); 20888 this.adapter.notifyTabActivated(index); 20889 }; 20890 MDCTabBarFoundation.prototype.handleKeyDown = function (evt) { 20891 // Get the key from the event 20892 var key = this.getKeyFromEvent_(evt); 20893 // Early exit if the event key isn't one of the keyboard navigation keys 20894 if (key === undefined) { 20895 return; 20896 } 20897 // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple 20898 if (!this.isActivationKey_(key)) { 20899 evt.preventDefault(); 20900 } 20901 if (this.useAutomaticActivation_) { 20902 if (this.isActivationKey_(key)) { 20903 return; 20904 } 20905 var index = this.determineTargetFromKey_(this.adapter.getPreviousActiveTabIndex(), key); 20906 this.adapter.setActiveTab(index); 20907 this.scrollIntoView(index); 20908 } else { 20909 var focusedTabIndex = this.adapter.getFocusedTabIndex(); 20910 if (this.isActivationKey_(key)) { 20911 this.adapter.setActiveTab(focusedTabIndex); 20912 } else { 20913 var index = this.determineTargetFromKey_(focusedTabIndex, key); 20914 this.adapter.focusTabAtIndex(index); 20915 this.scrollIntoView(index); 20916 } 20917 } 20918 }; 20919 /** 20920 * Handles the MDCTab:interacted event 20921 */ 20922 MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) { 20923 this.adapter.setActiveTab(this.adapter.getIndexOfTabById(evt.detail.tabId)); 20924 }; 20925 /** 20926 * Scrolls the tab at the given index into view 20927 * @param index The tab index to make visible 20928 */ 20929 MDCTabBarFoundation.prototype.scrollIntoView = function (index) { 20930 // Early exit if the index is out of range 20931 if (!this.indexIsInRange_(index)) { 20932 return; 20933 } 20934 // Always scroll to 0 if scrolling to the 0th index 20935 if (index === 0) { 20936 return this.adapter.scrollTo(0); 20937 } 20938 // Always scroll to the max value if scrolling to the Nth index 20939 // MDCTabScroller.scrollTo() will never scroll past the max possible value 20940 if (index === this.adapter.getTabListLength() - 1) { 20941 return this.adapter.scrollTo(this.adapter.getScrollC
20941ontentWidth()); 20942 } 20943 if (this.isRTL_()) { 20944 return this.scrollIntoViewRTL_(index); 20945 } 20946 this.scrollIntoView_(index); 20947 }; 20948 /** 20949 * Private method for determining the index of the destination tab based on what key was pressed 20950 * @param origin The original index from which to determine the destination 20951 * @param key The name of the key 20952 */ 20953 MDCTabBarFoundation.prototype.determineTargetFromKey_ = function (origin, key) { 20954 var isRTL = this.isRTL_(); 20955 var maxIndex = this.adapter.getTabListLength() - 1; 20956 var shouldGoToEnd = key === constants_1.strings.END_KEY; 20957 var shouldDecrement = key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL; 20958 var shouldIncrement = key === constants_1.strings.ARROW_RIGHT_KEY && !isRTL || key === constants_1.strings.ARROW_LEFT_KEY && isRTL; 20959 var index = origin; 20960 if (shouldGoToEnd) { 20961 index = maxIndex; 20962 } else if (shouldDecrement) { 20963 index -= 1; 20964 } else if (shouldIncrement) { 20965 index += 1; 20966 } else { 20967 index = 0; 20968 } 20969 if (index < 0) { 20970 index = maxIndex; 20971 } else if (index > maxIndex) { 20972 index = 0; 20973 } 20974 return index; 20975 }; 20976 /** 20977 * Calculates the scroll increment that will make the tab at the given index visible 20978 * @param index The index of the tab 20979 * @param nextIndex The index of the next tab 20980 * @param scrollPosition The current scroll position 20981 * @param barWidth The width of the Tab Bar 20982 */ 20983 MDCTabBarFoundation.prototype.calculateScrollIncrement_ = function (index, nextIndex, scrollPosition, barWidth) { 20984 var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex); 20985 var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth; 20986 var relativeContentRight = nextTabDimensions.contentRight - scrollPosition; 20987 var leftIncrement = relativeContentRight - constants_1.numbers.EXTRA_SCROLL_AMOUNT; 20988 var rightIncrement = relativeContentLeft + constants_1.numbers.EXTRA_SCROLL_AMOUNT; 20989 if (nextIndex < index) { 20990 return Math.min(leftIncrement, 0); 20991 } 20992 return Math.max(rightIncrement, 0); 20993 }; 20994 /** 20995 * Calculates the scroll increment that will make the tab at the given index visible in RTL 20996 * @param index The index of the tab 20997 * @param nextIndex The index of the next tab 20998 * @param scrollPosition The current scroll position 20999 * @param barWidth The width of the Tab Bar 21000 * @param scrollContentWidth The width of the scroll content 21001 */ 21002 MDCTabBarFoundation.prototype.calculateScrollIncrementRTL_ = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) { 21003 var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex); 21004 var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition; 21005 var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth; 21006 var leftIncrement = relativeContentRight + constants_1.numbers.EXTRA_SCROLL_AMOUNT; 21007 var rightIncrement = relativeContentLeft - constants_1.numbers.EXTRA_SCROLL_AMOUNT; 21008 if (nextIndex > index) { 21009 return Math.max(leftIncrement, 0); 21010 } 21011 return Math.min(rightIncrement, 0); 21012 }; 21013 /** 21014 * Determines the index of the adjacent tab closest to either edge of the Tab Bar 21015 * @param index The index of the tab 21016 * @param tabDimensions The dimensions of the tab 21017 * @param scrollPosition The current scroll position 21018 * @param barWidth The width of the tab bar 21019 */ 21020 MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge_ = function (index, tabDimensions, scrollPosition, barWidth) { 21021 /** 21022 * Tabs are laid out in the Tab Scroller like this: 21023 * 21024 * Scroll Position 21025 * +---+ 21026 * | | Bar Width 21027 * | +-----------------------------------+ 21028 * | | | 21029 * | V V 21030 * | +-----------------------------------+ 21031 * V | Tab Scroller | 21032 * +------------+--------------+-------------------+ 21033 * | Tab | Tab | Tab | 21034 * +------------+--------------+-------------------+ 21035 * | | 21036 * +-----------------------------------+ 21037 * 21038 * To determine the next adjacent index, we look at the Tab root left and 21039 * Tab root right, both relative to the scroll position. If the Tab root 21040 * left is less than 0, then we know it's out of view to the left. If the 21041 * Tab root right minus the bar width is greater than 0, we know the Tab is 21042 * out of view to the right. From there, we either increment or decrement 21043 * the index. 21044 */ 21045 var relativeRootLeft = tabDimensions.rootLeft - scrollPosition; 21046 var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth; 21047 var relativeRootDelta = relativeRootLeft + relativeRootRight; 21048 var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0; 21049 var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
21050 if (leftEdgeIsCloser) { 21051 return index - 1; 21052 } 21053 if (rightEdgeIsCloser) { 21054 return index + 1; 21055 } 21056 return -1; 21057 }; 21058 /** 21059 * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL 21060 * @param index The index of the tab 21061 * @param tabDimensions The dimensions of the tab 21062 * @param scrollPosition The current scroll position 21063 * @param barWidth The width of the tab bar 21064 * @param scrollContentWidth The width of the scroller content 21065 */ 21066 MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL_ = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) { 21067 var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition; 21068 var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition; 21069 var rootDelta = rootLeft + rootRight; 21070 var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0; 21071 var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0; 21072 if (leftEdgeIsCloser) { 21073 return index + 1; 21074 } 21075 if (rightEdgeIsCloser) { 21076 return index - 1; 21077 } 21078 return -1; 21079 }; 21080 /** 21081 * Returns the key associated with a keydown event 21082 * @param evt The keydown event 21083 */ 21084 MDCTabBarFoundation.prototype.getKeyFromEvent_ = function (evt) { 21085 if (ACCEPTABLE_KEYS.has(evt.key)) { 21086 return evt.key; 21087 } 21088 return KEYCODE_MAP.get(evt.keyCode); 21089 }; 21090 MDCTabBarFoundation.prototype.isActivationKey_ = function (key) { 21091 return key === constants_1.strings.SPACE_KEY || key === constants_1.strings.ENTER_KEY; 21092 }; 21093 /** 21094 * Returns whether a given index is inclusively between the ends 21095 * @param index The index to test 21096 */ 21097 MDCTabBarFoundation.prototype.indexIsInRange_ = function (index) { 21098 return index >= 0 && index < this.adapter.getTabListLength(); 21099 }; 21100 /** 21101 * Returns the view's RTL property 21102 */ 21103 MDCTabBarFoundation.prototype.isRTL_ = function () { 21104 return this.adapter.isRTL(); 21105 }; 21106 /** 21107 * Scrolls the tab at the given index into view for left-to-right user agents. 21108 * @param index The index of the tab to scroll into view 21109 */ 21110 MDCTabBarFoundation.prototype.scrollIntoView_ = function (index) { 21111 var scrollPosition = this.adapter.getScrollPosition(); 21112 var barWidth = this.adapter.getOffsetWidth(); 21113 var tabDimensions = this.adapter.getTabDimensionsAtIndex(index); 21114 var nextIndex = this.findAdjacentTabIndexClosestToEdge_(index, tabDimensions, scrollPosition, barWidth); 21115 if (!this.indexIsInRange_(nextIndex)) { 21116 return; 21117 } 21118 var scrollIncrement = this.calculateScrollIncrement_(index, nextIndex, scrollPosition, barWidth); 21119 this.adapter.incrementScroll(scrollIncrement); 21120 }; 21121 /** 21122 * Scrolls the tab at the given index into view in RTL 21123 * @param index The tab index to make visible 21124 */ 21125 MDCTabBarFoundation.prototype.scrollIntoViewRTL_ = function (index) { 21126 var scrollPosition = this.adapter.getScrollPosition(); 21127 var barWidth = this.adapter.getOffsetWidth(); 21128 var tabDimensions = this.adapter.getTabDimensionsAtIndex(index); 21129 var scrollWidth = this.adapter.getScrollContentWidth(); 21130 var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL_(index, tabDimensions, scrollPosition, barWidth, scrollWidth); 21131 if (!this.indexIsInRange_(nextIndex)) { 21132 return; 21133 } 21134 var scrollIncrement = this.calculateScrollIncrementRTL_(index, nextIndex, scrollPosition, barWidth, scrollWidth); 21135 this.adapter.incrementScroll(scrollIncrement); 21136 }; 21137 return MDCTabBarFoundation; 21138}(foundation_1.MDCFoundation); 21139exports.MDCTabBarFoundation = MDCTabBarFoundation; 21140// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 21141exports.default = MDCTabBarFoundation; 21142 21143/***/ }), 21144
21145/***/ "./packages/mdc-tab-bar/index.ts": 21146/*!***************************************!*\ 21147 !*** ./packages/mdc-tab-bar/index.ts ***! 21148 \***************************************/ 21149/*! no static exports found */ 21150/***/ (function(module, exports, __webpack_require__) { 21151 21152"use strict"; 21153 21154/** 21155 * @license 21156 * Copyright 2019 Google Inc. 21157 * 21158 * Permission is hereby granted, free of charge, to any person obtaining a copy 21159 * of this software and associated documentation files (the "Software"), to deal 21160 * in the Software without restriction, including without limitation the rights 21161 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21162 * copies of the Software, and to permit persons to whom the Software is 21163 * furnished to do so, subject to the following conditions: 21164 * 21165 * The above copyright notice and this permission notice shall be included in 21166 * all copies or substantial portions of the Software. 21167 * 21168 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21169 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21170 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21171 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21172 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21173 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21174 * THE SOFTWARE. 21175 */ 21176 21177function __export(m) { 21178 for (var p in m) { 21179 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 21180 } 21181} 21182Object.defineProperty(exports, "__esModule", { value: true }); 21183__export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-bar/component.ts")); 21184__export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts")); 21185__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts")); 21186 21187/***/ }), 21188
21189/***/ "./packages/mdc-tab-indicator/component.ts": 21190/*!*************************************************!*\ 21191 !*** ./packages/mdc-tab-indicator/component.ts ***! 21192 \*************************************************/ 21193/*! no static exports found */ 21194/***/ (function(module, exports, __webpack_require__) { 21195 21196"use strict"; 21197 21198/** 21199 * @license 21200 * Copyright 2018 Google Inc. 21201 * 21202 * Permission is hereby granted, free of charge, to any person obtaining a copy 21203 * of this software and associated documentation files (the "Software"), to deal 21204 * in the Software without restriction, including without limitation the rights 21205 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21206 * copies of the Software, and to permit persons to whom the Software is 21207 * furnished to do so, subject to the following conditions: 21208 * 21209 * The above copyright notice and this permission notice shall be included in 21210 * all copies or substantial portions of the Software. 21211 * 21212 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21213 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21214 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21215 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21216 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21217 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21218 * THE SOFTWARE. 21219 */ 21220 21221var __extends = this && this.__extends || function () { 21222 var _extendStatics = function extendStatics(d, b) { 21223 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 21224 d.__proto__ = b; 21225 } || function (d, b) { 21226 for (var p in b) { 21227 if (b.hasOwnProperty(p)) d[p] = b[p]; 21228 } 21229 }; 21230 return _extendStatics(d, b); 21231 }; 21232 return function (d, b) { 21233 _extendStatics(d, b); 21234 function __() { 21235 this.constructor = d; 21236 } 21237 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 21238 }; 21239}(); 21240Object.defineProperty(exports, "__esModule", { value: true }); 21241var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 21242var fading_foundation_1 = __webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts"); 21243var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"); 21244var sliding_foundation_1 = __webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts"); 21245var MDCTabIndicator = /** @class */function (_super) { 21246 __extends(MDCTabIndicator, _super); 21247 function MDCTabIndicator() { 21248 return _super !== null && _super.apply(this, arguments) || this; 21249 } 21250 MDCTabIndicator.attachTo = function (root) { 21251 return new MDCTabIndicator(root); 21252 }; 21253 MDCTabIndicator.prototype.initialize = function () { 21254 this.content_ = this.root.querySelector(foundation_1.MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR); 21255 }; 21256 MDCTabIndicator.prototype.computeContentClientRect = function () { 21257 return this.foundation.computeContentClientRect(); 21258 }; 21259 MDCTabIndicator.prototype.getDefaultFoundation = function () { 21260 var _this = this; 21261 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 21262 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 21263 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 21264 var adapter = { 21265 addClass: function addClass(className) { 21266 return _this.root.classList.add(className); 21267 }, 21268 removeClass: function removeClass(className) { 21269 return _this.root.classList.remove(className); 21270 }, 21271 computeContentClientRect: function computeContentClientRect() { 21272 return _this.content_.getBoundingClientRect(); 21273 }, 21274 setContentStyleProperty: function setContentStyleProperty(prop, value) { 21275 return _this.content_.style.setProperty(prop, value); 21276 } 21277 }; 21278 // tslint:enable:object-literal-sort-keys 21279 if (this.root.classList.contains(foundation_1.MDCTabIndicatorFoundation.cssClasse
21279s.FADE)) { 21280 return new fading_foundation_1.MDCFadingTabIndicatorFoundation(adapter); 21281 } 21282 // Default to the sliding indicator 21283 return new sliding_foundation_1.MDCSlidingTabIndicatorFoundation(adapter); 21284 }; 21285 MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) { 21286 this.foundation.activate(previousIndicatorClientRect); 21287 }; 21288 MDCTabIndicator.prototype.deactivate = function () { 21289 this.foundation.deactivate(); 21290 }; 21291 return MDCTabIndicator; 21292}(component_1.MDCComponent); 21293exports.MDCTabIndicator = MDCTabIndicator; 21294 21295/***/ }), 21296
21297/***/ "./packages/mdc-tab-indicator/constants.ts": 21298/*!*************************************************!*\ 21299 !*** ./packages/mdc-tab-indicator/constants.ts ***! 21300 \*************************************************/ 21301/*! no static exports found */ 21302/***/ (function(module, exports, __webpack_require__) { 21303 21304"use strict"; 21305 21306/** 21307 * @license 21308 * Copyright 2018 Google Inc. 21309 * 21310 * Permission is hereby granted, free of charge, to any person obtaining a copy 21311 * of this software and associated documentation files (the "Software"), to deal 21312 * in the Software without restriction, including without limitation the rights 21313 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21314 * copies of the Software, and to permit persons to whom the Software is 21315 * furnished to do so, subject to the following conditions: 21316 * 21317 * The above copyright notice and this permission notice shall be included in 21318 * all copies or substantial portions of the Software. 21319 * 21320 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21321 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21322 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21323 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21324 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21325 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21326 * THE SOFTWARE. 21327 */ 21328 21329Object.defineProperty(exports, "__esModule", { value: true });
21330var cssClasses = { 21331 ACTIVE: 'mdc-tab-indicator--active', 21332 FADE: 'mdc-tab-indicator--fade', 21333 NO_TRANSITION: 'mdc-tab-indicator--no-transition' 21334}; 21335exports.cssClasses = cssClasses; 21336var strings = { 21337 CONTENT_SELECTOR: '.mdc-tab-indicator__content' 21338}; 21339exports.strings = strings; 21340 21341/***/ }), 21342
21343/***/ "./packages/mdc-tab-indicator/fading-foundation.ts": 21344/*!*********************************************************!*\ 21345 !*** ./packages/mdc-tab-indicator/fading-foundation.ts ***! 21346 \*********************************************************/ 21347/*! no static exports found */ 21348/***/ (function(module, exports, __webpack_require__) { 21349 21350"use strict"; 21351 21352/** 21353 * @license 21354 * Copyright 2018 Google Inc. 21355 * 21356 * Permission is hereby granted, free of charge, to any person obtaining a copy 21357 * of this software and associated documentation files (the "Software"), to deal 21358 * in the Software without restriction, including without limitation the rights 21359 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21360 * copies of the Software, and to permit persons to whom the Software is 21361 * furnished to do so, subject to the following conditions: 21362 * 21363 * The above copyright notice and this permission notice shall be included in 21364 * all copies or substantial portions of the Software. 21365 * 21366 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21367 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21368 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21369 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21370 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21371 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21372 * THE SOFTWARE. 21373 */ 21374 21375var __extends = this && this.__extends || function () { 21376 var _extendStatics = function extendStatics(d, b) { 21377 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 21378 d.__proto__ = b; 21379 } || function (d, b) { 21380 for (var p in b) { 21381 if (b.hasOwnProperty(p)) d[p] = b[p]; 21382 } 21383 }; 21384 return _extendStatics(d, b); 21385 }; 21386 return function (d, b) { 21387 _extendStatics(d, b); 21388 function __() { 21389 this.constructor = d; 21390 } 21391 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 21392 }; 21393}(); 21394Object.defineProperty(exports, "__esModule", { value: true }); 21395var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"); 21396/* istanbul ignore next: subclass is not a branch statement */ 21397var MDCFadingTabIndicatorFoundation = /** @class */function (_super) { 21398 __extends(MDCFadingTabIndicatorFoundation, _super); 21399 function MDCFadingTabIndicatorFoundation() { 21400 return _super !== null && _super.apply(this, arguments) || this; 21401 } 21402 MDCFadingTabIndicatorFoundation.prototype.activate = function () { 21403 this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 21404 }; 21405 MDCFadingTabIndicatorFoundation.prototype.deactivate = function () { 21406 this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 21407 }; 21408 return MDCFadingTabIndicatorFoundation; 21409}(foundation_1.MDCTabIndicatorFoundation); 21410exports.MDCFadingTabIndicatorFoundation = MDCFadingTabIndicatorFoundation; 21411// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 21412exports.default = MDCFadingTabIndicatorFoundation; 21413 21414/***/ }), 21415
21416/***/ "./packages/mdc-tab-indicator/foundation.ts": 21417/*!**************************************************!*\ 21418 !*** ./packages/mdc-tab-indicator/foundation.ts ***! 21419 \**************************************************/ 21420/*! no static exports found */ 21421/***/ (function(module, exports, __webpack_require__) { 21422 21423"use strict"; 21424 21425/** 21426 * @license 21427 * Copyright 2018 Google Inc. 21428 * 21429 * Permission is hereby granted, free of charge, to any person obtaining a copy 21430 * of this software and associated documentation files (the "Software"), to deal 21431 * in the Software without restriction, including without limitation the rights 21432 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21433 * copies of the Software, and to permit persons to whom the Software is 21434 * furnished to do so, subject to the following conditions: 21435 * 21436 * The above copyright notice and this permission notice shall be included in 21437 * all copies or substantial portions of the Software. 21438 * 21439 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21440 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21441 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21442 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21443 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21444 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21445 * THE SOFTWARE. 21446 */ 21447 21448var __extends = this && this.__extends || function () { 21449 var _extendStatics = function extendStatics(d, b) { 21450 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 21451 d.__proto__ = b; 21452 } || function (d, b) { 21453 for (var p in b) { 21454 if (b.hasOwnProperty(p)) d[p] = b[p]; 21455 } 21456 }; 21457 return _extendStatics(d, b); 21458 }; 21459 return function (d, b) { 21460 _extendStatics(d, b); 21461 function __() { 21462 this.constructor = d; 21463 } 21464 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 21465 }; 21466}(); 21467var __assign = this && this.__assign || function () { 21468 __assign = Object.assign || function (t) { 21469 for (var s, i = 1, n = arguments.length; i < n; i++) { 21470 s = arguments[i]; 21471 for (var p in s) { 21472 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 21473 } 21474 } 21475 return t; 21476 }; 21477 return __assign.apply(this, arguments); 21478}; 21479Object.defineProperty(exports, "__esModule", { value: true }); 21480var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 21481var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts"); 21482var MDCTabIndicatorFoundation = /** @class */function (_super) { 21483 __extends(MDCTabIndicatorFoundation, _super); 21484 function MDCTabIndicatorFoundation(adapter) { 21485 return _super.call(this, __assign(__assign({}, MDCTabIndicatorFoundation.defaultAdapter), adapter)) || this; 21486 } 21487 Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", { 21488 get: function get() {
21489 return constants_1.cssClasses; 21490 }, 21491 enumerable: true, 21492 configurable: true 21493 }); 21494 Object.defineProperty(MDCTabIndicatorFoundation, "strings", { 21495 get: function get() { 21496 return constants_1.strings; 21497 }, 21498 enumerable: true, 21499 configurable: true 21500 }); 21501 Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", { 21502 get: function get() { 21503 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 21504 return { 21505 addClass: function addClass() { 21506 return undefined; 21507 }, 21508 removeClass: function removeClass() { 21509 return undefined; 21510 }, 21511 computeContentClientRect: function computeContentClientRect() { 21512 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 21513 }, 21514 setContentStyleProperty: function setContentStyleProperty() { 21515 return undefined; 21516 } 21517 }; 21518 // tslint:enable:object-literal-sort-keys 21519 }, 21520 enumerable: true, 21521 configurable: true 21522 }); 21523 MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () { 21524 return this.adapter.computeContentClientRect(); 21525 }; 21526 return MDCTabIndicatorFoundation; 21527}(foundation_1.MDCFoundation); 21528exports.MDCTabIndicatorFoundation = MDCTabIndicatorFoundation; 21529// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 21530exports.default = MDCTabIndicatorFoundation; 21531 21532/***/ }), 21533
21534/***/ "./packages/mdc-tab-indicator/index.ts": 21535/*!*********************************************!*\ 21536 !*** ./packages/mdc-tab-indicator/index.ts ***! 21537 \*********************************************/ 21538/*! no static exports found */ 21539/***/ (function(module, exports, __webpack_require__) { 21540 21541"use strict"; 21542 21543/** 21544 * @license 21545 * Copyright 2019 Google Inc. 21546 * 21547 * Permission is hereby granted, free of charge, to any person obtaining a copy 21548 * of this software and associated documentation files (the "Software"), to deal 21549 * in the Software without restriction, including without limitation the rights 21550 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21551 * copies of the Software, and to permit persons to whom the Software is 21552 * furnished to do so, subject to the following conditions: 21553 * 21554 * The above copyright notice and this permission notice shall be included in 21555 * all copies or substantial portions of the Software. 21556 * 21557 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21558 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21559 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21560 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21561 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21562 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21563 * THE SOFTWARE. 21564 */ 21565 21566function __export(m) { 21567 for (var p in m) { 21568 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 21569 } 21570} 21571Object.defineProperty(exports, "__esModule", { value: true }); 21572__export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-indicator/component.ts")); 21573__export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts")); 21574__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts")); 21575__export(__webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts")); 21576__export(__webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts")); 21577 21578/***/ }), 21579
21580/***/ "./packages/mdc-tab-indicator/sliding-foundation.ts": 21581/*!**********************************************************!*\ 21582 !*** ./packages/mdc-tab-indicator/sliding-foundation.ts ***! 21583 \**********************************************************/ 21584/*! no static exports found */ 21585/***/ (function(module, exports, __webpack_require__) { 21586 21587"use strict"; 21588 21589/** 21590 * @license 21591 * Copyright 2018 Google Inc. 21592 * 21593 * Permission is hereby granted, free of charge, to any person obtaining a copy 21594 * of this software and associated documentation files (the "Software"), to deal 21595 * in the Software without restriction, including without limitation the rights 21596 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21597 * copies of the Software, and to permit persons to whom the Software is 21598 * furnished to do so, subject to the following conditions: 21599 * 21600 * The above copyright notice and this permission notice shall be included in 21601 * all copies or substantial portions of the Software. 21602 * 21603 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21604 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21605 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21606 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21607 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21608 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21609 * THE SOFTWARE. 21610 */ 21611 21612var __extends = this && this.__extends || function () { 21613 var _extendStatics = function extendStatics(d, b) { 21614 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 21615 d.__proto__ = b; 21616 } || function (d, b) { 21617 for (var p in b) { 21618 if (b.hasOwnProperty(p)) d[p] = b[p]; 21619 } 21620 }; 21621 return _extendStatics(d, b); 21622 }; 21623 return function (d, b) { 21624 _extendStatics(d, b); 21625 function __() { 21626 this.constructor = d; 21627 } 21628 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 21629 }; 21630}(); 21631Object.defineProperty(exports, "__esModule", { value: true }); 21632var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"); 21633/* istanbul ignore next: subclass is not a branch statement */ 21634var MDCSlidingTabIndicatorFoundation = /** @class */function (_super) { 21635 __extends(MDCSlidingTabIndicatorFoundation, _super); 21636 function MDCSlidingTabIndicatorFoundation() { 21637 return _super !== null && _super.apply(this, arguments) || this; 21638 } 21639 MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) { 21640 // Early exit if no indicator is present to handle cases where an indicator 21641 // may be activated without a prior indicator state 21642 if (!previousIndicatorClientRect) { 21643 this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 21644 return; 21645 } 21646 // This animation uses the FLIP approach. You can read more about it at the link below: 21647 // https://aerotwist.com/blog/flip-your-animations/ 21648 // Calculate the dimensions based on the dimensions of the previous indicator 21649 var currentClientRect = this.computeContentClientRect(); 21650 var widthDelta = previousIndicatorClientRect.width / currentClientRect.width; 21651 var xPosition = previousIndicatorClientRect.left - currentClientRect.left; 21652 this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); 21653 this.adapter.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")"); 21654 // Force repaint before updating classes and transform to ensure the transform properly takes effect 21655 this.computeContentClientRect(); 21656 this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); 21657 this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 21658 this.adapter.setContentStyleProperty('transform', ''); 21659 }; 21660 MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () { 21661 this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasse
21661s.ACTIVE); 21662 }; 21663 return MDCSlidingTabIndicatorFoundation; 21664}(foundation_1.MDCTabIndicatorFoundation); 21665exports.MDCSlidingTabIndicatorFoundation = MDCSlidingTabIndicatorFoundation; 21666// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 21667exports.default = MDCSlidingTabIndicatorFoundation; 21668 21669/***/ }), 21670
21671/***/ "./packages/mdc-tab-scroller/component.ts": 21672/*!************************************************!*\ 21673 !*** ./packages/mdc-tab-scroller/component.ts ***! 21674 \************************************************/ 21675/*! no static exports found */ 21676/***/ (function(module, exports, __webpack_require__) { 21677 21678"use strict"; 21679 21680/** 21681 * @license 21682 * Copyright 2018 Google Inc. 21683 * 21684 * Permission is hereby granted, free of charge, to any person obtaining a copy 21685 * of this software and associated documentation files (the "Software"), to deal 21686 * in the Software without restriction, including without limitation the rights 21687 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21688 * copies of the Software, and to permit persons to whom the Software is 21689 * furnished to do so, subject to the following conditions: 21690 * 21691 * The above copyright notice and this permission notice shall be included in 21692 * all copies or substantial portions of the Software. 21693 * 21694 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21695 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21696 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21697 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21698 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21699 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21700 * THE SOFTWARE. 21701 */ 21702 21703var __extends = this && this.__extends || function () { 21704 var _extendStatics = function extendStatics(d, b) { 21705 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 21706 d.__proto__ = b; 21707 } || function (d, b) { 21708 for (var p in b) { 21709 if (b.hasOwnProperty(p)) d[p] = b[p]; 21710 } 21711 }; 21712 return _extendStatics(d, b); 21713 }; 21714 return function (d, b) { 21715 _extendStatics(d, b); 21716 function __() { 21717 this.constructor = d; 21718 } 21719 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 21720 }; 21721}(); 21722var __importStar = this && this.__importStar || function (mod) { 21723 if (mod && mod.__esModule) return mod; 21724 var result = {}; 21725 if (mod != null) for (var k in mod) { 21726 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 21727 }result["default"] = mod; 21728 return result; 21729}; 21730Object.defineProperty(exports, "__esModule", { value: true }); 21731var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 21732var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 21733var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 21734var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts"); 21735var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts")); 21736var MDCTabScroller = /** @class */function (_super) { 21737 __extends(MDCTabScroller, _super); 21738 function MDCTabScroller() { 21739 return _super !== null && _super.apply(this, arguments) || this; 21740 } 21741 MDCTabScroller.attachTo = function (root) { 21742 return new MDCTabScroller(root); 21743 }; 21744 MDCTabScroller.prototype.initialize = function () { 21745 this.area_ = this.root.querySelector(foundation_1.MDCTabScrollerFoundation.strings.AREA_SELECTOR); 21746 this.content_ = this.root.querySelector(foundation_1.MDCTabScrollerFoundation.strings.CONTENT_SELECTOR); 21747 }; 21748 MDCTabScroller.prototype.initialSyncWithDOM = function () { 21749 var _this = this; 21750 this.handleInteraction_ = function () { 21751 return _this.foundation.handleInteraction(); 21752 }; 21753 this.handleTransitionEnd_ = function (evt) { 21754 return _this.foundation.handleTransitionEnd(evt); 21755 }; 21756 this.area_.addEventListener('wheel', this.handleInteraction_, events_1.applyPassive()); 21757 this.area_.addEventListener('touchstart', this.handleInteraction_, events_1.applyPassive()); 21758 this.area_.addEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive()); 21759 this.area_.addEventListener('mousedown', this.handleInteraction_, events_1.applyPassive()); 21760 this.area_.addEventListener('keydown', this.handleInteraction_, events_1.applyPassive()); 21761 this.content_.addEventListener('transitionend', this.handleTransitionEnd_); 21762 }; 21763 MDCTabScroller.prototype.destroy = function () { 21764 _super.prototype.destroy.call(this); 21765 this.area_.removeEventListener('wheel', this.handleInteraction_, events_1.applyPassive()); 21766 this.area_.removeEventListener('touchstart', this.handleInteraction_, events_1.applyPassive()); 21767 this.area_.removeEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive()); 21768 this.area_.removeEventListener('mousedown', this.handleInteraction_, events_1.applyPassive()); 21769 this.area_.removeEventListener('keydown', this.handleInteraction_, events_1.applyPassive()); 21770 this.content_.removeEventListener('transitionend', this.handleTransitionEnd_); 21771 }; 21772 MDCTabScroller.prototype.getDefaultFoundation = function () { 21773 var _this = this; 21774 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 21775 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 21776 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 21777 var adapter = { 21778 eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) { 21779 return ponyfill_1.matches(evtTarget, selector); 21780 }, 21781 addClass: function addClass(className) { 21782 return _this.root.classList.add(className); 21783 }, 21784 removeClass: function removeClass(className) { 21785 return _this.root.classList.remove(className); 21786 }, 21787 addScrollAreaClass: function addScrollAreaClass(className) { 21788 return _this.area_.classList.add(className); 21789 }, 21790 setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) { 21791 return _this.area_.style.setProperty(prop, value); 21792 },
21793 setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) { 21794 return _this.content_.style.setProperty(prop, value); 21795 }, 21796 getScrollContentStyleValue: function getScrollContentStyleValue(propName) { 21797 return window.getComputedStyle(_this.content_).getPropertyValue(propName); 21798 }, 21799 setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) { 21800 return _this.area_.scrollLeft = scrollX; 21801 }, 21802 getScrollAreaScrollLeft: function getScrollAreaScrollLeft() { 21803 return _this.area_.scrollLeft; 21804 }, 21805 getScrollContentOffsetWidth: function getScrollContentOffsetWidth() { 21806 return _this.content_.offsetWidth; 21807 }, 21808 getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() { 21809 return _this.area_.offsetWidth; 21810 }, 21811 computeScrollAreaClientRect: function computeScrollAreaClientRect() { 21812 return _this.area_.getBoundingClientRect(); 21813 }, 21814 computeScrollContentClientRect: function computeScrollContentClientRect() { 21815 return _this.content_.getBoundingClientRect(); 21816 }, 21817 computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() { 21818 return util.computeHorizontalScrollbarHeight(document); 21819 } 21820 }; 21821 // tslint:enable:object-literal-sort-keys 21822 return new foundation_1.MDCTabScrollerFoundation(adapter); 21823 }; 21824 /** 21825 * Returns the current visual scroll position 21826 */ 21827 MDCTabScroller.prototype.getScrollPosition = function () { 21828 return this.foundation.getScrollPosition(); 21829 }; 21830 /** 21831 * Returns the width of the scroll content 21832 */ 21833 MDCTabScroller.prototype.getScrollContentWidth = function () { 21834 return this.content_.offsetWidth; 21835 }; 21836 /** 21837 * Increments the scroll value by the given amount 21838 * @param scrollXIncrement The pixel value by which to increment the scroll value 21839 */ 21840 MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) { 21841 this.foundation.incrementScroll(scrollXIncrement); 21842 }; 21843 /** 21844 * Scrolls to the given pixel position 21845 * @param scrollX The pixel value to scroll to 21846 */ 21847 MDCTabScroller.prototype.scrollTo = function (scrollX) { 21848 this.foundation.scrollTo(scrollX); 21849 }; 21850 return MDCTabScroller; 21851}(component_1.MDCComponent); 21852exports.MDCTabScroller = MDCTabScroller; 21853 21854/***/ }), 21855
21856/***/ "./packages/mdc-tab-scroller/constants.ts": 21857/*!************************************************!*\ 21858 !*** ./packages/mdc-tab-scroller/constants.ts ***! 21859 \************************************************/ 21860/*! no static exports found */ 21861/***/ (function(module, exports, __webpack_require__) { 21862 21863"use strict"; 21864 21865/** 21866 * @license 21867 * Copyright 2018 Google Inc. 21868 * 21869 * Permission is hereby granted, free of charge, to any person obtaining a copy 21870 * of this software and associated documentation files (the "Software"), to deal 21871 * in the Software without restriction, including without limitation the rights 21872 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21873 * copies of the Software, and to permit persons to whom the Software is 21874 * furnished to do so, subject to the following conditions: 21875 * 21876 * The above copyright notice and this permission notice shall be included in 21877 * all copies or substantial portions of the Software. 21878 * 21879 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21880 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21881 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21882 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21883 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21884 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21885 * THE SOFTWARE. 21886 */ 21887 21888Object.defineProperty(exports, "__esModule", { value: true });
21889var cssClasses = { 21890 ANIMATING: 'mdc-tab-scroller--animating', 21891 SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll', 21892 SCROLL_TEST: 'mdc-tab-scroller__test' 21893}; 21894exports.cssClasses = cssClasses; 21895var strings = { 21896 AREA_SELECTOR: '.mdc-tab-scroller__scroll-area', 21897 CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content' 21898}; 21899exports.strings = strings; 21900 21901/***/ }), 21902
21903/***/ "./packages/mdc-tab-scroller/foundation.ts": 21904/*!*************************************************!*\ 21905 !*** ./packages/mdc-tab-scroller/foundation.ts ***! 21906 \*************************************************/ 21907/*! no static exports found */ 21908/***/ (function(module, exports, __webpack_require__) { 21909 21910"use strict"; 21911 21912/** 21913 * @license 21914 * Copyright 2018 Google Inc. 21915 * 21916 * Permission is hereby granted, free of charge, to any person obtaining a copy 21917 * of this software and associated documentation files (the "Software"), to deal 21918 * in the Software without restriction, including without limitation the rights 21919 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21920 * copies of the Software, and to permit persons to whom the Software is 21921 * furnished to do so, subject to the following conditions: 21922 * 21923 * The above copyright notice and this permission notice shall be included in 21924 * all copies or substantial portions of the Software. 21925 * 21926 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21927 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21928 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21929 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21930 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21931 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21932 * THE SOFTWARE. 21933 */ 21934 21935var __extends = this && this.__extends || function () { 21936 var _extendStatics = function extendStatics(d, b) { 21937 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 21938 d.__proto__ = b; 21939 } || function (d, b) { 21940 for (var p in b) { 21941 if (b.hasOwnProperty(p)) d[p] = b[p]; 21942 } 21943 }; 21944 return _extendStatics(d, b); 21945 }; 21946 return function (d, b) { 21947 _extendStatics(d, b); 21948 function __() { 21949 this.constructor = d; 21950 } 21951 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 21952 }; 21953}(); 21954var __assign = this && this.__assign || function () { 21955 __assign = Object.assign || function (t) { 21956 for (var s, i = 1, n = arguments.length; i < n; i++) { 21957 s = arguments[i]; 21958 for (var p in s) { 21959 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 21960 } 21961 } 21962 return t; 21963 }; 21964 return __assign.apply(this, arguments); 21965}; 21966var __read = this && this.__read || function (o, n) { 21967 var m = typeof Symbol === "function" && o[Symbol.iterator]; 21968 if (!m) return o; 21969 var i = m.call(o), 21970 r, 21971 ar = [], 21972 e; 21973 try { 21974 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { 21975 ar.push(r.value); 21976 } 21977 } catch (error) { 21978 e = { error: error }; 21979 } finally { 21980 try { 21981 if (r && !r.done && (m = i["return"])) m.call(i); 21982 } finally { 21983 if (e) throw e.error; 21984 } 21985 } 21986 return ar; 21987}; 21988Object.defineProperty(exports, "__esModule", { value: true }); 21989var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 21990var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"); 21991var rtl_default_scroller_1 = __webpack_require__(/*! ./rtl-default-scroller */ "./packages/mdc-tab-scroller/rtl-default-scroller.ts"); 21992var rtl_negative_scroller_1 = __webpack_require__(/*! ./rtl-negative-scroller */ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts"); 21993var rtl_reverse_scroller_1 = __webpack_require__(/*! ./rtl-reverse-scroller */ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts"); 21994var MDCTabScrollerFoundation = /** @class */function (_super) { 21995 __extends(MDCTabScrollerFoundation, _super); 21996 function MDCTabScrollerFoundation(adapter) { 21997 var _this = _super.call(this, __assign(__assign({}, MDCTabScrollerFoundation.defaultAdapter), adapter)) || this; 21998 /** 21999 * Controls whether we should handle the transitionend and interaction events during the animation. 22000 */ 22001 _this.isAnimating_ = false;
22002 return _this; 22003 } 22004 Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", { 22005 get: function get() { 22006 return constants_1.cssClasses; 22007 }, 22008 enumerable: true, 22009 configurable: true 22010 }); 22011 Object.defineProperty(MDCTabScrollerFoundation, "strings", { 22012 get: function get() { 22013 return constants_1.strings; 22014 }, 22015 enumerable: true, 22016 configurable: true 22017 }); 22018 Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", { 22019 get: function get() { 22020 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 22021 return { 22022 eventTargetMatchesSelector: function eventTargetMatchesSelector() { 22023 return false; 22024 }, 22025 addClass: function addClass() { 22026 return undefined; 22027 }, 22028 removeClass: function removeClass() { 22029 return undefined; 22030 }, 22031 addScrollAreaClass: function addScrollAreaClass() { 22032 return undefined; 22033 }, 22034 setScrollAreaStyleProperty: function setScrollAreaStyleProperty() { 22035 return undefined; 22036 },
22037 setScrollContentStyleProperty: function setScrollContentStyleProperty() { 22038 return undefined; 22039 }, 22040 getScrollContentStyleValue: function getScrollContentStyleValue() { 22041 return ''; 22042 }, 22043 setScrollAreaScrollLeft: function setScrollAreaScrollLeft() { 22044 return undefined; 22045 }, 22046 getScrollAreaScrollLeft: function getScrollAreaScrollLeft() { 22047 return 0; 22048 }, 22049 getScrollContentOffsetWidth: function getScrollContentOffsetWidth() { 22050 return 0; 22051 }, 22052 getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() { 22053 return 0; 22054 }, 22055 computeScrollAreaClientRect: function computeScrollAreaClientRect() { 22056 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 22057 }, 22058 computeScrollContentClientRect: function computeScrollContentClientRect() { 22059 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 22060 }, 22061 computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() { 22062 return 0; 22063 } 22064 }; 22065 // tslint:enable:object-literal-sort-keys 22066 }, 22067 enumerable: true, 22068 configurable: true 22069 }); 22070 MDCTabScrollerFoundation.prototype.init = function () { 22071 // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll 22072 // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs. 22073 var horizontalScrollbarHeight = this.adapter.computeHorizontalScrollbarHeight(); 22074 this.adapter.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px'); 22075 this.adapter.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL); 22076 }; 22077 /** 22078 * Computes the current visual scroll position 22079 */ 22080 MDCTabScrollerFoundation.prototype.getScrollPosition = function () { 22081 if (this.isRTL_()) { 22082 return this.computeCurrentScrollPositionRTL_(); 22083 } 22084 var currentTranslateX = this.calculateCurrentTranslateX_(); 22085 var scrollLeft = this.adapter.getScrollAreaScrollLeft(); 22086 return scrollLeft - currentTranslateX; 22087 }; 22088 /** 22089 * Handles interaction events that occur during transition 22090 */ 22091 MDCTabScrollerFoundation.prototype.handleInteraction = function () { 22092 // Early exit if we aren't animating 22093 if (!this.isAnimating_) { 22094 return; 22095 } 22096 // Prevent other event listeners from handling this event 22097 this.stopScrollAnimation_(); 22098 }; 22099 /** 22100 * Handles the transitionend event 22101 */ 22102 MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) { 22103 // Early exit if we aren't animating or the event was triggered by a different element. 22104 var evtTarget = evt.target; 22105 if (!this.isAnimating_ || !this.adapter.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) { 22106 return; 22107 } 22108 this.isAnimating_ = false; 22109 this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); 22110 }; 22111 /** 22112 * Increment the scroll value by the scrollXIncrement using animation. 22113 * @param scrollXIncrement The value by which to increment the scroll position 22114 */ 22115 MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) { 22116 // Early exit for non-operational increment values 22117 if (scrollXIncrement === 0) { 22118 return; 22119 } 22120 this.animate_(this.getIncrementScrollOperation_(scrollXIncrement)); 22121 }; 22122 /** 22123 * Increment the scroll value by the scrollXIncrement without animation. 22124 * @param scrollXIncrement The value by which to increment the scroll position 22125 */ 22126 MDCTabScrollerFoundation.prototype.incrementScrollImmediate = function (scrollXIncrement) { 22127 // Early exit for non-operational increment values 22128 if (scrollXIncrement === 0) { 22129 return; 22130 } 22131 var operation = this.getIncrementScrollOperation_(scrollXIncrement); 22132 if (operation.scrollDelta === 0) { 22133 return; 22134 } 22135 this.stopScrollAnimation_(); 22136 this.adapter.setScrollAreaScrollLeft(operation.finalScrollPosition); 22137 }; 22138 /** 22139 * Scrolls to the given scrollX value 22140 */ 22141 MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) { 22142 if (this.isRTL_()) { 22143 return this.scrollToRTL_(scrollX); 22144 } 22145 this.scrollTo_(scrollX); 22146 }; 22147 /** 22148 * @return Browser-specific {@link MDCTabScrollerRTL} instance. 22149 */ 22150 MDCTabScrollerFoundation.prototype.getRTLScroller = function () { 22151 if (!this.rtlScrollerInstance_) { 22152 this.rtlScrollerInstance_ = this.rtlScrollerFactory_(); 22153 } 22154 return this.rtlScrollerInstance_; 22155 }; 22156 /** 22157 * @return translateX value from a CSS matrix transform function string. 22158 */ 22159 MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX_ = function () {
22160 var transformValue = this.adapter.getScrollContentStyleValue('transform'); 22161 // Early exit if no transform is present 22162 if (transformValue === 'none') { 22163 return 0; 22164 } 22165 // The transform value comes back as a matrix transformation in the form 22166 // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so 22167 // we're going to grab all the parenthesized values, strip out tx, and 22168 // parse it. 22169 var match = /\((.+?)\)/.exec(transformValue); 22170 if (!match) { 22171 return 0; 22172 } 22173 var matrixParams = match[1]; 22174 // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error. 22175 // @ts-ignore These unused variables should retain their semantic names for clarity. 22176 var _a = __read(matrixParams.split(','), 6), 22177 a = _a[0], 22178 b = _a[1], 22179 c = _a[2], 22180 d = _a[3], 22181 tx = _a[4], 22182 ty = _a[5]; 22183 return parseFloat(tx); // tslint:disable-line:ban 22184 }; 22185 /** 22186 * Calculates a safe scroll value that is > 0 and < the max scroll value 22187 * @param scrollX The distance to scroll 22188 */ 22189 MDCTabScrollerFoundation.prototype.clampScrollValue_ = function (scrollX) { 22190 var edges = this.calculateScrollEdges_(); 22191 return Math.min(Math.max(edges.left, scrollX), edges.right); 22192 }; 22193 MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL_ = function () { 22194 var translateX = this.calculateCurrentTranslateX_(); 22195 return this.getRTLScroller().getScrollPositionRTL(translateX); 22196 }; 22197 MDCTabScrollerFoundation.prototype.calculateScrollEdges_ = function () { 22198 var contentWidth = this.adapter.getScrollContentOffsetWidth(); 22199 var rootWidth = this.adapter.getScrollAreaOffsetWidth(); 22200 return { 22201 left: 0, 22202 right: contentWidth - rootWidth 22203 }; 22204 }; 22205 /** 22206 * Internal scroll method 22207 * @param scrollX The new scroll position 22208 */ 22209 MDCTabScrollerFoundation.prototype.scrollTo_ = function (scrollX) { 22210 var currentScrollX = this.getScrollPosition(); 22211 var safeScrollX = this.clampScrollValue_(scrollX); 22212 var scrollDelta = safeScrollX - currentScrollX; 22213 this.animate_({ 22214 finalScrollPosition: safeScrollX, 22215 scrollDelta: scrollDelta 22216 }); 22217 }; 22218 /** 22219 * Internal RTL scroll method 22220 * @param scrollX The new scroll position 22221 */ 22222 MDCTabScrollerFoundation.prototype.scrollToRTL_ = function (scrollX) { 22223 var animation = this.getRTLScroller().scrollToRTL(scrollX); 22224 this.animate_(animation); 22225 }; 22226 /** 22227 * Internal method to compute the increment scroll operation values. 22228 * @param scrollX The desired scroll position increment 22229 * @return MDCTabScrollerAnimation with the sanitized values for performing the scroll operation. 22230 */ 22231 MDCTabScrollerFoundation.prototype.getIncrementScrollOperation_ = function (scrollX) { 22232 if (this.isRTL_()) { 22233 return this.getRTLScroller().incrementScrollRTL(scrollX); 22234 } 22235 var currentScrollX = this.getScrollPosition(); 22236 var targetScrollX = scrollX + currentScrollX; 22237 var safeScrollX = this.clampScrollValue_(targetScrollX); 22238 var scrollDelta = safeScrollX - currentScrollX; 22239 return { 22240 finalScrollPosition: safeScrollX, 22241 scrollDelta: scrollDelta 22242 }; 22243 }; 22244 /** 22245 * Animates the tab scrolling 22246 * @param animation The animation to apply 22247 */ 22248 MDCTabScrollerFoundation.prototype.animate_ = function (animation) { 22249 var _this = this; 22250 // Early exit if translateX is 0, which means there's no animation to perform 22251 if (animation.scrollDelta === 0) { 22252 return; 22253 } 22254 this.stopScrollAnimation_(); 22255 // This animation uses the FLIP approach. 22256 // Read more here: https://aerotwist.com/blog/flip-your-animations/ 22257 this.adapter.setScrollAreaScrollLeft(animation.finalScrollPosition);
22258 this.adapter.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)"); 22259 // Force repaint 22260 this.adapter.computeScrollAreaClientRect(); 22261 requestAnimationFrame(function () { 22262 _this.adapter.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); 22263 _this.adapter.setScrollContentStyleProperty('transform', 'none'); 22264 }); 22265 this.isAnimating_ = true; 22266 }; 22267 /** 22268 * Stops scroll animation 22269 */ 22270 MDCTabScrollerFoundation.prototype.stopScrollAnimation_ = function () { 22271 this.isAnimating_ = false; 22272 var currentScrollPosition = this.getAnimatingScrollPosition_(); 22273 this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); 22274 this.adapter.setScrollContentStyleProperty('transform', 'translateX(0px)'); 22275 this.adapter.setScrollAreaScrollLeft(currentScrollPosition); 22276 }; 22277 /** 22278 * Gets the current scroll position during animation 22279 */ 22280 MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition_ = function () { 22281 var currentTranslateX = this.calculateCurrentTranslateX_(); 22282 var scrollLeft = this.adapter.getScrollAreaScrollLeft(); 22283 if (this.isRTL_()) { 22284 return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX); 22285 } 22286 return scrollLeft - currentTranslateX; 22287 }; 22288 /** 22289 * Determines the RTL Scroller to use 22290 */ 22291 MDCTabScrollerFoundation.prototype.rtlScrollerFactory_ = function () { 22292 // Browsers have three different implementations of scrollLeft in RTL mode, 22293 // dependent on the browser. The behavior is based off the max LTR 22294 // scrollLeft value and 0. 22295 // 22296 // * Default scrolling in RTL * 22297 // - Left-most value: 0 22298 // - Right-most value: Max LTR scrollLeft value 22299 // 22300 // * Negative scrolling in RTL * 22301 // - Left-most value: Negated max LTR scrollLeft value 22302 // - Right-most value: 0 22303 // 22304 // * Reverse scrolling in RTL * 22305 // - Left-most value: Max LTR scrollLeft value 22306 // - Right-most value: 0 22307 // 22308 // We use those principles below to determine which RTL scrollLeft 22309 // behavior is implemented in the current browser. 22310 var initialScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22311 this.adapter.setScrollAreaScrollLeft(initialScrollLeft - 1); 22312 var newScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22313 // If the newScrollLeft value is negative,then we know that the browser has 22314 // implemented negative RTL scrolling, since all other implementations have 22315 // only positive values. 22316 if (newScrollLeft < 0) { 22317 // Undo the scrollLeft test check 22318 this.adapter.setScrollAreaScrollLeft(initialScrollLeft); 22319 return new rtl_negative_scroller_1.MDCTabScrollerRTLNegative(this.adapter); 22320 } 22321 var rootClientRect = this.adapter.computeScrollAreaClientRect(); 22322 var contentClientRect = this.adapter.computeScrollContentClientRect(); 22323 var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right); 22324 // Undo the scrollLeft test check 22325 this.adapter.setScrollAreaScrollLeft(initialScrollLeft); 22326 // By calculating the clientRect of the root element and the clientRect of 22327 // the content element, we can determine how much the scroll value changed 22328 // when we performed the scrollLeft subtraction above. 22329 if (rightEdgeDelta === newScrollLeft) { 22330 return new rtl_reverse_scroller_1.MDCTabScrollerRTLReverse(this.adapter); 22331 } 22332 return new rtl_default_scroller_1.MDCTabScrollerRTLDefault(this.adapter); 22333 }; 22334 MDCTabScrollerFoundation.prototype.isRTL_ = function () { 22335 return this.adapter.getScrollContentStyleValue('direction') === 'rtl'; 22336 }; 22337 return MDCTabScrollerFoundation; 22338}(foundation_1.MDCFoundation); 22339exports.MDCTabScrollerFoundation = MDCTabScrollerFoundation; 22340// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 22341exports.default = MDCTabScrollerFoundation; 22342 22343/***/ }), 22344
22345/***/ "./packages/mdc-tab-scroller/index.ts": 22346/*!********************************************!*\ 22347 !*** ./packages/mdc-tab-scroller/index.ts ***! 22348 \********************************************/ 22349/*! no static exports found */ 22350/***/ (function(module, exports, __webpack_require__) { 22351 22352"use strict"; 22353 22354/** 22355 * @license 22356 * Copyright 2019 Google Inc. 22357 * 22358 * Permission is hereby granted, free of charge, to any person obtaining a copy 22359 * of this software and associated documentation files (the "Software"), to deal 22360 * in the Software without restriction, including without limitation the rights 22361 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22362 * copies of the Software, and to permit persons to whom the Software is 22363 * furnished to do so, subject to the following conditions: 22364 * 22365 * The above copyright notice and this permission notice shall be included in 22366 * all copies or substantial portions of the Software. 22367 * 22368 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22369 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22370 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22371 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22372 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22373 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22374 * THE SOFTWARE. 22375 */ 22376 22377function __export(m) { 22378 for (var p in m) { 22379 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 22380 } 22381} 22382var __importStar = this && this.__importStar || function (mod) { 22383 if (mod && mod.__esModule) return mod; 22384 var result = {}; 22385 if (mod != null) for (var k in mod) { 22386 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 22387 }result["default"] = mod; 22388 return result; 22389}; 22390Object.defineProperty(exports, "__esModule", { value: true }); 22391var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts")); 22392exports.util = util; 22393__export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-scroller/component.ts")); 22394__export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts")); 22395__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts")); 22396 22397/***/ }), 22398
22399/***/ "./packages/mdc-tab-scroller/rtl-default-scroller.ts": 22400/*!***********************************************************!*\ 22401 !*** ./packages/mdc-tab-scroller/rtl-default-scroller.ts ***! 22402 \***********************************************************/ 22403/*! no static exports found */ 22404/***/ (function(module, exports, __webpack_require__) { 22405 22406"use strict"; 22407 22408/** 22409 * @license 22410 * Copyright 2018 Google Inc. 22411 * 22412 * Permission is hereby granted, free of charge, to any person obtaining a copy 22413 * of this software and associated documentation files (the "Software"), to deal 22414 * in the Software without restriction, including without limitation the rights 22415 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22416 * copies of the Software, and to permit persons to whom the Software is 22417 * furnished to do so, subject to the following conditions: 22418 * 22419 * The above copyright notice and this permission notice shall be included in 22420 * all copies or substantial portions of the Software. 22421 * 22422 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22423 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22424 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22425 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22426 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22427 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22428 * THE SOFTWARE. 22429 */ 22430 22431var __extends = this && this.__extends || function () { 22432 var _extendStatics = function extendStatics(d, b) { 22433 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 22434 d.__proto__ = b; 22435 } || function (d, b) { 22436 for (var p in b) { 22437 if (b.hasOwnProperty(p)) d[p] = b[p]; 22438 } 22439 }; 22440 return _extendStatics(d, b); 22441 }; 22442 return function (d, b) { 22443 _extendStatics(d, b); 22444 function __() { 22445 this.constructor = d; 22446 } 22447 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 22448 }; 22449}(); 22450Object.defineProperty(exports, "__esModule", { value: true }); 22451var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts"); 22452var MDCTabScrollerRTLDefault = /** @class */function (_super) { 22453 __extends(MDCTabScrollerRTLDefault, _super); 22454 function MDCTabScrollerRTLDefault() { 22455 return _super !== null && _super.apply(this, arguments) || this; 22456 } 22457 MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () { 22458 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22459 var right = this.calculateScrollEdges_().right; 22460 // Scroll values on most browsers are ints instead of floats so we round 22461 return Math.round(right - currentScrollLeft); 22462 }; 22463 MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) { 22464 var edges = this.calculateScrollEdges_(); 22465 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22466 var clampedScrollLeft = this.clampScrollValue_(edges.right - scrollX); 22467 return { 22468 finalScrollPosition: clampedScrollLeft, 22469 scrollDelta: clampedScrollLeft - currentScrollLeft 22470 }; 22471 }; 22472 MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) { 22473 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22474 var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX); 22475 return { 22476 finalScrollPosition: clampedScrollLeft, 22477 scrollDelta: clampedScrollLeft - currentScrollLeft 22478 }; 22479 }; 22480 MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) { 22481 return scrollX; 22482 }; 22483 MDCTabScrollerRTLDefault.prototype.calculateScrollEdges_ = function () { 22484 var contentWidth = this.adapter.getScrollContentOffsetWidth(); 22485 var rootWidth = this.adapter.getScrollAreaOffsetWidth(); 22486 return { 22487 left: 0, 22488 right: contentWidth - rootWidth 22489 }; 22490 }; 22491 MDCTabScrollerRTLDefault.prototype.clampScrollValue_ = function (scrollX) { 22492 var edges = this.calculateScrollEdges_(); 22493 return Math.min(Math.max(edges.left, scrollX), edges.right); 22494 }; 22495 return MDCTabScrollerRTLDefault; 22496}(rtl_scroller_1.MDCTabScrollerRTL); 22497exports.MDCTabScrollerRTLDefault = MDCTabScrollerRTLDefault; 22498// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 22499exports.default = MDCTabScrollerRTLDefault; 22500 22501/***/ }), 22502
22503/***/ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts": 22504/*!************************************************************!*\ 22505 !*** ./packages/mdc-tab-scroller/rtl-negative-scroller.ts ***! 22506 \************************************************************/ 22507/*! no static exports found */ 22508/***/ (function(module, exports, __webpack_require__) { 22509 22510"use strict"; 22511 22512/** 22513 * @license 22514 * Copyright 2018 Google Inc. 22515 * 22516 * Permission is hereby granted, free of charge, to any person obtaining a copy 22517 * of this software and associated documentation files (the "Software"), to deal 22518 * in the Software without restriction, including without limitation the rights 22519 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22520 * copies of the Software, and to permit persons to whom the Software is 22521 * furnished to do so, subject to the following conditions: 22522 * 22523 * The above copyright notice and this permission notice shall be included in 22524 * all copies or substantial portions of the Software. 22525 * 22526 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22527 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22528 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22529 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22530 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22531 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22532 * THE SOFTWARE. 22533 */ 22534 22535var __extends = this && this.__extends || function () { 22536 var _extendStatics = function extendStatics(d, b) { 22537 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 22538 d.__proto__ = b; 22539 } || function (d, b) { 22540 for (var p in b) { 22541 if (b.hasOwnProperty(p)) d[p] = b[p]; 22542 } 22543 }; 22544 return _extendStatics(d, b); 22545 }; 22546 return function (d, b) { 22547 _extendStatics(d, b); 22548 function __() { 22549 this.constructor = d; 22550 } 22551 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 22552 }; 22553}(); 22554Object.defineProperty(exports, "__esModule", { value: true }); 22555var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts"); 22556var MDCTabScrollerRTLNegative = /** @class */function (_super) { 22557 __extends(MDCTabScrollerRTLNegative, _super); 22558 function MDCTabScrollerRTLNegative() { 22559 return _super !== null && _super.apply(this, arguments) || this; 22560 } 22561 MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) { 22562 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22563 return Math.round(translateX - currentScrollLeft); 22564 }; 22565 MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) { 22566 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22567 var clampedScrollLeft = this.clampScrollValue_(-scrollX); 22568 return { 22569 finalScrollPosition: clampedScrollLeft, 22570 scrollDelta: clampedScrollLeft - currentScrollLeft 22571 }; 22572 }; 22573 MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) { 22574 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22575 var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX); 22576 return { 22577 finalScrollPosition: clampedScrollLeft, 22578 scrollDelta: clampedScrollLeft - currentScrollLeft 22579 }; 22580 }; 22581 MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) { 22582 return scrollX - translateX; 22583 }; 22584 MDCTabScrollerRTLNegative.prototype.calculateScrollEdges_ = function () { 22585 var contentWidth = this.adapter.getScrollContentOffsetWidth(); 22586 var rootWidth = this.adapter.getScrollAreaOffsetWidth(); 22587 return { 22588 left: rootWidth - contentWidth, 22589 right: 0 22590 }; 22591 }; 22592 MDCTabScrollerRTLNegative.prototype.clampScrollValue_ = function (scrollX) { 22593 var edges = this.calculateScrollEdges_(); 22594 return Math.max(Math.min(edges.right, scrollX), edges.left); 22595 }; 22596 return MDCTabScrollerRTLNegative; 22597}(rtl_scroller_1.MDCTabScrollerRTL); 22598exports.MDCTabScrollerRTLNegative = MDCTabScrollerRTLNegative; 22599// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 22600exports.default = MDCTabScrollerRTLNegative; 22601 22602/***/ }), 22603
22604/***/ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts": 22605/*!***********************************************************!*\ 22606 !*** ./packages/mdc-tab-scroller/rtl-reverse-scroller.ts ***! 22607 \***********************************************************/ 22608/*! no static exports found */ 22609/***/ (function(module, exports, __webpack_require__) { 22610 22611"use strict"; 22612 22613/** 22614 * @license 22615 * Copyright 2018 Google Inc. 22616 * 22617 * Permission is hereby granted, free of charge, to any person obtaining a copy 22618 * of this software and associated documentation files (the "Software"), to deal 22619 * in the Software without restriction, including without limitation the rights 22620 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22621 * copies of the Software, and to permit persons to whom the Software is 22622 * furnished to do so, subject to the following conditions: 22623 * 22624 * The above copyright notice and this permission notice shall be included in 22625 * all copies or substantial portions of the Software. 22626 * 22627 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22628 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22629 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22630 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22631 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22632 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22633 * THE SOFTWARE. 22634 */ 22635 22636var __extends = this && this.__extends || function () { 22637 var _extendStatics = function extendStatics(d, b) { 22638 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 22639 d.__proto__ = b; 22640 } || function (d, b) { 22641 for (var p in b) { 22642 if (b.hasOwnProperty(p)) d[p] = b[p]; 22643 } 22644 }; 22645 return _extendStatics(d, b); 22646 }; 22647 return function (d, b) { 22648 _extendStatics(d, b); 22649 function __() { 22650 this.constructor = d; 22651 } 22652 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 22653 }; 22654}(); 22655Object.defineProperty(exports, "__esModule", { value: true }); 22656var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts"); 22657var MDCTabScrollerRTLReverse = /** @class */function (_super) { 22658 __extends(MDCTabScrollerRTLReverse, _super); 22659 function MDCTabScrollerRTLReverse() { 22660 return _super !== null && _super.apply(this, arguments) || this; 22661 } 22662 MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) { 22663 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22664 // Scroll values on most browsers are ints instead of floats so we round 22665 return Math.round(currentScrollLeft - translateX); 22666 }; 22667 MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) { 22668 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22669 var clampedScrollLeft = this.clampScrollValue_(scrollX); 22670 return { 22671 finalScrollPosition: clampedScrollLeft, 22672 scrollDelta: currentScrollLeft - clampedScrollLeft 22673 }; 22674 }; 22675 MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) { 22676 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 22677 var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft + scrollX); 22678 return { 22679 finalScrollPosition: clampedScrollLeft, 22680 scrollDelta: currentScrollLeft - clampedScrollLeft 22681 }; 22682 }; 22683 MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) { 22684 return scrollX + translateX; 22685 }; 22686 MDCTabScrollerRTLReverse.prototype.calculateScrollEdges_ = function () { 22687 var contentWidth = this.adapter.getScrollContentOffsetWidth(); 22688 var rootWidth = this.adapter.getScrollAreaOffsetWidth(); 22689 return { 22690 left: contentWidth - rootWidth, 22691 right: 0 22692 }; 22693 }; 22694 MDCTabScrollerRTLReverse.prototype.clampScrollValue_ = function (scrollX) { 22695 var edges = this.calculateScrollEdges_(); 22696 return Math.min(Math.max(edges.right, scrollX), edges.left); 22697 }; 22698 return MDCTabScrollerRTLReverse;
22699}(rtl_scroller_1.MDCTabScrollerRTL); 22700exports.MDCTabScrollerRTLReverse = MDCTabScrollerRTLReverse; 22701// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 22702exports.default = MDCTabScrollerRTLReverse; 22703 22704/***/ }), 22705
22706/***/ "./packages/mdc-tab-scroller/rtl-scroller.ts": 22707/*!***************************************************!*\ 22708 !*** ./packages/mdc-tab-scroller/rtl-scroller.ts ***! 22709 \***************************************************/ 22710/*! no static exports found */ 22711/***/ (function(module, exports, __webpack_require__) { 22712 22713"use strict"; 22714 22715/** 22716 * @license 22717 * Copyright 2018 Google Inc. 22718 * 22719 * Permission is hereby granted, free of charge, to any person obtaining a copy 22720 * of this software and associated documentation files (the "Software"), to deal 22721 * in the Software without restriction, including without limitation the rights 22722 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22723 * copies of the Software, and to permit persons to whom the Software is 22724 * furnished to do so, subject to the following conditions: 22725 * 22726 * The above copyright notice and this permission notice shall be included in 22727 * all copies or substantial portions of the Software. 22728 * 22729 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22730 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22731 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22732 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22733 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22734 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22735 * THE SOFTWARE. 22736 */ 22737 22738Object.defineProperty(exports, "__esModule", { value: true }); 22739var MDCTabScrollerRTL = /** @class */function () { 22740 function MDCTabScrollerRTL(adapter) { 22741 this.adapter = adapter; 22742 } 22743 return MDCTabScrollerRTL; 22744}(); 22745exports.MDCTabScrollerRTL = MDCTabScrollerRTL; 22746// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 22747exports.default = MDCTabScrollerRTL; 22748 22749/***/ }), 22750
22751/***/ "./packages/mdc-tab-scroller/util.ts": 22752/*!*******************************************!*\ 22753 !*** ./packages/mdc-tab-scroller/util.ts ***! 22754 \*******************************************/ 22755/*! no static exports found */ 22756/***/ (function(module, exports, __webpack_require__) { 22757 22758"use strict"; 22759 22760/** 22761 * @license 22762 * Copyright 2018 Google Inc. 22763 * 22764 * Permission is hereby granted, free of charge, to any person obtaining a copy 22765 * of this software and associated documentation files (the "Software"), to deal 22766 * in the Software without restriction, including without limitation the rights 22767 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22768 * copies of the Software, and to permit persons to whom the Software is 22769 * furnished to do so, subject to the following conditions: 22770 * 22771 * The above copyright notice and this permission notice shall be included in 22772 * all copies or substantial portions of the Software. 22773 * 22774 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22775 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22776 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22777 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22778 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22779 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22780 * THE SOFTWARE. 22781 */ 22782 22783Object.defineProperty(exports, "__esModule", { value: true }); 22784var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"); 22785/** 22786 * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing. 22787 */ 22788var horizontalScrollbarHeight_; 22789/** 22790 * Computes the height of browser-rendered horizontal scrollbars using a self-created test element. 22791 * May return 0 (e.g. on OS X browsers under default configuration). 22792 */ 22793function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) { 22794 if (shouldCacheResult === void 0) { 22795 shouldCacheResult = true; 22796 } 22797 if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') { 22798 return horizontalScrollbarHeight_; 22799 } 22800 var el = documentObj.createElement('div');
22801 el.classList.add(constants_1.cssClasses.SCROLL_TEST); 22802 documentObj.body.appendChild(el); 22803 var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight; 22804 documentObj.body.removeChild(el); 22805 if (shouldCacheResult) { 22806 horizontalScrollbarHeight_ = horizontalScrollbarHeight; 22807 } 22808 return horizontalScrollbarHeight; 22809} 22810exports.computeHorizontalScrollbarHeight = computeHorizontalScrollbarHeight; 22811 22812/***/ }), 22813
22814/***/ "./packages/mdc-tab/component.ts": 22815/*!***************************************!*\ 22816 !*** ./packages/mdc-tab/component.ts ***! 22817 \***************************************/ 22818/*! no static exports found */ 22819/***/ (function(module, exports, __webpack_require__) { 22820 22821"use strict"; 22822 22823/** 22824 * @license 22825 * Copyright 2018 Google Inc. 22826 * 22827 * Permission is hereby granted, free of charge, to any person obtaining a copy 22828 * of this software and associated documentation files (the "Software"), to deal 22829 * in the Software without restriction, including without limitation the rights 22830 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22831 * copies of the Software, and to permit persons to whom the Software is 22832 * furnished to do so, subject to the following conditions: 22833 * 22834 * The above copyright notice and this permission notice shall be included in 22835 * all copies or substantial portions of the Software. 22836 * 22837 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22838 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22839 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22840 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22841 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22842 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22843 * THE SOFTWARE. 22844 */ 22845 22846var __extends = this && this.__extends || function () { 22847 var _extendStatics = function extendStatics(d, b) { 22848 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 22849 d.__proto__ = b; 22850 } || function (d, b) { 22851 for (var p in b) { 22852 if (b.hasOwnProperty(p)) d[p] = b[p]; 22853 } 22854 }; 22855 return _extendStatics(d, b); 22856 }; 22857 return function (d, b) { 22858 _extendStatics(d, b); 22859 function __() { 22860 this.constructor = d; 22861 } 22862 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 22863 }; 22864}(); 22865var __assign = this && this.__assign || function () { 22866 __assign = Object.assign || function (t) { 22867 for (var s, i = 1, n = arguments.length; i < n; i++) { 22868 s = arguments[i]; 22869 for (var p in s) { 22870 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 22871 } 22872 } 22873 return t; 22874 }; 22875 return __assign.apply(this, arguments); 22876}; 22877Object.defineProperty(exports, "__esModule", { value: true }); 22878var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 22879var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 22880var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 22881var component_3 = __webpack_require__(/*! @material/tab-indicator/component */ "./packages/mdc-tab-indicator/component.ts"); 22882var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts"); 22883var MDCTab = /** @class */function (_super) { 22884 __extends(MDCTab, _super); 22885 function MDCTab() { 22886 return _super !== null && _super.apply(this, arguments) || this; 22887 } 22888 MDCTab.attachTo = function (root) { 22889 return new MDCTab(root); 22890 }; 22891 MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) { 22892 if (rippleFactory === void 0) { 22893 rippleFactory = function rippleFactory(el, foundation) { 22894 return new component_2.MDCRipple(el, foundation); 22895 }; 22896 } 22897 if (tabIndicatorFactory === void 0) { 22898 tabIndicatorFactory = function tabIndicatorFactory(el) { 22899 return new component_3.MDCTabIndicator(el); 22900 }; 22901 } 22902 this.id = this.root.id; 22903 var rippleSurface = this.root.querySelector(foundation_2.MDCTabFoundation.strings.RIPPLE_SELECTOR); 22904 var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { addClass: function addClass(className) { 22905 return rippleSurface.classList.add(className); 22906 }, removeClass: function removeClass(className) { 22907 return rippleSurface.classList.remove(className); 22908 }, updateCssVariable: function updateCssVariable(varName, value) { 22909 return rippleSurface.style.setProperty(varName, value); 22910 } }); 22911 var rippleFoundation = new foundation_1.MDCRippleFoundation(rippleAdapter); 22912 this.ripple_ = rippleFactory(this.root, rippleFoundation); 22913 var tabIndicatorElement = this.root.querySelector(foundation_2.MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR); 22914 this.tabIndicator_ = tabIndicatorFactory(tabIndicatorElement); 22915 this.content_ = this.root.querySelector(foundation_2.MDCTabFoundation.strings.CONTENT_SELECTOR); 22916 }; 22917 MDCTab.prototype.initialSyncWithDOM = function () { 22918 var _this = this; 22919 this.handleClick_ = function () { 22920 return _this.foundation.handleClick(); 22921 }; 22922 this.listen('click', this.handleClick_); 22923 }; 22924 MDCTab.prototype.destroy = function () { 22925 this.unlisten('click', this.handleClick_); 22926 this.ripple_.destroy(); 22927 _super.prototype.destroy.call(this); 22928 }; 22929 MDCTab.prototype.getDefaultFoundation = function () { 22930 var _this = this; 22931 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 22932 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 22933 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 22934 var adapter = { 22935 setAttr: function setAttr(attr, value) { 22936 return _this.root.setAttribute(attr, value); 22937 }, 22938 addClass: function addClass(className) { 22939 return _this.root.classList.add(className); 22940 }, 22941 removeClass: function removeClass(className) { 22942 return _this.root.classList.remove(className); 22943 }, 22944 hasClass: function hasClass(className) { 22945 return _this.root.classList.contains(className); 22946 }, 22947 activateIndicator: function activateIndicator(previousIndicatorClientRect) { 22948 return _this.tabIndicator_.activate(previousIndicatorClientRect); 22949 }, 22950 deactivateIndicator: function deactivateIndicator() { 22951 return _this.tabIndicator_.deactivate(); 22952 }, 22953 notifyInteracted: function notifyInteracted() {
22954 return _this.emit(foundation_2.MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */); 22955 }, 22956 getOffsetLeft: function getOffsetLeft() { 22957 return _this.root.offsetLeft; 22958 }, 22959 getOffsetWidth: function getOffsetWidth() { 22960 return _this.root.offsetWidth; 22961 }, 22962 getContentOffsetLeft: function getContentOffsetLeft() { 22963 return _this.content_.offsetLeft; 22964 }, 22965 getContentOffsetWidth: function getContentOffsetWidth() { 22966 return _this.content_.offsetWidth; 22967 }, 22968 focus: function focus() { 22969 return _this.root.focus(); 22970 } 22971 }; 22972 // tslint:enable:object-literal-sort-keys 22973 return new foundation_2.MDCTabFoundation(adapter); 22974 }; 22975 Object.defineProperty(MDCTab.prototype, "active", { 22976 /** 22977 * Getter for the active state of the tab 22978 */ 22979 get: function get() { 22980 return this.foundation.isActive(); 22981 }, 22982 enumerable: true, 22983 configurable: true 22984 }); 22985 Object.defineProperty(MDCTab.prototype, "focusOnActivate", { 22986 set: function set(focusOnActivate) { 22987 this.foundation.setFocusOnActivate(focusOnActivate); 22988 }, 22989 enumerable: true, 22990 configurable: true 22991 }); 22992 /** 22993 * Activates the tab 22994 */ 22995 MDCTab.prototype.activate = function (computeIndicatorClientRect) { 22996 this.foundation.activate(computeIndicatorClientRect); 22997 }; 22998 /** 22999 * Deactivates the tab 23000 */ 23001 MDCTab.prototype.deactivate = function () { 23002 this.foundation.deactivate(); 23003 }; 23004 /** 23005 * Returns the indicator's client rect 23006 */ 23007 MDCTab.prototype.computeIndicatorClientRect = function () { 23008 return this.tabIndicator_.computeContentClientRect(); 23009 }; 23010 MDCTab.prototype.computeDimensions = function () { 23011 return this.foundation.computeDimensions(); 23012 }; 23013 /** 23014 * Focuses the tab 23015 */ 23016 MDCTab.prototype.focus = function () { 23017 this.root.focus(); 23018 }; 23019 return MDCTab; 23020}(component_1.MDCComponent); 23021exports.MDCTab = MDCTab; 23022 23023/***/ }), 23024
23025/***/ "./packages/mdc-tab/constants.ts": 23026/*!***************************************!*\ 23027 !*** ./packages/mdc-tab/constants.ts ***! 23028 \***************************************/ 23029/*! no static exports found */ 23030/***/ (function(module, exports, __webpack_require__) { 23031 23032"use strict"; 23033 23034/** 23035 * @license 23036 * Copyright 2018 Google Inc. 23037 * 23038 * Permission is hereby granted, free of charge, to any person obtaining a copy 23039 * of this software and associated documentation files (the "Software"), to deal 23040 * in the Software without restriction, including without limitation the rights 23041 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23042 * copies of the Software, and to permit persons to whom the Software is 23043 * furnished to do so, subject to the following conditions: 23044 * 23045 * The above copyright notice and this permission notice shall be included in 23046 * all copies or substantial portions of the Software. 23047 * 23048 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23049 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23050 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23051 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23052 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23053 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23054 * THE SOFTWARE. 23055 */ 23056 23057Object.defineProperty(exports, "__esModule", { value: true });
23058var cssClasses = { 23059 ACTIVE: 'mdc-tab--active' 23060}; 23061exports.cssClasses = cssClasses; 23062var strings = { 23063 ARIA_SELECTED: 'aria-selected', 23064 CONTENT_SELECTOR: '.mdc-tab__content', 23065 INTERACTED_EVENT: 'MDCTab:interacted', 23066 RIPPLE_SELECTOR: '.mdc-tab__ripple', 23067 TABINDEX: 'tabIndex', 23068 TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator' 23069}; 23070exports.strings = strings; 23071 23072/***/ }), 23073
vendor: 3,145 bytes, lines 23074-23148
23074/***/ "./packages/mdc-tab/foundation.ts": 23075/*!****************************************!*\ 23076 !*** ./packages/mdc-tab/foundation.ts ***! 23077 \****************************************/ 23078/*! no static exports found */ 23079/***/ (function(module, exports, __webpack_require__) { 23080 23081"use strict"; 23082 23083/** 23084 * @license 23085 * Copyright 2018 Google Inc. 23086 * 23087 * Permission is hereby granted, free of charge, to any person obtaining a copy 23088 * of this software and associated documentation files (the "Software"), to deal 23089 * in the Software without restriction, including without limitation the rights 23090 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23091 * copies of the Software, and to permit persons to whom the Software is 23092 * furnished to do so, subject to the following conditions: 23093 * 23094 * The above copyright notice and this permission notice shall be included in 23095 * all copies or substantial portions of the Software. 23096 * 23097 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23098 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23099 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23100 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23101 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23102 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23103 * THE SOFTWARE. 23104 */ 23105 23106var __extends = this && this.__extends || function () { 23107 var _extendStatics = function extendStatics(d, b) { 23108 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 23109 d.__proto__ = b; 23110 } || function (d, b) { 23111 for (var p in b) { 23112 if (b.hasOwnProperty(p)) d[p] = b[p]; 23113 } 23114 }; 23115 return _extendStatics(d, b); 23116 }; 23117 return function (d, b) { 23118 _extendStatics(d, b); 23119 function __() { 23120 this.constructor = d; 23121 } 23122 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 23123 }; 23124}(); 23125var __assign = this && this.__assign || function () { 23126 __assign = Object.assign || function (t) { 23127 for (var s, i = 1, n = arguments.length; i < n; i++) { 23128 s = arguments[i]; 23129 for (var p in s) { 23130 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 23131 } 23132 } 23133 return t; 23134 }; 23135 return __assign.apply(this, arguments); 23136}; 23137Object.defineProperty(exports, "__esModule", { value: true }); 23138var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 23139var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts"); 23140var MDCTabFoundation = /** @class */function (_super) { 23141 __extends(MDCTabFoundation, _super); 23142 function MDCTabFoundation(adapter) { 23143 var _this = _super.call(this, __assign(__assign({}, MDCTabFoundation.defaultAdapter), adapter)) || this; 23144 _this.focusOnActivate_ = true; 23145 return _this; 23146 } 23147 Object.defineProperty(MDCTabFoundation, "cssClasses", { 23148 get: function get() {
23149 return constants_1.cssClasses; 23150 }, 23151 enumerable: true, 23152 configurable: true 23153 }); 23154 Object.defineProperty(MDCTabFoundation, "strings", { 23155 get: function get() { 23156 return constants_1.strings; 23157 }, 23158 enumerable: true, 23159 configurable: true 23160 }); 23161 Object.defineProperty(MDCTabFoundation, "defaultAdapter", { 23162 get: function get() { 23163 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 23164 return { 23165 addClass: function addClass() { 23166 return undefined; 23167 }, 23168 removeClass: function removeClass() { 23169 return undefined; 23170 }, 23171 hasClass: function hasClass() { 23172 return false; 23173 }, 23174 setAttr: function setAttr() { 23175 return undefined; 23176 }, 23177 activateIndicator: function activateIndicator() { 23178 return undefined; 23179 }, 23180 deactivateIndicator: function deactivateIndicator() { 23181 return undefined; 23182 }, 23183 notifyInteracted: function notifyInteracted() { 23184 return undefined; 23185 }, 23186 getOffsetLeft: function getOffsetLeft() { 23187 return 0; 23188 }, 23189 getOffsetWidth: function getOffsetWidth() { 23190 return 0; 23191 }, 23192 getContentOffsetLeft: function getContentOffsetLeft() { 23193 return 0; 23194 }, 23195 getContentOffsetWidth: function getContentOffsetWidth() { 23196 return 0; 23197 }, 23198 focus: function focus() { 23199 return undefined; 23200 } 23201 }; 23202 // tslint:enable:object-literal-sort-keys 23203 }, 23204 enumerable: true, 23205 configurable: true 23206 }); 23207 MDCTabFoundation.prototype.handleClick = function () { 23208 // It's up to the parent component to keep track of the active Tab and 23209 // ensure we don't activate a Tab that's already active. 23210 this.adapter.notifyInteracted(); 23211 }; 23212 MDCTabFoundation.prototype.isActive = function () {
23213 return this.adapter.hasClass(constants_1.cssClasses.ACTIVE); 23214 }; 23215 /** 23216 * Sets whether the tab should focus itself when activated 23217 */ 23218 MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) { 23219 this.focusOnActivate_ = focusOnActivate; 23220 }; 23221 /** 23222 * Activates the Tab 23223 */ 23224 MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) { 23225 this.adapter.addClass(constants_1.cssClasses.ACTIVE); 23226 this.adapter.setAttr(constants_1.strings.ARIA_SELECTED, 'true'); 23227 this.adapter.setAttr(constants_1.strings.TABINDEX, '0'); 23228 this.adapter.activateIndicator(previousIndicatorClientRect); 23229 if (this.focusOnActivate_) { 23230 this.adapter.focus(); 23231 } 23232 }; 23233 /** 23234 * Deactivates the Tab 23235 */ 23236 MDCTabFoundation.prototype.deactivate = function () { 23237 // Early exit 23238 if (!this.isActive()) { 23239 return; 23240 } 23241 this.adapter.removeClass(constants_1.cssClasses.ACTIVE); 23242 this.adapter.setAttr(constants_1.strings.ARIA_SELECTED, 'false'); 23243 this.adapter.setAttr(constants_1.strings.TABINDEX, '-1'); 23244 this.adapter.deactivateIndicator(); 23245 }; 23246 /** 23247 * Returns the dimensions of the Tab 23248 */ 23249 MDCTabFoundation.prototype.computeDimensions = function () { 23250 var rootWidth = this.adapter.getOffsetWidth(); 23251 var rootLeft = this.adapter.getOffsetLeft(); 23252 var contentWidth = this.adapter.getContentOffsetWidth(); 23253 var contentLeft = this.adapter.getContentOffsetLeft(); 23254 return { 23255 contentLeft: rootLeft + contentLeft, 23256 contentRight: rootLeft + contentLeft + contentWidth, 23257 rootLeft: rootLeft, 23258 rootRight: rootLeft + rootWidth 23259 }; 23260 }; 23261 return MDCTabFoundation; 23262}(foundation_1.MDCFoundation); 23263exports.MDCTabFoundation = MDCTabFoundation; 23264// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 23265exports.default = MDCTabFoundation; 23266 23267/***/ }), 23268
23269/***/ "./packages/mdc-tab/index.ts": 23270/*!***********************************!*\ 23271 !*** ./packages/mdc-tab/index.ts ***! 23272 \***********************************/ 23273/*! no static exports found */ 23274/***/ (function(module, exports, __webpack_require__) { 23275 23276"use strict"; 23277 23278/** 23279 * @license 23280 * Copyright 2019 Google Inc. 23281 * 23282 * Permission is hereby granted, free of charge, to any person obtaining a copy 23283 * of this software and associated documentation files (the "Software"), to deal 23284 * in the Software without restriction, including without limitation the rights 23285 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23286 * copies of the Software, and to permit persons to whom the Software is 23287 * furnished to do so, subject to the following conditions: 23288 * 23289 * The above copyright notice and this permission notice shall be included in 23290 * all copies or substantial portions of the Software. 23291 * 23292 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23293 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23294 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23295 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23296 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23297 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23298 * THE SOFTWARE. 23299 */ 23300 23301function __export(m) { 23302 for (var p in m) { 23303 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 23304 } 23305} 23306Object.defineProperty(exports, "__esModule", { value: true }); 23307__export(__webpack_require__(/*! ./component */ "./packages/mdc-tab/component.ts")); 23308__export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts")); 23309__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts")); 23310 23311/***/ }), 23312
23313/***/ "./packages/mdc-textfield/character-counter/component.ts": 23314/*!***************************************************************!*\ 23315 !*** ./packages/mdc-textfield/character-counter/component.ts ***! 23316 \***************************************************************/ 23317/*! no static exports found */ 23318/***/ (function(module, exports, __webpack_require__) { 23319 23320"use strict"; 23321 23322/** 23323 * @license 23324 * Copyright 2019 Google Inc. 23325 * 23326 * Permission is hereby granted, free of charge, to any person obtaining a copy 23327 * of this software and associated documentation files (the "Software"), to deal 23328 * in the Software without restriction, including without limitation the rights 23329 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23330 * copies of the Software, and to permit persons to whom the Software is 23331 * furnished to do so, subject to the following conditions: 23332 * 23333 * The above copyright notice and this permission notice shall be included in 23334 * all copies or substantial portions of the Software. 23335 * 23336 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23337 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23338 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23339 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23340 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23341 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23342 * THE SOFTWARE. 23343 */ 23344 23345var __extends = this && this.__extends || function () { 23346 var _extendStatics = function extendStatics(d, b) { 23347 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 23348 d.__proto__ = b; 23349 } || function (d, b) { 23350 for (var p in b) { 23351 if (b.hasOwnProperty(p)) d[p] = b[p]; 23352 } 23353 }; 23354 return _extendStatics(d, b); 23355 }; 23356 return function (d, b) { 23357 _extendStatics(d, b); 23358 function __() { 23359 this.constructor = d; 23360 } 23361 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 23362 }; 23363}(); 23364Object.defineProperty(exports, "__esModule", { value: true }); 23365var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 23366var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"); 23367var MDCTextFieldCharacterCounter = /** @class */function (_super) { 23368 __extends(MDCTextFieldCharacterCounter, _super); 23369 function MDCTextFieldCharacterCounter() { 23370 return _super !== null && _super.apply(this, arguments) || this; 23371 } 23372 MDCTextFieldCharacterCounter.attachTo = function (root) { 23373 return new MDCTextFieldCharacterCounter(root); 23374 }; 23375 Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundationForTextField", { 23376 // Provided for access by MDCTextField component 23377 get: function get() { 23378 return this.foundation; 23379 }, 23380 enumerable: true, 23381 configurable: true 23382 }); 23383 MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () { 23384 var _this = this; 23385 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 23386 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 23387 var adapter = { 23388 setContent: function setContent(content) { 23389 _this.root.textContent = content; 23390 } 23391 }; 23392 return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter); 23393 }; 23394 return MDCTextFieldCharacterCounter; 23395}(component_1.MDCComponent); 23396exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter; 23397 23398/***/ }), 23399
23400/***/ "./packages/mdc-textfield/character-counter/constants.ts": 23401/*!***************************************************************!*\ 23402 !*** ./packages/mdc-textfield/character-counter/constants.ts ***! 23403 \***************************************************************/ 23404/*! no static exports found */ 23405/***/ (function(module, exports, __webpack_require__) { 23406 23407"use strict"; 23408 23409/** 23410 * @license 23411 * Copyright 2019 Google Inc. 23412 * 23413 * Permission is hereby granted, free of charge, to any person obtaining a copy 23414 * of this software and associated documentation files (the "Software"), to deal 23415 * in the Software without restriction, including without limitation the rights 23416 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23417 * copies of the Software, and to permit persons to whom the Software is 23418 * furnished to do so, subject to the following conditions: 23419 * 23420 * The above copyright notice and this permission notice shall be included in 23421 * all copies or substantial portions of the Software. 23422 * 23423 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23424 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23425 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23426 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23427 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23428 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23429 * THE SOFTWARE. 23430 */ 23431 23432Object.defineProperty(exports, "__esModule", { value: true });
23433var cssClasses = { 23434 ROOT: 'mdc-text-field-character-counter' 23435}; 23436exports.cssClasses = cssClasses; 23437var strings = { 23438 ROOT_SELECTOR: "." + cssClasses.ROOT 23439}; 23440exports.strings = strings; 23441 23442/***/ }), 23443
23444/***/ "./packages/mdc-textfield/character-counter/foundation.ts": 23445/*!****************************************************************!*\ 23446 !*** ./packages/mdc-textfield/character-counter/foundation.ts ***! 23447 \****************************************************************/ 23448/*! no static exports found */ 23449/***/ (function(module, exports, __webpack_require__) { 23450 23451"use strict"; 23452 23453/** 23454 * @license 23455 * Copyright 2019 Google Inc. 23456 * 23457 * Permission is hereby granted, free of charge, to any person obtaining a copy 23458 * of this software and associated documentation files (the "Software"), to deal 23459 * in the Software without restriction, including without limitation the rights 23460 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23461 * copies of the Software, and to permit persons to whom the Software is 23462 * furnished to do so, subject to the following conditions: 23463 * 23464 * The above copyright notice and this permission notice shall be included in 23465 * all copies or substantial portions of the Software. 23466 * 23467 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23468 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23469 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23470 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23471 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23472 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23473 * THE SOFTWARE. 23474 */ 23475 23476var __extends = this && this.__extends || function () { 23477 var _extendStatics = function extendStatics(d, b) { 23478 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 23479 d.__proto__ = b; 23480 } || function (d, b) { 23481 for (var p in b) { 23482 if (b.hasOwnProperty(p)) d[p] = b[p]; 23483 } 23484 }; 23485 return _extendStatics(d, b); 23486 }; 23487 return function (d, b) { 23488 _extendStatics(d, b); 23489 function __() { 23490 this.constructor = d; 23491 } 23492 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 23493 }; 23494}(); 23495var __assign = this && this.__assign || function () { 23496 __assign = Object.assign || function (t) { 23497 for (var s, i = 1, n = arguments.length; i < n; i++) { 23498 s = arguments[i]; 23499 for (var p in s) { 23500 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 23501 } 23502 } 23503 return t; 23504 }; 23505 return __assign.apply(this, arguments); 23506}; 23507Object.defineProperty(exports, "__esModule", { value: true }); 23508var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 23509var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts"); 23510var MDCTextFieldCharacterCounterFoundation = /** @class */function (_super) { 23511 __extends(MDCTextFieldCharacterCounterFoundation, _super); 23512 function MDCTextFieldCharacterCounterFoundation(adapter) { 23513 return _super.call(this, __assign(__assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter), adapter)) || this; 23514 } 23515 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", { 23516 get: function get() {
23517 return constants_1.cssClasses; 23518 }, 23519 enumerable: true, 23520 configurable: true 23521 }); 23522 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", { 23523 get: function get() { 23524 return constants_1.strings; 23525 }, 23526 enumerable: true, 23527 configurable: true 23528 }); 23529 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", { 23530 /** 23531 * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types. 23532 */ 23533 get: function get() { 23534 return { 23535 setContent: function setContent() { 23536 return undefined; 23537 } 23538 }; 23539 }, 23540 enumerable: true, 23541 configurable: true 23542 }); 23543 MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) { 23544 currentLength = Math.min(currentLength, maxLength); 23545 this.adapter.setContent(currentLength + " / " + maxLength); 23546 }; 23547 return MDCTextFieldCharacterCounterFoundation; 23548}(foundation_1.MDCFoundation); 23549exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation; 23550// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 23551exports.default = MDCTextFieldCharacterCounterFoundation; 23552 23553/***/ }), 23554
23555/***/ "./packages/mdc-textfield/character-counter/index.ts": 23556/*!***********************************************************!*\ 23557 !*** ./packages/mdc-textfield/character-counter/index.ts ***! 23558 \***********************************************************/ 23559/*! no static exports found */ 23560/***/ (function(module, exports, __webpack_require__) { 23561 23562"use strict"; 23563 23564/** 23565 * @license 23566 * Copyright 2019 Google Inc. 23567 * 23568 * Permission is hereby granted, free of charge, to any person obtaining a copy 23569 * of this software and associated documentation files (the "Software"), to deal 23570 * in the Software without restriction, including without limitation the rights 23571 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23572 * copies of the Software, and to permit persons to whom the Software is 23573 * furnished to do so, subject to the following conditions: 23574 * 23575 * The above copyright notice and this permission notice shall be included in 23576 * all copies or substantial portions of the Software. 23577 * 23578 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23579 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23580 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23581 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23582 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23583 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23584 * THE SOFTWARE. 23585 */ 23586 23587function __export(m) { 23588 for (var p in m) { 23589 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 23590 } 23591} 23592Object.defineProperty(exports, "__esModule", { value: true }); 23593__export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/character-counter/component.ts")); 23594__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts")); 23595var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
23596exports.characterCountCssClasses = constants_1.cssClasses; 23597exports.characterCountStrings = constants_1.strings; 23598 23599/***/ }), 23600
23601/***/ "./packages/mdc-textfield/component.ts": 23602/*!*********************************************!*\ 23603 !*** ./packages/mdc-textfield/component.ts ***! 23604 \*********************************************/ 23605/*! no static exports found */ 23606/***/ (function(module, exports, __webpack_require__) { 23607 23608"use strict"; 23609 23610/** 23611 * @license 23612 * Copyright 2016 Google Inc. 23613 * 23614 * Permission is hereby granted, free of charge, to any person obtaining a copy 23615 * of this software and associated documentation files (the "Software"), to deal 23616 * in the Software without restriction, including without limitation the rights 23617 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23618 * copies of the Software, and to permit persons to whom the Software is 23619 * furnished to do so, subject to the following conditions: 23620 * 23621 * The above copyright notice and this permission notice shall be included in 23622 * all copies or substantial portions of the Software. 23623 * 23624 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23625 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23626 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23627 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23628 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23629 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23630 * THE SOFTWARE. 23631 */ 23632 23633var __extends = this && this.__extends || function () { 23634 var _extendStatics = function extendStatics(d, b) { 23635 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 23636 d.__proto__ = b; 23637 } || function (d, b) { 23638 for (var p in b) { 23639 if (b.hasOwnProperty(p)) d[p] = b[p]; 23640 } 23641 }; 23642 return _extendStatics(d, b); 23643 }; 23644 return function (d, b) { 23645 _extendStatics(d, b); 23646 function __() { 23647 this.constructor = d; 23648 } 23649 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 23650 }; 23651}(); 23652var __assign = this && this.__assign || function () { 23653 __assign = Object.assign || function (t) { 23654 for (var s, i = 1, n = arguments.length; i < n; i++) { 23655 s = arguments[i]; 23656 for (var p in s) { 23657 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 23658 } 23659 } 23660 return t; 23661 }; 23662 return __assign.apply(this, arguments); 23663}; 23664var __importStar = this && this.__importStar || function (mod) { 23665 if (mod && mod.__esModule) return mod; 23666 var result = {}; 23667 if (mod != null) for (var k in mod) { 23668 if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 23669 }result["default"] = mod; 23670 return result; 23671}; 23672Object.defineProperty(exports, "__esModule", { value: true }); 23673var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 23674var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 23675var ponyfill = __importStar(__webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts")); 23676var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts"); 23677var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts"); 23678var component_4 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts"); 23679var component_5 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 23680var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 23681var component_6 = __webpack_require__(/*! ./character-counter/component */ "./packages/mdc-textfield/character-counter/component.ts"); 23682var foundation_2 = __webpack_require__(/*! ./character-counter/foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"); 23683var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"); 23684var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts");
23685var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-textfield/helper-text/component.ts"); 23686var foundation_4 = __webpack_require__(/*! ./helper-text/foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"); 23687var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-textfield/icon/component.ts"); 23688var MDCTextField = /** @class */function (_super) { 23689 __extends(MDCTextField, _super); 23690 function MDCTextField() { 23691 return _super !== null && _super.apply(this, arguments) || this; 23692 } 23693 MDCTextField.attachTo = function (root) { 23694 return new MDCTextField(root); 23695 }; 23696 MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) { 23697 if (rippleFactory === void 0) { 23698 rippleFactory = function rippleFactory(el, foundation) { 23699 return new component_5.MDCRipple(el, foundation); 23700 }; 23701 } 23702 if (lineRippleFactory === void 0) { 23703 lineRippleFactory = function lineRippleFactory(el) { 23704 return new component_3.MDCLineRipple(el); 23705 }; 23706 } 23707 if (helperTextFactory === void 0) { 23708 helperTextFactory = function helperTextFactory(el) { 23709 return new component_7.MDCTextFieldHelperText(el); 23710 }; 23711 } 23712 if (characterCounterFactory === void 0) { 23713 characterCounterFactory = function characterCounterFactory(el) { 23714 return new component_6.MDCTextFieldCharacterCounter(el); 23715 }; 23716 } 23717 if (iconFactory === void 0) { 23718 iconFactory = function iconFactory(el) { 23719 return new component_8.MDCTextFieldIcon(el); 23720 }; 23721 } 23722 if (labelFactory === void 0) { 23723 labelFactory = function labelFactory(el) { 23724 return new component_2.MDCFloatingLabel(el); 23725 }; 23726 } 23727 if (outlineFactory === void 0) { 23728 outlineFactory = function outlineFactory(el) { 23729 return new component_4.MDCNotchedOutline(el); 23730 }; 23731 } 23732 this.input_ = this.root.querySelector(constants_1.strings.INPUT_SELECTOR); 23733 var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR); 23734 this.label_ = labelElement ? labelFactory(labelElement) : null; 23735 var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR); 23736 this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null; 23737 var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR); 23738 this.outline_ = outlineElement ? outlineFactory(outlineElement) : null; 23739 // Helper text 23740 var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings; 23741 var nextElementSibling = this.root.nextElementSibling; 23742 var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasse
23742s.HELPER_LINE); 23743 var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR); 23744 this.helperText_ = helperTextEl ? helperTextFactory(helperTextEl) : null; 23745 // Character counter 23746 var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings; 23747 var characterCounterEl = this.root.querySelector(characterCounterStrings.ROOT_SELECTOR); 23748 // If character counter is not found in root element search in sibling element. 23749 if (!characterCounterEl && hasHelperLine && nextElementSibling) { 23750 characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR); 23751 } 23752 this.characterCounter_ = characterCounterEl ? characterCounterFactory(characterCounterEl) : null; 23753 // Leading icon 23754 var leadingIconEl = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR); 23755 this.leadingIcon_ = leadingIconEl ? iconFactory(leadingIconEl) : null; 23756 // Trailing icon 23757 var trailingIconEl = this.root.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR); 23758 this.trailingIcon_ = trailingIconEl ? iconFactory(trailingIconEl) : null; 23759 // Prefix and Suffix 23760 this.prefix_ = this.root.querySelector(constants_1.strings.PREFIX_SELECTOR); 23761 this.suffix_ = this.root.querySelector(constants_1.strings.SUFFIX_SELECTOR); 23762 this.ripple = this.createRipple_(rippleFactory); 23763 }; 23764 MDCTextField.prototype.destroy = function () { 23765 if (this.ripple) { 23766 this.ripple.destroy(); 23767 } 23768 if (this.lineRipple_) { 23769 this.lineRipple_.destroy(); 23770 } 23771 if (this.helperText_) { 23772 this.helperText_.destroy(); 23773 } 23774 if (this.characterCounter_) { 23775 this.characterCounter_.destroy(); 23776 } 23777 if (this.leadingIcon_) { 23778 this.leadingIcon_.destroy(); 23779 } 23780 if (this.trailingIcon_) { 23781 this.trailingIcon_.destroy(); 23782 } 23783 if (this.label_) { 23784 this.label_.destroy(); 23785 } 23786 if (this.outline_) { 23787 this.outline_.destroy(); 23788 } 23789 _super.prototype.destroy.call(this); 23790 }; 23791 /** 23792 * Initializes the Text Field's internal state based on the environment's 23793 * state. 23794 */ 23795 MDCTextField.prototype.initialSyncWithDOM = function () { 23796 this.disabled = this.input_.disabled; 23797 }; 23798 Object.defineProperty(MDCTextField.prototype, "value", { 23799 get: function get() { 23800 return this.foundation.getValue(); 23801 }, 23802 /** 23803 * @param value The value to set on the input. 23804 */ 23805 set: function set(value) { 23806 this.foundation.setValue(value); 23807 }, 23808 enumerable: true, 23809 configurable: true 23810 }); 23811 Object.defineProperty(MDCTextField.prototype, "disabled", { 23812 get: function get() { 23813 return this.foundation.isDisabled(); 23814 }, 23815 /** 23816 * @param disabled Sets the Text Field disabled or enabled. 23817 */ 23818 set: function set(disabled) { 23819 this.foundation.setDisabled(disabled); 23820 }, 23821 enumerable: true, 23822 configurable: true 23823 }); 23824 Object.defineProperty(MDCTextField.prototype, "valid", { 23825 get: function get() { 23826 return this.foundation.isValid(); 23827 }, 23828 /** 23829 * @param valid Sets the Text Field valid or invalid. 23830 */ 23831 set: function set(valid) { 23832 this.foundation.setValid(valid); 23833 }, 23834 enumerable: true, 23835 configurable: true 23836 }); 23837 Object.defineProperty(MDCTextField.prototype, "required", { 23838 get: function get() { 23839 return this.input_.required; 23840 }, 23841 /** 23842 * @param required Sets the Text Field to required. 23843 */ 23844 set: function set(required) { 23845 this.input_.required = required; 23846 }, 23847 enumerable: true, 23848 configurable: true 23849 }); 23850 Object.defineProperty(MDCTextField.prototype, "pattern", { 23851 get: function get() { 23852 return this.input_.pattern; 23853 }, 23854 /** 23855 * @param pattern Sets the input element's validation pattern. 23856 */ 23857 set: function set(pattern) { 23858 this.input_.pattern = pattern; 23859 }, 23860 enumerable: true, 23861 configurable: true 23862 });
23863 Object.defineProperty(MDCTextField.prototype, "minLength", { 23864 get: function get() { 23865 return this.input_.minLength; 23866 }, 23867 /** 23868 * @param minLength Sets the input element's minLength. 23869 */ 23870 set: function set(minLength) { 23871 this.input_.minLength = minLength; 23872 }, 23873 enumerable: true, 23874 configurable: true 23875 }); 23876 Object.defineProperty(MDCTextField.prototype, "maxLength", { 23877 get: function get() { 23878 return this.input_.maxLength; 23879 }, 23880 /** 23881 * @param maxLength Sets the input element's maxLength. 23882 */ 23883 set: function set(maxLength) { 23884 // Chrome throws exception if maxLength is set to a value less than zero 23885 if (maxLength < 0) { 23886 this.input_.removeAttribute('maxLength'); 23887 } else { 23888 this.input_.maxLength = maxLength; 23889 } 23890 }, 23891 enumerable: true, 23892 configurable: true 23893 }); 23894 Object.defineProperty(MDCTextField.prototype, "min", { 23895 get: function get() { 23896 return this.input_.min; 23897 }, 23898 /** 23899 * @param min Sets the input element's min. 23900 */ 23901 set: function set(min) { 23902 this.input_.min = min; 23903 }, 23904 enumerable: true, 23905 configurable: true 23906 }); 23907 Object.defineProperty(MDCTextField.prototype, "max", { 23908 get: function get() { 23909 return this.input_.max; 23910 }, 23911 /** 23912 * @param max Sets the input element's max. 23913 */ 23914 set: function set(max) { 23915 this.input_.max = max; 23916 }, 23917 enumerable: true, 23918 configurable: true 23919 }); 23920 Object.defineProperty(MDCTextField.prototype, "step", { 23921 get: function get() { 23922 return this.input_.step; 23923 }, 23924 /** 23925 * @param step Sets the input element's step. 23926 */ 23927 set: function set(step) { 23928 this.input_.step = step; 23929 }, 23930 enumerable: true, 23931 configurable: true 23932 }); 23933 Object.defineProperty(MDCTextField.prototype, "helperTextContent", { 23934 /** 23935 * Sets the helper text element content. 23936 */ 23937 set: function set(content) { 23938 this.foundation.setHelperTextContent(content); 23939 }, 23940 enumerable: true, 23941 configurable: true 23942 }); 23943 Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", { 23944 /** 23945 * Sets the aria label of the leading icon. 23946 */ 23947 set: function set(label) { 23948 this.foundation.setLeadingIconAriaLabel(label); 23949 }, 23950 enumerable: true, 23951 configurable: true 23952 }); 23953 Object.defineProperty(MDCTextField.prototype, "leadingIconContent", { 23954 /** 23955 * Sets the text content of the leading icon. 23956 */ 23957 set: function set(content) { 23958 this.foundation.setLeadingIconContent(content); 23959 }, 23960 enumerable: true, 23961 configurable: true 23962 }); 23963 Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", { 23964 /** 23965 * Sets the aria label of the trailing icon. 23966 */ 23967 set: function set(label) { 23968 this.foundation.setTrailingIconAriaLabel(label); 23969 }, 23970 enumerable: true, 23971 configurable: true 23972 }); 23973 Object.defineProperty(MDCTextField.prototype, "trailingIconContent", { 23974 /** 23975 * Sets the text content of the trailing icon. 23976 */ 23977 set: function set(content) { 23978 this.foundation.setTrailingIconContent(content); 23979 }, 23980 enumerable: true, 23981 configurable: true 23982 }); 23983 Object.defineProperty(MDCTextField.prototype, "useNativeValidation", { 23984 /** 23985 * Enables or disables the use of native validation. Use this for custom validation. 23986 * @param useNativeValidation Set this to false to ignore native input validation. 23987 */ 23988 set: function set(useNativeValidation) { 23989 this.foundation.setUseNativeValidation(useNativeValidation); 23990 }, 23991 enumerable: true, 23992 configurable: true 23993 });
23994 Object.defineProperty(MDCTextField.prototype, "prefixText", { 23995 /** 23996 * Gets the text content of the prefix, or null if it does not exist. 23997 */ 23998 get: function get() { 23999 return this.prefix_ ? this.prefix_.textContent : null; 24000 }, 24001 /** 24002 * Sets the text content of the prefix, if it exists. 24003 */ 24004 set: function set(prefixText) { 24005 if (this.prefix_) { 24006 this.prefix_.textContent = prefixText; 24007 } 24008 }, 24009 enumerable: true, 24010 configurable: true 24011 }); 24012 Object.defineProperty(MDCTextField.prototype, "suffixText", { 24013 /** 24014 * Gets the text content of the suffix, or null if it does not exist. 24015 */ 24016 get: function get() { 24017 return this.suffix_ ? this.suffix_.textContent : null; 24018 }, 24019 /** 24020 * Sets the text content of the suffix, if it exists. 24021 */ 24022 set: function set(suffixText) { 24023 if (this.suffix_) { 24024 this.suffix_.textContent = suffixText; 24025 } 24026 }, 24027 enumerable: true, 24028 configurable: true 24029 }); 24030 /** 24031 * Focuses the input element. 24032 */ 24033 MDCTextField.prototype.focus = function () { 24034 this.input_.focus(); 24035 }; 24036 /** 24037 * Recomputes the outline SVG path for the outline element. 24038 */ 24039 MDCTextField.prototype.layout = function () { 24040 var openNotch = this.foundation.shouldFloat; 24041 this.foundation.notchOutline(openNotch); 24042 }; 24043 MDCTextField.prototype.getDefaultFoundation = function () { 24044 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 24045 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 24046 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 24047 var adapter = __assign(__assign(__assign(__assign(__assign({}, this.getRootAdapterMethods_()), this.getInputAdapterMethods_()), this.getLabelAdapterMethods_()), this.getLineRippleAdapterMethods_()), this.getOutlineAdapterMethods_()); 24048 // tslint:enable:object-literal-sort-keys 24049 return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap_()); 24050 }; 24051 MDCTextField.prototype.getRootAdapterMethods_ = function () { 24052 var _this = this; 24053 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 24054 return { 24055 addClass: function addClass(className) { 24056 return _this.root.classList.add(className); 24057 }, 24058 removeClass: function removeClass(className) { 24059 return _this.root.classList.remove(className); 24060 }, 24061 hasClass: function hasClass(className) { 24062 return _this.root.classList.contains(className); 24063 }, 24064 registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) { 24065 _this.listen(evtType, handler); 24066 }, 24067 deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) { 24068 _this.unlisten(evtType, handler); 24069 }, 24070 registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) { 24071 var getAttributesList = function getAttributesList(mutationsList) { 24072 return mutationsList.map(function (mutation) { 24073 return mutation.attributeName; 24074 }).filter(function (attributeName) { 24075 return attributeName; 24076 }); 24077 }; 24078 var observer = new MutationObserver(function (mutationsList) { 24079 return handler(getAttributesList(mutationsList)); 24080 }); 24081 var config = { attributes: true }; 24082 observer.observe(_this.input_, config); 24083 return observer; 24084 }, 24085 deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) { 24086 observer.disconnect(); 24087 } 24088 }; 24089 // tslint:enable:object-literal-sort-keys 24090 }; 24091 MDCTextField.prototype.getInputAdapterMethods_ = function () { 24092 var _this = this; 24093 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 24094 return { 24095 getNativeInput: function getNativeInput() { 24096 return _this.input_; 24097 }, 24098 setInputAttr: function setInputAttr(attr, value) { 24099 _this.input_.setAttribute(attr, value); 24100 }, 24101 removeInputAttr: function removeInputAttr(attr) { 24102 _this.input_.removeAttribute(attr); 24103 }, 24104 isFocused: function isFocused() { 24105 return document.activeElement === _this.input_; 24106 }, 24107 registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) { 24108 _this.input_.addEventListener(evtType, handler, events_1.applyPassive()); 24109 }, 24110 deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) { 24111 _this.input_.removeEventListener(evtType, handler, events_1.applyPassive()); 24112 } 24113 }; 24114 // tslint:enable:object-literal-sort-keys 24115 }; 24116 MDCTextField.prototype.getLabelAdapterMethods_ = function () { 24117 var _this = this; 24118 return { 24119 floatLabel: function floatLabel(shouldFloat) { 24120 return _this.label_ && _this.label_.float(shouldFloat); 24121 }, 24122 getLabelWidth: function getLabelWidth() { 24123 return _this.label_ ? _this.label_.getWidth() : 0; 24124 }, 24125 hasLabel: function hasLabel() { 24126 return Boolean(_this.label_); 24127 }, 24128 shakeLabel: function shakeLabel(shouldShake) { 24129 return _this.label_ && _this.label_.shake(shouldShake); 24130 }, 24131 setLabelRequired: function setLabelRequired(isRequired) { 24132 return _this.label_ && _this.label_.setRequired(isRequired); 24133 } 24134 }; 24135 }; 24136 MDCTextField.prototype.getLineRippleAdapterMethods_ = function () { 24137 var _this = this; 24138 return { 24139 activateLineRipple: function activateLineRipple() { 24140 if (_this.lineRipple_) { 24141 _this.lineRipple_.activate(); 24142 } 24143 }, 24144 deactivateLineRipple: function deactivateLineRipple() { 24145 if (_this.lineRipple_) { 24146 _this.lineRipple_.deactivate(); 24147 } 24148 }, 24149 setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) { 24150 if (_this.lineRipple_) { 24151 _this.lineRipple_.setRippleCenter(normalizedX); 24152 } 24153 } 24154 }; 24155 }; 24156 MDCTextField.prototype.getOutlineAdapterMethods_ = function () { 24157 var _this = this; 24158 return { 24159 closeOutline: function closeOutline() { 24160 return _this.outline_ && _this.outline_.closeNotch(); 24161 }, 24162 hasOutline: function hasOutline() { 24163 return Boolean(_this.outline_); 24164 }, 24165 notchOutline: function notchOutline(labelWidth) { 24166 return _this.outline_ && _this.outline_.notch(labelWidth); 24167 } 24168 }; 24169 }; 24170 /** 24171 * @return A map of all subcomponents to subfoundations. 24172 */ 24173 MDCTextField.prototype.getFoundationMap_ = function () { 24174 return { 24175 characterCounter: this.characterCounter_ ? this.characterCounter_.foundationForTextField : undefined, 24176 helperText: this.helperText_ ? this.helperText_.foundationForTextField : undefined, 24177 leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundationForTextField : undefined, 24178 trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundationForTextField : undefined 24179 }; 24180 }; 24181 MDCTextField.prototype.createRipple_ = function (rippleFactory) { 24182 var _this = this; 24183 var isTextArea = this.root.classList.contains(constants_1.cssClasse
24183s.TEXTAREA); 24184 var isOutlined = this.root.classList.contains(constants_1.cssClasses.OUTLINED); 24185 if (isTextArea || isOutlined) { 24186 return null; 24187 } 24188 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 24189 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 24190 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 24191 var adapter = __assign(__assign({}, component_5.MDCRipple.createAdapter(this)), { isSurfaceActive: function isSurfaceActive() { 24192 return ponyfill.matches(_this.input_, ':active'); 24193 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 24194 return _this.input_.addEventListener(evtType, handler, events_1.applyPassive()); 24195 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 24196 return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive()); 24197 } }); 24198 // tslint:enable:object-literal-sort-keys 24199 return rippleFactory(this.root, new foundation_1.MDCRippleFoundation(adapter)); 24200 }; 24201 return MDCTextField; 24202}(component_1.MDCComponent); 24203exports.MDCTextField = MDCTextField; 24204 24205/***/ }), 24206
24207/***/ "./packages/mdc-textfield/constants.ts": 24208/*!*********************************************!*\ 24209 !*** ./packages/mdc-textfield/constants.ts ***! 24210 \*********************************************/ 24211/*! no static exports found */ 24212/***/ (function(module, exports, __webpack_require__) { 24213 24214"use strict"; 24215 24216/** 24217 * @license 24218 * Copyright 2016 Google Inc. 24219 * 24220 * Permission is hereby granted, free of charge, to any person obtaining a copy 24221 * of this software and associated documentation files (the "Software"), to deal 24222 * in the Software without restriction, including without limitation the rights 24223 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24224 * copies of the Software, and to permit persons to whom the Software is 24225 * furnished to do so, subject to the following conditions: 24226 * 24227 * The above copyright notice and this permission notice shall be included in 24228 * all copies or substantial portions of the Software. 24229 * 24230 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24231 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24232 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24233 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24234 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24235 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24236 * THE SOFTWARE. 24237 */ 24238 24239Object.defineProperty(exports, "__esModule", { value: true }); 24240var strings = { 24241 ARIA_CONTROLS: 'aria-controls', 24242 ARIA_DESCRIBEDBY: 'aria-describedby', 24243 INPUT_SELECTOR: '.mdc-text-field__input', 24244 LABEL_SELECTOR: '.mdc-floating-label', 24245 LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading', 24246 LINE_RIPPLE_SELECTOR: '.mdc-line-ripple', 24247 OUTLINE_SELECTOR: '.mdc-notched-outline', 24248 PREFIX_SELECTOR: '.mdc-text-field__affix--prefix', 24249 SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix', 24250 TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing' 24251}; 24252exports.strings = strings;
24253var cssClasses = { 24254 DISABLED: 'mdc-text-field--disabled', 24255 FOCUSED: 'mdc-text-field--focused', 24256 HELPER_LINE: 'mdc-text-field-helper-line', 24257 INVALID: 'mdc-text-field--invalid', 24258 LABEL_FLOATING: 'mdc-text-field--label-floating', 24259 NO_LABEL: 'mdc-text-field--no-label', 24260 OUTLINED: 'mdc-text-field--outlined', 24261 ROOT: 'mdc-text-field', 24262 TEXTAREA: 'mdc-text-field--textarea', 24263 WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon', 24264 WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon' 24265}; 24266exports.cssClasses = cssClasses; 24267var numbers = { 24268 LABEL_SCALE: 0.75 24269}; 24270exports.numbers = numbers; 24271/** 24272 * Whitelist based off of https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation 24273 * under the "Validation-related attributes" section. 24274 */ 24275var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength']; 24276exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST; 24277/** 24278 * Label should always float for these types as they show some UI even if value is empty. 24279 */ 24280var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week']; 24281exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES; 24282 24283/***/ }), 24284
24285/***/ "./packages/mdc-textfield/foundation.ts": 24286/*!**********************************************!*\ 24287 !*** ./packages/mdc-textfield/foundation.ts ***! 24288 \**********************************************/ 24289/*! no static exports found */ 24290/***/ (function(module, exports, __webpack_require__) { 24291 24292"use strict"; 24293 24294/** 24295 * @license 24296 * Copyright 2016 Google Inc. 24297 * 24298 * Permission is hereby granted, free of charge, to any person obtaining a copy 24299 * of this software and associated documentation files (the "Software"), to deal 24300 * in the Software without restriction, including without limitation the rights 24301 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24302 * copies of the Software, and to permit persons to whom the Software is 24303 * furnished to do so, subject to the following conditions: 24304 * 24305 * The above copyright notice and this permission notice shall be included in 24306 * all copies or substantial portions of the Software. 24307 * 24308 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24309 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24310 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24311 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24312 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24313 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24314 * THE SOFTWARE. 24315 */ 24316 24317var __extends = this && this.__extends || function () { 24318 var _extendStatics = function extendStatics(d, b) { 24319 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 24320 d.__proto__ = b; 24321 } || function (d, b) { 24322 for (var p in b) { 24323 if (b.hasOwnProperty(p)) d[p] = b[p]; 24324 } 24325 }; 24326 return _extendStatics(d, b); 24327 }; 24328 return function (d, b) { 24329 _extendStatics(d, b); 24330 function __() { 24331 this.constructor = d; 24332 } 24333 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 24334 }; 24335}(); 24336var __assign = this && this.__assign || function () { 24337 __assign = Object.assign || function (t) { 24338 for (var s, i = 1, n = arguments.length; i < n; i++) { 24339 s = arguments[i]; 24340 for (var p in s) { 24341 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 24342 } 24343 } 24344 return t; 24345 }; 24346 return __assign.apply(this, arguments); 24347}; 24348Object.defineProperty(exports, "__esModule", { value: true }); 24349var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 24350var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"); 24351var POINTERDOWN_EVENTS = ['mousedown', 'touchstart']; 24352var INTERACTION_EVENTS = ['click', 'keydown']; 24353var MDCTextFieldFoundation = /** @class */function (_super) { 24354 __extends(MDCTextFieldFoundation, _super); 24355 /** 24356 * @param adapter 24357 * @param foundationMap Map from subcomponent names to their subfoundations. 24358 */ 24359 function MDCTextFieldFoundation(adapter, foundationMap) { 24360 if (foundationMap === void 0) { 24361 foundationMap = {}; 24362 } 24363 var _this = _super.call(this, __assign(__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this; 24364 _this.isFocused_ = false; 24365 _this.receivedUserInput_ = false; 24366 _this.isValid_ = true; 24367 _this.useNativeValidation_ = true; 24368 _this.validateOnValueChange_ = true; 24369 _this.helperText_ = foundationMap.helperText; 24370 _this.characterCounter_ = foundationMap.characterCounter; 24371 _this.leadingIcon_ = foundationMap.leadingIcon; 24372 _this.trailingIcon_ = foundationMap.trailingIcon; 24373 _this.inputFocusHandler_ = function () { 24374 return _this.activateFocus(); 24375 }; 24376 _this.inputBlurHandler_ = function () { 24377 return _this.deactivateFocus(); 24378 }; 24379 _this.inputInputHandler_ = function () { 24380 return _this.handleInput(); 24381 }; 24382 _this.setPointerXOffset_ = function (evt) { 24383 return _this.setTransformOrigin(evt); 24384 }; 24385 _this.textFieldInteractionHandler_ = function () { 24386 return _this.handleTextFieldInteraction(); 24387 }; 24388 _this.validationAttributeChangeHandler_ = function (attributesList) { 24389 return _this.handleValidationAttributeChange(attributesList); 24390 }; 24391 return _this; 24392 }
24393 Object.defineProperty(MDCTextFieldFoundation, "cssClasses", { 24394 get: function get() { 24395 return constants_1.cssClasses; 24396 }, 24397 enumerable: true, 24398 configurable: true 24399 }); 24400 Object.defineProperty(MDCTextFieldFoundation, "strings", { 24401 get: function get() { 24402 return constants_1.strings; 24403 }, 24404 enumerable: true, 24405 configurable: true 24406 }); 24407 Object.defineProperty(MDCTextFieldFoundation, "numbers", { 24408 get: function get() { 24409 return constants_1.numbers; 24410 }, 24411 enumerable: true, 24412 configurable: true 24413 }); 24414 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat_", { 24415 get: function get() { 24416 var type = this.getNativeInput_().type; 24417 return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0; 24418 }, 24419 enumerable: true, 24420 configurable: true 24421 }); 24422 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", { 24423 get: function get() { 24424 return this.shouldAlwaysFloat_ || this.isFocused_ || !!this.getValue() || this.isBadInput_(); 24425 }, 24426 enumerable: true, 24427 configurable: true 24428 }); 24429 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", { 24430 get: function get() { 24431 return !this.isFocused_ && !this.isValid() && !!this.getValue(); 24432 }, 24433 enumerable: true, 24434 configurable: true 24435 }); 24436 Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", { 24437 /** 24438 * See {@link MDCTextFieldAdapter} for typing information on parameters and 24439 * return types. 24440 */ 24441 get: function get() { 24442 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 24443 return { 24444 addClass: function addClass() { 24445 return undefined; 24446 }, 24447 removeClass: function removeClass() { 24448 return undefined; 24449 }, 24450 hasClass: function hasClass() { 24451 return true; 24452 }, 24453 setInputAttr: function setInputAttr() { 24454 return undefined; 24455 }, 24456 removeInputAttr: function removeInputAttr() { 24457 return undefined; 24458 }, 24459 registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() { 24460 return undefined; 24461 }, 24462 deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() { 24463 return undefined; 24464 }, 24465 registerInputInteractionHandler: function registerInputInteractionHandler() { 24466 return undefined; 24467 }, 24468 deregisterInputInteractionHandler: function deregisterInputInteractionHandler() { 24469 return undefined; 24470 }, 24471 registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() { 24472 return new MutationObserver(function () { 24473 return undefined; 24474 }); 24475 }, 24476 deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() { 24477 return undefined; 24478 }, 24479 getNativeInput: function getNativeInput() { 24480 return null; 24481 }, 24482 isFocused: function isFocused() { 24483 return false; 24484 }, 24485 activateLineRipple: function activateLineRipple() { 24486 return undefined; 24487 }, 24488 deactivateLineRipple: function deactivateLineRipple() { 24489 return undefined; 24490 }, 24491 setLineRippleTransformOrigin: function setLineRippleTransformOrigin() { 24492 return undefined; 24493 }, 24494 shakeLabel: function shakeLabel() { 24495 return undefined; 24496 }, 24497 floatLabel: function floatLabel() { 24498 return undefined; 24499 }, 24500 setLabelRequired: function setLabelRequired() { 24501 return undefined; 24502 }, 24503 hasLabel: function hasLabel() { 24504 return false;
24505 }, 24506 getLabelWidth: function getLabelWidth() { 24507 return 0; 24508 }, 24509 hasOutline: function hasOutline() { 24510 return false; 24511 }, 24512 notchOutline: function notchOutline() { 24513 return undefined; 24514 }, 24515 closeOutline: function closeOutline() { 24516 return undefined; 24517 } 24518 }; 24519 // tslint:enable:object-literal-sort-keys 24520 }, 24521 enumerable: true, 24522 configurable: true 24523 }); 24524 MDCTextFieldFoundation.prototype.init = function () { 24525 var _this = this; 24526 if (this.adapter.hasLabel() && this.getNativeInput_().required) { 24527 this.adapter.setLabelRequired(true); 24528 } 24529 if (this.adapter.isFocused()) { 24530 this.inputFocusHandler_(); 24531 } else if (this.adapter.hasLabel() && this.shouldFloat) { 24532 this.notchOutline(true); 24533 this.adapter.floatLabel(true); 24534 this.styleFloating_(true); 24535 } 24536 this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler_); 24537 this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler_); 24538 this.adapter.registerInputInteractionHandler('input', this.inputInputHandler_); 24539 POINTERDOWN_EVENTS.forEach(function (evtType) { 24540 _this.adapter.registerInputInteractionHandler(evtType, _this.setPointerXOffset_); 24541 }); 24542 INTERACTION_EVENTS.forEach(function (evtType) { 24543 _this.adapter.registerTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_); 24544 }); 24545 this.validationObserver_ = this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_); 24546 this.setCharacterCounter_(this.getValue().length); 24547 }; 24548 MDCTextFieldFoundation.prototype.destroy = function () { 24549 var _this = this; 24550 this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler_); 24551 this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler_); 24552 this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler_); 24553 POINTERDOWN_EVENTS.forEach(function (evtType) { 24554 _this.adapter.deregisterInputInteractionHandler(evtType, _this.setPointerXOffset_); 24555 }); 24556 INTERACTION_EVENTS.forEach(function (evtType) { 24557 _this.adapter.deregisterTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_); 24558 }); 24559 this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver_); 24560 }; 24561 /** 24562 * Handles user interactions with the Text Field. 24563 */ 24564 MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () { 24565 var nativeInput = this.adapter.getNativeInput(); 24566 if (nativeInput && nativeInput.disabled) { 24567 return; 24568 } 24569 this.receivedUserInput_ = true; 24570 }; 24571 /** 24572 * Handles validation attribute changes 24573 */ 24574 MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) { 24575 var _this = this; 24576 attributesList.some(function (attributeName) { 24577 if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) { 24578 _this.styleValidity_(true); 24579 _this.adapter.setLabelRequired(_this.getNativeInput_().required); 24580 return true; 24581 } 24582 return false; 24583 }); 24584 if (attributesList.indexOf('maxlength') > -1) { 24585 this.setCharacterCounter_(this.getValue().length); 24586 } 24587 }; 24588 /** 24589 * Opens/closes the notched outline. 24590 */ 24591 MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) { 24592 if (!this.adapter.hasOutline() || !this.adapter.hasLabel()) { 24593 return; 24594 } 24595 if (openNotch) { 24596 var labelWidth = this.adapter.getLabelWidth() * constants_1.numbers.LABEL_SCALE; 24597 this.adapter.notchOutline(labelWidth); 24598 } else { 24599 this.adapter.closeOutline(); 24600 } 24601 }; 24602 /** 24603 * Activates the text field focus state. 24604 */ 24605 MDCTextFieldFoundation.prototype.activateFocus = function () { 24606 this.isFocused_ = true; 24607 this.styleFocused_(this.isFocused_); 24608 this.adapter.activateLineRipple(); 24609 if (this.adapter.hasLabel()) { 24610 this.notchOutline(this.shouldFloat); 24611 this.adapter.floatLabel(this.shouldFloat); 24612 this.styleFloating_(this.shouldFloat); 24613 this.adapter.shakeLabel(this.shouldShake); 24614 }
24615 if (this.helperText_ && (this.helperText_.isPersistent() || !this.helperText_.isValidation() || !this.isValid_)) { 24616 this.helperText_.showToScreenReader(); 24617 } 24618 }; 24619 /** 24620 * Sets the line ripple's transform origin, so that the line ripple activate 24621 * animation will animate out from the user's click location. 24622 */ 24623 MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) { 24624 if (this.isDisabled() || this.adapter.hasOutline()) { 24625 return; 24626 } 24627 var touches = evt.touches; 24628 var targetEvent = touches ? touches[0] : evt; 24629 var targetClientRect = targetEvent.target.getBoundingClientRect(); 24630 var normalizedX = targetEvent.clientX - targetClientRect.left; 24631 this.adapter.setLineRippleTransformOrigin(normalizedX); 24632 }; 24633 /** 24634 * Handles input change of text input and text area. 24635 */ 24636 MDCTextFieldFoundation.prototype.handleInput = function () { 24637 this.autoCompleteFocus(); 24638 this.setCharacterCounter_(this.getValue().length); 24639 }; 24640 /** 24641 * Activates the Text Field's focus state in cases when the input value 24642 * changes without user input (e.g. programmatically). 24643 */ 24644 MDCTextFieldFoundation.prototype.autoCompleteFocus = function () { 24645 if (!this.receivedUserInput_) { 24646 this.activateFocus(); 24647 } 24648 }; 24649 /** 24650 * Deactivates the Text Field's focus state. 24651 */ 24652 MDCTextFieldFoundation.prototype.deactivateFocus = function () { 24653 this.isFocused_ = false; 24654 this.adapter.deactivateLineRipple(); 24655 var isValid = this.isValid(); 24656 this.styleValidity_(isValid); 24657 this.styleFocused_(this.isFocused_); 24658 if (this.adapter.hasLabel()) { 24659 this.notchOutline(this.shouldFloat); 24660 this.adapter.floatLabel(this.shouldFloat); 24661 this.styleFloating_(this.shouldFloat); 24662 this.adapter.shakeLabel(this.shouldShake); 24663 } 24664 if (!this.shouldFloat) { 24665 this.receivedUserInput_ = false; 24666 } 24667 }; 24668 MDCTextFieldFoundation.prototype.getValue = function () { 24669 return this.getNativeInput_().value; 24670 }; 24671 /** 24672 * @param value The value to set on the input Element. 24673 */ 24674 MDCTextFieldFoundation.prototype.setValue = function (value) { 24675 // Prevent Safari from moving the caret to the end of the input when the 24676 // value has not changed. 24677 if (this.getValue() !== value) { 24678 this.getNativeInput_().value = value; 24679 } 24680 this.setCharacterCounter_(value.length); 24681 if (this.validateOnValueChange_) { 24682 var isValid = this.isValid(); 24683 this.styleValidity_(isValid); 24684 } 24685 if (this.adapter.hasLabel()) { 24686 this.notchOutline(this.shouldFloat); 24687 this.adapter.floatLabel(this.shouldFloat); 24688 this.styleFloating_(this.shouldFloat); 24689 if (this.validateOnValueChange_) { 24690 this.adapter.shakeLabel(this.shouldShake); 24691 } 24692 } 24693 }; 24694 /** 24695 * @return The custom validity state, if set; otherwise, the result of a 24696 * native validity check. 24697 */ 24698 MDCTextFieldFoundation.prototype.isValid = function () { 24699 return this.useNativeValidation_ ? this.isNativeInputValid_() : this.isValid_; 24700 }; 24701 /** 24702 * @param isValid Sets the custom validity state of the Text Field. 24703 */ 24704 MDCTextFieldFoundation.prototype.setValid = function (isValid) { 24705 this.isValid_ = isValid; 24706 this.styleValidity_(isValid); 24707 var shouldShake = !isValid && !this.isFocused_ && !!this.getValue(); 24708 if (this.adapter.hasLabel()) { 24709 this.adapter.shakeLabel(shouldShake); 24710 } 24711 }; 24712 /** 24713 * @param shouldValidate Whether or not validity should be updated on 24714 * value change. 24715 */ 24716 MDCTextFieldFoundation.prototype.setValidateOnValueChange = function (shouldValidate) { 24717 this.validateOnValueChange_ = shouldValidate; 24718 }; 24719 /** 24720 * @return Whether or not validity should be updated on value change. `true` 24721 * by default. 24722 */ 24723 MDCTextFieldFoundation.prototype.getValidateOnValueChange = function () { 24724 return this.validateOnValueChange_; 24725 }; 24726 /** 24727 * Enables or disables the use of native validation. Use this for custom 24728 * validation.
24729 * @param useNativeValidation Set this to false to ignore native input 24730 * validation. 24731 */ 24732 MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) { 24733 this.useNativeValidation_ = useNativeValidation; 24734 }; 24735 MDCTextFieldFoundation.prototype.isDisabled = function () { 24736 return this.getNativeInput_().disabled; 24737 }; 24738 /** 24739 * @param disabled Sets the text-field disabled or enabled. 24740 */ 24741 MDCTextFieldFoundation.prototype.setDisabled = function (disabled) { 24742 this.getNativeInput_().disabled = disabled; 24743 this.styleDisabled_(disabled); 24744 }; 24745 /** 24746 * @param content Sets the content of the helper text. 24747 */ 24748 MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) { 24749 if (this.helperText_) { 24750 this.helperText_.setContent(content); 24751 } 24752 }; 24753 /** 24754 * Sets the aria label of the leading icon. 24755 */ 24756 MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) { 24757 if (this.leadingIcon_) { 24758 this.leadingIcon_.setAriaLabel(label); 24759 } 24760 }; 24761 /** 24762 * Sets the text content of the leading icon. 24763 */ 24764 MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) { 24765 if (this.leadingIcon_) { 24766 this.leadingIcon_.setContent(content); 24767 } 24768 }; 24769 /** 24770 * Sets the aria label of the trailing icon. 24771 */ 24772 MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) { 24773 if (this.trailingIcon_) { 24774 this.trailingIcon_.setAriaLabel(label); 24775 } 24776 }; 24777 /** 24778 * Sets the text content of the trailing icon. 24779 */ 24780 MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) { 24781 if (this.trailingIcon_) { 24782 this.trailingIcon_.setContent(content); 24783 } 24784 }; 24785 /** 24786 * Sets character counter values that shows characters used and the total 24787 * character limit. 24788 */ 24789 MDCTextFieldFoundation.prototype.setCharacterCounter_ = function (currentLength) { 24790 if (!this.characterCounter_) { 24791 return; 24792 } 24793 var maxLength = this.getNativeInput_().maxLength; 24794 if (maxLength === -1) { 24795 throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.'); 24796 } 24797 this.characterCounter_.setCounterValue(currentLength, maxLength); 24798 }; 24799 /** 24800 * @return True if the Text Field input fails in converting the user-supplied 24801 * value. 24802 */ 24803 MDCTextFieldFoundation.prototype.isBadInput_ = function () { 24804 // The badInput property is not supported in IE 11 💩. 24805 return this.getNativeInput_().validity.badInput || false; 24806 }; 24807 /** 24808 * @return The result of native validity checking (ValidityState.valid). 24809 */ 24810 MDCTextFieldFoundation.prototype.isNativeInputValid_ = function () { 24811 return this.getNativeInput_().validity.valid; 24812 }; 24813 /** 24814 * Styles the component based on the validity state. 24815 */ 24816 MDCTextFieldFoundation.prototype.styleValidity_ = function (isValid) { 24817 var INVALID = MDCTextFieldFoundation.cssClasses.INVALID; 24818 if (isValid) { 24819 this.adapter.removeClass(INVALID); 24820 } else { 24821 this.adapter.addClass(INVALID); 24822 } 24823 if (this.helperText_) { 24824 this.helperText_.setValidity(isValid); 24825 // We dynamically set or unset aria-describedby for validation helper text 24826 // only, based on whether the field is valid 24827 var helperTextValidation = this.helperText_.isValidation(); 24828 if (!helperTextValidation) { 24829 return; 24830 } 24831 var helperTextVisible = this.helperText_.isVisible(); 24832 var helperTextId = this.helperText_.getId(); 24833 if (helperTextVisible && helperTextId) { 24834 this.adapter.setInputAttr(constants_1.strings.ARIA_DESCRIBEDBY, helperTextId); 24835 } else { 24836 this.adapter.removeInputAttr(constants_1.strings.ARIA_DESCRIBEDBY); 24837 } 24838 } 24839 }; 24840 /** 24841 * Styles the component based on the focused state. 24842 */ 24843 MDCTextFieldFoundation.prototype.styleFocused_ = function (isFocused) {
24844 var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED; 24845 if (isFocused) { 24846 this.adapter.addClass(FOCUSED); 24847 } else { 24848 this.adapter.removeClass(FOCUSED); 24849 } 24850 }; 24851 /** 24852 * Styles the component based on the disabled state. 24853 */ 24854 MDCTextFieldFoundation.prototype.styleDisabled_ = function (isDisabled) { 24855 var _a = MDCTextFieldFoundation.cssClasses, 24856 DISABLED = _a.DISABLED, 24857 INVALID = _a.INVALID; 24858 if (isDisabled) { 24859 this.adapter.addClass(DISABLED); 24860 this.adapter.removeClass(INVALID); 24861 } else { 24862 this.adapter.removeClass(DISABLED); 24863 } 24864 if (this.leadingIcon_) { 24865 this.leadingIcon_.setDisabled(isDisabled); 24866 } 24867 if (this.trailingIcon_) { 24868 this.trailingIcon_.setDisabled(isDisabled); 24869 } 24870 }; 24871 /** 24872 * Styles the component based on the label floating state. 24873 */ 24874 MDCTextFieldFoundation.prototype.styleFloating_ = function (isFloating) { 24875 var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING; 24876 if (isFloating) { 24877 this.adapter.addClass(LABEL_FLOATING); 24878 } else { 24879 this.adapter.removeClass(LABEL_FLOATING); 24880 } 24881 }; 24882 /** 24883 * @return The native text input element from the host environment, or an 24884 * object with the same shape for unit tests. 24885 */ 24886 MDCTextFieldFoundation.prototype.getNativeInput_ = function () { 24887 // this.adapter may be undefined in foundation unit tests. This happens when 24888 // testdouble is creating a mock object and invokes the 24889 // shouldShake/shouldFloat getters (which in turn call getValue(), which 24890 // calls this method) before init() has been called from the MDCTextField 24891 // constructor. To work around that issue, we return a dummy object. 24892 var nativeInput = this.adapter ? this.adapter.getNativeInput() : null; 24893 return nativeInput || { 24894 disabled: false, 24895 maxLength: -1, 24896 required: false, 24897 type: 'input', 24898 validity: { 24899 badInput: false, 24900 valid: true 24901 }, 24902 value: '' 24903 }; 24904 }; 24905 return MDCTextFieldFoundation; 24906}(foundation_1.MDCFoundation); 24907exports.MDCTextFieldFoundation = MDCTextFieldFoundation; 24908// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 24909exports.default = MDCTextFieldFoundation; 24910 24911/***/ }), 24912
24913/***/ "./packages/mdc-textfield/helper-text/component.ts": 24914/*!*********************************************************!*\ 24915 !*** ./packages/mdc-textfield/helper-text/component.ts ***! 24916 \*********************************************************/ 24917/*! no static exports found */ 24918/***/ (function(module, exports, __webpack_require__) { 24919 24920"use strict"; 24921 24922/** 24923 * @license 24924 * Copyright 2017 Google Inc. 24925 * 24926 * Permission is hereby granted, free of charge, to any person obtaining a copy 24927 * of this software and associated documentation files (the "Software"), to deal 24928 * in the Software without restriction, including without limitation the rights 24929 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24930 * copies of the Software, and to permit persons to whom the Software is 24931 * furnished to do so, subject to the following conditions: 24932 * 24933 * The above copyright notice and this permission notice shall be included in 24934 * all copies or substantial portions of the Software. 24935 * 24936 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24937 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24938 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24939 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24940 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24941 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24942 * THE SOFTWARE. 24943 */ 24944 24945var __extends = this && this.__extends || function () { 24946 var _extendStatics = function extendStatics(d, b) { 24947 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 24948 d.__proto__ = b; 24949 } || function (d, b) { 24950 for (var p in b) { 24951 if (b.hasOwnProperty(p)) d[p] = b[p]; 24952 } 24953 }; 24954 return _extendStatics(d, b); 24955 }; 24956 return function (d, b) { 24957 _extendStatics(d, b); 24958 function __() { 24959 this.constructor = d; 24960 } 24961 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 24962 }; 24963}(); 24964Object.defineProperty(exports, "__esModule", { value: true }); 24965var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 24966var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"); 24967var MDCTextFieldHelperText = /** @class */function (_super) { 24968 __extends(MDCTextFieldHelperText, _super); 24969 function MDCTextFieldHelperText() { 24970 return _super !== null && _super.apply(this, arguments) || this; 24971 } 24972 MDCTextFieldHelperText.attachTo = function (root) { 24973 return new MDCTextFieldHelperText(root); 24974 }; 24975 Object.defineProperty(MDCTextFieldHelperText.prototype, "foundationForTextField", { 24976 // Provided for access by MDCTextField component 24977 get: function get() { 24978 return this.foundation; 24979 }, 24980 enumerable: true, 24981 configurable: true 24982 }); 24983 MDCTextFieldHelperText.prototype.getDefaultFoundation = function () { 24984 var _this = this; 24985 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 24986 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 24987 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 24988 var adapter = { 24989 addClass: function addClass(className) { 24990 return _this.root.classList.add(className); 24991 }, 24992 removeClass: function removeClass(className) { 24993 return _this.root.classList.remove(className); 24994 }, 24995 hasClass: function hasClass(className) { 24996 return _this.root.classList.contains(className); 24997 }, 24998 getAttr: function getAttr(attr) { 24999 return _this.root.getAttribute(attr); 25000 }, 25001 setAttr: function setAttr(attr, value) { 25002 return _this.root.setAttribute(attr, value); 25003 }, 25004 removeAttr: function removeAttr(attr) { 25005 return _this.root.removeAttribute(attr); 25006 }, 25007 setContent: function setContent(content) { 25008 _this.root.textContent = content; 25009 } 25010 }; 25011 // tslint:enable:object-literal-sort-keys 25012 return new foundation_1.MDCTextFieldHelperTextFoundation(adapter); 25013 }; 25014 return MDCTextFieldHelperText; 25015}(component_1.MDCComponent); 25016exports.MDCTextFieldHelperText = MDCTextFieldHelperText; 25017 25018/***/ }), 25019
25020/***/ "./packages/mdc-textfield/helper-text/constants.ts": 25021/*!*********************************************************!*\ 25022 !*** ./packages/mdc-textfield/helper-text/constants.ts ***! 25023 \*********************************************************/ 25024/*! no static exports found */ 25025/***/ (function(module, exports, __webpack_require__) { 25026 25027"use strict"; 25028 25029/** 25030 * @license 25031 * Copyright 2016 Google Inc. 25032 * 25033 * Permission is hereby granted, free of charge, to any person obtaining a copy 25034 * of this software and associated documentation files (the "Software"), to deal 25035 * in the Software without restriction, including without limitation the rights 25036 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25037 * copies of the Software, and to permit persons to whom the Software is 25038 * furnished to do so, subject to the following conditions: 25039 * 25040 * The above copyright notice and this permission notice shall be included in 25041 * all copies or substantial portions of the Software. 25042 * 25043 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25044 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25045 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25046 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25047 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25048 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25049 * THE SOFTWARE. 25050 */ 25051 25052Object.defineProperty(exports, "__esModule", { value: true });
25053var cssClasses = { 25054 HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent', 25055 HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg', 25056 ROOT: 'mdc-text-field-helper-text' 25057}; 25058exports.cssClasses = cssClasses; 25059var strings = { 25060 ARIA_HIDDEN: 'aria-hidden', 25061 ROLE: 'role', 25062 ROOT_SELECTOR: "." + cssClasses.ROOT 25063}; 25064exports.strings = strings; 25065 25066/***/ }), 25067
25068/***/ "./packages/mdc-textfield/helper-text/foundation.ts": 25069/*!**********************************************************!*\ 25070 !*** ./packages/mdc-textfield/helper-text/foundation.ts ***! 25071 \**********************************************************/ 25072/*! no static exports found */ 25073/***/ (function(module, exports, __webpack_require__) { 25074 25075"use strict"; 25076 25077/** 25078 * @license 25079 * Copyright 2017 Google Inc. 25080 * 25081 * Permission is hereby granted, free of charge, to any person obtaining a copy 25082 * of this software and associated documentation files (the "Software"), to deal 25083 * in the Software without restriction, including without limitation the rights 25084 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25085 * copies of the Software, and to permit persons to whom the Software is 25086 * furnished to do so, subject to the following conditions: 25087 * 25088 * The above copyright notice and this permission notice shall be included in 25089 * all copies or substantial portions of the Software. 25090 * 25091 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25092 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25093 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25094 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25095 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25096 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25097 * THE SOFTWARE. 25098 */ 25099 25100var __extends = this && this.__extends || function () { 25101 var _extendStatics = function extendStatics(d, b) { 25102 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 25103 d.__proto__ = b; 25104 } || function (d, b) { 25105 for (var p in b) { 25106 if (b.hasOwnProperty(p)) d[p] = b[p]; 25107 } 25108 }; 25109 return _extendStatics(d, b); 25110 }; 25111 return function (d, b) { 25112 _extendStatics(d, b); 25113 function __() { 25114 this.constructor = d; 25115 } 25116 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25117 }; 25118}(); 25119var __assign = this && this.__assign || function () { 25120 __assign = Object.assign || function (t) { 25121 for (var s, i = 1, n = arguments.length; i < n; i++) { 25122 s = arguments[i]; 25123 for (var p in s) { 25124 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 25125 } 25126 } 25127 return t; 25128 }; 25129 return __assign.apply(this, arguments); 25130}; 25131Object.defineProperty(exports, "__esModule", { value: true }); 25132var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 25133var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts"); 25134var MDCTextFieldHelperTextFoundation = /** @class */function (_super) { 25135 __extends(MDCTextFieldHelperTextFoundation, _super); 25136 function MDCTextFieldHelperTextFoundation(adapter) { 25137 return _super.call(this, __assign(__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this; 25138 } 25139 Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", { 25140 get: function get() {
25141 return constants_1.cssClasses; 25142 }, 25143 enumerable: true, 25144 configurable: true 25145 }); 25146 Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", { 25147 get: function get() { 25148 return constants_1.strings; 25149 }, 25150 enumerable: true, 25151 configurable: true 25152 }); 25153 Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", { 25154 /** 25155 * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types. 25156 */ 25157 get: function get() { 25158 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 25159 return { 25160 addClass: function addClass() { 25161 return undefined; 25162 }, 25163 removeClass: function removeClass() { 25164 return undefined; 25165 }, 25166 hasClass: function hasClass() { 25167 return false; 25168 }, 25169 getAttr: function getAttr() { 25170 return null; 25171 }, 25172 setAttr: function setAttr() { 25173 return undefined; 25174 }, 25175 removeAttr: function removeAttr() { 25176 return undefined; 25177 }, 25178 setContent: function setContent() { 25179 return undefined; 25180 } 25181 }; 25182 // tslint:enable:object-literal-sort-keys 25183 }, 25184 enumerable: true, 25185 configurable: true 25186 }); 25187 MDCTextFieldHelperTextFoundation.prototype.getId = function () { 25188 return this.adapter.getAttr('id'); 25189 }; 25190 MDCTextFieldHelperTextFoundation.prototype.isVisible = function () { 25191 return this.adapter.getAttr(constants_1.strings.ARIA_HIDDEN) !== 'true'; 25192 }; 25193 /** 25194 * Sets the content of the helper text field. 25195 */ 25196 MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) { 25197 this.adapter.setContent(content); 25198 }; 25199 MDCTextFieldHelperTextFoundation.prototype.isPersistent = function () {
25200 return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT); 25201 }; 25202 /** 25203 * @param isPersistent Sets the persistency of the helper text. 25204 */ 25205 MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) { 25206 if (isPersistent) { 25207 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT); 25208 } else { 25209 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT); 25210 } 25211 }; 25212 /** 25213 * @return whether the helper text acts as an error validation message. 25214 */ 25215 MDCTextFieldHelperTextFoundation.prototype.isValidation = function () { 25216 return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 25217 }; 25218 /** 25219 * @param isValidation True to make the helper text act as an error validation message. 25220 */ 25221 MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) { 25222 if (isValidation) { 25223 this.adapter.addClass(constants_1.cssClasse
25223s.HELPER_TEXT_VALIDATION_MSG); 25224 } else { 25225 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 25226 } 25227 }; 25228 /** 25229 * Makes the helper text visible to the screen reader. 25230 */ 25231 MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () { 25232 this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN); 25233 }; 25234 /** 25235 * Sets the validity of the helper text based on the input validity. 25236 */ 25237 MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) { 25238 var helperTextIsPersistent = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT); 25239 var helperTextIsValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 25240 var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid; 25241 if (validationMsgNeedsDisplay) { 25242 this.showToScreenReader(); 25243 this.adapter.setAttr(constants_1.strings.ROLE, 'alert'); 25244 } else { 25245 this.adapter.removeAttr(constants_1.strings.ROLE); 25246 } 25247 if (!helperTextIsPersistent && !validationMsgNeedsDisplay) { 25248 this.hide_(); 25249 } 25250 }; 25251 /** 25252 * Hides the help text from screen readers. 25253 */ 25254 MDCTextFieldHelperTextFoundation.prototype.hide_ = function () { 25255 this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true'); 25256 }; 25257 return MDCTextFieldHelperTextFoundation; 25258}(foundation_1.MDCFoundation); 25259exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation; 25260// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 25261exports.default = MDCTextFieldHelperTextFoundation; 25262 25263/***/ }), 25264
25265/***/ "./packages/mdc-textfield/helper-text/index.ts": 25266/*!*****************************************************!*\ 25267 !*** ./packages/mdc-textfield/helper-text/index.ts ***! 25268 \*****************************************************/ 25269/*! no static exports found */ 25270/***/ (function(module, exports, __webpack_require__) { 25271 25272"use strict"; 25273 25274/** 25275 * @license 25276 * Copyright 2019 Google Inc. 25277 * 25278 * Permission is hereby granted, free of charge, to any person obtaining a copy 25279 * of this software and associated documentation files (the "Software"), to deal 25280 * in the Software without restriction, including without limitation the rights 25281 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25282 * copies of the Software, and to permit persons to whom the Software is 25283 * furnished to do so, subject to the following conditions: 25284 * 25285 * The above copyright notice and this permission notice shall be included in 25286 * all copies or substantial portions of the Software. 25287 * 25288 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25289 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25290 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25291 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25292 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25293 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25294 * THE SOFTWARE. 25295 */ 25296 25297function __export(m) { 25298 for (var p in m) { 25299 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 25300 } 25301} 25302Object.defineProperty(exports, "__esModule", { value: true }); 25303__export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/helper-text/component.ts")); 25304__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts")); 25305var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
25306exports.helperTextCssClasses = constants_1.cssClasses; 25307exports.helperTextStrings = constants_1.strings; 25308 25309/***/ }), 25310
25311/***/ "./packages/mdc-textfield/icon/component.ts": 25312/*!**************************************************!*\ 25313 !*** ./packages/mdc-textfield/icon/component.ts ***! 25314 \**************************************************/ 25315/*! no static exports found */ 25316/***/ (function(module, exports, __webpack_require__) { 25317 25318"use strict"; 25319 25320/** 25321 * @license 25322 * Copyright 2017 Google Inc. 25323 * 25324 * Permission is hereby granted, free of charge, to any person obtaining a copy 25325 * of this software and associated documentation files (the "Software"), to deal 25326 * in the Software without restriction, including without limitation the rights 25327 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25328 * copies of the Software, and to permit persons to whom the Software is 25329 * furnished to do so, subject to the following conditions: 25330 * 25331 * The above copyright notice and this permission notice shall be included in 25332 * all copies or substantial portions of the Software. 25333 * 25334 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25335 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25336 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25337 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25338 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25339 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25340 * THE SOFTWARE. 25341 */ 25342 25343var __extends = this && this.__extends || function () { 25344 var _extendStatics = function extendStatics(d, b) { 25345 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 25346 d.__proto__ = b; 25347 } || function (d, b) { 25348 for (var p in b) { 25349 if (b.hasOwnProperty(p)) d[p] = b[p]; 25350 } 25351 }; 25352 return _extendStatics(d, b); 25353 }; 25354 return function (d, b) { 25355 _extendStatics(d, b); 25356 function __() { 25357 this.constructor = d; 25358 } 25359 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25360 }; 25361}(); 25362Object.defineProperty(exports, "__esModule", { value: true }); 25363var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 25364var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"); 25365var MDCTextFieldIcon = /** @class */function (_super) { 25366 __extends(MDCTextFieldIcon, _super); 25367 function MDCTextFieldIcon() { 25368 return _super !== null && _super.apply(this, arguments) || this; 25369 } 25370 MDCTextFieldIcon.attachTo = function (root) { 25371 return new MDCTextFieldIcon(root); 25372 }; 25373 Object.defineProperty(MDCTextFieldIcon.prototype, "foundationForTextField", { 25374 // Provided for access by MDCTextField component 25375 get: function get() { 25376 return this.foundation; 25377 }, 25378 enumerable: true, 25379 configurable: true 25380 }); 25381 MDCTextFieldIcon.prototype.getDefaultFoundation = function () { 25382 var _this = this; 25383 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 25384 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 25385 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 25386 var adapter = { 25387 getAttr: function getAttr(attr) { 25388 return _this.root.getAttribute(attr); 25389 }, 25390 setAttr: function setAttr(attr, value) { 25391 return _this.root.setAttribute(attr, value); 25392 }, 25393 removeAttr: function removeAttr(attr) { 25394 return _this.root.removeAttribute(attr); 25395 }, 25396 setContent: function setContent(content) { 25397 _this.root.textContent = content; 25398 }, 25399 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 25400 return _this.listen(evtType, handler); 25401 }, 25402 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 25403 return _this.unlisten(evtType, handler); 25404 }, 25405 notifyIconAction: function notifyIconAction() {
25406 return _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */); 25407 } 25408 }; 25409 // tslint:enable:object-literal-sort-keys 25410 return new foundation_1.MDCTextFieldIconFoundation(adapter); 25411 }; 25412 return MDCTextFieldIcon; 25413}(component_1.MDCComponent); 25414exports.MDCTextFieldIcon = MDCTextFieldIcon; 25415 25416/***/ }), 25417
25418/***/ "./packages/mdc-textfield/icon/constants.ts": 25419/*!**************************************************!*\ 25420 !*** ./packages/mdc-textfield/icon/constants.ts ***! 25421 \**************************************************/ 25422/*! no static exports found */ 25423/***/ (function(module, exports, __webpack_require__) { 25424 25425"use strict"; 25426 25427/** 25428 * @license 25429 * Copyright 2016 Google Inc. 25430 * 25431 * Permission is hereby granted, free of charge, to any person obtaining a copy 25432 * of this software and associated documentation files (the "Software"), to deal 25433 * in the Software without restriction, including without limitation the rights 25434 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25435 * copies of the Software, and to permit persons to whom the Software is 25436 * furnished to do so, subject to the following conditions: 25437 * 25438 * The above copyright notice and this permission notice shall be included in 25439 * all copies or substantial portions of the Software. 25440 * 25441 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25442 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25443 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25444 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25445 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25446 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25447 * THE SOFTWARE. 25448 */ 25449 25450Object.defineProperty(exports, "__esModule", { value: true }); 25451var strings = { 25452 ICON_EVENT: 'MDCTextField:icon', 25453 ICON_ROLE: 'button' 25454}; 25455exports.strings = strings;
25456var cssClasses = { 25457 ROOT: 'mdc-text-field__icon' 25458}; 25459exports.cssClasses = cssClasses; 25460 25461/***/ }), 25462
25463/***/ "./packages/mdc-textfield/icon/foundation.ts": 25464/*!***************************************************!*\ 25465 !*** ./packages/mdc-textfield/icon/foundation.ts ***! 25466 \***************************************************/ 25467/*! no static exports found */ 25468/***/ (function(module, exports, __webpack_require__) { 25469 25470"use strict"; 25471 25472/** 25473 * @license 25474 * Copyright 2017 Google Inc. 25475 * 25476 * Permission is hereby granted, free of charge, to any person obtaining a copy 25477 * of this software and associated documentation files (the "Software"), to deal 25478 * in the Software without restriction, including without limitation the rights 25479 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25480 * copies of the Software, and to permit persons to whom the Software is 25481 * furnished to do so, subject to the following conditions: 25482 * 25483 * The above copyright notice and this permission notice shall be included in 25484 * all copies or substantial portions of the Software. 25485 * 25486 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25487 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25488 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25489 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25490 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25491 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25492 * THE SOFTWARE. 25493 */ 25494 25495var __extends = this && this.__extends || function () { 25496 var _extendStatics = function extendStatics(d, b) { 25497 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 25498 d.__proto__ = b; 25499 } || function (d, b) { 25500 for (var p in b) { 25501 if (b.hasOwnProperty(p)) d[p] = b[p]; 25502 } 25503 }; 25504 return _extendStatics(d, b); 25505 }; 25506 return function (d, b) { 25507 _extendStatics(d, b); 25508 function __() { 25509 this.constructor = d; 25510 } 25511 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25512 }; 25513}(); 25514var __assign = this && this.__assign || function () { 25515 __assign = Object.assign || function (t) { 25516 for (var s, i = 1, n = arguments.length; i < n; i++) { 25517 s = arguments[i]; 25518 for (var p in s) { 25519 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 25520 } 25521 } 25522 return t; 25523 }; 25524 return __assign.apply(this, arguments); 25525}; 25526Object.defineProperty(exports, "__esModule", { value: true }); 25527var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 25528var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts"); 25529var INTERACTION_EVENTS = ['click', 'keydown']; 25530var MDCTextFieldIconFoundation = /** @class */function (_super) { 25531 __extends(MDCTextFieldIconFoundation, _super); 25532 function MDCTextFieldIconFoundation(adapter) { 25533 var _this = _super.call(this, __assign(__assign({}, MDCTextFieldIconFoundation.defaultAdapter), adapter)) || this; 25534 _this.savedTabIndex_ = null; 25535 _this.interactionHandler_ = function (evt) { 25536 return _this.handleInteraction(evt); 25537 }; 25538 return _this; 25539 } 25540 Object.defineProperty(MDCTextFieldIconFoundation, "strings", { 25541 get: function get() { 25542 return constants_1.strings; 25543 }, 25544 enumerable: true, 25545 configurable: true 25546 }); 25547 Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", { 25548 get: function get() {
25549 return constants_1.cssClasses; 25550 }, 25551 enumerable: true, 25552 configurable: true 25553 }); 25554 Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", { 25555 /** 25556 * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types. 25557 */ 25558 get: function get() { 25559 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 25560 return { 25561 getAttr: function getAttr() { 25562 return null; 25563 }, 25564 setAttr: function setAttr() { 25565 return undefined; 25566 }, 25567 removeAttr: function removeAttr() { 25568 return undefined; 25569 }, 25570 setContent: function setContent() { 25571 return undefined; 25572 }, 25573 registerInteractionHandler: function registerInteractionHandler() { 25574 return undefined; 25575 }, 25576 deregisterInteractionHandler: function deregisterInteractionHandler() { 25577 return undefined; 25578 }, 25579 notifyIconAction: function notifyIconAction() { 25580 return undefined; 25581 } 25582 }; 25583 // tslint:enable:object-literal-sort-keys 25584 }, 25585 enumerable: true, 25586 configurable: true 25587 }); 25588 MDCTextFieldIconFoundation.prototype.init = function () { 25589 var _this = this; 25590 this.savedTabIndex_ = this.adapter.getAttr('tabindex'); 25591 INTERACTION_EVENTS.forEach(function (evtType) { 25592 _this.adapter.registerInteractionHandler(evtType, _this.interactionHandler_); 25593 }); 25594 }; 25595 MDCTextFieldIconFoundation.prototype.destroy = function () { 25596 var _this = this; 25597 INTERACTION_EVENTS.forEach(function (evtType) { 25598 _this.adapter.deregisterInteractionHandler(evtType, _this.interactionHandler_); 25599 }); 25600 }; 25601 MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) { 25602 if (!this.savedTabIndex_) { 25603 return; 25604 } 25605 if (disabled) { 25606 this.adapter.setAttr('tabindex', '-1'); 25607 this.adapter.removeAttr('role'); 25608 } else { 25609 this.adapter.setAttr('tabindex', this.savedTabIndex_); 25610 this.adapter.setAttr('role', constants_1.strings.ICON_ROLE); 25611 } 25612 }; 25613 MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) { 25614 this.adapter.setAttr('aria-label', label); 25615 }; 25616 MDCTextFieldIconFoundation.prototype.setContent = function (content) { 25617 this.adapter.setContent(content); 25618 }; 25619 MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) { 25620 var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13; 25621 if (evt.type === 'click' || isEnterKey) { 25622 evt.preventDefault(); // stop click from causing host label to focus 25623 // input 25624 this.adapter.notifyIconAction(); 25625 } 25626 }; 25627 return MDCTextFieldIconFoundation; 25628}(foundation_1.MDCFoundation); 25629exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation; 25630// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 25631exports.default = MDCTextFieldIconFoundation; 25632 25633/***/ }), 25634
25635/***/ "./packages/mdc-textfield/icon/index.ts": 25636/*!**********************************************!*\ 25637 !*** ./packages/mdc-textfield/icon/index.ts ***! 25638 \**********************************************/ 25639/*! no static exports found */ 25640/***/ (function(module, exports, __webpack_require__) { 25641 25642"use strict"; 25643 25644/** 25645 * @license 25646 * Copyright 2019 Google Inc. 25647 * 25648 * Permission is hereby granted, free of charge, to any person obtaining a copy 25649 * of this software and associated documentation files (the "Software"), to deal 25650 * in the Software without restriction, including without limitation the rights 25651 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25652 * copies of the Software, and to permit persons to whom the Software is 25653 * furnished to do so, subject to the following conditions: 25654 * 25655 * The above copyright notice and this permission notice shall be included in 25656 * all copies or substantial portions of the Software. 25657 * 25658 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25659 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25660 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25661 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25662 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25663 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25664 * THE SOFTWARE. 25665 */ 25666 25667function __export(m) { 25668 for (var p in m) { 25669 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 25670 } 25671} 25672Object.defineProperty(exports, "__esModule", { value: true }); 25673__export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/icon/component.ts")); 25674__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts")); 25675var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
25676exports.iconCssClasses = constants_1.cssClasses; 25677exports.iconStrings = constants_1.strings; 25678 25679/***/ }), 25680
25681/***/ "./packages/mdc-textfield/index.ts": 25682/*!*****************************************!*\ 25683 !*** ./packages/mdc-textfield/index.ts ***! 25684 \*****************************************/ 25685/*! no static exports found */ 25686/***/ (function(module, exports, __webpack_require__) { 25687 25688"use strict"; 25689 25690/** 25691 * @license 25692 * Copyright 2019 Google Inc. 25693 * 25694 * Permission is hereby granted, free of charge, to any person obtaining a copy 25695 * of this software and associated documentation files (the "Software"), to deal 25696 * in the Software without restriction, including without limitation the rights 25697 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25698 * copies of the Software, and to permit persons to whom the Software is 25699 * furnished to do so, subject to the following conditions: 25700 * 25701 * The above copyright notice and this permission notice shall be included in 25702 * all copies or substantial portions of the Software. 25703 * 25704 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25705 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25706 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25707 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25708 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25709 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25710 * THE SOFTWARE. 25711 */ 25712 25713function __export(m) { 25714 for (var p in m) { 25715 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 25716 } 25717} 25718Object.defineProperty(exports, "__esModule", { value: true }); 25719__export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/component.ts")); 25720__export(__webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts")); 25721__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts")); 25722__export(__webpack_require__(/*! ./character-counter/index */ "./packages/mdc-textfield/character-counter/index.ts")); 25723__export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-textfield/helper-text/index.ts")); 25724__export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-textfield/icon/index.ts")); 25725 25726/***/ }), 25727
25728/***/ "./packages/mdc-tooltip/component.ts": 25729/*!*******************************************!*\ 25730 !*** ./packages/mdc-tooltip/component.ts ***! 25731 \*******************************************/ 25732/*! no static exports found */ 25733/***/ (function(module, exports, __webpack_require__) { 25734 25735"use strict"; 25736 25737/** 25738 * @license 25739 * Copyright 2020 Google Inc. 25740 * 25741 * Permission is hereby granted, free of charge, to any person obtaining a copy 25742 * of this software and associated documentation files (the "Software"), to deal 25743 * in the Software without restriction, including without limitation the rights 25744 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25745 * copies of the Software, and to permit persons to whom the Software is 25746 * furnished to do so, subject to the following conditions: 25747 * 25748 * The above copyright notice and this permission notice shall be included in 25749 * all copies or substantial portions of the Software. 25750 * 25751 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25752 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25753 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25754 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25755 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25756 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25757 * THE SOFTWARE. 25758 */ 25759 25760var __extends = this && this.__extends || function () { 25761 var _extendStatics = function extendStatics(d, b) { 25762 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 25763 d.__proto__ = b; 25764 } || function (d, b) { 25765 for (var p in b) { 25766 if (b.hasOwnProperty(p)) d[p] = b[p]; 25767 } 25768 }; 25769 return _extendStatics(d, b); 25770 }; 25771 return function (d, b) { 25772 _extendStatics(d, b); 25773 function __() { 25774 this.constructor = d; 25775 } 25776 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25777 }; 25778}(); 25779Object.defineProperty(exports, "__esModule", { value: true }); 25780var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 25781var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tooltip/constants.ts"); 25782var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tooltip/foundation.ts"); 25783var MDCTooltip = /** @class */function (_super) { 25784 __extends(MDCTooltip, _super); 25785 function MDCTooltip() { 25786 return _super !== null && _super.apply(this, arguments) || this; 25787 } 25788 MDCTooltip.attachTo = function (root) { 25789 return new MDCTooltip(root); 25790 }; 25791 MDCTooltip.prototype.initialize = function () { 25792 var tooltipId = this.root.getAttribute('id'); 25793 if (!tooltipId) { 25794 throw new Error('MDCTooltip: Tooltip component must have an id.'); 25795 } 25796 var anchorElem = document.querySelector("[aria-describedby=\"" + tooltipId + "\"]") || document.querySelector("[data-tooltip-id=\"" + tooltipId + "\"]"); 25797 if (!anchorElem) { 25798 throw new Error('MDCTooltip: Tooltip component requires an anchor element annotated with [aria-describedby] or [data-tooltip-id] anchor element.'); 25799 } 25800 this.anchorElem = anchorElem; 25801 }; 25802 MDCTooltip.prototype.initialSyncWithDOM = function () { 25803 var _this = this; 25804 this.isTooltipRich = this.foundation.isRich(); 25805 this.isTooltipPersistent = this.foundation.isPersistent(); 25806 this.handleMouseEnter = function () { 25807 _this.foundation.handleAnchorMouseEnter(); 25808 }; 25809 this.handleFocus = function (evt) { 25810 _this.foundation.handleAnchorFocus(evt); 25811 }; 25812 this.handleMouseLeave = function () { 25813 _this.foundation.handleAnchorMouseLeave(); 25814 }; 25815 this.handleBlur = function (evt) { 25816 _this.foundation.handleAnchorBlur(evt); 25817 }; 25818 this.handleTransitionEnd = function () { 25819 _this.foundation.handleTransitionEnd(); 25820 }; 25821 this.handleClick = function () { 25822 _this.foundation.handleAnchorClick(); 25823 }; 25824 this.anchorElem.addEventListener('blur', this.handleBlur); 25825 if (this.isTooltipRich && this.isTooltipPersistent) { 25826 this.anchorElem.addEventListener('click', this.handleClick); 25827 } else { 25828 this.anchorElem.addEventListener('mouseenter', this.handleMouseEnter); 25829 // TODO(b/157075286): Listening for a 'focus' event is too broad. 25830 this.anchorElem.addEventListener('focus', this.handleFocus); 25831 this.anchorElem.addEventListener('mouseleave', this.handleMouseLeave); 25832 } 25833 this.listen('transitionend', this.handleTransitionEnd); 25834 }; 25835 MDCTooltip.prototype.destroy = function () { 25836 if (this.anchorElem) { 25837 this.anchorElem.removeEventListener('blur', this.handleBlur); 25838 if (this.isTooltipRich && this.isTooltipPersistent) { 25839 this.anchorElem.removeEventListener('click', this.handleClick); 25840 } else { 25841 this.anchorElem.removeEventListener('mouseenter', this.handleMouseEnter); 25842 this.anchorElem.removeEventListener('focus', this.handleFocus); 25843 this.anchorElem.removeEventListener('mouseleave', this.handleMouseLeave); 25844 } 25845 } 25846 this.unlisten('transitionend', this.handleTransitionEnd); 25847 _super.prototype.destroy.call(this); 25848 }; 25849 MDCTooltip.prototype.setTooltipPosition = function (position) { 25850 this.foundation.setTooltipPosition(position); 25851 }; 25852 MDCTooltip.prototype.setAnchorBoundaryType = function (type) { 25853 this.foundation.setAnchorBoundaryType(type); 25854 }; 25855 MDCTooltip.prototype.hide = function () { 25856 this.foundation.hide(); 25857 }; 25858 MDCTooltip.prototype.isShown = function () { 25859 this.foundation.isShown(); 25860 }; 25861 MDCTooltip.prototype.getDefaultFoundation = function () { 25862 var _this = this; 25863 var adapter = { 25864 getAttribute: function getAttribute(attr) { 25865 return _this.root.getAttribute(attr); 25866 }, 25867 setAttribute: function setAttribute(attr, value) { 25868 _this.root.setAttribute(attr, value); 25869 }, 25870 addClass: function addClass(className) { 25871 _this.root.classList.add(className); 25872 }, 25873 hasClass: function hasClass(className) { 25874 return _this.root.classList.contains(className); 25875 }, 25876 removeClass: function removeClass(className) { 25877 _this.root.classList.remove(className); 25878 }, 25879 getComputedStyleProperty: function getComputedStyleProperty(propertyName) { 25880 return window.getComputedStyle(_this.root).getPropertyValue(propertyName); 25881 }, 25882 setStyleProperty: function setStyleProperty(propertyName, value) { 25883 _this.root.style.setProperty(propertyName, value); 25884 }, 25885 setSurfaceStyleProperty: function setSurfaceStyleProperty(propertyName, value) { 25886 var surface = _this.root.querySelector("." + constants_1.CssClasse
25886s.SURFACE); 25887 surface === null || surface === void 0 ? void 0 : surface.style.setProperty(propertyName, value); 25888 }, 25889 getViewportWidth: function getViewportWidth() { 25890 return window.innerWidth; 25891 }, 25892 getViewportHeight: function getViewportHeight() { 25893 return window.innerHeight; 25894 }, 25895 getTooltipSize: function getTooltipSize() { 25896 return { 25897 width: _this.root.offsetWidth, 25898 height: _this.root.offsetHeight 25899 }; 25900 }, 25901 getAnchorBoundingRect: function getAnchorBoundingRect() { 25902 return _this.anchorElem ? _this.anchorElem.getBoundingClientRect() : null; 25903 }, 25904 getParentBoundingRect: function getParentBoundingRect() { 25905 var _a, _b; 25906 return (_b = (_a = _this.root.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) !== null && _b !== void 0 ? _b : null; 25907 }, 25908 getAnchorAttribute: function getAnchorAttribute(attr) { 25909 return _this.anchorElem ? _this.anchorElem.getAttribute(attr) : null; 25910 }, 25911 setAnchorAttribute: function setAnchorAttribute(attr, value) { 25912 var _a; 25913 (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.setAttribute(attr, value); 25914 }, 25915 isRTL: function isRTL() { 25916 return getComputedStyle(_this.root).direction === 'rtl'; 25917 }, 25918 anchorContainsElement: function anchorContainsElement(element) { 25919 var _a; 25920 return !!((_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.contains(element)); 25921 }, 25922 tooltipContainsElement: function tooltipContainsElement(element) { 25923 return _this.root.contains(element); 25924 }, 25925 focusAnchorElement: function focusAnchorElement() { 25926 var _a; 25927 (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.focus(); 25928 }, 25929 registerEventHandler: function registerEventHandler(evt, handler) { 25930 if (_this.root instanceof HTMLElement) { 25931 _this.root.addEventListener(evt, handler); 25932 } 25933 }, 25934 deregisterEventHandler: function deregisterEventHandler(evt, handler) { 25935 if (_this.root instanceof HTMLElement) { 25936 _this.root.removeEventListener(evt, handler); 25937 } 25938 }, 25939 registerDocumentEventHandler: function registerDocumentEventHandler(evt, handler) { 25940 document.body.addEventListener(evt, handler); 25941 }, 25942 deregisterDocumentEventHandler: function deregisterDocumentEventHandler(evt, handler) { 25943 document.body.removeEventListener(evt, handler); 25944 }, 25945 registerWindowEventHandler: function registerWindowEventHandler(evt, handler) { 25946 window.addEventListener(evt, handler); 25947 }, 25948 deregisterWindowEventHandler: function deregisterWindowEventHandler(evt, handler) { 25949 window.removeEventListener(evt, handler); 25950 }, 25951 notifyHidden: function notifyHidden() { 25952 _this.emit(constants_1.events.HIDDEN, {}); 25953 } 25954 }; 25955 //tslint:enable:object-literal-sort-keys 25956 return new foundation_1.MDCTooltipFoundation(adapter); 25957 }; 25958 return MDCTooltip; 25959}(component_1.MDCComponent); 25960exports.MDCTooltip = MDCTooltip; 25961 25962/***/ }), 25963
25964/***/ "./packages/mdc-tooltip/constants.ts": 25965/*!*******************************************!*\ 25966 !*** ./packages/mdc-tooltip/constants.ts ***! 25967 \*******************************************/ 25968/*! no static exports found */ 25969/***/ (function(module, exports, __webpack_require__) { 25970 25971"use strict"; 25972 25973/** 25974 * @license 25975 * Copyright 2020 Google Inc. 25976 * 25977 * Permission is hereby granted, free of charge, to any person obtaining a copy 25978 * of this software and associated documentation files (the "Software"), to deal 25979 * in the Software without restriction, including without limitation the rights 25980 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25981 * copies of the Software, and to permit persons to whom the Software is 25982 * furnished to do so, subject to the following conditions: 25983 * 25984 * The above copyright notice and this permission notice shall be included in 25985 * all copies or substantial portions of the Software. 25986 * 25987 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25988 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25989 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25990 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25991 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25992 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25993 * THE SOFTWARE. 25994 */ 25995 25996Object.defineProperty(exports, "__esModule", { value: true }); 25997var CssClasses; 25998(function (CssClasses) { 25999 CssClasses["RICH"] = "mdc-tooltip--rich"; 26000 CssClasses["SHOWN"] = "mdc-tooltip--shown"; 26001 CssClasses["SHOWING"] = "mdc-tooltip--showing"; 26002 CssClasses["SHOWING_TRANSITION"] = "mdc-tooltip--showing-transition"; 26003 CssClasses["HIDE"] = "mdc-tooltip--hide"; 26004 CssClasses["HIDE_TRANSITION"] = "mdc-tooltip--hide-transition"; 26005 CssClasses["MULTILINE_TOOLTIP"] = "mdc-tooltip--multiline"; 26006 CssClasses["SURFACE"] = "mdc-tooltip__surface"; 26007})(CssClasses || (CssClasses = {})); 26008exports.CssClasses = CssClasses; 26009var numbers = { 26010 BOUNDED_ANCHOR_GAP: 4, 26011 UNBOUNDED_ANCHOR_GAP: 8, 26012 MIN_VIEWPORT_TOOLTIP_THRESHOLD: 8, 26013 HIDE_DELAY_MS: 600, 26014 SHOW_DELAY_MS: 500, 26015 // LINT.IfChange(tooltip-dimensions) 26016 MIN_HEIGHT: 24, 26017 MAX_WIDTH: 200 26018}; 26019exports.numbers = numbers; 26020var attributes = { 26021 ARIA_EXPANDED: 'aria-expanded', 26022 ARIA_HASPOPUP: 'aria-haspopup', 26023 PERSISTENT: 'data-mdc-tooltip-persistent' 26024}; 26025exports.attributes = attributes; 26026var events = { 26027 HIDDEN: 'MDCTooltip:hidden' 26028}; 26029exports.events = events; 26030/** Enum for possible tooltip positioning relative to its anchor element. */ 26031var XPosition; 26032(function (XPosition) { 26033 XPosition[XPosition["DETECTED"] = 0] = "DETECTED"; 26034 XPosition[XPosition["START"] = 1] = "START"; 26035 // Note: CENTER is not valid for rich tooltips. 26036 XPosition[XPosition["CENTER"] = 2] = "CENTER"; 26037 XPosition[XPosition["END"] = 3] = "END"; 26038})(XPosition || (XPosition = {})); 26039exports.XPosition = XPosition; 26040var YPosition; 26041(function (YPosition) { 26042 YPosition[YPosition["DETECTED"] = 0] = "DETECTED"; 26043 YPosition[YPosition["ABOVE"] = 1] = "ABOVE"; 26044 YPosition[YPosition["BELOW"] = 2] = "BELOW"; 26045})(YPosition || (YPosition = {})); 26046exports.YPosition = YPosition; 26047/** 26048 * Enum for possible anchor boundary types. This determines the gap between the 26049 * bottom of the anchor and the tooltip element. 26050 * Bounded anchors have an identifiable boundary (e.g. buttons). 26051 * Unbounded anchors don't have a visually declared boundary (e.g. plain text). 26052 */ 26053var AnchorBoundaryType; 26054(function (AnchorBoundaryType) { 26055 AnchorBoundaryType[AnchorBoundaryType["BOUNDED"] = 0] = "BOUNDED"; 26056 AnchorBoundaryType[AnchorBoundaryType["UNBOUNDED"] = 1] = "UNBOUNDED"; 26057})(AnchorBoundaryType || (AnchorBoundaryType = {})); 26058exports.AnchorBoundaryType = AnchorBoundaryType; 26059var strings = { 26060 LEFT: 'left', 26061 RIGHT: 'right', 26062 CENTER: 'center', 26063 TOP: 'top', 26064 BOTTOM: 'bottom' 26065}; 26066exports.strings = strings; 26067 26068/***/ }), 26069
26070/***/ "./packages/mdc-tooltip/foundation.ts": 26071/*!********************************************!*\ 26072 !*** ./packages/mdc-tooltip/foundation.ts ***! 26073 \********************************************/ 26074/*! no static exports found */ 26075/***/ (function(module, exports, __webpack_require__) { 26076 26077"use strict"; 26078 26079/** 26080 * @license 26081 * Copyright 2020 Google Inc. 26082 * 26083 * Permission is hereby granted, free of charge, to any person obtaining a copy 26084 * of this software and associated documentation files (the "Software"), to deal 26085 * in the Software without restriction, including without limitation the rights 26086 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26087 * copies of the Software, and to permit persons to whom the Software is 26088 * furnished to do so, subject to the following conditions: 26089 * 26090 * The above copyright notice and this permission notice shall be included in 26091 * all copies or substantial portions of the Software. 26092 * 26093 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26094 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26095 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26096 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26097 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26098 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26099 * THE SOFTWARE. 26100 */ 26101 26102var __extends = this && this.__extends || function () { 26103 var _extendStatics = function extendStatics(d, b) { 26104 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 26105 d.__proto__ = b; 26106 } || function (d, b) { 26107 for (var p in b) { 26108 if (b.hasOwnProperty(p)) d[p] = b[p]; 26109 } 26110 }; 26111 return _extendStatics(d, b); 26112 }; 26113 return function (d, b) { 26114 _extendStatics(d, b); 26115 function __() { 26116 this.constructor = d; 26117 } 26118 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 26119 }; 26120}(); 26121var __assign = this && this.__assign || function () { 26122 __assign = Object.assign || function (t) { 26123 for (var s, i = 1, n = arguments.length; i < n; i++) { 26124 s = arguments[i]; 26125 for (var p in s) { 26126 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 26127 } 26128 } 26129 return t; 26130 }; 26131 return __assign.apply(this, arguments); 26132}; 26133var __values = this && this.__values || function (o) { 26134 var s = typeof Symbol === "function" && Symbol.iterator, 26135 m = s && o[s], 26136 i = 0; 26137 if (m) return m.call(o); 26138 if (o && typeof o.length === "number") return { 26139 next: function next() { 26140 if (o && i >= o.length) o = void 0; 26141 return { value: o && o[i++], done: !o }; 26142 } 26143 }; 26144 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 26145}; 26146Object.defineProperty(exports, "__esModule", { value: true }); 26147var animationframe_1 = __webpack_require__(/*! @material/animation/animationframe */ "./packages/mdc-animation/animationframe.ts"); 26148var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 26149var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 26150var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 26151var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tooltip/constants.ts"); 26152var RICH = constants_1.CssClasses.RICH, 26153 SHOWN = constants_1.CssClasses.SHOWN, 26154 SHOWING = constants_1.CssClasses.SHOWING, 26155 SHOWING_TRANSITION = constants_1.CssClasses.SHOWING_TRANSITION, 26156 HIDE = constants_1.CssClasses.HIDE, 26157 HIDE_TRANSITION = constants_1.CssClasses.HIDE_TRANSITION, 26158 MULTILINE_TOOLTIP = constants_1.CssClasses.MULTILINE_TOOLTIP; 26159var AnimationKeys; 26160(function (AnimationKeys) { 26161 AnimationKeys["POLL_ANCHOR"] = "poll_anchor"; 26162})(AnimationKeys || (AnimationKeys = {})); 26163// Accessing `window` without a `typeof` check will throw on Node environments. 26164var HAS_WINDOW = typeof window !== 'undefined'; 26165var MDCTooltipFoundation = /** @class */function (_super) { 26166 __extends(MDCTooltipFoundation, _super); 26167 function MDCTooltipFoundation(adapter) { 26168 var _this = _super.call(this, __assign(__assign({}, MDCTooltipFoundation.defaultAdapter), adapter)) || this; 26169 _this.tooltipShown = false;
26170 _this.anchorGap = constants_1.numbers.BOUNDED_ANCHOR_GAP; 26171 _this.xTooltipPos = constants_1.XPosition.DETECTED; 26172 _this.yTooltipPos = constants_1.YPosition.DETECTED; 26173 // Minimum threshold distance needed between the tooltip and the viewport. 26174 _this.minViewportTooltipThreshold = constants_1.numbers.MIN_VIEWPORT_TOOLTIP_THRESHOLD; 26175 _this.hideDelayMs = constants_1.numbers.HIDE_DELAY_MS; 26176 _this.showDelayMs = constants_1.numbers.SHOW_DELAY_MS; 26177 _this.anchorRect = null; 26178 _this.parentRect = null; 26179 _this.frameId = null; 26180 _this.hideTimeout = null; 26181 _this.showTimeout = null; 26182 _this.animFrame = new animationframe_1.AnimationFrame(); 26183 _this.documentClickHandler = function (evt) { 26184 _this.handleDocumentClick(evt); 26185 }; 26186 _this.documentKeydownHandler = function (evt) { 26187 _this.handleKeydown(evt); 26188 }; 26189 _this.richTooltipMouseEnterHandler = function () { 26190 _this.handleRichTooltipMouseEnter(); 26191 }; 26192 _this.richTooltipMouseLeaveHandler = function () { 26193 _this.handleRichTooltipMouseLeave(); 26194 }; 26195 _this.richTooltipFocusOutHandler = function (evt) { 26196 _this.handleRichTooltipFocusOut(evt); 26197 }; 26198 _this.windowScrollHandler = function () { 26199 _this.handleWindowChangeEvent(); 26200 }; 26201 _this.windowResizeHandler = function () { 26202 _this.handleWindowChangeEvent(); 26203 }; 26204 return _this; 26205 } 26206 Object.defineProperty(MDCTooltipFoundation, "defaultAdapter", { 26207 get: function get() { 26208 return { 26209 getAttribute: function getAttribute() { 26210 return null; 26211 }, 26212 setAttribute: function setAttribute() { 26213 return undefined; 26214 }, 26215 addClass: function addClass() { 26216 return undefined; 26217 }, 26218 hasClass: function hasClass() { 26219 return false; 26220 }, 26221 removeClass: function removeClass() { 26222 return undefined; 26223 }, 26224 getComputedStyleProperty: function getComputedStyleProperty() { 26225 return ''; 26226 }, 26227 setStyleProperty: function setStyleProperty() { 26228 return undefined; 26229 }, 26230 setSurfaceStyleProperty: function setSurfaceStyleProperty() { 26231 return undefined; 26232 }, 26233 getViewportWidth: function getViewportWidth() { 26234 return 0; 26235 }, 26236 getViewportHeight: function getViewportHeight() { 26237 return 0; 26238 }, 26239 getTooltipSize: function getTooltipSize() { 26240 return { width: 0, height: 0 }; 26241 }, 26242 getAnchorBoundingRect: function getAnchorBoundingRect() { 26243 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 26244 }, 26245 getParentBoundingRect: function getParentBoundingRect() { 26246 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 26247 }, 26248 getAnchorAttribute: function getAnchorAttribute() { 26249 return null; 26250 }, 26251 setAnchorAttribute: function setAnchorAttribute() { 26252 return null; 26253 }, 26254 isRTL: function isRTL() { 26255 return false; 26256 }, 26257 anchorContainsElement: function anchorContainsElement() { 26258 return false; 26259 }, 26260 tooltipContainsElement: function tooltipContainsElement() { 26261 return false; 26262 }, 26263 focusAnchorElement: function focusAnchorElement() { 26264 return undefined; 26265 }, 26266 registerEventHandler: function registerEventHandler() { 26267 return undefined; 26268 }, 26269 deregisterEventHandler: function deregisterEventHandler() { 26270 return undefined; 26271 }, 26272 registerDocumentEventHandler: function registerDocumentEventHandler() { 26273 return undefined; 26274 }, 26275 deregisterDocumentEventHandler: function deregisterDocumentEventHandler() { 26276 return undefined; 26277 }, 26278 registerWindowEventHandler: function registerWindowEventHandler() { 26279 return undefined; 26280 }, 26281 deregisterWindowEventHandler: function deregisterWindowEventHandler() { 26282 return undefined; 26283 }, 26284 notifyHidden: function notifyHidden() { 26285 return undefined; 26286 } 26287 }; 26288 }, 26289 enumerable: true, 26290 configurable: true 26291 }); 26292 MDCTooltipFoundation.prototype.init = function () { 26293 this.richTooltip = this.adapter.hasClass(RICH); 26294 this.persistentTooltip = this.adapter.getAttribute(constants_1.attributes.PERSISTENT) === 'true'; 26295 this.interactiveTooltip = !!this.adapter.getAnchorAttribute(constants_1.attributes.ARIA_EXPANDED) && this.adapter.getAnchorAttribute(constants_1.attributes.ARIA_HASPOPUP) === 'dialog'; 26296 }; 26297 MDCTooltipFoundation.prototype.isShown = function () { 26298 return this.tooltipShown; 26299 }; 26300 MDCTooltipFoundation.prototype.isRich = function () { 26301 return this.richTooltip; 26302 }; 26303 MDCTooltipFoundation.prototype.isPersistent = function () { 26304 return this.persistentTooltip; 26305 }; 26306 MDCTooltipFoundation.prototype.handleAnchorMouseEnter = function () { 26307 var _this = this; 26308 if (this.tooltipShown) { 26309 // Covers the instance where a user hovers over the anch
26309or to reveal the 26310 // tooltip, and then quickly navigates away and then back to the anchor. 26311 // The tooltip should stay visible without animating out and then back in 26312 // again. 26313 this.show(); 26314 } else { 26315 // clearHideTimeout here since handleAnchorMouseLeave sets a hideTimeout 26316 // and that can execute before the showTimeout executes, resulting in hide 26317 // being called and the showTimeout set below to be cleared. 26318 this.clearHideTimeout(); 26319 this.showTimeout = setTimeout(function () { 26320 _this.show(); 26321 }, this.showDelayMs); 26322 } 26323 }; 26324 MDCTooltipFoundation.prototype.handleAnchorFocus = function (evt) { 26325 var _this = this; 26326 // TODO(b/157075286): Need to add some way to distinguish keyboard 26327 // navigation focus events from other focus events, and only show the 26328 // tooltip on the former of these events. 26329 var relatedTarget = evt.relatedTarget; 26330 var tooltipContainsRelatedTarget = relatedTarget instanceof HTMLElement && this.adapter.tooltipContainsElement(relatedTarget); 26331 // Do not show tooltip if the previous focus was on a tooltip element. This 26332 // occurs when a rich tooltip is closed and focus is restored to the anchor 26333 // or when user tab-navigates back into the anchor from the rich tooltip. 26334 if (tooltipContainsRelatedTarget) { 26335 return; 26336 } 26337 this.showTimeout = setTimeout(function () { 26338 _this.show(); 26339 }, this.showDelayMs); 26340 }; 26341 MDCTooltipFoundation.prototype.handleAnchorMouseLeave = function () { 26342 var _this = this; 26343 this.clearShowTimeout(); 26344 this.hideTimeout = setTimeout(function () { 26345 _this.hide(); 26346 }, this.hideDelayMs); 26347 }; 26348 MDCTooltipFoundation.prototype.handleAnchorBlur = function (evt) { 26349 if (this.richTooltip) { 26350 var tooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement && this.adapter.tooltipContainsElement(evt.relatedTarget); 26351 // If focus changed to the tooltip element, don't hide the tooltip. 26352 if (tooltipContainsRelatedTargetElement) { 26353 return; 26354 } 26355 } 26356 // Hide tooltip immediately on focus change. 26357 this.hide(); 26358 }; 26359 MDCTooltipFoundation.prototype.handleAnchorClick = function () { 26360 if (this.tooltipShown) { 26361 this.hide(); 26362 } else { 26363 this.show(); 26364 } 26365 }; 26366 MDCTooltipFoundation.prototype.handleDocumentClick = function (evt) { 26367 var anchorOrTooltipContainsTargetElement = evt.target instanceof HTMLElement && (this.adapter.anchorContainsElement(evt.target) || this.adapter.tooltipContainsElement(evt.target)); 26368 // For persistent rich tooltips, we will not hide if: 26369 // - The click target is within the anchor element. Otherwise, both 26370 // the anchor element's click handler and this handler will handle the 26371 // click (due to event propagation), resulting in a shown tooltip 26372 // being immediately hidden if the tooltip was initially hidden. 26373 // - The click target is within the tooltip element, since clicks 26374 // on the tooltip do not close the tooltip. 26375 if (this.richTooltip && this.persistentTooltip && anchorOrTooltipContainsTargetElement) { 26376 return; 26377 } 26378 // Hide the tooltip immediately on click. 26379 this.hide(); 26380 }; 26381 MDCTooltipFoundation.prototype.handleKeydown = function (evt) { 26382 // Hide the tooltip immediately on ESC key. 26383 var key = keyboard_1.normalizeKey(evt); 26384 if (key === keyboard_1.KEY.ESCAPE) { 26385 var tooltipContainsActiveElement = document.activeElement instanceof HTMLElement && this.adapter.tooltipContainsElement(document.activeElement); 26386 if (tooltipContainsActiveElement) { 26387 this.adapter.focusAnchorElement(); 26388 } 26389 this.hide(); 26390 } 26391 }; 26392 MDCTooltipFoundation.prototype.handleRichTooltipMouseEnter = function () { 26393 this.show(); 26394 }; 26395 MDCTooltipFoundation.prototype.handleRichTooltipMouseLeave = function () { 26396 var _this = this; 26397 this.clearShowTimeout(); 26398 this.hideTimeout = setTimeout(function () { 26399 _this.hide(); 26400 }, this.hideDelayMs); 26401 }; 26402 MDCTooltipFoundation.prototype.handleRichTooltipFocusOut = function (evt) { 26403 var anchorOrTooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement && (this.adapter.anchorContainsElement(evt.relatedTarget) || this.adapter.tooltipContainsElement(evt.relatedTarget));
26404 // If the focus is still within the anchor or the tooltip, do not hide the 26405 // tooltip. 26406 if (anchorOrTooltipContainsRelatedTargetElement) { 26407 return; 26408 } 26409 this.hide(); 26410 }; 26411 /** 26412 * On window resize or scroll, check the anchor position and size and 26413 * repostion tooltip if necessary. 26414 */ 26415 MDCTooltipFoundation.prototype.handleWindowChangeEvent = function () { 26416 var _this = this; 26417 // Since scroll and resize events can fire at a high rate, we throttle 26418 // the potential re-positioning of tooltip component using 26419 // requestAnimationFrame. 26420 this.animFrame.request(AnimationKeys.POLL_ANCHOR, function () { 26421 _this.repositionTooltipOnAnchorMove(); 26422 }); 26423 }; 26424 MDCTooltipFoundation.prototype.show = function () { 26425 var _this = this; 26426 this.clearHideTimeout(); 26427 this.clearShowTimeout(); 26428 if (this.tooltipShown) { 26429 return; 26430 } 26431 this.tooltipShown = true; 26432 var showTooltipOptions = this.parseShowTooltipOptions(); 26433 if (!showTooltipOptions.hideFromScreenreader) { 26434 this.adapter.setAttribute('aria-hidden', 'false'); 26435 } 26436 if (this.richTooltip) { 26437 if (this.interactiveTooltip) { 26438 this.adapter.setAnchorAttribute('aria-expanded', 'true'); 26439 } 26440 this.adapter.registerEventHandler('focusout', this.richTooltipFocusOutHandler); 26441 if (!this.persistentTooltip) { 26442 this.adapter.registerEventHandler('mouseenter', this.richTooltipMouseEnterHandler); 26443 this.adapter.registerEventHandler('mouseleave', this.richTooltipMouseLeaveHandler); 26444 } 26445 } 26446 this.adapter.removeClass(HIDE); 26447 this.adapter.addClass(SHOWING); 26448 if (this.isTooltipMultiline() && !this.richTooltip) { 26449 this.adapter.addClass(MULTILINE_TOOLTIP); 26450 } 26451 this.anchorRect = this.adapter.getAnchorBoundingRect(); 26452 this.parentRect = this.adapter.getParentBoundingRect(); 26453 this.richTooltip ? this.positionRichTooltip() : this.positionPlainTooltip(); 26454 this.adapter.registerDocumentEventHandler('click', this.documentClickHandler); 26455 this.adapter.registerDocumentEventHandler('keydown', this.documentKeydownHandler); 26456 this.adapter.registerWindowEventHandler('scroll', this.windowScrollHandler); 26457 this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler); 26458 this.frameId = requestAnimationFrame(function () { 26459 _this.clearAllAnimationClasses(); 26460 _this.adapter.addClass(SHOWN); 26461 _this.adapter.addClass(SHOWING_TRANSITION); 26462 }); 26463 }; 26464 MDCTooltipFoundation.prototype.hide = function () { 26465 this.clearHideTimeout(); 26466 this.clearShowTimeout(); 26467 if (!this.tooltipShown) { 26468 return; 26469 } 26470 if (this.frameId) { 26471 cancelAnimationFrame(this.frameId); 26472 } 26473 this.tooltipShown = false; 26474 this.adapter.setAttribute('aria-hidden', 'true'); 26475 this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler); 26476 if (this.richTooltip) { 26477 if (this.interactiveTooltip) { 26478 this.adapter.setAnchorAttribute('aria-expanded', 'false'); 26479 } 26480 if (!this.persistentTooltip) { 26481 this.adapter.deregisterEventHandler('mouseenter', this.richTooltipMouseEnterHandler); 26482 this.adapter.deregisterEventHandler('mouseleave', this.richTooltipMouseLeaveHandler); 26483 } 26484 } 26485 this.clearAllAnimationClasses(); 26486 this.adapter.addClass(HIDE); 26487 this.adapter.addClass(HIDE_TRANSITION); 26488 this.adapter.removeClass(SHOWN); 26489 this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler); 26490 this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler); 26491 this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler); 26492 this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler); 26493 }; 26494 MDCTooltipFoundation.prototype.handleTransitionEnd = function () { 26495 var isHidingTooltip = this.adapter.hasClass(HIDE); 26496 this.adapter.removeClass(SHOWING); 26497 this.adapter.removeClass(SHOWING_TRANSITION); 26498 this.adapter.removeClass(HIDE); 26499 this.adapter.removeClass(HIDE_TRANSITION); 26500 // If handleTransitionEnd is called after hiding the tooltip, the tooltip
26501 // will have the HIDE class (before calling the adapter removeClass method). 26502 // If tooltip is now hidden, send a notification that the animation has 26503 // completed and the tooltip is no longer visible. 26504 if (isHidingTooltip) { 26505 this.adapter.notifyHidden(); 26506 } 26507 }; 26508 MDCTooltipFoundation.prototype.clearAllAnimationClasses = function () { 26509 this.adapter.removeClass(SHOWING_TRANSITION); 26510 this.adapter.removeClass(HIDE_TRANSITION); 26511 }; 26512 MDCTooltipFoundation.prototype.setTooltipPosition = function (position) { 26513 var xPos = position.xPos, 26514 yPos = position.yPos; 26515 if (xPos) { 26516 this.xTooltipPos = xPos; 26517 } 26518 if (yPos) { 26519 this.yTooltipPos = yPos; 26520 } 26521 }; 26522 MDCTooltipFoundation.prototype.setAnchorBoundaryType = function (type) { 26523 if (type === constants_1.AnchorBoundaryType.UNBOUNDED) { 26524 this.anchorGap = constants_1.numbers.UNBOUNDED_ANCHOR_GAP; 26525 } else { 26526 this.anchorGap = constants_1.numbers.BOUNDED_ANCHOR_GAP; 26527 } 26528 }; 26529 MDCTooltipFoundation.prototype.parseShowTooltipOptions = function () { 26530 var hideFromScreenreader = Boolean(this.adapter.getAnchorAttribute('data-tooltip-id')); 26531 return { hideFromScreenreader: hideFromScreenreader }; 26532 }; 26533 MDCTooltipFoundation.prototype.isTooltipMultiline = function () { 26534 var tooltipSize = this.adapter.getTooltipSize(); 26535 return tooltipSize.height > constants_1.numbers.MIN_HEIGHT && tooltipSize.width >= constants_1.numbers.MAX_WIDTH; 26536 }; 26537 MDCTooltipFoundation.prototype.positionPlainTooltip = function () { 26538 // A plain tooltip has `fixed` positioning and is placed as an immediate 26539 // child of the document body. Its positioning is calculated with respect to 26540 // the viewport. 26541 var _a = this.calculateTooltipStyles(this.anchorRect), 26542 top = _a.top, 26543 yTransformOrigin = _a.yTransformOrigin, 26544 left = _a.left, 26545 xTransformOrigin = _a.xTransformOrigin; 26546 var transformProperty = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; 26547 this.adapter.setSurfaceStyleProperty(transformProperty + "-origin", yTransformOrigin + " " + xTransformOrigin); 26548 this.adapter.setStyleProperty('top', top + "px"); 26549 this.adapter.setStyleProperty('left', left + "px"); 26550 }; 26551 MDCTooltipFoundation.prototype.positionRichTooltip = function () { 26552 // TODO(b/177686782): Remove width setting when max-content is used to style 26553 // the rich tooltip. 26554 var _a, _b, _c, _d; 26555 // getComputedStyleProperty is used instead of getTooltipSize since 26556 // getTooltipSize returns the offSetWidth, which includes the border and 26557 // padding. What we need is the width of the tooltip without border and 26558 // padding. 26559 var width = this.adapter.getComputedStyleProperty('width'); 26560 // When rich tooltips are positioned within their parent containers, the 26561 // tooltip width might be shrunk if it collides with the edge of the parent 26562 // container. We set the width of the tooltip to prevent this. 26563 this.adapter.setStyleProperty('width', width); 26564 var _e = this.calculateTooltipStyles(this.anchorRect), 26565 top = _e.top, 26566 yTransformOrigin = _e.yTransformOrigin, 26567 left = _e.left, 26568 xTransformOrigin = _e.xTransformOrigin; 26569 var transformProperty = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; 26570 this.adapter.setSurfaceStyleProperty(transformProperty + "-origin", yTransformOrigin + " " + xTransformOrigin); 26571 // A rich tooltip has `absolute` positioning and is placed as a sibling to 26572 // the anchor element. Its positioning is calculated with respect to the 26573 // parent element, and so the values need to be adjusted against the parent 26574 // element. 26575 var leftAdjustment = left - ((_b = (_a = this.parentRect) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0); 26576 var topAdjustment = top - ((_d = (_c = this.parentRect) === null || _c === void 0 ? void 0 : _c.top) !== null && _d !== void 0 ? _d : 0); 26577 this.adapter.setStyleProperty('top', topAdjustment + "px"); 26578 this.adapter.setStyleProperty('left', leftAdjustment + "px"); 26579 }; 26580 /** 26581 * Calculates the position of the tooltip. A tooltip will be placed beneath
26582 * the anchor element and aligned either with the 'start'/'end' edge of the 26583 * anchor element or the 'center'. 26584 * 26585 * Tooltip alignment is selected such that the tooltip maintains a threshold 26586 * distance away from the viewport (defaulting to 'center' alignment). If the 26587 * placement of the anchor prevents this threshold distance from being 26588 * maintained, the tooltip is positioned so that it does not collide with the 26589 * viewport. 26590 * 26591 * Users can specify an alignment, however, if this alignment results in the 26592 * tooltip colliding with the viewport, this specification is overwritten. 26593 */ 26594 MDCTooltipFoundation.prototype.calculateTooltipStyles = function (anchorRect) { 26595 if (!anchorRect) { 26596 return { top: 0, left: 0 }; 26597 } 26598 var tooltipSize = this.adapter.getTooltipSize(); 26599 var top = this.calculateYTooltipDistance(anchorRect, tooltipSize.height); 26600 var left = this.calculateXTooltipDistance(anchorRect, tooltipSize.width); 26601 return { 26602 top: top.distance, 26603 yTransformOrigin: top.yTransformOrigin, 26604 left: left.distance, 26605 xTransformOrigin: left.xTransformOrigin 26606 }; 26607 }; 26608 /** 26609 * Calculates the `left` distance for the tooltip. 26610 * Returns the distance value and a string indicating the x-axis transform- 26611 * origin that should be used when animating the tooltip. 26612 */ 26613 MDCTooltipFoundation.prototype.calculateXTooltipDistance = function (anchorRect, tooltipWidth) { 26614 var isLTR = !this.adapter.isRTL(); 26615 var startPos, endPos, centerPos; 26616 var startTransformOrigin, endTransformOrigin; 26617 if (this.richTooltip) { 26618 startPos = isLTR ? anchorRect.left - tooltipWidth : anchorRect.right; 26619 endPos = isLTR ? anchorRect.right : anchorRect.left - tooltipWidth; 26620 startTransformOrigin = isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT; 26621 endTransformOrigin = isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT; 26622 } else { 26623 startPos = isLTR ? anchorRect.left : anchorRect.right - tooltipWidth; 26624 endPos = isLTR ? anchorRect.right - tooltipWidth : anchorRect.left; 26625 centerPos = anchorRect.left + (anchorRect.width - tooltipWidth) / 2; 26626 startTransformOrigin = isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT; 26627 endTransformOrigin = isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT; 26628 } 26629 var positionOptions = this.richTooltip ? this.determineValidPositionOptions(startPos, endPos) : 26630 // For plain tooltips, centerPos is defined 26631 this.determineValidPositionOptions(centerPos, startPos, endPos); 26632 if (this.xTooltipPos === constants_1.XPosition.START && positionOptions.has(startPos)) { 26633 return { distance: startPos, xTransformOrigin: startTransformOrigin }; 26634 } 26635 if (this.xTooltipPos === constants_1.XPosition.END && positionOptions.has(endPos)) { 26636 return { distance: endPos, xTransformOrigin: endTransformOrigin }; 26637 } 26638 if (this.xTooltipPos === constants_1.XPosition.CENTER && positionOptions.has(centerPos)) { 26639 // This code path is only executed if calculating the distance for plain 26640 // tooltips. In this instance, centerPos will always be defined, so we can 26641 // safely assert that the returned value is non-null/undefined. 26642 return { distance: centerPos, xTransformOrigin: constants_1.strings.CENTER }; 26643 } 26644 // If no user position is supplied, rich tooltips default to end pos, then 26645 // start position. Plain tooltips default to center, start, then end. 26646 var possiblePositions = this.richTooltip ? [{ distance: endPos, xTransformOrigin: endTransformOrigin }, { distance: startPos, xTransformOrigin: startTransformOrigin }] : [{ distance: centerPos, xTransformOrigin: constants_1.strings.CENTER }, { distance: startPos, xTransformOrigin: startTransformOrigin }, { distance: endPos, xTransformOrigin: endTransformOrigin }];
26647 var validPosition = possiblePositions.find(function (_a) { 26648 var distance = _a.distance; 26649 return positionOptions.has(distance); 26650 }); 26651 if (validPosition) { 26652 return validPosition; 26653 } 26654 // Indicates that all potential positions would result in the tooltip 26655 // colliding with the viewport. This would only occur when the anchor 26656 // element itself collides with the viewport, or the viewport is very 26657 // narrow. In this case, we allow the tooltip to be mis-aligned from the 26658 // anchor element. 26659 if (anchorRect.left < 0) { 26660 return { 26661 distance: this.minViewportTooltipThreshold, 26662 xTransformOrigin: constants_1.strings.LEFT 26663 }; 26664 } else { 26665 var viewportWidth = this.adapter.getViewportWidth(); 26666 var distance = viewportWidth - (tooltipWidth + this.minViewportTooltipThreshold); 26667 return { distance: distance, xTransformOrigin: constants_1.strings.RIGHT }; 26668 } 26669 }; 26670 /** 26671 * Given the values for the horizontal alignments of the tooltip, calculates 26672 * which of these options would result in the tooltip maintaining the required 26673 * threshold distance vs which would result in the tooltip staying within the 26674 * viewport. 26675 * 26676 * A Set of values is returned holding the distances that would honor the 26677 * above requirements. Following the logic for determining the tooltip 26678 * position, if all alignments violate the threshold, then the returned Set 26679 * contains values that keep the tooltip within the viewport. 26680 */ 26681 MDCTooltipFoundation.prototype.determineValidPositionOptions = function () { 26682 var e_1, _a; 26683 var positions = []; 26684 for (var _i = 0; _i < arguments.length; _i++) { 26685 positions[_i] = arguments[_i]; 26686 } 26687 var posWithinThreshold = new Set(); 26688 var posWithinViewport = new Set(); 26689 try { 26690 for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) { 26691 var position = positions_1_1.value; 26692 if (this.positionHonorsViewportThreshold(position)) { 26693 posWithinThreshold.add(position); 26694 } else if (this.positionDoesntCollideWithViewport(position)) { 26695 posWithinViewport.add(position); 26696 } 26697 } 26698 } catch (e_1_1) { 26699 e_1 = { error: e_1_1 }; 26700 } finally { 26701 try { 26702 if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1); 26703 } finally { 26704 if (e_1) throw e_1.error; 26705 } 26706 } 26707 return posWithinThreshold.size ? posWithinThreshold : posWithinViewport; 26708 }; 26709 MDCTooltipFoundation.prototype.positionHonorsViewportThreshold = function (leftPos) { 26710 var viewportWidth = this.adapter.getViewportWidth(); 26711 var tooltipWidth = this.adapter.getTooltipSize().width; 26712 return leftPos + tooltipWidth <= viewportWidth - this.minViewportTooltipThreshold && leftPos >= this.minViewportTooltipThreshold; 26713 }; 26714 MDCTooltipFoundation.prototype.positionDoesntCollideWithViewport = function (leftPos) { 26715 var viewportWidth = this.adapter.getViewportWidth(); 26716 var tooltipWidth = this.adapter.getTooltipSize().width; 26717 return leftPos + tooltipWidth <= viewportWidth && leftPos >= 0; 26718 }; 26719 /** 26720 * Calculates the `top` distance for the tooltip. 26721 * Returns the distance value and a string indicating the y-axis transform- 26722 * origin that should be used when animating the tooltip. 26723 */ 26724 MDCTooltipFoundation.prototype.calculateYTooltipDistance = function (anchorRect, tooltipHeight) { 26725 var belowYPos = anchorRect.bottom + this.anchorGap; 26726 var aboveYPos = anchorRect.top - (this.anchorGap + tooltipHeight); 26727 var yPositionOptions = this.determineValidYPositionOptions(aboveYPos, belowYPos); 26728 if (this.yTooltipPos === constants_1.YPosition.ABOVE && yPositionOptions.has(aboveYPos)) { 26729 return { distance: aboveYPos, yTransformOrigin: constants_1.strings.BOTTOM }; 26730 } else if (this.yTooltipPos === constants_1.YPosition.BELOW && yPositionOptions.has(belowYPos)) { 26731 return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP }; 26732 } 26733 if (yPositionOptions.has(belowYPos)) { 26734 return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP }; 26735 } 26736 if (yPositionOptions.has(aboveYPos)) { 26737 return { distance: aboveYPos, yTransformOrigin: constants_1.strings.BOTTOM }; 26738 } 26739 // Indicates that all potential positions would result in the tooltip 26740 // colliding with the viewport. This would only occur when the viewport is 26741 // very short. 26742 return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP }; 26743 }; 26744 /** 26745 * Given the values for above/below alignment of the tooltip, calculates 26746 * which of these options would result in the tooltip maintaining the required
26747 * threshold distance vs which would result in the tooltip staying within the 26748 * viewport. 26749 * 26750 * A Set of values is returned holding the distances that would honor the 26751 * above requirements. Following the logic for determining the tooltip 26752 * position, if all possible alignments violate the threshold, then the 26753 * returned Set contains values that keep the tooltip within the viewport. 26754 */ 26755 MDCTooltipFoundation.prototype.determineValidYPositionOptions = function (aboveAnchorPos, belowAnchorPos) { 26756 var posWithinThreshold = new Set(); 26757 var posWithinViewport = new Set(); 26758 if (this.yPositionHonorsViewportThreshold(aboveAnchorPos)) { 26759 posWithinThreshold.add(aboveAnchorPos); 26760 } else if (this.yPositionDoesntCollideWithViewport(aboveAnchorPos)) { 26761 posWithinViewport.add(aboveAnchorPos); 26762 } 26763 if (this.yPositionHonorsViewportThreshold(belowAnchorPos)) { 26764 posWithinThreshold.add(belowAnchorPos); 26765 } else if (this.yPositionDoesntCollideWithViewport(belowAnchorPos)) { 26766 posWithinViewport.add(belowAnchorPos); 26767 } 26768 return posWithinThreshold.size ? posWithinThreshold : posWithinViewport; 26769 }; 26770 MDCTooltipFoundation.prototype.yPositionHonorsViewportThreshold = function (yPos) { 26771 var viewportHeight = this.adapter.getViewportHeight(); 26772 var tooltipHeight = this.adapter.getTooltipSize().height; 26773 return yPos + tooltipHeight + this.minViewportTooltipThreshold <= viewportHeight && yPos >= this.minViewportTooltipThreshold; 26774 }; 26775 MDCTooltipFoundation.prototype.yPositionDoesntCollideWithViewport = function (yPos) { 26776 var viewportHeight = this.adapter.getViewportHeight(); 26777 var tooltipHeight = this.adapter.getTooltipSize().height; 26778 return yPos + tooltipHeight <= viewportHeight && yPos >= 0; 26779 }; 26780 MDCTooltipFoundation.prototype.repositionTooltipOnAnchorMove = function () { 26781 var newAnchorRect = this.adapter.getAnchorBoundingRect(); 26782 if (!newAnchorRect || !this.anchorRect) return; 26783 if (newAnchorRect.top !== this.anchorRect.top || newAnchorRect.left !== this.anchorRect.left || newAnchorRect.height !== this.anchorRect.height || newAnchorRect.width !== this.anchorRect.width) { 26784 this.anchorRect = newAnchorRect; 26785 this.parentRect = this.adapter.getParentBoundingRect(); 26786 this.richTooltip ? this.positionRichTooltip() : this.positionPlainTooltip(); 26787 } 26788 }; 26789 MDCTooltipFoundation.prototype.clearShowTimeout = function () { 26790 if (this.showTimeout) { 26791 clearTimeout(this.showTimeout); 26792 this.showTimeout = null; 26793 } 26794 }; 26795 MDCTooltipFoundation.prototype.clearHideTimeout = function () { 26796 if (this.hideTimeout) { 26797 clearTimeout(this.hideTimeout); 26798 this.hideTimeout = null; 26799 } 26800 }; 26801 MDCTooltipFoundation.prototype.destroy = function () { 26802 if (this.frameId) { 26803 cancelAnimationFrame(this.frameId); 26804 this.frameId = null; 26805 } 26806 this.clearHideTimeout(); 26807 this.clearShowTimeout(); 26808 this.adapter.removeClass(SHOWN); 26809 this.adapter.removeClass(SHOWING_TRANSITION); 26810 this.adapter.removeClass(SHOWING); 26811 this.adapter.removeClass(HIDE); 26812 this.adapter.removeClass(HIDE_TRANSITION); 26813 if (this.richTooltip) { 26814 this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler); 26815 if (!this.persistentTooltip) { 26816 this.adapter.deregisterEventHandler('mouseenter', this.richTooltipMouseEnterHandler); 26817 this.adapter.deregisterEventHandler('mouseleave', this.richTooltipMouseLeaveHandler); 26818 } 26819 } 26820 this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler); 26821 this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler); 26822 this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler); 26823 this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler); 26824 this.animFrame.cancelAll(); 26825 }; 26826 return MDCTooltipFoundation; 26827}(foundation_1.MDCFoundation); 26828exports.MDCTooltipFoundation = MDCTooltipFoundation; 26829// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 26830exports.default = MDCTooltipFoundation; 26831 26832/***/ }), 26833
26834/***/ "./packages/mdc-tooltip/index.ts": 26835/*!***************************************!*\ 26836 !*** ./packages/mdc-tooltip/index.ts ***! 26837 \***************************************/ 26838/*! no static exports found */ 26839/***/ (function(module, exports, __webpack_require__) { 26840 26841"use strict"; 26842 26843/** 26844 * @license 26845 * Copyright 2020 Google Inc. 26846 * 26847 * Permission is hereby granted, free of charge, to any person obtaining a copy 26848 * of this software and associated documentation files (the "Software"), to deal 26849 * in the Software without restriction, including without limitation the rights 26850 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26851 * copies of the Software, and to permit persons to whom the Software is 26852 * furnished to do so, subject to the following conditions: 26853 * 26854 * The above copyright notice and this permission notice shall be included in 26855 * all copies or substantial portions of the Software. 26856 * 26857 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26858 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26859 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26860 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26861 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26862 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26863 * THE SOFTWARE. 26864 */ 26865 26866function __export(m) { 26867 for (var p in m) { 26868 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 26869 } 26870} 26871Object.defineProperty(exports, "__esModule", { value: true }); 26872__export(__webpack_require__(/*! ./component */ "./packages/mdc-tooltip/component.ts")); 26873__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tooltip/foundation.ts")); 26874__export(__webpack_require__(/*! ./constants */ "./packages/mdc-tooltip/constants.ts")); 26875 26876/***/ }), 26877
26878/***/ "./packages/mdc-top-app-bar/component.ts": 26879/*!***********************************************!*\ 26880 !*** ./packages/mdc-top-app-bar/component.ts ***! 26881 \***********************************************/ 26882/*! no static exports found */ 26883/***/ (function(module, exports, __webpack_require__) { 26884 26885"use strict"; 26886 26887/** 26888 * @license 26889 * Copyright 2018 Google Inc. 26890 * 26891 * Permission is hereby granted, free of charge, to any person obtaining a copy 26892 * of this software and associated documentation files (the "Software"), to deal 26893 * in the Software without restriction, including without limitation the rights 26894 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26895 * copies of the Software, and to permit persons to whom the Software is 26896 * furnished to do so, subject to the following conditions: 26897 * 26898 * The above copyright notice and this permission notice shall be included in 26899 * all copies or substantial portions of the Software. 26900 * 26901 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26902 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26903 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26904 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26905 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26906 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26907 * THE SOFTWARE. 26908 */ 26909 26910var __extends = this && this.__extends || function () { 26911 var _extendStatics = function extendStatics(d, b) { 26912 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 26913 d.__proto__ = b; 26914 } || function (d, b) { 26915 for (var p in b) { 26916 if (b.hasOwnProperty(p)) d[p] = b[p]; 26917 } 26918 }; 26919 return _extendStatics(d, b); 26920 }; 26921 return function (d, b) { 26922 _extendStatics(d, b); 26923 function __() { 26924 this.constructor = d; 26925 } 26926 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 26927 }; 26928}(); 26929Object.defineProperty(exports, "__esModule", { value: true }); 26930var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 26931var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 26932var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"); 26933var foundation_1 = __webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts"); 26934var foundation_2 = __webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts"); 26935var foundation_3 = __webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"); 26936var MDCTopAppBar = /** @class */function (_super) { 26937 __extends(MDCTopAppBar, _super); 26938 function MDCTopAppBar() { 26939 return _super !== null && _super.apply(this, arguments) || this; 26940 } 26941 MDCTopAppBar.attachTo = function (root) { 26942 return new MDCTopAppBar(root); 26943 }; 26944 MDCTopAppBar.prototype.initialize = function (rippleFactory) { 26945 if (rippleFactory === void 0) { 26946 rippleFactory = function rippleFactory(el) { 26947 return component_2.MDCRipple.attachTo(el); 26948 }; 26949 } 26950 this.navIcon_ = this.root.querySelector(constants_1.strings.NAVIGATION_ICON_SELECTOR); 26951 // Get all icons in the toolbar and instantiate the ripples 26952 var icons = [].slice.call(this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR)); 26953 if (this.navIcon_) { 26954 icons.push(this.navIcon_); 26955 } 26956 this.iconRipples_ = icons.map(function (icon) { 26957 var ripple = rippleFactory(icon); 26958 ripple.unbounded = true; 26959 return ripple; 26960 }); 26961 this.scrollTarget_ = window; 26962 }; 26963 MDCTopAppBar.prototype.initialSyncWithDOM = function () { 26964 this.handleNavigationClick_ = this.foundation.handleNavigationClick.bind(this.foundation); 26965 this.handleWindowResize_ = this.foundation.handleWindowResize.bind(this.foundation); 26966 this.handleTargetScroll_ = this.foundation.handleTargetScroll.bind(this.foundation); 26967 this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_); 26968 if (this.navIcon_) { 26969 this.navIcon_.addEventListener('click', this.handleNavigationClick_); 26970 } 26971 var isFixed = this.root.classList.contains(constants_1.cssClasse
26971s.FIXED_CLASS); 26972 var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS); 26973 if (!isShort && !isFixed) { 26974 window.addEventListener('resize', this.handleWindowResize_); 26975 } 26976 }; 26977 MDCTopAppBar.prototype.destroy = function () { 26978 this.iconRipples_.forEach(function (iconRipple) { 26979 return iconRipple.destroy(); 26980 }); 26981 this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_); 26982 if (this.navIcon_) { 26983 this.navIcon_.removeEventListener('click', this.handleNavigationClick_); 26984 } 26985 var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS); 26986 var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS); 26987 if (!isShort && !isFixed) { 26988 window.removeEventListener('resize', this.handleWindowResize_); 26989 } 26990 _super.prototype.destroy.call(this); 26991 }; 26992 MDCTopAppBar.prototype.setScrollTarget = function (target) { 26993 // Remove scroll handler from the previous scroll target 26994 this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_); 26995 this.scrollTarget_ = target; 26996 // Initialize scroll handler on the new scroll target 26997 this.handleTargetScroll_ = this.foundation.handleTargetScroll.bind(this.foundation); 26998 this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_); 26999 }; 27000 MDCTopAppBar.prototype.getDefaultFoundation = function () { 27001 var _this = this; 27002 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 27003 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 27004 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 27005 var adapter = { 27006 hasClass: function hasClass(className) { 27007 return _this.root.classList.contains(className); 27008 }, 27009 addClass: function addClass(className) { 27010 return _this.root.classList.add(className); 27011 }, 27012 removeClass: function removeClass(className) { 27013 return _this.root.classList.remove(className); 27014 }, 27015 setStyle: function setStyle(property, value) { 27016 return _this.root.style.setProperty(property, value); 27017 }, 27018 getTopAppBarHeight: function getTopAppBarHeight() { 27019 return _this.root.clientHeight; 27020 }, 27021 notifyNavigationIconClicked: function notifyNavigationIconClicked() { 27022 return _this.emit(constants_1.strings.NAVIGATION_EVENT, {}); 27023 }, 27024 getViewportScrollY: function getViewportScrollY() { 27025 var win = _this.scrollTarget_; 27026 var el = _this.scrollTarget_; 27027 return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop; 27028 }, 27029 getTotalActionItems: function getTotalActionItems() { 27030 return _this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR).length; 27031 } 27032 }; 27033 // tslint:enable:object-literal-sort-keys 27034 var foundation;
27035 if (this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS)) { 27036 foundation = new foundation_2.MDCShortTopAppBarFoundation(adapter); 27037 } else if (this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS)) { 27038 foundation = new foundation_1.MDCFixedTopAppBarFoundation(adapter); 27039 } else { 27040 foundation = new foundation_3.MDCTopAppBarFoundation(adapter); 27041 } 27042 return foundation; 27043 }; 27044 return MDCTopAppBar; 27045}(component_1.MDCComponent); 27046exports.MDCTopAppBar = MDCTopAppBar; 27047 27048/***/ }), 27049
27050/***/ "./packages/mdc-top-app-bar/constants.ts": 27051/*!***********************************************!*\ 27052 !*** ./packages/mdc-top-app-bar/constants.ts ***! 27053 \***********************************************/ 27054/*! no static exports found */ 27055/***/ (function(module, exports, __webpack_require__) { 27056 27057"use strict"; 27058 27059/** 27060 * @license 27061 * Copyright 2018 Google Inc. 27062 * 27063 * Permission is hereby granted, free of charge, to any person obtaining a copy 27064 * of this software and associated documentation files (the "Software"), to deal 27065 * in the Software without restriction, including without limitation the rights 27066 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27067 * copies of the Software, and to permit persons to whom the Software is 27068 * furnished to do so, subject to the following conditions: 27069 * 27070 * The above copyright notice and this permission notice shall be included in 27071 * all copies or substantial portions of the Software. 27072 * 27073 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27074 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27075 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27076 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27077 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27078 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27079 * THE SOFTWARE. 27080 */ 27081 27082Object.defineProperty(exports, "__esModule", { value: true });
27083var cssClasses = { 27084 FIXED_CLASS: 'mdc-top-app-bar--fixed', 27085 FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled', 27086 SHORT_CLASS: 'mdc-top-app-bar--short', 27087 SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed', 27088 SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item' 27089}; 27090exports.cssClasses = cssClasses; 27091var numbers = { 27092 DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100, 27093 MAX_TOP_APP_BAR_HEIGHT: 128 27094}; 27095exports.numbers = numbers; 27096var strings = { 27097 ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item', 27098 NAVIGATION_EVENT: 'MDCTopAppBar:nav', 27099 NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon', 27100 ROOT_SELECTOR: '.mdc-top-app-bar', 27101 TITLE_SELECTOR: '.mdc-top-app-bar__title' 27102}; 27103exports.strings = strings; 27104 27105/***/ }), 27106
27107/***/ "./packages/mdc-top-app-bar/fixed/foundation.ts": 27108/*!******************************************************!*\ 27109 !*** ./packages/mdc-top-app-bar/fixed/foundation.ts ***! 27110 \******************************************************/ 27111/*! no static exports found */ 27112/***/ (function(module, exports, __webpack_require__) { 27113 27114"use strict"; 27115 27116/** 27117 * @license 27118 * Copyright 2018 Google Inc. 27119 * 27120 * Permission is hereby granted, free of charge, to any person obtaining a copy 27121 * of this software and associated documentation files (the "Software"), to deal 27122 * in the Software without restriction, including without limitation the rights 27123 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27124 * copies of the Software, and to permit persons to whom the Software is 27125 * furnished to do so, subject to the following conditions: 27126 * 27127 * The above copyright notice and this permission notice shall be included in 27128 * all copies or substantial portions of the Software. 27129 * 27130 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27131 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27132 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27133 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27134 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27135 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27136 * THE SOFTWARE. 27137 */ 27138 27139var __extends = this && this.__extends || function () { 27140 var _extendStatics = function extendStatics(d, b) { 27141 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 27142 d.__proto__ = b; 27143 } || function (d, b) { 27144 for (var p in b) { 27145 if (b.hasOwnProperty(p)) d[p] = b[p]; 27146 } 27147 }; 27148 return _extendStatics(d, b); 27149 }; 27150 return function (d, b) { 27151 _extendStatics(d, b); 27152 function __() { 27153 this.constructor = d; 27154 } 27155 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 27156 }; 27157}(); 27158Object.defineProperty(exports, "__esModule", { value: true }); 27159var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts"); 27160var foundation_1 = __webpack_require__(/*! ../standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"); 27161var MDCFixedTopAppBarFoundation = /** @class */function (_super) { 27162 __extends(MDCFixedTopAppBarFoundation, _super); 27163 function MDCFixedTopAppBarFoundation() { 27164 var _this = _super !== null && _super.apply(this, arguments) || this; 27165 /** 27166 * State variable for the previous scroll iteration top app bar state 27167 */ 27168 _this.wasScrolled_ = false; 27169 return _this; 27170 } 27171 /** 27172 * Scroll handler for applying/removing the modifier class on the fixed top app bar. 27173 * @override 27174 */ 27175 MDCFixedTopAppBarFoundation.prototype.handleTargetScroll = function () { 27176 var currentScroll = this.adapter.getViewportScrollY(); 27177 if (currentScroll <= 0) { 27178 if (this.wasScrolled_) {
27179 this.adapter.removeClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS); 27180 this.wasScrolled_ = false; 27181 } 27182 } else { 27183 if (!this.wasScrolled_) { 27184 this.adapter.addClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS); 27185 this.wasScrolled_ = true; 27186 } 27187 } 27188 }; 27189 return MDCFixedTopAppBarFoundation; 27190}(foundation_1.MDCTopAppBarFoundation); 27191exports.MDCFixedTopAppBarFoundation = MDCFixedTopAppBarFoundation; 27192// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 27193exports.default = MDCFixedTopAppBarFoundation; 27194 27195/***/ }), 27196
27197/***/ "./packages/mdc-top-app-bar/foundation.ts": 27198/*!************************************************!*\ 27199 !*** ./packages/mdc-top-app-bar/foundation.ts ***! 27200 \************************************************/ 27201/*! no static exports found */ 27202/***/ (function(module, exports, __webpack_require__) { 27203 27204"use strict"; 27205 27206/** 27207 * @license 27208 * Copyright 2018 Google Inc. 27209 * 27210 * Permission is hereby granted, free of charge, to any person obtaining a copy 27211 * of this software and associated documentation files (the "Software"), to deal 27212 * in the Software without restriction, including without limitation the rights 27213 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27214 * copies of the Software, and to permit persons to whom the Software is 27215 * furnished to do so, subject to the following conditions: 27216 * 27217 * The above copyright notice and this permission notice shall be included in 27218 * all copies or substantial portions of the Software. 27219 * 27220 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27221 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27222 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27223 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27224 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27225 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27226 * THE SOFTWARE. 27227 */ 27228 27229var __extends = this && this.__extends || function () { 27230 var _extendStatics = function extendStatics(d, b) { 27231 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 27232 d.__proto__ = b; 27233 } || function (d, b) { 27234 for (var p in b) { 27235 if (b.hasOwnProperty(p)) d[p] = b[p]; 27236 } 27237 }; 27238 return _extendStatics(d, b); 27239 }; 27240 return function (d, b) { 27241 _extendStatics(d, b); 27242 function __() { 27243 this.constructor = d; 27244 } 27245 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 27246 }; 27247}(); 27248var __assign = this && this.__assign || function () { 27249 __assign = Object.assign || function (t) { 27250 for (var s, i = 1, n = arguments.length; i < n; i++) { 27251 s = arguments[i]; 27252 for (var p in s) { 27253 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 27254 } 27255 } 27256 return t; 27257 }; 27258 return __assign.apply(this, arguments); 27259}; 27260Object.defineProperty(exports, "__esModule", { value: true }); 27261var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 27262var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"); 27263var MDCTopAppBarBaseFoundation = /** @class */function (_super) { 27264 __extends(MDCTopAppBarBaseFoundation, _super); 27265 /* istanbul ignore next: optional argument is not a branch statement */ 27266 function MDCTopAppBarBaseFoundation(adapter) { 27267 return _super.call(this, __assign(__assign({}, MDCTopAppBarBaseFoundation.defaultAdapter), adapter)) || this; 27268 } 27269 Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", { 27270 get: function get() { 27271 return constants_1.strings; 27272 }, 27273 enumerable: true, 27274 configurable: true 27275 }); 27276 Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", { 27277 get: function get() {
27278 return constants_1.cssClasses; 27279 }, 27280 enumerable: true, 27281 configurable: true 27282 }); 27283 Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", { 27284 get: function get() { 27285 return constants_1.numbers; 27286 }, 27287 enumerable: true, 27288 configurable: true 27289 }); 27290 Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", { 27291 /** 27292 * See {@link MDCTopAppBarAdapter} for typing information on parameters and return types. 27293 */ 27294 get: function get() { 27295 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 27296 return { 27297 addClass: function addClass() { 27298 return undefined; 27299 }, 27300 removeClass: function removeClass() { 27301 return undefined; 27302 }, 27303 hasClass: function hasClass() { 27304 return false; 27305 }, 27306 setStyle: function setStyle() { 27307 return undefined; 27308 }, 27309 getTopAppBarHeight: function getTopAppBarHeight() { 27310 return 0; 27311 }, 27312 notifyNavigationIconClicked: function notifyNavigationIconClicked() { 27313 return undefined; 27314 }, 27315 getViewportScrollY: function getViewportScrollY() { 27316 return 0; 27317 }, 27318 getTotalActionItems: function getTotalActionItems() { 27319 return 0; 27320 } 27321 }; 27322 // tslint:enable:object-literal-sort-keys 27323 }, 27324 enumerable: true, 27325 configurable: true 27326 }); 27327 /** Other variants of TopAppBar foundation overrides this method */ 27328 MDCTopAppBarBaseFoundation.prototype.handleTargetScroll = function () {}; // tslint:disable-line:no-empty 27329 /** Other variants of TopAppBar foundation overrides this method */ 27330 MDCTopAppBarBaseFoundation.prototype.handleWindowResize = function () {}; // tslint:disable-line:no-empty 27331 MDCTopAppBarBaseFoundation.prototype.handleNavigationClick = function () { 27332 this.adapter.notifyNavigationIconClicked(); 27333 }; 27334 return MDCTopAppBarBaseFoundation; 27335}(foundation_1.MDCFoundation); 27336exports.MDCTopAppBarBaseFoundation = MDCTopAppBarBaseFoundation; 27337// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 27338exports.default = MDCTopAppBarBaseFoundation; 27339 27340/***/ }), 27341
27342/***/ "./packages/mdc-top-app-bar/index.ts": 27343/*!*******************************************!*\ 27344 !*** ./packages/mdc-top-app-bar/index.ts ***! 27345 \*******************************************/ 27346/*! no static exports found */ 27347/***/ (function(module, exports, __webpack_require__) { 27348 27349"use strict"; 27350 27351/** 27352 * @license 27353 * Copyright 2019 Google Inc. 27354 * 27355 * Permission is hereby granted, free of charge, to any person obtaining a copy 27356 * of this software and associated documentation files (the "Software"), to deal 27357 * in the Software without restriction, including without limitation the rights 27358 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27359 * copies of the Software, and to permit persons to whom the Software is 27360 * furnished to do so, subject to the following conditions: 27361 * 27362 * The above copyright notice and this permission notice shall be included in 27363 * all copies or substantial portions of the Software. 27364 * 27365 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27366 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27367 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27368 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27369 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27370 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27371 * THE SOFTWARE. 27372 */ 27373 27374function __export(m) { 27375 for (var p in m) { 27376 if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 27377 } 27378} 27379Object.defineProperty(exports, "__esModule", { value: true }); 27380__export(__webpack_require__(/*! ./component */ "./packages/mdc-top-app-bar/component.ts")); 27381__export(__webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts")); 27382__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-top-app-bar/foundation.ts")); 27383__export(__webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts")); 27384__export(__webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts")); 27385__export(__webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts")); 27386 27387/***/ }), 27388
27389/***/ "./packages/mdc-top-app-bar/short/foundation.ts": 27390/*!******************************************************!*\ 27391 !*** ./packages/mdc-top-app-bar/short/foundation.ts ***! 27392 \******************************************************/ 27393/*! no static exports found */ 27394/***/ (function(module, exports, __webpack_require__) { 27395 27396"use strict"; 27397 27398/** 27399 * @license 27400 * Copyright 2018 Google Inc. 27401 * 27402 * Permission is hereby granted, free of charge, to any person obtaining a copy 27403 * of this software and associated documentation files (the "Software"), to deal 27404 * in the Software without restriction, including without limitation the rights 27405 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27406 * copies of the Software, and to permit persons to whom the Software is 27407 * furnished to do so, subject to the following conditions: 27408 * 27409 * The above copyright notice and this permission notice shall be included in 27410 * all copies or substantial portions of the Software. 27411 * 27412 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27413 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27414 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27415 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27416 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27417 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27418 * THE SOFTWARE. 27419 */ 27420 27421var __extends = this && this.__extends || function () { 27422 var _extendStatics = function extendStatics(d, b) { 27423 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 27424 d.__proto__ = b; 27425 } || function (d, b) { 27426 for (var p in b) { 27427 if (b.hasOwnProperty(p)) d[p] = b[p]; 27428 } 27429 }; 27430 return _extendStatics(d, b); 27431 }; 27432 return function (d, b) { 27433 _extendStatics(d, b); 27434 function __() { 27435 this.constructor = d; 27436 } 27437 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 27438 }; 27439}(); 27440Object.defineProperty(exports, "__esModule", { value: true }); 27441var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts"); 27442var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts"); 27443var MDCShortTopAppBarFoundation = /** @class */function (_super) { 27444 __extends(MDCShortTopAppBarFoundation, _super); 27445 /* istanbul ignore next: optional argument is not a branch statement */ 27446 function MDCShortTopAppBarFoundation(adapter) { 27447 var _this = _super.call(this, adapter) || this; 27448 _this.isCollapsed_ = false; 27449 _this.isAlwaysCollapsed_ = false; 27450 return _this; 27451 } 27452 Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", { 27453 // Public visibility for backward compatibility. 27454 get: function get() { 27455 return this.isCollapsed_; 27456 }, 27457 enumerable: true, 27458 configurable: true 27459 }); 27460 MDCShortTopAppBarFoundation.prototype.init = function () { 27461 _super.prototype.init.call(this); 27462 if (this.adapter.getTotalActionItems() > 0) {
27463 this.adapter.addClass(constants_1.cssClasses.SHORT_HAS_ACTION_ITEM_CLASS); 27464 } 27465 // If initialized with SHORT_COLLAPSED_CLASS, the bar should always be collapsed 27466 this.setAlwaysCollapsed(this.adapter.hasClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS)); 27467 }; 27468 /** 27469 * Set if the short top app bar should always be collapsed. 27470 * 27471 * @param value When `true`, bar will always be collapsed. When `false`, bar may collapse or expand based on scroll. 27472 */ 27473 MDCShortTopAppBarFoundation.prototype.setAlwaysCollapsed = function (value) { 27474 this.isAlwaysCollapsed_ = !!value; 27475 if (this.isAlwaysCollapsed_) { 27476 this.collapse_(); 27477 } else { 27478 // let maybeCollapseBar_ determine if the bar should be collapsed 27479 this.maybeCollapseBar_(); 27480 } 27481 }; 27482 MDCShortTopAppBarFoundation.prototype.getAlwaysCollapsed = function () { 27483 return this.isAlwaysCollapsed_; 27484 }; 27485 /** 27486 * Scroll handler for applying/removing the collapsed modifier class on the short top app bar. 27487 * @override 27488 */ 27489 MDCShortTopAppBarFoundation.prototype.handleTargetScroll = function () { 27490 this.maybeCollapseBar_(); 27491 }; 27492 MDCShortTopAppBarFoundation.prototype.maybeCollapseBar_ = function () { 27493 if (this.isAlwaysCollapsed_) { 27494 return; 27495 } 27496 var currentScroll = this.adapter.getViewportScrollY(); 27497 if (currentScroll <= 0) { 27498 if (this.isCollapsed_) { 27499 this.uncollapse_(); 27500 } 27501 } else { 27502 if (!this.isCollapsed_) { 27503 this.collapse_(); 27504 } 27505 } 27506 }; 27507 MDCShortTopAppBarFoundation.prototype.uncollapse_ = function () {
27508 this.adapter.removeClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS); 27509 this.isCollapsed_ = false; 27510 }; 27511 MDCShortTopAppBarFoundation.prototype.collapse_ = function () { 27512 this.adapter.addClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS); 27513 this.isCollapsed_ = true; 27514 }; 27515 return MDCShortTopAppBarFoundation; 27516}(foundation_1.MDCTopAppBarBaseFoundation); 27517exports.MDCShortTopAppBarFoundation = MDCShortTopAppBarFoundation; 27518// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 27519exports.default = MDCShortTopAppBarFoundation; 27520 27521/***/ }), 27522
27523/***/ "./packages/mdc-top-app-bar/standard/foundation.ts": 27524/*!*********************************************************!*\ 27525 !*** ./packages/mdc-top-app-bar/standard/foundation.ts ***! 27526 \*********************************************************/ 27527/*! no static exports found */ 27528/***/ (function(module, exports, __webpack_require__) { 27529 27530"use strict"; 27531 27532/** 27533 * @license 27534 * Copyright 2018 Google Inc. 27535 * 27536 * Permission is hereby granted, free of charge, to any person obtaining a copy 27537 * of this software and associated documentation files (the "Software"), to deal 27538 * in the Software without restriction, including without limitation the rights 27539 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27540 * copies of the Software, and to permit persons to whom the Software is 27541 * furnished to do so, subject to the following conditions: 27542 * 27543 * The above copyright notice and this permission notice shall be included in 27544 * all copies or substantial portions of the Software. 27545 * 27546 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27547 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27548 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27549 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27550 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27551 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27552 * THE SOFTWARE. 27553 */ 27554 27555var __extends = this && this.__extends || function () { 27556 var _extendStatics = function extendStatics(d, b) { 27557 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 27558 d.__proto__ = b; 27559 } || function (d, b) { 27560 for (var p in b) { 27561 if (b.hasOwnProperty(p)) d[p] = b[p]; 27562 } 27563 }; 27564 return _extendStatics(d, b); 27565 }; 27566 return function (d, b) { 27567 _extendStatics(d, b); 27568 function __() { 27569 this.constructor = d; 27570 } 27571 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 27572 }; 27573}(); 27574Object.defineProperty(exports, "__esModule", { value: true }); 27575var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts"); 27576var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts"); 27577var INITIAL_VALUE = 0; 27578var MDCTopAppBarFoundation = /** @class */function (_super) { 27579 __extends(MDCTopAppBarFoundation, _super); 27580 /* istanbul ignore next: optional argument is not a branch statement */ 27581 function MDCTopAppBarFoundation(adapter) { 27582 var _this = _super.call(this, adapter) || this; 27583 /** 27584 * Indicates if the top app bar was docked in the previous scroll handler iteration. 27585 */ 27586 _this.wasDocked_ = true; 27587 /** 27588 * Indicates if the top app bar is docked in the fully shown position. 27589 */ 27590 _this.isDockedShowing_ = true; 27591 /** 27592 * Variable for current scroll position of the top app bar 27593 */ 27594 _this.currentAppBarOffsetTop_ = 0; 27595 /** 27596 * Used to prevent the top app bar from being scrolled out of view during resize events 27597 */ 27598 _this.isCurrentlyBeingResized_ = false; 27599 /** 27600 * The timeout that's used to throttle the resize events 27601 */ 27602 _this.resizeThrottleId_ = INITIAL_VALUE; 27603 /** 27604 * The timeout that's used to debounce toggling the isCurrentlyBeingResized_ variable after a resize 27605 */ 27606 _this.resizeDebounceId_ = INITIAL_VALUE; 27607 _this.lastScrollPosition_ = _this.adapter.getViewportScrollY(); 27608 _this.topAppBarHeight_ = _this.adapter.getTopAppBarHeight(); 27609 return _this; 27610 } 27611 MDCTopAppBarFoundation.prototype.destroy = function () { 27612 _super.prototype.destroy.call(this); 27613 this.adapter.setStyle('top', ''); 27614 }; 27615 /** 27616 * Scroll handler for the default scroll behavior of the top app bar. 27617 * @override 27618 */ 27619 MDCTopAppBarFoundation.prototype.handleTargetScroll = function () { 27620 var currentScrollPosition = Math.max(this.adapter.getViewportScrollY(), 0
27620); 27621 var diff = currentScrollPosition - this.lastScrollPosition_; 27622 this.lastScrollPosition_ = currentScrollPosition; 27623 // If the window is being resized the lastScrollPosition_ needs to be updated but the 27624 // current scroll of the top app bar should stay in the same position. 27625 if (!this.isCurrentlyBeingResized_) { 27626 this.currentAppBarOffsetTop_ -= diff; 27627 if (this.currentAppBarOffsetTop_ > 0) { 27628 this.currentAppBarOffsetTop_ = 0; 27629 } else if (Math.abs(this.currentAppBarOffsetTop_) > this.topAppBarHeight_) { 27630 this.currentAppBarOffsetTop_ = -this.topAppBarHeight_; 27631 } 27632 this.moveTopAppBar_(); 27633 } 27634 }; 27635 /** 27636 * Top app bar resize handler that throttle/debounce functions that execute updates. 27637 * @override 27638 */ 27639 MDCTopAppBarFoundation.prototype.handleWindowResize = function () { 27640 var _this = this; 27641 // Throttle resize events 10 p/s 27642 if (!this.resizeThrottleId_) { 27643 this.resizeThrottleId_ = setTimeout(function () { 27644 _this.resizeThrottleId_ = INITIAL_VALUE; 27645 _this.throttledResizeHandler_(); 27646 }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS); 27647 } 27648 this.isCurrentlyBeingResized_ = true; 27649 if (this.resizeDebounceId_) { 27650 clearTimeout(this.resizeDebounceId_); 27651 } 27652 this.resizeDebounceId_ = setTimeout(function () { 27653 _this.handleTargetScroll(); 27654 _this.isCurrentlyBeingResized_ = false; 27655 _this.resizeDebounceId_ = INITIAL_VALUE; 27656 }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS); 27657 }; 27658 /** 27659 * Function to determine if the DOM needs to update. 27660 */ 27661 MDCTopAppBarFoundation.prototype.checkForUpdate_ = function () { 27662 var offscreenBoundaryTop = -this.topAppBarHeight_; 27663 var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop_ < 0; 27664 var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop_ > offscreenBoundaryTop; 27665 var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen; 27666 // If it's partially showing, it can't be docked. 27667 if (partiallyShowing) { 27668 this.wasDocked_ = false; 27669 } else { 27670 // Not previously docked and not partially showing, it's now docked. 27671 if (!this.wasDocked_) { 27672 this.wasDocked_ = true; 27673 return true; 27674 } else if (this.isDockedShowing_ !== hasAnyPixelsOnscreen) { 27675 this.isDockedShowing_ = hasAnyPixelsOnscreen; 27676 return true; 27677 } 27678 } 27679 return partiallyShowing; 27680 }; 27681 /** 27682 * Function to move the top app bar if needed. 27683 */ 27684 MDCTopAppBarFoundation.prototype.moveTopAppBar_ = function () { 27685 if (this.checkForUpdate_()) { 27686 // Once the top app bar is fully hidden we use the max potential top app bar height as our offset 27687 // so the top app bar doesn't show if the window resizes and the new height > the old height. 27688 var offset = this.currentAppBarOffsetTop_; 27689 if (Math.abs(offset) >= this.topAppBarHeight_) { 27690 offset = -constants_1.numbers.MAX_TOP_APP_BAR_HEIGHT; 27691 } 27692 this.adapter.setStyle('top', offset + 'px'); 27693 } 27694 }; 27695 /** 27696 * Throttled function that updates the top app bar scrolled values if the 27697 * top app bar height changes. 27698 */ 27699 MDCTopAppBarFoundation.prototype.throttledResizeHandler_ = function () { 27700 var currentHeight = this.adapter.getTopAppBarHeight(); 27701 if (this.topAppBarHeight_ !== currentHeight) { 27702 this.wasDocked_ = false; 27703 // Since the top app bar has a different height depending on the screen width, this 27704 // will ensure that the top app bar remains in the correct location if 27705 // completely hidden and a resize makes the top app bar a different height. 27706 this.currentAppBarOffsetTop_ -= this.topAppBarHeight_ - currentHeight; 27707 this.topAppBarHeight_ = currentHeight; 27708 } 27709 this.handleTargetScroll(); 27710 }; 27711 return MDCTopAppBarFoundation; 27712}(foundation_1.MDCTopAppBarBaseFoundation); 27713exports.MDCTopAppBarFoundation = MDCTopAppBarFoundation; 27714// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 27715exports.default = MDCTopAppBarFoundation; 27716 27717/***/ })
27717 27718 27719/******/ }); 27720}); 27721//# sourceMappingURL=material-components-web.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.