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(
vendor: 13,776 bytes, lines 12-262
12[], 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 __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 139 if (k2 === undefined) k2 = k; 140 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 141 return m[k]; 142 } }); 143} : function (o, m, k, k2) { 144 if (k2 === undefined) k2 = k; 145 o[k2] = m[k]; 146}); 147var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 148 Object.defineProperty(o, "default", { enumerable: true, value: v }); 149} : function (o, v) { 150 o["default"] = v; 151}); 152var __importStar = this && this.__importStar || function (mod) { 153 if (mod && mod.__esModule) return mod; 154 var result = {}; 155 if (mod != null) for (var k in mod) { 156 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 157 }__setModuleDefault(result, mod); 158 return result; 159}; 160var __importDefault = this && this.__importDefault || function (mod) { 161 return mod && mod.__esModule ? mod : { "default": mod }; 162}; 163Object.defineProperty(exports, "__esModule", { value: true }); 164exports.topAppBar = exports.tooltip = exports.textField = exports.tabScroller = exports.tabIndicator = exports.tabBar = exports.tab = exports.switchControl = exports.snackbar = exports.slider = exports.select = exports.segmentedButton = exports.ripple = exports.radio = exports.notchedOutline = exports.menuSurface = exports.menu = exports.list = exports.linearProgress = exports.lineRipple = exports.iconButton = exports.formField = exports.floatingLabel = exports.drawer = exports.dom = exports.dialog = exports.dataTable = exports.circularProgress = exports.chips = exports.checkbox = exports.base = exports.banner = exports.autoInit = void 0; 165var index_1 = __importDefault(__webpack_require__(/*! @material/auto-init/index */ "./packages/mdc-auto-init/index.ts")); 166exports.autoInit = index_1.default; 167var banner = __importStar(__webpack_require__(/*! @material/banner/index */ "./packages/mdc-banner/index.ts")); 168exports.banner = banner; 169var base = __importStar(__webpack_require__(/*! @material/base/index */ "./packages/mdc-base/index.ts")); 170exports.base = base; 171var checkbox = __importStar(__webpack_require__(/*! @material/checkbox/index */ "./packages/mdc-checkbox/index.ts")); 172exports.checkbox = checkbox; 173var chips = __importStar(__webpack_require__(/*! @material/chips/deprecated/index */ "./packages/mdc-chips/deprecated/index.ts")); 174exports.chips = chips; 175var circularProgress = __importStar(__webpack_require__(/*! @material/circular-progress/index */ "./packages/mdc-circular-progress/index.ts")); 176exports.circularProgress = circularProgress; 177var dataTable = __importStar(__webpack_require__(/*! @material/data-table/index */ "./packages/mdc-data-table/index.ts")); 178exports.dataTable = dataTable; 179var dialog = __importStar(__webpack_require__(/*! @material/dialog/index */ "./packages/mdc-dialog/index.ts")); 180exports.dialog = dialog; 181var dom = __importStar(__webpack_require__(/*! @material/dom/index */ "./packages/mdc-dom/index.ts")); 182exports.dom = dom; 183var drawer = __importStar(__webpack_require__(/*! @material/drawer/index */ "./packages/mdc-drawer/index.ts")); 184exports.drawer = drawer; 185var floatingLabel = __importStar(__webpack_require__(/*! @material/floating-label/index */ "./packages/mdc-floating-label/index.ts")); 186exports.floatingLabel = floatingLabel; 187var formField = __importStar(__webpack_require__(/*! @material/form-field/index */ "./packages/mdc-form-field/index.ts")); 188exports.formField = formField; 189var iconButton = __importStar(__webpack_require__(/*! @material/icon-button/index */ "./packages/mdc-icon-button/index.ts")); 190exports.iconButton = iconButton; 191var lineRipple = __importStar(__webpack_require__(/*! @material/line-ripple/index */ "./packages/mdc-line-ripple/index.ts")); 192exports.lineRipple = lineRipple; 193var linearProgress = __importStar(__webpack_require__(/*! @material/linear-progress/index */ "./packages/mdc-linear-progress/index.ts")); 194exports.linearProgress = linearProgress; 195var list = __importStar(__webpack_require__(/*! @material/list/index */ "./packages/mdc-list/index.ts")); 196exports.list = list; 197var menuSurface = __importStar(__webpack_require__(/*! @material/menu-surface/index */ "./packages/mdc-menu-surface/index.ts")); 198exports.menuSurface = menuSurface; 199var menu = __importStar(__webpack_require__(/*! @material/menu/index */ "./packages/mdc-menu/index.ts")); 200exports.menu = menu; 201var notchedOutline = __importStar(__webpack_require__(/*! @material/notched-outline/index */ "./packages/mdc-notched-outline/index.ts")); 202exports.notchedOutline = notchedOutline; 203var radio = __importStar(__webpack_require__(/*! @material/radio/index */ "./packages/mdc-radio/index.ts")); 204exports.radio = radio; 205var ripple = __importStar(__webpack_require__(/*! @material/ripple/index */ "./packages/mdc-ripple/index.ts")); 206exports.ripple = ripple; 207var segmentedButton = __importStar(__webpack_require__(/*! @material/segmented-button/index */ "./packages/mdc-segmented-button/index.ts")); 208exports.segmentedButton = segmentedButton; 209var select = __importStar(__webpack_require__(/*! @material/select/index */ "./packages/mdc-select/index.ts")); 210exports.select = select; 211var slider = __importStar(__webpack_require__(/*! @material/slider/index */ "./packages/mdc-slider/index.ts")); 212exports.slider = slider; 213var snackbar = __importStar(__webpack_require__(/*! @material/snackbar/index */ "./packages/mdc-snackbar/index.ts")); 214exports.snackbar = snackbar; 215var switchControl = __importStar(__webpack_require__(/*! @material/switch/index */ "./packages/mdc-switch/index.ts")); 216exports.switchControl = switchControl; 217var tabBar = __importStar(__webpack_require__(/*! @material/tab-bar/index */ "./packages/mdc-tab-bar/index.ts")); 218exports.tabBar = tabBar; 219var tabIndicator = __importStar(__webpack_require__(/*! @material/tab-indicator/index */ "./packages/mdc-tab-indicator/index.ts")); 220exports.tabIndicator = tabIndicator; 221var tabScroller = __importStar(__webpack_require__(/*! @material/tab-scroller/index */ "./packages/mdc-tab-scroller/index.ts")); 222exports.tabScroller = tabScroller; 223var tab = __importStar(__webpack_require__(/*! @material/tab/index */ "./packages/mdc-tab/index.ts")); 224exports.tab = tab; 225var textField = __importStar(__webpack_require__(/*! @material/textfield/index */ "./packages/mdc-textfield/index.ts")); 226exports.textField = textField; 227var tooltip = __importStar(__webpack_require__(/*! @material/tooltip/index */ "./packages/mdc-tooltip/index.ts")); 228exports.tooltip = tooltip; 229var topAppBar = __importStar(__webpack_require__(/*! @material/top-app-bar/index */ "./packages/mdc-top-app-bar/index.ts")); 230exports.topAppBar = topAppBar; 231// Register all components 232index_1.default.register('MDCBanner', banner.MDCBanner); 233index_1.default.register('MDCCheckbox', checkbox.MDCCheckbox); 234index_1.default.register('MDCChip', chips.MDCChip); 235index_1.default.register('MDCChipSet', chips.MDCChipSet); 236index_1.default.register('MDCCircularProgress', circularProgress.MDCCircularProgress); 237index_1.default.register('MDCDataTable', dataTable.MDCDataTable); 238index_1.default.register('MDCDialog', dialog.MDCDialog); 239index_1.default.register('MDCDrawer', drawer.MDCDrawer); 240index_1.default.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel); 241index_1.default.register('MDCFormField', formField.MDCFormField); 242index_1.default.register('MDCIconButtonToggle', iconButton.MDCIconButtonToggle); 243index_1.default.register('MDCLineRipple', lineRipple.MDCLineRipple); 244index_1.default.register('MDCLinearProgress', linearProgress.MDCLinearProgress); 245index_1.default.register('MDCList', list.MDCList); 246index_1.default.register('MDCMenu', menu.MDCMenu); 247index_1.default.register('MDCMenuSurface', menuSurface.MDCMenuSurface); 248index_1.default.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline); 249index_1.default.register('MDCRadio', radio.MDCRadio); 250index_1.default.register('MDCRipple', ripple.MDCRipple); 251index_1.default.register('MDCSegmentedButton', segmentedButton.MDCSegmentedButton); 252index_1.default.register('MDCSelect', select.MDCSelect); 253index_1.default.register('MDCSlider', slider.MDCSlider); 254index_1.default.register('MDCSnackbar', snackbar.MDCSnackbar); 255index_1.default.register('MDCSwitch', switchControl.MDCSwitch); 256index_1.default.register('MDCTabBar', tabBar.MDCTabBar); 257index_1.default.register('MDCTextField', textField.MDCTextField); 258index_1.default.register('MDCTooltip', tooltip.MDCTooltip); 259index_1.default.register('MDCTopAppBar', topAppBar.MDCTopAppBar); 260 261/***/ }), 262
vendor: 3,785 bytes, lines 263-362
263/***/ "./packages/mdc-animation/animationframe.ts": 264/*!**************************************************!*\ 265 !*** ./packages/mdc-animation/animationframe.ts ***! 266 \**************************************************/ 267/*! no static exports found */ 268/***/ (function(module, exports, __webpack_require__) { 269 270"use strict"; 271 272/** 273 * @license 274 * Copyright 2020 Google Inc. 275 * 276 * Permission is hereby granted, free of charge, to any person obtaining a copy 277 * of this software and associated documentation files (the "Software"), to deal 278 * in the Software without restriction, including without limitation the rights 279 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 280 * copies of the Software, and to permit persons to whom the Software is 281 * furnished to do so, subject to the following conditions: 282 * 283 * The above copyright notice and this permission notice shall be included in 284 * all copies or substantial portions of the Software. 285 * 286 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 287 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 288 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 289 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 290 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 291 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 292 * THE SOFTWARE. 293 */ 294 295Object.defineProperty(exports, "__esModule", { value: true }); 296exports.AnimationFrame = void 0; 297/** 298 * AnimationFrame provides a user-friendly abstraction around requesting 299 * and canceling animation frames. 300 */ 301var AnimationFrame = /** @class */function () { 302 function AnimationFrame() { 303 this.rafIDs = new Map(); 304 } 305 /** 306 * Requests an animation frame. Cancels any existing frame with the same key. 307 * @param {string} key The key for this callback. 308 * @param {FrameRequestCallback} callback The callback to be executed. 309 */ 310 AnimationFrame.prototype.request = function (key, callback) { 311 var _this = this; 312 this.cancel(key); 313 var frameID = requestAnimationFrame(function (frame) { 314 _this.rafIDs.delete(key); 315 // Callback must come *after* the key is deleted so that nested calls to 316 // request with the same key are not deleted. 317 callback(frame); 318 }); 319 this.rafIDs.set(key, frameID); 320 }; 321 /** 322 * Cancels a queued callback with the given key. 323 * @param {string} key The key for this callback. 324 */ 325 AnimationFrame.prototype.cancel = function (key) { 326 var rafID = this.rafIDs.get(key); 327 if (rafID) { 328 cancelAnimationFrame(rafID); 329 this.rafIDs.delete(key); 330 } 331 }; 332 /** 333 * Cancels all queued callback. 334 */ 335 AnimationFrame.prototype.cancelAll = function () { 336 var _this = this; 337 // Need to use forEach because it's the only iteration method supported 338 // by IE11. Suppress the underscore because we don't need it. 339 // tslint:disable-next-line:enforce-name-casing 340 this.rafIDs.forEach(function (_, key) { 341 _this.cancel(key); 342 }); 343 }; 344 /** 345 * Returns the queue of unexecuted callback keys. 346 */ 347 AnimationFrame.prototype.getQueue = function () { 348 var queue = []; 349 // Need to use forEach because it's the only iteration method supported 350 // by IE11. Suppress the underscore because we don't need it. 351 // tslint:disable-next-line:enforce-name-casing 352 this.rafIDs.forEach(function (_, key) { 353 queue.push(key); 354 }); 355 return queue; 356 }; 357 return AnimationFrame; 358}(); 359exports.AnimationFrame = AnimationFrame; 360 361/***/ }), 362
vendor: 3,587 bytes, lines 363-463
363/***/ "./packages/mdc-animation/util.ts": 364/*!****************************************!*\ 365 !*** ./packages/mdc-animation/util.ts ***! 366 \****************************************/ 367/*! no static exports found */ 368/***/ (function(module, exports, __webpack_require__) { 369 370"use strict"; 371 372/** 373 * @license 374 * Copyright 2016 Google Inc. 375 * 376 * Permission is hereby granted, free of charge, to any person obtaining a copy 377 * of this software and associated documentation files (the "Software"), to deal 378 * in the Software without restriction, including without limitation the rights 379 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 380 * copies of the Software, and to permit persons to whom the Software is 381 * furnished to do so, subject to the following conditions: 382 * 383 * The above copyright notice and this permission notice shall be included in 384 * all copies or substantial portions of the Software. 385 * 386 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 387 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 388 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 389 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 390 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 391 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 392 * THE SOFTWARE. 393 */ 394 395Object.defineProperty(exports, "__esModule", { value: true }); 396exports.getCorrectEventName = exports.getCorrectPropertyName = void 0; 397var cssPropertyNameMap = { 398 animation: { 399 prefixed: '-webkit-animation', 400 standard: 'animation' 401 }, 402 transform: { 403 prefixed: '-webkit-transform', 404 standard: 'transform' 405 }, 406 transition: { 407 prefixed: '-webkit-transition', 408 standard: 'transition' 409 } 410}; 411var jsEventTypeMap = { 412 animationend: { 413 cssProperty: 'animation', 414 prefixed: 'webkitAnimationEnd', 415 standard: 'animationend' 416 }, 417 animationiteration: { 418 cssProperty: 'animation', 419 prefixed: 'webkitAnimationIteration', 420 standard: 'animationiteration' 421 }, 422 animationstart: { 423 cssProperty: 'animation', 424 prefixed: 'webkitAnimationStart', 425 standard: 'animationstart' 426 }, 427 transitionend: { 428 cssProperty: 'transition', 429 prefixed: 'webkitTransitionEnd', 430 standard: 'transitionend' 431 } 432}; 433function isWindow(windowObj) { 434 return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; 435} 436function getCorrectPropertyName(windowObj, cssProperty) { 437 if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { 438 var el = windowObj.document.createElement('div'); 439 var _a = cssPropertyNameMap[cssProperty], 440 standard = _a.standard, 441 prefixed = _a.prefixed; 442 var isStandard = standard in el.style; 443 return isStandard ? standard : prefixed; 444 } 445 return cssProperty; 446} 447exports.getCorrectPropertyName = getCorrectPropertyName; 448function getCorrectEventName(windowObj, eventType) { 449 if (isWindow(windowObj) && eventType in jsEventTypeMap) { 450 var el = windowObj.document.createElement('div'); 451 var _a = jsEventTypeMap[eventType], 452 standard = _a.standard, 453 prefixed = _a.prefixed, 454 cssProperty = _a.cssProperty; 455 var isStandard = cssProperty in el.style; 456 return isStandard ? standard : prefixed; 457 } 458 return eventType; 459} 460exports.getCorrectEventName = getCorrectEventName; 461 462/***/ }), 463
vendor: 7,398 bytes, lines 464-645
464/***/ "./packages/mdc-auto-init/constants.ts": 465/*!*********************************************!*\ 466 !*** ./packages/mdc-auto-init/constants.ts ***! 467 \*********************************************/ 468/*! no static exports found */ 469/***/ (function(module, exports, __webpack_require__) { 470 471"use strict"; 472 473/** 474 * @license 475 * Copyright 2019 Google Inc. 476 * 477 * Permission is hereby granted, free of charge, to any person obtaining a copy 478 * of this software and associated documentation files (the "Software"), to deal 479 * in the Software without restriction, including without limitation the rights 480 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 481 * copies of the Software, and to permit persons to whom the Software is 482 * furnished to do so, subject to the following conditions: 483 * 484 * The above copyright notice and this permission notice shall be included in 485 * all copies or substantial portions of the Software. 486 * 487 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 488 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 489 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 490 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 491 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 492 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 493 * THE SOFTWARE. 494 */ 495 496Object.defineProperty(exports, "__esModule", { value: true }); 497exports.strings = void 0; 498exports.strings = { 499 AUTO_INIT_ATTR: 'data-mdc-auto-init', 500 AUTO_INIT_STATE_ATTR: 'data-mdc-auto-init-state', 501 INITIALIZED_STATE: 'initialized' 502}; 503 504/***/ }), 505 506/***/ "./packages/mdc-auto-init/index.ts": 507/*!*****************************************!*\ 508 !*** ./packages/mdc-auto-init/index.ts ***! 509 \*****************************************/ 510/*! no static exports found */ 511/***/ (function(module, exports, __webpack_require__) { 512 513"use strict"; 514 515/** 516 * @license 517 * Copyright 2016 Google Inc. 518 * 519 * Permission is hereby granted, free of charge, to any person obtaining a copy 520 * of this software and associated documentation files (the "Software"), to deal 521 * in the Software without restriction, including without limitation the rights 522 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 523 * copies of the Software, and to permit persons to whom the Software is 524 * furnished to do so, subject to the following conditions: 525 * 526 * The above copyright notice and this permission notice shall be included in 527 * all copies or substantial portions of the Software. 528 * 529 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 530 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 531 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 532 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 533 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 534 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 535 * THE SOFTWARE. 536 */ 537 538var __values = this && this.__values || function (o) { 539 var s = typeof Symbol === "function" && Symbol.iterator, 540 m = s && o[s], 541 i = 0; 542 if (m) return m.call(o); 543 if (o && typeof o.length === "number") return { 544 next: function next() { 545 if (o && i >= o.length) o = void 0; 546 return { value: o && o[i++], done: !o }; 547 } 548 }; 549 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 550}; 551Object.defineProperty(exports, "__esModule", { value: true }); 552exports.mdcAutoInit = void 0; 553var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-auto-init/constants.ts"); 554var AUTO_INIT_ATTR = constants_1.strings.AUTO_INIT_ATTR, 555 AUTO_INIT_STATE_ATTR = constants_1.strings.AUTO_INIT_STATE_ATTR, 556 INITIALIZED_STATE = constants_1.strings.INITIALIZED_STATE; 557var registry = {}; 558var CONSOLE_WARN = console.warn.bind(console); // tslint:disable-line:no-console 559function emit(evtType, evtData, shouldBubble) { 560 if (shouldBubble === void 0) { 561 shouldBubble = false; 562 } 563 var evt; 564 if (typeof CustomEvent === 'function') { 565 evt = new CustomEvent(evtType, { 566 bubbles: shouldBubble, 567 detail: evtData 568 }); 569 } else { 570 evt = document.createEvent('CustomEvent'); 571 evt.initCustomEvent(evtType, shouldBubble, false, evtData); 572 } 573 document.dispatchEvent(evt); 574} 575/* istanbul ignore next: optional argument is not a branch statement */ 576/** 577 * Auto-initializes all MDC components on a page. 578 */ 579function mdcAutoInit(root) { 580 var e_1, _a; 581 if (root === void 0) { 582 root = document; 583 } 584 var components = []; 585 var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]")); 586 nodes = nodes.filter(function (node) { 587 return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE; 588 }); 589 try { 590 for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) { 591 var node = nodes_1_1.value; 592 var ctorName = node.getAttribute(AUTO_INIT_ATTR); 593 if (!ctorName) { 594 throw new Error('(mdc-auto-init) Constructor name must be given.'); 595 } 596 var Constructor = registry[ctorName]; // tslint:disable-line:variable-name 597 if (typeof Constructor !== 'function') { 598 throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName); 599 } 600 // TODO: Should we make an eslint rule for an attachTo() static method? 601 // See https://github.com/Microsoft/TypeScript/issues/14600 for discussion of static interface support in TS 602 var component = Constructor.attachTo(node); 603 Object.defineProperty(node, ctorName, { 604 configurable: true, 605 enumerable: false, 606 value: component, 607 writable: false 608 }); 609 components.push(component); 610 node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE); 611 } 612 } catch (e_1_1) { 613 e_1 = { error: e_1_1 }; 614 } finally { 615 try { 616 if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1); 617 } finally { 618 if (e_1) throw e_1.error; 619 } 620 } 621 emit('MDCAutoInit:End', {}); 622 return components; 623} 624exports.mdcAutoInit = mdcAutoInit; 625// Constructor is PascalCased because it is a direct reference to a class, rather than an instance of a class. 626// tslint:disable-next-line:variable-name 627mdcAutoInit.register = function (componentName, Constructor, warn) { 628 if (warn === void 0) { 629 warn = CONSOLE_WARN; 630 } 631 if (typeof Constructor !== 'function') { 632 throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function."); 633 } 634 var registryValue = registry[componentName]; 635 if (registryValue) { 636 warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue); 637 } 638 registry[componentName] = Constructor; 639}; 640mdcAutoInit.deregister = function (componentName) { 641 delete registry[componentName]; 642}; 643/** @nocollapse */ 644mdcAutoInit.deregisterAll = function () { 645 var
645keys = Object.keys(registry); 646 keys.forEach(this.deregister, this);
vendor: 8,489 bytes, lines 646-832
646 647}; 648// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 649exports.default = mdcAutoInit; 650 651/***/ }), 652 653/***/ "./packages/mdc-banner/adapter.ts": 654/*!****************************************!*\ 655 !*** ./packages/mdc-banner/adapter.ts ***! 656 \****************************************/ 657/*! no static exports found */ 658/***/ (function(module, exports, __webpack_require__) { 659 660"use strict"; 661 662/** 663 * @license 664 * Copyright 2020 Google Inc. 665 * 666 * Permission is hereby granted, free of charge, to any person obtaining a copy 667 * of this software and associated documentation files (the "Software"), to deal 668 * in the Software without restriction, including without limitation the rights 669 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 670 * copies of the Software, and to permit persons to whom the Software is 671 * furnished to do so, subject to the following conditions: 672 * 673 * The above copyright notice and this permission notice shall be included in 674 * all copies or substantial portions of the Software. 675 * 676 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 677 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 678 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 679 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 680 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 681 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 682 * THE SOFTWARE. 683 */ 684 685Object.defineProperty(exports, "__esModule", { value: true }); 686 687/***/ }), 688 689/***/ "./packages/mdc-banner/component.ts": 690/*!******************************************!*\ 691 !*** ./packages/mdc-banner/component.ts ***! 692 \******************************************/ 693/*! no static exports found */ 694/***/ (function(module, exports, __webpack_require__) { 695 696"use strict"; 697 698/** 699 * @license 700 * Copyright 2020 Google Inc. 701 * 702 * Permission is hereby granted, free of charge, to any person obtaining a copy 703 * of this software and associated documentation files (the "Software"), to deal 704 * in the Software without restriction, including without limitation the rights 705 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 706 * copies of the Software, and to permit persons to whom the Software is 707 * furnished to do so, subject to the following conditions: 708 * 709 * The above copyright notice and this permission notice shall be included in 710 * all copies or substantial portions of the Software. 711 * 712 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 713 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 714 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 715 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 716 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 717 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 718 * THE SOFTWARE. 719 */ 720 721var __extends = this && this.__extends || function () { 722 var _extendStatics = function extendStatics(d, b) { 723 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 724 d.__proto__ = b; 725 } || function (d, b) { 726 for (var p in b) { 727 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 728 } 729 }; 730 return _extendStatics(d, b); 731 }; 732 return function (d, b) { 733 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 734 _extendStatics(d, b); 735 function __() { 736 this.constructor = d; 737 } 738 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 739 }; 740}(); 741Object.defineProperty(exports, "__esModule", { value: true }); 742exports.MDCBanner = void 0; 743var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 744var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts"); 745var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 746var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-banner/constants.ts"); 747var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-banner/foundation.ts"); 748/** Vanilla JS implementation of banner component. */ 749var MDCBanner = /** @class */function (_super) { 750 __extends(MDCBanner, _super); 751 function MDCBanner() { 752 return _super !== null && _super.apply(this, arguments) || this; 753 } 754 MDCBanner.attachTo = function (root) { 755 return new MDCBanner(root); 756 }; 757 MDCBanner.prototype.initialize = function (focusTrapFactory) { 758 var _this = this; 759 if (focusTrapFactory === void 0) { 760 focusTrapFactory = function focusTrapFactory(el, focusOptions) { 761 return new focus_trap_1.FocusTrap(el, focusOptions); 762 }; 763 } 764 this.contentEl = this.root.querySelector(constants_1.selectors.CONTENT); 765 this.textEl = this.root.querySelector(constants_1.selectors.TEXT); 766 this.primaryActionEl = this.root.querySelector(constants_1.selectors.PRIMARY_ACTION); 767 this.secondaryActionEl = this.root.querySelector(constants_1.selectors.SECONDARY_ACTION); 768 this.focusTrapFactory = focusTrapFactory; 769 this.handleContentClick = function (evt) { 770 var target = evt.target; 771 if (ponyfill_1.closest(target, constants_1.selectors.PRIMARY_ACTION)) { 772 _this.foundation.handlePrimaryActionClick(); 773 } else if (ponyfill_1.closest(target, constants_1.selectors.SECONDARY_ACTION)) { 774 _this.foundation.handleSecondaryActionClick(); 775 } 776 }; 777 }; 778 MDCBanner.prototype.initialSyncWithDOM = function () { 779 this.registerContentClickHandler(this.handleContentClick); 780 this.focusTrap = this.focusTrapFactory(this.root, { initialFocusEl: this.primaryActionEl }); 781 }; 782 MDCBanner.prototype.destroy = function () { 783 _super.prototype.destroy.call(this); 784 this.deregisterContentClickHandler(this.handleContentClick); 785 }; 786 MDCBanner.prototype.layout = function () { 787 this.foundation.layout(); 788 }; 789 /** 790 * Opens the banner and fires events.OPENING to indicate the beginning of its 791 * opening animation and then events.OPENED once the animation finishes. 792 */ 793 MDCBanner.prototype.open = function () { 794 this.foundation.open(); 795 }; 796 /** 797 * Closes the banner and fires events.CLOSING to indicate the beginning of its 798 * closing animation and then events.CLOSED once the animation finishes. 799 * @param reason Why the banner was closed. Value will be passed to 800 * events.CLOSING and events.CLOSED via the `event.detail.reason` 801 * property. Standard values are CloseReason.PRIMARY and 802 * CloseReason.SECONDARY, but CloseReason.UNSPECIFIED is provided for 803 * custom handling of programmatic closing of the banner. 804 */ 805 MDCBanner.prototype.close = function (reason) { 806 this.foundation.close(reason); 807 }; 808 MDCBanner.prototype.getDefaultFoundation = function () { 809 var _this = this; 810 // DO NOT INLINE this variable. For backward compatibility, foundations take 811 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 812 // methods, we need a separate, strongly typed adapter variable. 813 var adapter = { 814 addClass: function addClass(className) { 815 _this.root.classList.add(className); 816 }, 817 getContentHeight: function getContentHeight() { 818 return _this.contentEl.offsetHeight; 819 }, 820 notifyClosed: function notifyClosed(reason) { 821 _this.emit(constants_1.events.CLOSED, { reason: reason }); 822 }, 823 notifyClosing: function notifyClosing(reason) { 824 _this.emit(constants_1.events.CLOSING, { reason: reason }); 825 }, 826 notifyOpened: function notifyOpened() { 827 _this.emit(constants_1.events.OPENED, {}); 828 }, 829 notifyOpening: function notifyOpening() { 830 _this.emit(constants_1.events.OPENING, {}); 831 }, 832
vendor: 2,058 bytes, lines 832-886
832releaseFocus: function releaseFocus() { 833 _this.focusTrap.releaseFocus(); 834 }, 835 removeClass: function removeClass(className) { 836 _this.root.classList.remove(className); 837 }, 838 setStyleProperty: function setStyleProperty(propertyName, value) { 839 _this.root.style.setProperty(propertyName, value); 840 }, 841 trapFocus: function trapFocus() { 842 _this.focusTrap.trapFocus(); 843 } 844 }; 845 return new foundation_1.MDCBannerFoundation(adapter); 846 }; 847 Object.defineProperty(MDCBanner.prototype, "isOpen", { 848 get: function get() { 849 return this.foundation.isOpen(); 850 }, 851 enumerable: false, 852 configurable: true 853 }); 854 MDCBanner.prototype.getText = function () { 855 return this.textEl.textContent || ''; 856 }; 857 MDCBanner.prototype.setText = function (text) { 858 this.textEl.textContent = text; 859 }; 860 MDCBanner.prototype.getPrimaryActionText = function () { 861 return this.primaryActionEl.textContent || ''; 862 }; 863 MDCBanner.prototype.setPrimaryActionText = function (actionButtonText) { 864 this.primaryActionEl.textContent = actionButtonText; 865 }; 866 /** Returns null if the banner has no secondary action. */ 867 MDCBanner.prototype.getSecondaryActionText = function () { 868 return this.secondaryActionEl ? this.secondaryActionEl.textContent || '' : null; 869 }; 870 MDCBanner.prototype.setSecondaryActionText = function (actionButtonText) { 871 if (this.secondaryActionEl) { 872 this.secondaryActionEl.textContent = actionButtonText; 873 } 874 }; 875 MDCBanner.prototype.registerContentClickHandler = function (handler) { 876 this.contentEl.addEventListener('click', handler); 877 }; 878 MDCBanner.prototype.deregisterContentClickHandler = function (handler) { 879 this.contentEl.removeEventListener('click', handler); 880 }; 881 return MDCBanner; 882}(component_1.MDCComponent); 883exports.MDCBanner = MDCBanner; 884 885/***/ }), 886
887/***/ "./packages/mdc-banner/constants.ts": 888/*!******************************************!*\ 889 !*** ./packages/mdc-banner/constants.ts ***! 890 \******************************************/ 891/*! no static exports found */ 892/***/ (function(module, exports, __webpack_require__) { 893 894"use strict"; 895 896/** 897 * @license 898 * Copyright 2020 Google Inc. 899 * 900 * Permission is hereby granted, free of charge, to any person obtaining a copy 901 * of this software and associated documentation files (the "Software"), to deal 902 * in the Software without restriction, including without limitation the rights 903 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 904 * copies of the Software, and to permit persons to whom the Software is 905 * furnished to do so, subject to the following conditions: 906 * 907 * The above copyright notice and this permission notice shall be included in 908 * all copies or substantial portions of the Software. 909 * 910 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 911 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 912 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 913 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 914 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 915 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 916 * THE SOFTWARE. 917 */ 918 919Object.defineProperty(exports, "__esModule", { value: true }); 920exports.CloseReason = exports.selectors = exports.events = exports.numbers = exports.cssClasses = void 0; 921/** Banner element classes. */ 922exports.cssClasses = { 923 CLOSING: 'mdc-banner--closing', 924 OPEN: 'mdc-banner--open', 925 OPENING: 'mdc-banner--opening' 926}; 927/** Banner numbers. */ 928exports.numbers = { 929 BANNER_ANIMATION_CLOSE_TIME_MS: 250, 930 BANNER_ANIMATION_OPEN_TIME_MS: 300 931}; 932/** Banner events. */ 933exports.events = { 934 CLOSED: 'MDCBanner:closed', 935 CLOSING: 'MDCBanner:closing', 936 OPENED: 'MDCBanner:opened', 937 OPENING: 'MDCBanner:opening' 938}; 939/** Banner selectors. */ 940exports.selectors = { 941 CONTENT: '.mdc-banner__content', 942 PRIMARY_ACTION: '.mdc-banner__primary-action', 943 SECONDARY_ACTION: '.mdc-banner__secondary-action', 944 TEXT: '.mdc-banner__text' 945}; 946/** Reason as to why the banner was closed. */ 947var CloseReason; 948(function (CloseReason) { 949 // Indicates the banner was closed via primary action button. 950 CloseReason[CloseReason["PRIMARY"] = 0] = "PRIMARY"; 951 // Indicates the banner was closed via secondary action button. 952 CloseReason[CloseReason["SECONDARY"] = 1] = "SECONDARY"; 953 // Will never be used by the component. Provided for custom handling of 954 // programmatic closing of the banner. 955 CloseReason[CloseReason["UNSPECIFIED"] = 2] = "UNSPECIFIED"; 956})(CloseReason = exports.CloseReason || (exports.CloseReas
vendor: 4,644 bytes, lines 956-1069
956on = {})); 957 958/***/ }), 959 960/***/ "./packages/mdc-banner/foundation.ts": 961/*!*******************************************!*\ 962 !*** ./packages/mdc-banner/foundation.ts ***! 963 \*******************************************/ 964/*! no static exports found */ 965/***/ (function(module, exports, __webpack_require__) { 966 967"use strict"; 968 969/** 970 * @license 971 * Copyright 2020 Google Inc. 972 * 973 * Permission is hereby granted, free of charge, to any person obtaining a copy 974 * of this software and associated documentation files (the "Software"), to deal 975 * in the Software without restriction, including without limitation the rights 976 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 977 * copies of the Software, and to permit persons to whom the Software is 978 * furnished to do so, subject to the following conditions: 979 * 980 * The above copyright notice and this permission notice shall be included in 981 * all copies or substantial portions of the Software. 982 * 983 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 984 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 985 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 986 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 987 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 988 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 989 * THE SOFTWARE. 990 */ 991 992var __extends = this && this.__extends || function () { 993 var _extendStatics = function extendStatics(d, b) { 994 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 995 d.__proto__ = b; 996 } || function (d, b) { 997 for (var p in b) { 998 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 999 } 1000 }; 1001 return _extendStatics(d, b); 1002 }; 1003 return function (d, b) { 1004 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 1005 _extendStatics(d, b); 1006 function __() { 1007 this.constructor = d; 1008 } 1009 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 1010 }; 1011}(); 1012var __assign = this && this.__assign || function () { 1013 __assign = Object.assign || function (t) { 1014 for (var s, i = 1, n = arguments.length; i < n; i++) { 1015 s = arguments[i]; 1016 for (var p in s) { 1017 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 1018 } 1019 } 1020 return t; 1021 }; 1022 return __assign.apply(this, arguments); 1023}; 1024Object.defineProperty(exports, "__esModule", { value: true }); 1025exports.MDCBannerFoundation = void 0; 1026var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 1027var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-banner/constants.ts"); 1028var OPENING = constants_1.cssClasses.OPENING, 1029 OPEN = constants_1.cssClasses.OPEN, 1030 CLOSING = constants_1.cssClasses.CLOSING; 1031/** 1032 * Foundation class for banner. Responsibilities include opening and closing the 1033 * banner. 1034 */ 1035var MDCBannerFoundation = /** @class */function (_super) { 1036 __extends(MDCBannerFoundation, _super); 1037 function MDCBannerFoundation(adapter) { 1038 var _this = _super.call(this, __assign(__assign({}, MDCBannerFoundation.defaultAdapter), adapter)) || this; 1039 _this.isOpened = false; 1040 // Request id for open animation, used to cancel the refresh callback 1041 // request on close() and destroy(). 1042 _this.animationFrame = 0; 1043 // Timer id for close and open animation, used to cancel the timer on 1044 // close() and destroy(). 1045 _this.animationTimer = 0; 1046 return _this; 1047 } 1048 Object.defineProperty(MDCBannerFoundation, "defaultAdapter", { 1049 get: function get() { 1050 return { 1051 addClass: function addClass() { 1052 return undefined; 1053 }, 1054 getContentHeight: function getContentHeight() { 1055 return 0; 1056 }, 1057 notifyClosed: function notifyClosed() { 1058 return undefined; 1059 }, 1060 notifyClosing: function notifyClosing() { 1061 return undefined; 1062 }, 1063 notifyOpened: function notifyOpened() { 1064 return undefined; 1065 }, 1066 notifyOpening: function notifyOpening() { 1067 return undefined; 1068 }, 1069
vendor: 3,161 bytes, lines 1069-1145
1069releaseFocus: function releaseFocus() { 1070 return undefined; 1071 }, 1072 removeClass: function removeClass() { 1073 return undefined; 1074 }, 1075 setStyleProperty: function setStyleProperty() { 1076 return undefined; 1077 }, 1078 trapFocus: function trapFocus() { 1079 return undefined; 1080 } 1081 }; 1082 }, 1083 enumerable: false, 1084 configurable: true 1085 }); 1086 MDCBannerFoundation.prototype.destroy = function () { 1087 cancelAnimationFrame(this.animationFrame); 1088 this.animationFrame = 0; 1089 clearTimeout(this.animationTimer); 1090 this.animationTimer = 0; 1091 }; 1092 MDCBannerFoundation.prototype.open = function () { 1093 var _this = this; 1094 this.isOpened = true; 1095 this.adapter.notifyOpening(); 1096 this.adapter.removeClass(CLOSING); 1097 this.adapter.addClass(OPENING); 1098 var contentHeight = this.adapter.getContentHeight(); 1099 this.animationFrame = requestAnimationFrame(function () { 1100 _this.adapter.addClass(OPEN); 1101 _this.adapter.setStyleProperty('height', contentHeight + "px"); 1102 _this.animationTimer = setTimeout(function () { 1103 _this.handleAnimationTimerEnd(); 1104 _this.adapter.trapFocus(); 1105 _this.adapter.notifyOpened(); 1106 }, constants_1.numbers.BANNER_ANIMATION_OPEN_TIME_MS); 1107 }); 1108 }; 1109 /** 1110 * @param reason Why the banner was closed. Value will be passed to 1111 * events.CLOSING and events.CLOSED via the `event.detail.reason` 1112 * property. Standard values are CloseReason.PRIMARY and 1113 * CloseReason.SECONDARY, but CloseReason.UNSPECIFIED is provided for 1114 * custom handling of programmatic closing of the banner. 1115 */ 1116 MDCBannerFoundation.prototype.close = function (reason) { 1117 var _this = this; 1118 if (!this.isOpened) { 1119 // Avoid redundant close calls (and events), e.g. repeated interactions as 1120 // the banner is animating closed 1121 return; 1122 } 1123 cancelAnimationFrame(this.animationFrame); 1124 this.animationFrame = 0; 1125 this.isOpened = false; 1126 this.adapter.notifyClosing(reason); 1127 this.adapter.addClass(CLOSING); 1128 this.adapter.setStyleProperty('height', '0'); 1129 this.adapter.removeClass(OPEN); 1130 this.adapter.removeClass(OPENING); 1131 clearTimeout(this.animationTimer); 1132 this.animationTimer = setTimeout(function () { 1133 _this.adapter.releaseFocus(); 1134 _this.handleAnimationTimerEnd(); 1135 _this.adapter.notifyClosed(reason); 1136 }, constants_1.numbers.BANNER_ANIMATION_CLOSE_TIME_MS); 1137 }; 1138 MDCBannerFoundation.prototype.isOpen = function () { 1139 return this.isOpened; 1140 }; 1141 MDCBannerFoundation.prototype.handlePrimaryActionClick = function () { 1142 this.close(constants_1.CloseReason.PRIMARY); 1143 }; 1144 MDCBannerFoundation.prototype.handleSecondaryActionClick = function () { 1145 this.close(constants_1.CloseReason.SECONDARY);
vendor: 5,696 bytes, lines 1145-1286
1145 1146 }; 1147 MDCBannerFoundation.prototype.layout = function () { 1148 var contentHeight = this.adapter.getContentHeight(); 1149 this.adapter.setStyleProperty('height', contentHeight + "px"); 1150 }; 1151 MDCBannerFoundation.prototype.handleAnimationTimerEnd = function () { 1152 this.animationTimer = 0; 1153 this.adapter.removeClass(OPENING); 1154 this.adapter.removeClass(CLOSING); 1155 }; 1156 return MDCBannerFoundation; 1157}(foundation_1.MDCFoundation); 1158exports.MDCBannerFoundation = MDCBannerFoundation; 1159 1160/***/ }), 1161 1162/***/ "./packages/mdc-banner/index.ts": 1163/*!**************************************!*\ 1164 !*** ./packages/mdc-banner/index.ts ***! 1165 \**************************************/ 1166/*! no static exports found */ 1167/***/ (function(module, exports, __webpack_require__) { 1168 1169"use strict"; 1170 1171/** 1172 * @license 1173 * Copyright 2020 Google Inc. 1174 * 1175 * Permission is hereby granted, free of charge, to any person obtaining a copy 1176 * of this software and associated documentation files (the "Software"), to deal 1177 * in the Software without restriction, including without limitation the rights 1178 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1179 * copies of the Software, and to permit persons to whom the Software is 1180 * furnished to do so, subject to the following conditions: 1181 * 1182 * The above copyright notice and this permission notice shall be included in 1183 * all copies or substantial portions of the Software. 1184 * 1185 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1186 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1187 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1188 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1189 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1190 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1191 * THE SOFTWARE. 1192 */ 1193 1194var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 1195 if (k2 === undefined) k2 = k; 1196 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 1197 return m[k]; 1198 } }); 1199} : function (o, m, k, k2) { 1200 if (k2 === undefined) k2 = k; 1201 o[k2] = m[k]; 1202}); 1203var __exportStar = this && this.__exportStar || function (m, exports) { 1204 for (var p in m) { 1205 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 1206 } 1207}; 1208Object.defineProperty(exports, "__esModule", { value: true }); 1209__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-banner/adapter.ts"), exports); 1210__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-banner/component.ts"), exports); 1211__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-banner/constants.ts"), exports); 1212__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-banner/foundation.ts"), exports); 1213 1214/***/ }), 1215 1216/***/ "./packages/mdc-base/component.ts": 1217/*!****************************************!*\ 1218 !*** ./packages/mdc-base/component.ts ***! 1219 \****************************************/ 1220/*! no static exports found */ 1221/***/ (function(module, exports, __webpack_require__) { 1222 1223"use strict"; 1224 1225/** 1226 * @license 1227 * Copyright 2016 Google Inc. 1228 * 1229 * Permission is hereby granted, free of charge, to any person obtaining a copy 1230 * of this software and associated documentation files (the "Software"), to deal 1231 * in the Software without restriction, including without limitation the rights 1232 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1233 * copies of the Software, and to permit persons to whom the Software is 1234 * furnished to do so, subject to the following conditions: 1235 * 1236 * The above copyright notice and this permission notice shall be included in 1237 * all copies or substantial portions of the Software. 1238 * 1239 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1240 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1241 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1242 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1243 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1244 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1245 * THE SOFTWARE. 1246 */ 1247 1248var __read = this && this.__read || function (o, n) { 1249 var m = typeof Symbol === "function" && o[Symbol.iterator]; 1250 if (!m) return o; 1251 var i = m.call(o), 1252 r, 1253 ar = [], 1254 e; 1255 try { 1256 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { 1257 ar.push(r.value); 1258 } 1259 } catch (error) { 1260 e = { error: error }; 1261 } finally { 1262 try { 1263 if (r && !r.done && (m = i["return"])) m.call(i); 1264 } finally { 1265 if (e) throw e.error; 1266 } 1267 } 1268 return ar; 1269}; 1270var __spreadArray = this && this.__spreadArray || function (to, from) { 1271 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) { 1272 to[j] = from[i]; 1273 }return to; 1274}; 1275Object.defineProperty(exports, "__esModule", { value: true }); 1276exports.MDCComponent = void 0; 1277var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"); 1278var MDCComponent = /** @class */function () { 1279 function MDCComponent(root, foundation) { 1280 var args = []; 1281 for (var _i = 2; _i < arguments.length; _i++) { 1282 args[_i - 2] = arguments[_i]; 1283 } 1284 this.root = root; 1285 this.initialize.apply(this, __spreadArray([], __read(args))); 1286 // Note that we initialize foundation here and not within the constructor's
1286 default param so that 1287 // this.root_ is defined and can be used within the
vendor: 7,541 bytes, lines 1287-1449
1287 foundation class. 1288 this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation; 1289 this.foundation.init(); 1290 this.initialSyncWithDOM(); 1291 } 1292 MDCComponent.attachTo = function (root) { 1293 // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and 1294 // returns an instantiated component with its root set to that element. Also note that in the cases of 1295 // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized 1296 // from getDefaultFoundation(). 1297 return new MDCComponent(root, new foundation_1.MDCFoundation({})); 1298 }; 1299 /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ 1300 MDCComponent.prototype.initialize = function () { 1301 var _args = []; 1302 for (var _i = 0; _i < arguments.length; _i++) { 1303 _args[_i] = arguments[_i]; 1304 } 1305 // Subclasses can override this to do any additional setup work that would be considered part of a 1306 // "constructor". Essentially, it is a hook into the parent constructor before the foundation is 1307 // initialized. Any additional arguments besides root and foundation will be passed in here. 1308 }; 1309 MDCComponent.prototype.getDefaultFoundation = function () { 1310 // Subclasses must override this method to return a properly configured foundation class for the 1311 // component. 1312 throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); 1313 }; 1314 MDCComponent.prototype.initialSyncWithDOM = function () { 1315 // Subclasses should override this method if they need to perform work to synchronize with a host DOM 1316 // object. An example of this would be a form control wrapper that needs to synchronize its internal state 1317 // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM 1318 // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. 1319 }; 1320 MDCComponent.prototype.destroy = function () { 1321 // Subclasses may implement this method to release any resources / deregister any listeners they have 1322 // attached. An example of this might be deregistering a resize event from the window object. 1323 this.foundation.destroy(); 1324 }; 1325 MDCComponent.prototype.listen = function (evtType, handler, options) { 1326 this.root.addEventListener(evtType, handler, options); 1327 }; 1328 MDCComponent.prototype.unlisten = function (evtType, handler, options) { 1329 this.root.removeEventListener(evtType, handler, options); 1330 }; 1331 /** 1332 * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. 1333 */ 1334 MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { 1335 if (shouldBubble === void 0) { 1336 shouldBubble = false; 1337 } 1338 var evt; 1339 if (typeof CustomEvent === 'function') { 1340 evt = new CustomEvent(evtType, { 1341 bubbles: shouldBubble, 1342 detail: evtData 1343 }); 1344 } else { 1345 evt = document.createEvent('CustomEvent'); 1346 evt.initCustomEvent(evtType, shouldBubble, false, evtData); 1347 } 1348 this.root.dispatchEvent(evt); 1349 }; 1350 return MDCComponent; 1351}(); 1352exports.MDCComponent = MDCComponent; 1353// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 1354exports.default = MDCComponent; 1355 1356/***/ }), 1357 1358/***/ "./packages/mdc-base/foundation.ts": 1359/*!*****************************************!*\ 1360 !*** ./packages/mdc-base/foundation.ts ***! 1361 \*****************************************/ 1362/*! no static exports found */ 1363/***/ (function(module, exports, __webpack_require__) { 1364 1365"use strict"; 1366 1367/** 1368 * @license 1369 * Copyright 2016 Google Inc. 1370 * 1371 * Permission is hereby granted, free of charge, to any person obtaining a copy 1372 * of this software and associated documentation files (the "Software"), to deal 1373 * in the Software without restriction, including without limitation the rights 1374 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1375 * copies of the Software, and to permit persons to whom the Software is 1376 * furnished to do so, subject to the following conditions: 1377 * 1378 * The above copyright notice and this permission notice shall be included in 1379 * all copies or substantial portions of the Software. 1380 * 1381 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1382 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1383 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1384 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1385 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1386 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1387 * THE SOFTWARE. 1388 */ 1389 1390Object.defineProperty(exports, "__esModule", { value: true }); 1391exports.MDCFoundation = void 0; 1392var MDCFoundation = /** @class */function () { 1393 function MDCFoundation(adapter) { 1394 if (adapter === void 0) { 1395 adapter = {}; 1396 } 1397 this.adapter = adapter; 1398 } 1399 Object.defineProperty(MDCFoundation, "cssClasses", { 1400 get: function get() { 1401 // Classes extending MDCFoundation should implement this method to return an object which exports every 1402 // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} 1403 return {}; 1404 }, 1405 enumerable: false, 1406 configurable: true 1407 }); 1408 Object.defineProperty(MDCFoundation, "strings", { 1409 get: function get() { 1410 // Classes extending MDCFoundation should implement this method to return an object which exports all 1411 // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} 1412 return {}; 1413 }, 1414 enumerable: false, 1415 configurable: true 1416 }); 1417 Object.defineProperty(MDCFoundation, "numbers", { 1418 get: function get() { 1419 // Classes extending MDCFoundation should implement this method to return an object which exports all 1420 // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} 1421 return {}; 1422 }, 1423 enumerable: false, 1424 configurable: true 1425 }); 1426 Object.defineProperty(MDCFoundation, "defaultAdapter", { 1427 get: function get() { 1428 // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient 1429 // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter 1430 // validation. 1431 return {}; 1432 }, 1433 enumerable: false, 1434 configurable: true 1435 }); 1436 MDCFoundation.prototype.init = function () { 1437 // Subclasses should override this method to perform initialization routines (registering events, etc.) 1438 }; 1439 MDCFoundation.prototype.destroy = function () { 1440 // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) 1441 }; 1442 return MDCFoundation; 1443}(); 1444exports.MDCFoundation = MDCFoundation; 1445// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 1446exports.default = MDCFoundation; 1447 1448/***/ }), 1449
vendor: 2,305 bytes, lines 1450-1502
1450/***/ "./packages/mdc-base/index.ts": 1451/*!************************************!*\ 1452 !*** ./packages/mdc-base/index.ts ***! 1453 \************************************/ 1454/*! no static exports found */ 1455/***/ (function(module, exports, __webpack_require__) { 1456 1457"use strict"; 1458 1459/** 1460 * @license 1461 * Copyright 2019 Google Inc. 1462 * 1463 * Permission is hereby granted, free of charge, to any person obtaining a copy 1464 * of this software and associated documentation files (the "Software"), to deal 1465 * in the Software without restriction, including without limitation the rights 1466 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1467 * copies of the Software, and to permit persons to whom the Software is 1468 * furnished to do so, subject to the following conditions: 1469 * 1470 * The above copyright notice and this permission notice shall be included in 1471 * all copies or substantial portions of the Software. 1472 * 1473 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1474 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1475 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1476 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1477 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1478 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1479 * THE SOFTWARE. 1480 */ 1481 1482var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 1483 if (k2 === undefined) k2 = k; 1484 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 1485 return m[k]; 1486 } }); 1487} : function (o, m, k, k2) { 1488 if (k2 === undefined) k2 = k; 1489 o[k2] = m[k]; 1490}); 1491var __exportStar = this && this.__exportStar || function (m, exports) { 1492 for (var p in m) { 1493 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 1494 } 1495}; 1496Object.defineProperty(exports, "__esModule", { value: true }); 1497__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-base/component.ts"), exports); 1498__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"), exports); 1499__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-base/types.ts"), exports); 1500 1501/***/ }), 1502
vendor: 4,411 bytes, lines 1503-1608
1503/***/ "./packages/mdc-base/types.ts": 1504/*!************************************!*\ 1505 !*** ./packages/mdc-base/types.ts ***! 1506 \************************************/ 1507/*! no static exports found */ 1508/***/ (function(module, exports, __webpack_require__) { 1509 1510"use strict"; 1511 1512/** 1513 * @license 1514 * Copyright 2019 Google Inc. 1515 * 1516 * Permission is hereby granted, free of charge, to any person obtaining a copy 1517 * of this software and associated documentation files (the "Software"), to deal 1518 * in the Software without restriction, including without limitation the rights 1519 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1520 * copies of the Software, and to permit persons to whom the Software is 1521 * furnished to do so, subject to the following conditions: 1522 * 1523 * The above copyright notice and this permission notice shall be included in 1524 * all copies or substantial portions of the Software. 1525 * 1526 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1527 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1528 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1529 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1530 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1531 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1532 * THE SOFTWARE. 1533 */ 1534 1535Object.defineProperty(exports, "__esModule", { value: true }); 1536// tslint:enable:no-any 1537 1538/***/ }), 1539 1540/***/ "./packages/mdc-checkbox/adapter.ts": 1541/*!******************************************!*\ 1542 !*** ./packages/mdc-checkbox/adapter.ts ***! 1543 \******************************************/ 1544/*! no static exports found */ 1545/***/ (function(module, exports, __webpack_require__) { 1546 1547"use strict"; 1548 1549/** 1550 * @license 1551 * Copyright 2016 Google Inc. 1552 * 1553 * Permission is hereby granted, free of charge, to any person obtaining a copy 1554 * of this software and associated documentation files (the "Software"), to deal 1555 * in the Software without restriction, including without limitation the rights 1556 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1557 * copies of the Software, and to permit persons to whom the Software is 1558 * furnished to do so, subject to the following conditions: 1559 * 1560 * The above copyright notice and this permission notice shall be included in 1561 * all copies or substantial portions of the Software. 1562 * 1563 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1564 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1565 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1566 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1567 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1568 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1569 * THE SOFTWARE. 1570 */ 1571 1572Object.defineProperty(exports, "__esModule", { value: true }); 1573 1574/***/ }), 1575 1576/***/ "./packages/mdc-checkbox/component.ts": 1577/*!********************************************!*\ 1578 !*** ./packages/mdc-checkbox/component.ts ***! 1579 \********************************************/ 1580/*! no static exports found */ 1581/***/ (function(module, exports, __webpack_require__) { 1582 1583"use strict"; 1584 1585/** 1586 * @license 1587 * Copyright 2016 Google Inc. 1588 * 1589 * Permission is hereby granted, free of charge, to any person obtaining a copy 1590 * of this software and associated documentation files (the "Software"), to deal 1591 * in the Software without restriction, including without limitation the rights 1592 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1593 * copies of the Software, and to permit persons to whom the Software is 1594 * furnished to do so, subject to the following conditions: 1595 * 1596 * The above copyright notice and this permission notice shall be included in 1597 * all copies or substantial portions of the Software. 1598 * 1599 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1600 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1601 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1602 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1603 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1604 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1605 * THE SOFTWARE. 1606 */ 1607 1608var _
vendor: 8,308 bytes, lines 1608-1788
1608_extends = this && this.__extends || function () { 1609 var _extendStatics = function extendStatics(d, b) { 1610 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 1611 d.__proto__ = b; 1612 } || function (d, b) { 1613 for (var p in b) { 1614 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 1615 } 1616 }; 1617 return _extendStatics(d, b); 1618 }; 1619 return function (d, b) { 1620 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 1621 _extendStatics(d, b); 1622 function __() { 1623 this.constructor = d; 1624 } 1625 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 1626 }; 1627}(); 1628var __assign = this && this.__assign || function () { 1629 __assign = Object.assign || function (t) { 1630 for (var s, i = 1, n = arguments.length; i < n; i++) { 1631 s = arguments[i]; 1632 for (var p in s) { 1633 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 1634 } 1635 } 1636 return t; 1637 }; 1638 return __assign.apply(this, arguments); 1639}; 1640Object.defineProperty(exports, "__esModule", { value: true }); 1641exports.MDCCheckbox = void 0; 1642var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 1643var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 1644var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 1645var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 1646var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 1647var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 1648var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"); 1649var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts"); 1650var CB_PROTO_PROPS = ['checked', 'indeterminate']; 1651var MDCCheckbox = /** @class */function (_super) { 1652 __extends(MDCCheckbox, _super); 1653 function MDCCheckbox() { 1654 var _this = _super !== null && _super.apply(this, arguments) || this; 1655 _this.ripple_ = _this.createRipple_(); 1656 return _this; 1657 } 1658 MDCCheckbox.attachTo = function (root) { 1659 return new MDCCheckbox(root); 1660 }; 1661 Object.defineProperty(MDCCheckbox.prototype, "ripple", { 1662 get: function get() { 1663 return this.ripple_; 1664 }, 1665 enumerable: false, 1666 configurable: true 1667 }); 1668 Object.defineProperty(MDCCheckbox.prototype, "checked", { 1669 get: function get() { 1670 return this.nativeControl_.checked; 1671 }, 1672 set: function set(checked) { 1673 this.nativeControl_.checked = checked; 1674 }, 1675 enumerable: false, 1676 configurable: true 1677 }); 1678 Object.defineProperty(MDCCheckbox.prototype, "indeterminate", { 1679 get: function get() { 1680 return this.nativeControl_.indeterminate; 1681 }, 1682 set: function set(indeterminate) { 1683 this.nativeControl_.indeterminate = indeterminate; 1684 }, 1685 enumerable: false, 1686 configurable: true 1687 }); 1688 Object.defineProperty(MDCCheckbox.prototype, "disabled", { 1689 get: function get() { 1690 return this.nativeControl_.disabled; 1691 }, 1692 set: function set(disabled) { 1693 this.foundation.setDisabled(disabled); 1694 }, 1695 enumerable: false, 1696 configurable: true 1697 }); 1698 Object.defineProperty(MDCCheckbox.prototype, "value", { 1699 get: function get() { 1700 return this.nativeControl_.value; 1701 }, 1702 set: function set(value) { 1703 this.nativeControl_.value = value; 1704 }, 1705 enumerable: false, 1706 configurable: true 1707 }); 1708 MDCCheckbox.prototype.initialize = function () { 1709 var DATA_INDETERMINATE_ATTR = constants_1.strings.DATA_INDETERMINATE_ATTR; 1710 this.nativeControl_.indeterminate = this.nativeControl_.getAttribute(DATA_INDETERMINATE_ATTR) === 'true'; 1711 this.nativeControl_.removeAttribute(DATA_INDETERMINATE_ATTR); 1712 }; 1713 MDCCheckbox.prototype.initialSyncWithDOM = function () { 1714 var _this = this; 1715 this.handleChange_ = function () { 1716 return _this.foundation.handleChange(); 1717 }; 1718 this.handleAnimationEnd_ = function () { 1719 return _this.foundation.handleAnimationEnd(); 1720 }; 1721 this.nativeControl_.addEventListener('change', this.handleChange_); 1722 this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_); 1723 this.installPropertyChangeHooks_(); 1724 }; 1725 MDCCheckbox.prototype.destroy = function () { 1726 this.ripple_.destroy(); 1727 this.nativeControl_.removeEventListener('change', this.handleChange_); 1728 this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_); 1729 this.uninstallPropertyChangeHooks_(); 1730 _super.prototype.destroy.call(this); 1731 }; 1732 MDCCheckbox.prototype.getDefaultFoundation = function () { 1733 var _this = this; 1734 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 1735 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 1736 var adapter = { 1737 addClass: function addClass(className) { 1738 return _this.root.classList.add(className); 1739 }, 1740 forceLayout: function forceLayout() { 1741 return _this.root.offsetWidth; 1742 }, 1743 hasNativeControl: function hasNativeControl() { 1744 return !!_this.nativeControl_; 1745 }, 1746 isAttachedToDOM: function isAttachedToDOM() { 1747 return Boolean(_this.root.parentNode); 1748 }, 1749 isChecked: function isChecked() { 1750 return _this.checked; 1751 }, 1752 isIndeterminate: function isIndeterminate() { 1753 return _this.indeterminate; 1754 }, 1755 removeClass: function removeClass(className) { 1756 _this.root.classList.remove(className); 1757 }, 1758 removeNativeControlAttr: function removeNativeControlAttr(attr) { 1759 _this.nativeControl_.removeAttribute(attr); 1760 }, 1761 setNativeControlAttr: function setNativeControlAttr(attr, value) { 1762 _this.nativeControl_.setAttribute(attr, value); 1763 }, 1764 setNativeControlDisabled: function setNativeControlDisabled(disabled) { 1765 _this.nativeControl_.disabled = disabled; 1766 } 1767 }; 1768 return new foundation_2.MDCCheckboxFoundation(adapter); 1769 }; 1770 MDCCheckbox.prototype.createRipple_ = function () { 1771 var _this = this; 1772 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 1773 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 1774 var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 1775 return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive()); 1776 }, isSurfaceActive: function isSurfaceActive() { 1777 return ponyfill_1.matches(_this.nativeControl_, ':active'); 1778 }, isUnbounded: function isUnbounded() { 1779 return true; 1780 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 1781 return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive()); 1782 } }); 1783 return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter)); 1784 }; 1785 MDCCheckbox.prototype.installPropertyChangeHooks_ = function () { 1786 var _this = this; 1787 var nativeCb = this.nativeControl_; 1788 var cbProto = Object.getPrototypeOf(nativeCb);
1789 CB_PROTO_PROPS.forEach(function (controlState) { 1790 var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); 1791 // We have to check for this descriptor, since some browsers (Safari) don't support its return. 1792 // See: https://bugs.webkit.org/show_bug.cgi?id=49739 1793 if (!validDescriptor(desc)) { 1794 return; 1795 } 1796 // Type cast is needed for compatibility with Closure Compiler. 1797 var nativeGetter = desc.get; 1798 var nativeCbDesc = { 1799 configurable: desc.configurable, 1800 enumerable: desc.enumerable, 1801 get: nativeGetter, 1802 set: function set(state) { 1803 desc.set.call(nativeCb, state); 1804 _this.foundation.handleChange(); 1805 } 1806 }; 1807 Object.defineProperty(nativeCb, controlState, nativeCbDesc); 1808 }); 1809 }; 1810 MDCCheckbox.prototype.uninstallPropertyChangeHooks_ = function () { 1811 var nativeCb = this.nativeControl_; 1812 var cbProto = Object.getPrototypeOf(nativeCb); 1813 CB_PROTO_PROPS.forEach(function (controlState) { 1814 var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); 1815 if (!validDescriptor(desc)) { 1816 return; 1817 } 1818 Object.defineProperty(nativeCb, controlState, desc); 1819 }); 1820 }; 1821 Object.defineProperty(MDCCheckbox.prototype, "nativeControl_", { 1822 get: function get() { 1823 var NATIVE_CONTROL_SELECTOR = constants_1.strings.NATIVE_CONTROL_SELECTOR; 1824 var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR); 1825 if (!el) { 1826 throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element"); 1827 } 1828 return el; 1829 }, 1830 enumerable: false, 1831 configurable: true 1832 })
vendor: 6,434 bytes, lines 1832-1983
1832; 1833 return MDCCheckbox; 1834}(component_1.MDCComponent); 1835exports.MDCCheckbox = MDCCheckbox; 1836function validDescriptor(inputPropDesc) { 1837 return !!inputPropDesc && typeof inputPropDesc.set === 'function'; 1838} 1839 1840/***/ }), 1841 1842/***/ "./packages/mdc-checkbox/constants.ts": 1843/*!********************************************!*\ 1844 !*** ./packages/mdc-checkbox/constants.ts ***! 1845 \********************************************/ 1846/*! no static exports found */ 1847/***/ (function(module, exports, __webpack_require__) { 1848 1849"use strict"; 1850 1851/** 1852 * @license 1853 * Copyright 2016 Google Inc. 1854 * 1855 * Permission is hereby granted, free of charge, to any person obtaining a copy 1856 * of this software and associated documentation files (the "Software"), to deal 1857 * in the Software without restriction, including without limitation the rights 1858 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1859 * copies of the Software, and to permit persons to whom the Software is 1860 * furnished to do so, subject to the following conditions: 1861 * 1862 * The above copyright notice and this permission notice shall be included in 1863 * all copies or substantial portions of the Software. 1864 * 1865 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1866 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1867 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1868 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1869 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1870 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1871 * THE SOFTWARE. 1872 */ 1873 1874Object.defineProperty(exports, "__esModule", { value: true }); 1875exports.numbers = exports.strings = exports.cssClasses = void 0; 1876exports.cssClasses = { 1877 ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate', 1878 ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked', 1879 ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked', 1880 ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked', 1881 ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked', 1882 ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate', 1883 BACKGROUND: 'mdc-checkbox__background', 1884 CHECKED: 'mdc-checkbox--checked', 1885 CHECKMARK: 'mdc-checkbox__checkmark', 1886 CHECKMARK_PATH: 'mdc-checkbox__checkmark-path', 1887 DISABLED: 'mdc-checkbox--disabled', 1888 INDETERMINATE: 'mdc-checkbox--indeterminate', 1889 MIXEDMARK: 'mdc-checkbox__mixedmark', 1890 NATIVE_CONTROL: 'mdc-checkbox__native-control', 1891 ROOT: 'mdc-checkbox', 1892 SELECTED: 'mdc-checkbox--selected', 1893 UPGRADED: 'mdc-checkbox--upgraded' 1894}; 1895exports.strings = { 1896 ARIA_CHECKED_ATTR: 'aria-checked', 1897 ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed', 1898 DATA_INDETERMINATE_ATTR: 'data-indeterminate', 1899 NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control', 1900 TRANSITION_STATE_CHECKED: 'checked', 1901 TRANSITION_STATE_INDETERMINATE: 'indeterminate', 1902 TRANSITION_STATE_INIT: 'init', 1903 TRANSITION_STATE_UNCHECKED: 'unchecked' 1904}; 1905exports.numbers = { 1906 ANIM_END_LATCH_MS: 250 1907}; 1908 1909/***/ }), 1910 1911/***/ "./packages/mdc-checkbox/foundation.ts": 1912/*!*********************************************!*\ 1913 !*** ./packages/mdc-checkbox/foundation.ts ***! 1914 \*********************************************/ 1915/*! no static exports found */ 1916/***/ (function(module, exports, __webpack_require__) { 1917 1918"use strict"; 1919 1920/** 1921 * @license 1922 * Copyright 2016 Google Inc. 1923 * 1924 * Permission is hereby granted, free of charge, to any person obtaining a copy 1925 * of this software and associated documentation files (the "Software"), to deal 1926 * in the Software without restriction, including without limitation the rights 1927 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1928 * copies of the Software, and to permit persons to whom the Software is 1929 * furnished to do so, subject to the following conditions: 1930 * 1931 * The above copyright notice and this permission notice shall be included in 1932 * all copies or substantial portions of the Software. 1933 * 1934 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1935 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1936 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1937 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1938 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1939 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1940 * THE SOFTWARE. 1941 */ 1942 1943var __extends = this && this.__extends || function () { 1944 var _extendStatics = function extendStatics(d, b) { 1945 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 1946 d.__proto__ = b; 1947 } || function (d, b) { 1948 for (var p in b) { 1949 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 1950 } 1951 }; 1952 return _extendStatics(d, b); 1953 }; 1954 return function (d, b) { 1955 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 1956 _extendStatics(d, b); 1957 function __() { 1958 this.constructor = d; 1959 } 1960 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 1961 }; 1962}(); 1963var __assign = this && this.__assign || function () { 1964 __assign = Object.assign || function (t) { 1965 for (var s, i = 1, n = arguments.length; i < n; i++) { 1966 s = arguments[i]; 1967 for (var p in s) { 1968 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 1969 } 1970 } 1971 return t; 1972 }; 1973 return __assign.apply(this, arguments); 1974}; 1975Object.defineProperty(exports, "__esModule", { value: true }); 1976exports.MDCCheckboxFoundation = void 0; 1977var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 1978var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"); 1979var MDCCheckboxFoundation = /** @class */function (_super) { 1980 __extends(MDCCheckboxFoundation, _super); 1981 function MDCCheckboxFoundation(adapter) { 1982 var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this; 1983 _this.currentCheckState
1983_ = constants_1.strings.TRANSITION_STATE_INIT; 1984 _this.currentAnimationClass_ = ''; 1985 _this.animEndLatchTimer_ = 0; 1986 _this.enableAnimationEndHandler_ = false; 1987 return _this; 1988 } 1989 Object.defineProperty(MDCCheckboxFoundation, "cssClasses", { 1990 get: function get() { 1991 return constants_1.cssClasses; 1992 }, 1993 enumerable: false, 1994 configurable: true 1995 }); 1996 Object.defineProperty(MDCCheckboxFoundation, "strings", { 1997 get: function get() { 1998 return constants_1.strings; 1999 }, 2000 enumerable: false, 2001 configurable: true 2002 }); 2003 Object.defineProperty(MDCCheckboxFoundation, "numbers", { 2004 get: function get() { 2005 return constants_1.numbers; 2006 }, 2007 enumerable: false, 2008 configurable: true 2009 }); 2010 Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", { 2011 get: function get() { 2012 return { 2013 addClass: function addClass() { 2014 return undefined; 2015 }, 2016 forceLayout: function forceLayout() { 2017 return undefined; 2018 }, 2019 hasNativeControl: function hasNativeControl() { 2020 return false; 2021 }, 2022 isAttachedToDOM: function isAttachedToDOM() { 2023 return false; 2024 }, 2025 isChecked: function isChecked() { 2026 return false; 2027 }, 2028 isIndeterminate: function isIndeterminate() { 2029 return false; 2030 }, 2031 removeClass: function removeClass() { 2032 return undefined; 2033 }, 2034 removeNativeControlAttr: function removeNativeControlAttr() { 2035 return undefined; 2036 }, 2037 setNativeControlAttr: function setNativeControlAttr() { 2038 return undefined; 2039 }, 2040 setNativeControlDisabled: function setNativeControlDisabled() { 2041 return undefined; 2042 } 2043 }; 2044 }, 2045 enumerable: false, 2046 configurable: true 2047 }); 2048 MDCCheckboxFoundation.prototype.init = function () { 2049 this.currentCheckState_ = this.determineCheckState_(); 2050 this.updateAriaChecked_();
2051 this.adapter.addClass(constants_1.cssClasses.UPGRADED); 2052 }; 2053 MDCCheckboxFoundation.prototype.destroy = function () { 2054 clearTimeout(this.animEndLatchTimer_); 2055 }; 2056 MDCCheckboxFoundation.prototype.setDisabled = function (disabled) { 2057 this.adapter.setNativeControlDisabled(disabled); 2058 if (disabled) { 2059 this.adapter.addClass(constants_1.cssClasses.DISABLED); 2060 } else { 2061 this.adapter.removeClass(constants_1.cssClasses.DISABLED); 2062 } 2063 }; 2064 /** 2065 * Handles the animationend event for the checkbox 2066 */ 2067 MDCCheckboxFoundation.prototype.handleAnimationEnd = function () { 2068 var _this = this; 2069 if (!this.enableAnimationEndHandler_) { 2070 return; 2071 } 2072 clearTimeout(this.animEndLatchTimer_); 2073 this.animEndLatchTimer_ = setTimeout(function () { 2074 _this.adapter.removeClass(_this.currentAnimationClass_); 2075 _this.enableAnimationEndHandler_ = false; 2076 }, constants_1.numbers.ANIM_END_LATCH_MS); 2077 }; 2078 /** 2079 * Handles the change event for the checkbox 2080 */ 2081 MDCCheckboxFoundation.prototype.handleChange = function () { 2082 this.transitionCheckState_(); 2083 }; 2084 MDCCheckboxFoundation.prototype.transitionCheckState_ = function () { 2085 if (!this.adapter.hasNativeControl()) { 2086 return; 2087 } 2088 var oldState = this.currentCheckState_; 2089 var newState = this.determineCheckState_(); 2090 if (oldState === newState) { 2091 return; 2092 } 2093 this.updateAriaChecked_(); 2094 var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
vendor: 3,386 bytes, lines 2095-2152
2095 var SELECTED = constants_1.cssClasses.SELECTED; 2096 if (newState === TRANSITION_STATE_UNCHECKED) { 2097 this.adapter.removeClass(SELECTED); 2098 } else { 2099 this.adapter.addClass(SELECTED); 2100 } 2101 // Check to ensure that there isn't a previously existing animation class, in case for example 2102 // the user interacted with the checkbox before the animation was finished. 2103 if (this.currentAnimationClass_.length > 0) { 2104 clearTimeout(this.animEndLatchTimer_); 2105 this.adapter.forceLayout(); 2106 this.adapter.removeClass(this.currentAnimationClass_); 2107 } 2108 this.currentAnimationClass_ = this.getTransitionAnimationClass_(oldState, newState); 2109 this.currentCheckState_ = newState; 2110 // Check for parentNode so that animations are only run when the element is attached 2111 // to the DOM. 2112 if (this.adapter.isAttachedToDOM() && this.currentAnimationClass_.length > 0) { 2113 this.adapter.addClass(this.currentAnimationClass_); 2114 this.enableAnimationEndHandler_ = true; 2115 } 2116 }; 2117 MDCCheckboxFoundation.prototype.determineCheckState_ = function () { 2118 var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE, 2119 TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED, 2120 TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED; 2121 if (this.adapter.isIndeterminate()) { 2122 return TRANSITION_STATE_INDETERMINATE; 2123 } 2124 return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED; 2125 }; 2126 MDCCheckboxFoundation.prototype.getTransitionAnimationClass_ = function (oldState, newState) { 2127 var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT, 2128 TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED, 2129 TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED; 2130 var _a = MDCCheckboxFoundation.cssClasses, 2131 ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED, 2132 ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE, 2133 ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED, 2134 ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE, 2135 ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED, 2136 ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED; 2137 switch (oldState) { 2138 case TRANSITION_STATE_INIT: 2139 if (newState === TRANSITION_STATE_UNCHECKED) { 2140 return ''; 2141 } 2142 return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; 2143 case TRANSITION_STATE_UNCHECKED: 2144 return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE; 2145 case TRANSITION_STATE_CHECKED: 2146 return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE; 2147 default: 2148 // TRANSITION_STATE_INDETERMINATE 2149 return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; 2150 } 2151 }; 2152 MDCCheckboxFoundation.prototype.updateAriaChecked_
vendor: 7,186 bytes, lines 2152-2311
2152 = function () { 2153 // Ensure aria-checked is set to mixed if checkbox is in indeterminate state. 2154 if (this.adapter.isIndeterminate()) { 2155 this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE); 2156 } else { 2157 // The on/off state does not need to keep track of aria-checked, since 2158 // the screenreader uses the checked property on the checkbox element. 2159 this.adapter.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR); 2160 } 2161 }; 2162 return MDCCheckboxFoundation; 2163}(foundation_1.MDCFoundation); 2164exports.MDCCheckboxFoundation = MDCCheckboxFoundation; 2165// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 2166exports.default = MDCCheckboxFoundation; 2167 2168/***/ }), 2169 2170/***/ "./packages/mdc-checkbox/index.ts": 2171/*!****************************************!*\ 2172 !*** ./packages/mdc-checkbox/index.ts ***! 2173 \****************************************/ 2174/*! no static exports found */ 2175/***/ (function(module, exports, __webpack_require__) { 2176 2177"use strict"; 2178 2179/** 2180 * @license 2181 * Copyright 2019 Google Inc. 2182 * 2183 * Permission is hereby granted, free of charge, to any person obtaining a copy 2184 * of this software and associated documentation files (the "Software"), to deal 2185 * in the Software without restriction, including without limitation the rights 2186 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2187 * copies of the Software, and to permit persons to whom the Software is 2188 * furnished to do so, subject to the following conditions: 2189 * 2190 * The above copyright notice and this permission notice shall be included in 2191 * all copies or substantial portions of the Software. 2192 * 2193 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2194 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2195 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2196 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2197 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2198 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2199 * THE SOFTWARE. 2200 */ 2201 2202var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 2203 if (k2 === undefined) k2 = k; 2204 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 2205 return m[k]; 2206 } }); 2207} : function (o, m, k, k2) { 2208 if (k2 === undefined) k2 = k; 2209 o[k2] = m[k]; 2210}); 2211var __exportStar = this && this.__exportStar || function (m, exports) { 2212 for (var p in m) { 2213 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 2214 } 2215}; 2216Object.defineProperty(exports, "__esModule", { value: true }); 2217__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-checkbox/adapter.ts"), exports); 2218__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-checkbox/component.ts"), exports); 2219__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"), exports); 2220__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts"), exports); 2221 2222/***/ }), 2223 2224/***/ "./packages/mdc-chips/deprecated/chip-set/adapter.ts": 2225/*!***********************************************************!*\ 2226 !*** ./packages/mdc-chips/deprecated/chip-set/adapter.ts ***! 2227 \***********************************************************/ 2228/*! no static exports found */ 2229/***/ (function(module, exports, __webpack_require__) { 2230 2231"use strict"; 2232 2233/** 2234 * @license 2235 * Copyright 2017 Google Inc. 2236 * 2237 * Permission is hereby granted, free of charge, to any person obtaining a copy 2238 * of this software and associated documentation files (the "Software"), to deal 2239 * in the Software without restriction, including without limitation the rights 2240 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2241 * copies of the Software, and to permit persons to whom the Software is 2242 * furnished to do so, subject to the following conditions: 2243 * 2244 * The above copyright notice and this permission notice shall be included in 2245 * all copies or substantial portions of the Software. 2246 * 2247 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2248 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2249 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2250 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2251 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2252 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2253 * THE SOFTWARE. 2254 */ 2255 2256Object.defineProperty(exports, "__esModule", { value: true }); 2257 2258/***/ }), 2259 2260/***/ "./packages/mdc-chips/deprecated/chip-set/component.ts": 2261/*!*************************************************************!*\ 2262 !*** ./packages/mdc-chips/deprecated/chip-set/component.ts ***! 2263 \*************************************************************/ 2264/*! no static exports found */ 2265/***/ (function(module, exports, __webpack_require__) { 2266 2267"use strict"; 2268 2269/** 2270 * @license 2271 * Copyright 2016 Google Inc. 2272 * 2273 * Permission is hereby granted, free of charge, to any person obtaining a copy 2274 * of this software and associated documentation files (the "Software"), to deal 2275 * in the Software without restriction, including without limitation the rights 2276 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2277 * copies of the Software, and to permit persons to whom the Software is 2278 * furnished to do so, subject to the following conditions: 2279 * 2280 * The above copyright notice and this permission notice shall be included in 2281 * all copies or substantial portions of the Software. 2282 * 2283 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2284 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2285 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2286 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2287 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2288 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2289 * THE SOFTWARE. 2290 */ 2291 2292var __extends = this && this.__extends || function () { 2293 var _extendStatics = function extendStatics(d, b) { 2294 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 2295 d.__proto__ = b; 2296 } || function (d, b) { 2297 for (var p in b) { 2298 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 2299 } 2300 }; 2301 return _extendStatics(d, b); 2302 }; 2303 return function (d, b) { 2304 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 2305 _extendStatics(d, b); 2306 function __() { 2307 this.constructor = d; 2308 } 2309 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2310 }; 2311}();
vendor: 6,810 bytes, lines 2312-2463
2312Object.defineProperty(exports, "__esModule", { value: true }); 2313exports.MDCChipSet = void 0; 2314var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 2315var announce_1 = __webpack_require__(/*! @material/dom/announce */ "./packages/mdc-dom/announce.ts"); 2316var component_2 = __webpack_require__(/*! ../chip/component */ "./packages/mdc-chips/deprecated/chip/component.ts"); 2317var foundation_1 = __webpack_require__(/*! ../chip/foundation */ "./packages/mdc-chips/deprecated/chip/foundation.ts"); 2318var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/deprecated/chip-set/foundation.ts"); 2319var _a = foundation_1.MDCChipFoundation.strings, 2320 INTERACTION_EVENT = _a.INTERACTION_EVENT, 2321 SELECTION_EVENT = _a.SELECTION_EVENT, 2322 REMOVAL_EVENT = _a.REMOVAL_EVENT, 2323 NAVIGATION_EVENT = _a.NAVIGATION_EVENT; 2324var CHIP_SELECTOR = foundation_2.MDCChipSetFoundation.strings.CHIP_SELECTOR; 2325var idCounter = 0; 2326var MDCChipSet = /** @class */function (_super) { 2327 __extends(MDCChipSet, _super); 2328 function MDCChipSet() { 2329 return _super !== null && _super.apply(this, arguments) || this; 2330 } 2331 MDCChipSet.attachTo = function (root) { 2332 return new MDCChipSet(root); 2333 }; 2334 Object.defineProperty(MDCChipSet.prototype, "chips", { 2335 get: function get() { 2336 return this.chips_.slice(); 2337 }, 2338 enumerable: false, 2339 configurable: true 2340 }); 2341 Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", { 2342 /** 2343 * @return An array of the IDs of all selected chips. 2344 */ 2345 get: function get() { 2346 return this.foundation.getSelectedChipIds(); 2347 }, 2348 enumerable: false, 2349 configurable: true 2350 }); 2351 /** 2352 * @param chipFactory A function which creates a new MDCChip. 2353 */ 2354 MDCChipSet.prototype.initialize = function (chipFactory) { 2355 if (chipFactory === void 0) { 2356 chipFactory = function chipFactory(el) { 2357 return new component_2.MDCChip(el); 2358 }; 2359 } 2360 this.chipFactory_ = chipFactory; 2361 this.chips_ = this.instantiateChips_(this.chipFactory_); 2362 }; 2363 MDCChipSet.prototype.initialSyncWithDOM = function () { 2364 var _this = this; 2365 this.chips_.forEach(function (chip) { 2366 if (chip.id && chip.selected) { 2367 _this.foundation.select(chip.id); 2368 } 2369 }); 2370 this.handleChipInteraction_ = function (evt) { 2371 return _this.foundation.handleChipInteraction(evt.detail); 2372 }; 2373 this.handleChipSelection_ = function (evt) { 2374 return _this.foundation.handleChipSelection(evt.detail); 2375 }; 2376 this.handleChipRemoval_ = function (evt) { 2377 return _this.foundation.handleChipRemoval(evt.detail); 2378 }; 2379 this.handleChipNavigation_ = function (evt) { 2380 return _this.foundation.handleChipNavigation(evt.detail); 2381 }; 2382 this.listen(INTERACTION_EVENT, this.handleChipInteraction_); 2383 this.listen(SELECTION_EVENT, this.handleChipSelection_); 2384 this.listen(REMOVAL_EVENT, this.handleChipRemoval_); 2385 this.listen(NAVIGATION_EVENT, this.handleChipNavigation_); 2386 }; 2387 MDCChipSet.prototype.destroy = function () { 2388 this.chips_.forEach(function (chip) { 2389 chip.destroy(); 2390 }); 2391 this.unlisten(INTERACTION_EVENT, this.handleChipInteraction_); 2392 this.unlisten(SELECTION_EVENT, this.handleChipSelection_); 2393 this.unlisten(REMOVAL_EVENT, this.handleChipRemoval_); 2394 this.unlisten(NAVIGATION_EVENT, this.handleChipNavigation_); 2395 _super.prototype.destroy.call(this); 2396 }; 2397 /** 2398 * Adds a new chip object to the chip set from the given chip element. 2399 */ 2400 MDCChipSet.prototype.addChip = function (chipEl) { 2401 chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter; 2402 this.chips_.push(this.chipFactory_(chipEl)); 2403 }; 2404 MDCChipSet.prototype.getDefaultFoundation = function () { 2405 var _this = this; 2406 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 2407 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 2408 var adapter = { 2409 announceMessage: function announceMessage(message) { 2410 announce_1.announce(message); 2411 }, 2412 focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex(index) { 2413 _this.chips_[index].focusPrimaryAction(); 2414 }, 2415 focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex(index) { 2416 _this.chips_[index].focusTrailingAction(); 2417 }, 2418 getChipListCount: function getChipListCount() { 2419 return _this.chips_.length; 2420 }, 2421 getIndexOfChipById: function getIndexOfChipById(chipId) { 2422 return _this.findChipIndex_(chipId); 2423 }, 2424 hasClass: function hasClass(className) { 2425 return _this.root.classList.contains(className); 2426 }, 2427 isRTL: function isRTL() { 2428 return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; 2429 }, 2430 removeChipAtIndex: function removeChipAtIndex(index) { 2431 if (index >= 0 && index < _this.chips_.length) { 2432 _this.chips_[index].destroy(); 2433 _this.chips_[index].remove(); 2434 _this.chips_.splice(index, 1); 2435 } 2436 }, 2437 removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex(index) { 2438 _this.chips_[index].removeFocus(); 2439 }, 2440 selectChipAtIndex: function selectChipAtIndex(index, selected, shouldNotifyClients) { 2441 if (index >= 0 && index < _this.chips_.length) { 2442 _this.chips_[index].setSelectedFromChipSet(selected, shouldNotifyClients); 2443 } 2444 } 2445 }; 2446 return new foundation_2.MDCChipSetFoundation(adapter); 2447 }; 2448 /** 2449 * Instantiates chip components on all of the chip set's child chip elements. 2450 */ 2451 MDCChipSet.prototype.instantiateChips_ = function (chipFactory) { 2452 var chipElements = [].slice.call(this.root.querySelectorAll(CHIP_SELECTOR)); 2453 return chipElements.map(function (el) { 2454 el.id = el.id || "mdc-chip-" + ++idCounter; 2455 return chipFactory(el); 2456 }); 2457 }; 2458 /** 2459 * Returns the index of the chip with the given id, or -1 if the chip does not exist. 2460 */ 2461 MDCChipSet.prototype.findChipIndex_ = function (chipId) { 2462 for (var i = 0; i < this.chips_.length; i++) { 2463 if (this.chips_
vendor: 5,550 bytes, lines 2463-2595
2463[i].id === chipId) { 2464 return i; 2465 } 2466 } 2467 return -1; 2468 }; 2469 return MDCChipSet; 2470}(component_1.MDCComponent); 2471exports.MDCChipSet = MDCChipSet; 2472 2473/***/ }), 2474 2475/***/ "./packages/mdc-chips/deprecated/chip-set/constants.ts": 2476/*!*************************************************************!*\ 2477 !*** ./packages/mdc-chips/deprecated/chip-set/constants.ts ***! 2478 \*************************************************************/ 2479/*! no static exports found */ 2480/***/ (function(module, exports, __webpack_require__) { 2481 2482"use strict"; 2483 2484/** 2485 * @license 2486 * Copyright 2016 Google Inc. 2487 * 2488 * Permission is hereby granted, free of charge, to any person obtaining a copy 2489 * of this software and associated documentation files (the "Software"), to deal 2490 * in the Software without restriction, including without limitation the rights 2491 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2492 * copies of the Software, and to permit persons to whom the Software is 2493 * furnished to do so, subject to the following conditions: 2494 * 2495 * The above copyright notice and this permission notice shall be included in 2496 * all copies or substantial portions of the Software. 2497 * 2498 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2499 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2500 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2501 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2502 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2503 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2504 * THE SOFTWARE. 2505 */ 2506 2507Object.defineProperty(exports, "__esModule", { value: true }); 2508exports.cssClasses = exports.strings = void 0; 2509exports.strings = { 2510 CHIP_SELECTOR: '.mdc-chip' 2511}; 2512exports.cssClasses = { 2513 CHOICE: 'mdc-chip-set--choice', 2514 FILTER: 'mdc-chip-set--filter' 2515}; 2516 2517/***/ }), 2518 2519/***/ "./packages/mdc-chips/deprecated/chip-set/foundation.ts": 2520/*!**************************************************************!*\ 2521 !*** ./packages/mdc-chips/deprecated/chip-set/foundation.ts ***! 2522 \**************************************************************/ 2523/*! no static exports found */ 2524/***/ (function(module, exports, __webpack_require__) { 2525 2526"use strict"; 2527 2528/** 2529 * @license 2530 * Copyright 2017 Google Inc. 2531 * 2532 * Permission is hereby granted, free of charge, to any person obtaining a copy 2533 * of this software and associated documentation files (the "Software"), to deal 2534 * in the Software without restriction, including without limitation the rights 2535 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2536 * copies of the Software, and to permit persons to whom the Software is 2537 * furnished to do so, subject to the following conditions: 2538 * 2539 * The above copyright notice and this permission notice shall be included in 2540 * all copies or substantial portions of the Software. 2541 * 2542 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2543 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2544 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2545 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2546 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2547 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2548 * THE SOFTWARE. 2549 */ 2550 2551var __extends = this && this.__extends || function () { 2552 var _extendStatics = function extendStatics(d, b) { 2553 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 2554 d.__proto__ = b; 2555 } || function (d, b) { 2556 for (var p in b) { 2557 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 2558 } 2559 }; 2560 return _extendStatics(d, b); 2561 }; 2562 return function (d, b) { 2563 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 2564 _extendStatics(d, b); 2565 function __() { 2566 this.constructor = d; 2567 } 2568 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2569 }; 2570}(); 2571var __assign = this && this.__assign || function () { 2572 __assign = Object.assign || function (t) { 2573 for (var s, i = 1, n = arguments.length; i < n; i++) { 2574 s = arguments[i]; 2575 for (var p in s) { 2576 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 2577 } 2578 } 2579 return t; 2580 }; 2581 return __assign.apply(this, arguments); 2582}; 2583Object.defineProperty(exports, "__esModule", { value: true }); 2584exports.MDCChipSetFoundation = void 0; 2585var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 2586var constants_1 = __webpack_require__(/*! ../chip/constants */ "./packages/mdc-chips/deprecated/chip/constants.ts"); 2587var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/deprecated/chip-set/constants.ts"); 2588var MDCChipSetFoundation = /** @class */function (_super) { 2589 __extends(MDCChipSetFoundation, _super); 2590 function MDCChipSetFoundation(adapter) { 2591 var _this = _super.call(this, __assign(__assign({}, MDCChipSetFoundation.defaultAdapter), adapter)) || this; 2592 /** 2593 * The ids of the selected chips in the set. Only used for choice chip set or filter chip set. 2594 */ 2595 _this.selectedChipIds
2595_ = []; 2596 return _this; 2597 } 2598 Object.defineProperty(MDCChipSetFoundation, "strings", { 2599 get: function get() { 2600 return constants_2.strings; 2601 }, 2602 enumerable: false, 2603 configurable: true 2604 }); 2605 Object.defineProperty(MDCChipSetFoundation, "cssClasses", { 2606 get: function get() { 2607 return constants_2.cssClasses; 2608 }, 2609 enumerable: false, 2610 configurable: true 2611 }); 2612 Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", { 2613 get: function get() { 2614 return { 2615 announceMessage: function announceMessage() { 2616 return undefined; 2617 }, 2618 focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex() { 2619 return undefined; 2620 }, 2621 focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex() { 2622 return undefined; 2623 }, 2624 getChipListCount: function getChipListCount() { 2625 return -1; 2626 }, 2627 getIndexOfChipById: function getIndexOfChipById() { 2628 return -1; 2629 }, 2630 hasClass: function hasClass() { 2631 return false;
vendor: 8,154 bytes, lines 2632-2825
2632 }, 2633 isRTL: function isRTL() { 2634 return false; 2635 }, 2636 removeChipAtIndex: function removeChipAtIndex() { 2637 return undefined; 2638 }, 2639 removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex() { 2640 return undefined; 2641 }, 2642 selectChipAtIndex: function selectChipAtIndex() { 2643 return undefined; 2644 } 2645 }; 2646 }, 2647 enumerable: false, 2648 configurable: true 2649 }); 2650 /** 2651 * Returns an array of the IDs of all selected chips. 2652 */ 2653 MDCChipSetFoundation.prototype.getSelectedChipIds = function () { 2654 return this.selectedChipIds_.slice(); 2655 }; 2656 /** 2657 * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant. 2658 * Does not notify clients of the updated selection state. 2659 */ 2660 MDCChipSetFoundation.prototype.select = function (chipId) { 2661 this.select_(chipId, false); 2662 }; 2663 /** 2664 * Handles a chip interaction event 2665 */ 2666 MDCChipSetFoundation.prototype.handleChipInteraction = function (_a) { 2667 var chipId = _a.chipId; 2668 var index = this.adapter.getIndexOfChipById(chipId); 2669 this.removeFocusFromChipsExcept_(index); 2670 if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) || this.adapter.hasClass(constants_2.cssClasses.FILTER)) { 2671 this.toggleSelect_(chipId); 2672 } 2673 }; 2674 /** 2675 * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip. 2676 */ 2677 MDCChipSetFoundation.prototype.handleChipSelection = function (_a) { 2678 var chipId = _a.chipId, 2679 selected = _a.selected, 2680 shouldIgnore = _a.shouldIgnore; 2681 // Early exit if we should ignore the event 2682 if (shouldIgnore) { 2683 return; 2684 } 2685 var chipIsSelected = this.selectedChipIds_.indexOf(chipId) >= 0; 2686 if (selected && !chipIsSelected) { 2687 this.select(chipId); 2688 } else if (!selected && chipIsSelected) { 2689 this.deselect_(chipId); 2690 } 2691 }; 2692 /** 2693 * Handles the event when a chip is removed. 2694 */ 2695 MDCChipSetFoundation.prototype.handleChipRemoval = function (_a) { 2696 var chipId = _a.chipId, 2697 removedAnnouncement = _a.removedAnnouncement; 2698 if (removedAnnouncement) { 2699 this.adapter.announceMessage(removedAnnouncement); 2700 } 2701 var index = this.adapter.getIndexOfChipById(chipId); 2702 this.deselectAndNotifyClients_(chipId); 2703 this.adapter.removeChipAtIndex(index); 2704 var maxIndex = this.adapter.getChipListCount() - 1; 2705 if (maxIndex < 0) { 2706 return; 2707 } 2708 var nextIndex = Math.min(index, maxIndex); 2709 this.removeFocusFromChipsExcept_(nextIndex); 2710 // After removing a chip, we should focus the trailing action for the next chip. 2711 this.adapter.focusChipTrailingActionAtIndex(nextIndex); 2712 }; 2713 /** 2714 * Handles a chip navigation event. 2715 */ 2716 MDCChipSetFoundation.prototype.handleChipNavigation = function (_a) { 2717 var chipId = _a.chipId, 2718 key = _a.key, 2719 source = _a.source; 2720 var maxIndex = this.adapter.getChipListCount() - 1; 2721 var index = this.adapter.getIndexOfChipById(chipId); 2722 // Early exit if the index is out of range or the key is unusable 2723 if (index === -1 || !constants_1.navigationKeys.has(key)) { 2724 return; 2725 } 2726 var isRTL = this.adapter.isRTL(); 2727 var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; 2728 var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; 2729 var isDownKey = key === constants_1.strings.ARROW_DOWN_KEY || key === constants_1.strings.IE_ARROW_DOWN_KEY; 2730 var shouldIncrement = !isRTL && isRightKey || isRTL && isLeftKey || isDownKey; 2731 var isHome = key === constants_1.strings.HOME_KEY; 2732 var isEnd = key === constants_1.strings.END_KEY; 2733 if (shouldIncrement) { 2734 index++; 2735 } else if (isHome) { 2736 index = 0; 2737 } else if (isEnd) { 2738 index = maxIndex; 2739 } else { 2740 index--; 2741 } 2742 // Early exit if the index is out of bounds 2743 if (index < 0 || index > maxIndex) { 2744 return; 2745 } 2746 this.removeFocusFromChipsExcept_(index); 2747 this.focusChipAction_(index, key, source); 2748 }; 2749 MDCChipSetFoundation.prototype.focusChipAction_ = function (index, key, source) { 2750 var shouldJumpChips = constants_1.jumpChipKeys.has(key); 2751 if (shouldJumpChips && source === constants_1.EventSource.PRIMARY) { 2752 return this.adapter.focusChipPrimaryActionAtIndex(index); 2753 } 2754 if (shouldJumpChips && source === constants_1.EventSource.TRAILING) { 2755 return this.adapter.focusChipTrailingActionAtIndex(index); 2756 } 2757 var dir = this.getDirection_(key); 2758 if (dir === constants_1.Direction.LEFT) { 2759 return this.adapter.focusChipTrailingActionAtIndex(index); 2760 } 2761 if (dir === constants_1.Direction.RIGHT) { 2762 return this.adapter.focusChipPrimaryActionAtIndex(index); 2763 } 2764 }; 2765 MDCChipSetFoundation.prototype.getDirection_ = function (key) { 2766 var isRTL = this.adapter.isRTL(); 2767 var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; 2768 var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; 2769 if (!isRTL && isLeftKey || isRTL && isRightKey) { 2770 return constants_1.Direction.LEFT; 2771 } 2772 return constants_1.Direction.RIGHT; 2773 }; 2774 /** 2775 * Deselects the chip with the given id and optionally notifies clients. 2776 */ 2777 MDCChipSetFoundation.prototype.deselect_ = function (chipId, shouldNotifyClients) { 2778 if (shouldNotifyClients === void 0) { 2779 shouldNotifyClients = false; 2780 } 2781 var index = this.selectedChipIds_.indexOf(chipId); 2782 if (index >= 0) { 2783 this.selectedChipIds_.splice(index, 1); 2784 var chipIndex = this.adapter.getIndexOfChipById(chipId); 2785 this.adapter.selectChipAtIndex(chipIndex, /** isSelected */false, shouldNotifyClients); 2786 } 2787 }; 2788 /** 2789 * Deselects the chip with the given id and notifies clients. 2790 */ 2791 MDCChipSetFoundation.prototype.deselectAndNotifyClients_ = function (chipId) { 2792 this.deselect_(chipId, true); 2793 }; 2794 /** 2795 * Toggles selection of the chip with the given id. 2796 */ 2797 MDCChipSetFoundation.prototype.toggleSelect_ = function (chipId) { 2798 if (this.selectedChipIds_.indexOf(chipId) >= 0) { 2799 this.deselectAndNotifyClients_(chipId); 2800 } else { 2801 this.selectAndNotifyClients_(chipId); 2802 } 2803 }; 2804 MDCChipSetFoundation.prototype.removeFocusFromChipsExcept_ = function (index) { 2805 var chipCount = this.adapter.getChipListCount(); 2806 for (var i = 0; i < chipCount; i++) { 2807 if (i !== index) { 2808 this.adapter.removeFocusFromChipAtIndex(i); 2809 } 2810 } 2811 }; 2812 MDCChipSetFoundation.prototype.selectAndNotifyClients_ = function (chipId) { 2813 this.select_(chipId, true); 2814 }; 2815 MDCChipSetFoundation.prototype.select_ = function (chipId, shouldNotifyClients) { 2816 if (this.selectedChipIds_.indexOf(chipId) >= 0) { 2817 return; 2818 } 2819 if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) && this.selectedChipIds_.length > 0) { 2820 var previouslySelectedChip = this.selectedChipIds_[0]; 2821 var previouslySelectedIndex = this.adapter.getIndexOfChipById(previouslySelectedChip); 2822 this.selectedChipIds_ = []; 2823 this.adapter.selectChipAtIndex(previouslySelectedIndex, /** isSelected */false, shouldNotifyClients); 2824 } 2825 this.selectedChipIds_
vendor: 10,282 bytes, lines 2825-3056
2825.push(chipId); 2826 var index = this.adapter.getIndexOfChipById(chipId); 2827 this.adapter.selectChipAtIndex(index, /** isSelected */true, shouldNotifyClients); 2828 }; 2829 return MDCChipSetFoundation; 2830}(foundation_1.MDCFoundation); 2831exports.MDCChipSetFoundation = MDCChipSetFoundation; 2832// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 2833exports.default = MDCChipSetFoundation; 2834 2835/***/ }), 2836 2837/***/ "./packages/mdc-chips/deprecated/chip-set/index.ts": 2838/*!*********************************************************!*\ 2839 !*** ./packages/mdc-chips/deprecated/chip-set/index.ts ***! 2840 \*********************************************************/ 2841/*! no static exports found */ 2842/***/ (function(module, exports, __webpack_require__) { 2843 2844"use strict"; 2845 2846/** 2847 * @license 2848 * Copyright 2019 Google Inc. 2849 * 2850 * Permission is hereby granted, free of charge, to any person obtaining a copy 2851 * of this software and associated documentation files (the "Software"), to deal 2852 * in the Software without restriction, including without limitation the rights 2853 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2854 * copies of the Software, and to permit persons to whom the Software is 2855 * furnished to do so, subject to the following conditions: 2856 * 2857 * The above copyright notice and this permission notice shall be included in 2858 * all copies or substantial portions of the Software. 2859 * 2860 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2861 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2862 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2863 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2864 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2865 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2866 * THE SOFTWARE. 2867 */ 2868 2869var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 2870 if (k2 === undefined) k2 = k; 2871 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 2872 return m[k]; 2873 } }); 2874} : function (o, m, k, k2) { 2875 if (k2 === undefined) k2 = k; 2876 o[k2] = m[k]; 2877}); 2878var __exportStar = this && this.__exportStar || function (m, exports) { 2879 for (var p in m) { 2880 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 2881 } 2882}; 2883Object.defineProperty(exports, "__esModule", { value: true }); 2884exports.chipSetStrings = exports.chipSetCssClasses = void 0; 2885__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-chips/deprecated/chip-set/adapter.ts"), exports); 2886__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-chips/deprecated/chip-set/component.ts"), exports); 2887__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/deprecated/chip-set/foundation.ts"), exports); 2888var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/deprecated/chip-set/constants.ts"); 2889Object.defineProperty(exports, "chipSetCssClasses", { enumerable: true, get: function get() { 2890 return constants_1.cssClasses; 2891 } }); 2892Object.defineProperty(exports, "chipSetStrings", { enumerable: true, get: function get() { 2893 return constants_1.strings; 2894 } }); 2895 2896/***/ }), 2897 2898/***/ "./packages/mdc-chips/deprecated/chip/adapter.ts": 2899/*!*******************************************************!*\ 2900 !*** ./packages/mdc-chips/deprecated/chip/adapter.ts ***! 2901 \*******************************************************/ 2902/*! no static exports found */ 2903/***/ (function(module, exports, __webpack_require__) { 2904 2905"use strict"; 2906 2907/** 2908 * @license 2909 * Copyright 2017 Google Inc. 2910 * 2911 * Permission is hereby granted, free of charge, to any person obtaining a copy 2912 * of this software and associated documentation files (the "Software"), to deal 2913 * in the Software without restriction, including without limitation the rights 2914 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2915 * copies of the Software, and to permit persons to whom the Software is 2916 * furnished to do so, subject to the following conditions: 2917 * 2918 * The above copyright notice and this permission notice shall be included in 2919 * all copies or substantial portions of the Software. 2920 * 2921 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2922 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2923 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2924 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2925 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2926 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2927 * THE SOFTWARE. 2928 */ 2929 2930Object.defineProperty(exports, "__esModule", { value: true }); 2931 2932/***/ }), 2933 2934/***/ "./packages/mdc-chips/deprecated/chip/component.ts": 2935/*!*********************************************************!*\ 2936 !*** ./packages/mdc-chips/deprecated/chip/component.ts ***! 2937 \*********************************************************/ 2938/*! no static exports found */ 2939/***/ (function(module, exports, __webpack_require__) { 2940 2941"use strict"; 2942 2943/** 2944 * @license 2945 * Copyright 2016 Google Inc. 2946 * 2947 * Permission is hereby granted, free of charge, to any person obtaining a copy 2948 * of this software and associated documentation files (the "Software"), to deal 2949 * in the Software without restriction, including without limitation the rights 2950 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2951 * copies of the Software, and to permit persons to whom the Software is 2952 * furnished to do so, subject to the following conditions: 2953 * 2954 * The above copyright notice and this permission notice shall be included in 2955 * all copies or substantial portions of the Software. 2956 * 2957 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2958 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2959 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2960 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2961 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2962 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2963 * THE SOFTWARE. 2964 */ 2965 2966var __extends = this && this.__extends || function () { 2967 var _extendStatics = function extendStatics(d, b) { 2968 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 2969 d.__proto__ = b; 2970 } || function (d, b) { 2971 for (var p in b) { 2972 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 2973 } 2974 }; 2975 return _extendStatics(d, b); 2976 }; 2977 return function (d, b) { 2978 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 2979 _extendStatics(d, b); 2980 function __() { 2981 this.constructor = d; 2982 } 2983 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2984 }; 2985}(); 2986var __assign = this && this.__assign || function () { 2987 __assign = Object.assign || function (t) { 2988 for (var s, i = 1, n = arguments.length; i < n; i++) { 2989 s = arguments[i]; 2990 for (var p in s) { 2991 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 2992 } 2993 } 2994 return t; 2995 }; 2996 return __assign.apply(this, arguments); 2997}; 2998Object.defineProperty(exports, "__esModule", { value: true }); 2999exports.MDCChip = void 0; 3000var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 3001var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 3002var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 3003var component_3 = __webpack_require__(/*! ../trailingaction/component */ "./packages/mdc-chips/deprecated/trailingaction/component.ts"); 3004var constants_1 = __webpack_require__(/*! ../trailingaction/constants */ "./packages/mdc-chips/deprecated/trailingaction/constants.ts"); 3005var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/deprecated/chip/constants.ts"); 3006var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/deprecated/chip/foundation.ts"); 3007var MDCChip = /** @class */function (_super) { 3008 __extends(MDCChip, _super); 3009 function MDCChip() { 3010 return _super !== null && _super.apply(this, arguments) || this; 3011 } 3012 Object.defineProperty(MDCChip.prototype, "selected", { 3013 /** 3014 * @return Whether the chip is selected. 3015 */ 3016 get: function get() { 3017 return this.foundation.isSelected(); 3018 }, 3019 /** 3020 * Sets selected state on the chip. 3021 */ 3022 set: function set(selected) { 3023 this.foundation.setSelected(selected); 3024 }, 3025 enumerable: false, 3026 configurable: true 3027 }); 3028 Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", { 3029 /** 3030 * @return Whether a trailing icon click should trigger exit/removal of the chip. 3031 */ 3032 get: function get() { 3033 return this.foundation.getShouldRemoveOnTrailingIconClick(); 3034 }, 3035 /** 3036 * Sets whether a trailing icon click should trigger exit/removal of the chip. 3037 */ 3038 set: function set(shouldRemove) { 3039 this.foundation.setShouldRemoveOnTrailingIconClick(shouldRemove); 3040 }, 3041 enumerable: false, 3042 configurable: true 3043 }); 3044 Object.defineProperty(MDCChip.prototype, "setShouldFocusPrimaryActionOnClick", { 3045 /** 3046 * Sets whether a clicking on the chip should focus the primary action. 3047 */ 3048 set: function set(shouldFocus) { 3049 this.foundation.setShouldFocusPrimaryActionOnClick(shouldFocus); 3050 }, 3051 enumerable: false, 3052 configurable: true 3053 }); 3054 Object.defineProperty(MDCChip.prototype, "ripple", { 3055 get: function get() { 3056 return this.ripple
vendor: 8,853 bytes, lines 3056-3236
3056_; 3057 }, 3058 enumerable: false, 3059 configurable: true 3060 }); 3061 Object.defineProperty(MDCChip.prototype, "id", { 3062 get: function get() { 3063 return this.root.id; 3064 }, 3065 enumerable: false, 3066 configurable: true 3067 }); 3068 MDCChip.attachTo = function (root) { 3069 return new MDCChip(root); 3070 }; 3071 MDCChip.prototype.initialize = function (rippleFactory, trailingActionFactory) { 3072 var _this = this; 3073 if (rippleFactory === void 0) { 3074 rippleFactory = function rippleFactory(el, foundation) { 3075 return new component_2.MDCRipple(el, foundation); 3076 }; 3077 } 3078 if (trailingActionFactory === void 0) { 3079 trailingActionFactory = function trailingActionFactory(el) { 3080 return new component_3.MDCChipTrailingAction(el); 3081 }; 3082 } 3083 this.leadingIcon_ = this.root.querySelector(constants_2.strings.LEADING_ICON_SELECTOR); 3084 this.checkmark_ = this.root.querySelector(constants_2.strings.CHECKMARK_SELECTOR); 3085 this.primaryAction_ = this.root.querySelector(constants_2.strings.PRIMARY_ACTION_SELECTOR); 3086 var trailingActionEl = this.root.querySelector(constants_2.strings.TRAILING_ACTION_SELECTOR); 3087 if (trailingActionEl) { 3088 this.trailingAction_ = trailingActionFactory(trailingActionEl); 3089 } 3090 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 3091 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 3092 var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() { 3093 return _this.foundation.getDimensions(); 3094 } }); 3095 this.ripple_ = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter)); 3096 }; 3097 MDCChip.prototype.initialSyncWithDOM = function () { 3098 var _this = this; 3099 // Custom events 3100 this.handleTrailingActionInteraction_ = function () { 3101 _this.foundation.handleTrailingActionInteraction(); 3102 }; 3103 this.handleTrailingActionNavigation_ = function (evt) { 3104 _this.foundation.handleTrailingActionNavigation(evt); 3105 }; 3106 // Native events 3107 this.handleClick_ = function () { 3108 _this.foundation.handleClick(); 3109 }; 3110 this.handleKeydown_ = function (evt) { 3111 _this.foundation.handleKeydown(evt); 3112 }; 3113 this.handleTransitionEnd_ = function (evt) { 3114 _this.foundation.handleTransitionEnd(evt); 3115 }; 3116 this.handleFocusIn_ = function (evt) { 3117 _this.foundation.handleFocusIn(evt); 3118 }; 3119 this.handleFocusOut_ = function (evt) { 3120 _this.foundation.handleFocusOut(evt); 3121 }; 3122 this.listen('transitionend', this.handleTransitionEnd_); 3123 this.listen('click', this.handleClick_); 3124 this.listen('keydown', this.handleKeydown_); 3125 this.listen('focusin', this.handleFocusIn_); 3126 this.listen('focusout', this.handleFocusOut_); 3127 if (this.trailingAction_) { 3128 this.listen(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction_); 3129 this.listen(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation_); 3130 } 3131 }; 3132 MDCChip.prototype.destroy = function () { 3133 this.ripple_.destroy(); 3134 this.unlisten('transitionend', this.handleTransitionEnd_); 3135 this.unlisten('keydown', this.handleKeydown_); 3136 this.unlisten('click', this.handleClick_); 3137 this.unlisten('focusin', this.handleFocusIn_); 3138 this.unlisten('focusout', this.handleFocusOut_); 3139 if (this.trailingAction_) { 3140 this.unlisten(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction_); 3141 this.unlisten(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation_); 3142 } 3143 _super.prototype.destroy.call(this); 3144 }; 3145 /** 3146 * Begins the exit animation which leads to removal of the chip. 3147 */ 3148 MDCChip.prototype.beginExit = function () { 3149 this.foundation.beginExit(); 3150 }; 3151 MDCChip.prototype.getDefaultFoundation = function () { 3152 var _this = this; 3153 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 3154 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 3155 var adapter = { 3156 addClass: function addClass(className) { 3157 return _this.root.classList.add(className); 3158 }, 3159 addClassToLeadingIcon: function addClassToLeadingIcon(className) { 3160 if (_this.leadingIcon_) { 3161 _this.leadingIcon_.classList.add(className); 3162 } 3163 }, 3164 eventTargetHasClass: function eventTargetHasClass(target, className) { 3165 return target ? target.classList.contains(className) : false; 3166 }, 3167 focusPrimaryAction: function focusPrimaryAction() { 3168 if (_this.primaryAction_) { 3169 _this.primaryAction_.focus(); 3170 } 3171 }, 3172 focusTrailingAction: function focusTrailingAction() { 3173 if (_this.trailingAction_) { 3174 _this.trailingAction_.focus(); 3175 } 3176 }, 3177 getAttribute: function getAttribute(attr) { 3178 return _this.root.getAttribute(attr); 3179 }, 3180 getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() { 3181 return _this.checkmark_ ? _this.checkmark_.getBoundingClientRect() : null; 3182 }, 3183 getComputedStyleValue: function getComputedStyleValue(propertyName) { 3184 return window.getComputedStyle(_this.root).getPropertyValue(propertyName); 3185 }, 3186 getRootBoundingClientRect: function getRootBoundingClientRect() { 3187 return _this.root.getBoundingClientRect(); 3188 }, 3189 hasClass: function hasClass(className) { 3190 return _this.root.classList.contains(className); 3191 }, 3192 hasLeadingIcon: function hasLeadingIcon() { 3193 return !!_this.leadingIcon_; 3194 }, 3195 isRTL: function isRTL() { 3196 return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; 3197 }, 3198 isTrailingActionNavigable: function isTrailingActionNavigable() { 3199 if (_this.trailingAction_) { 3200 return _this.trailingAction_.isNavigable(); 3201 } 3202 return false; 3203 }, 3204 notifyInteraction: function notifyInteraction() { 3205 return _this.emit(constants_2.strings.INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */); 3206 }, 3207 notifyNavigation: function notifyNavigation(key, source) { 3208 return _this.emit(constants_2.strings.NAVIGATION_EVENT, { chipId: _this.id, key: key, source: source }, true /* shouldBubble */); 3209 }, 3210 notifyRemoval: function notifyRemoval(removedAnnouncement) { 3211 _this.emit(constants_2.strings.REMOVAL_EVENT, { chipId: _this.id, removedAnnouncement: removedAnnouncement }, true /* shouldBubble */); 3212 }, 3213 notifySelection: function notifySelection(selected, shouldIgnore) { 3214 return _this.emit(constants_2.strings.SELECTION_EVENT, { chipId: _this.id, selected: selected, shouldIgnore: shouldIgnore }, true /* shouldBubble */); 3215 }, 3216 notifyTrailingIconInteraction: function notifyTrailingIconInteraction() { 3217 return _this.emit(constants_2.strings.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */); 3218 }, 3219 notifyEditStart: function notifyEditStart() {}, 3220 notifyEditFinish: function notifyEditFinish() {}, 3221 removeClass: function removeClass(className) { 3222 return _this.root.classList.remove(className); 3223 }, 3224 removeClassFromLeadingIcon: function removeClassFromLeadingIcon(className) { 3225 if (_this.leadingIcon_) { 3226 _this.leadingIcon_.classList.remove(className); 3227 } 3228 }, 3229 removeTrailingActionFocus: function removeTrailingActionFocus() { 3230 if (_this.trailingAction_) { 3231 _this.trailingAction_.removeFocus(); 3232 } 3233 }, 3234 setPrimaryActionAttr: function setPrimaryActionAttr(attr, value) { 3235 if (_this.primaryAction_) { 3236 _this.primaryAction_
vendor: 9,900 bytes, lines 3236-3470
3236.setAttribute(attr, value); 3237 } 3238 }, 3239 setStyleProperty: function setStyleProperty(propertyName, value) { 3240 return _this.root.style.setProperty(propertyName, value); 3241 } 3242 }; 3243 return new foundation_2.MDCChipFoundation(adapter); 3244 }; 3245 MDCChip.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) { 3246 this.foundation.setSelectedFromChipSet(selected, shouldNotifyClients); 3247 }; 3248 MDCChip.prototype.focusPrimaryAction = function () { 3249 this.foundation.focusPrimaryAction(); 3250 }; 3251 MDCChip.prototype.focusTrailingAction = function () { 3252 this.foundation.focusTrailingAction(); 3253 }; 3254 MDCChip.prototype.removeFocus = function () { 3255 this.foundation.removeFocus(); 3256 }; 3257 MDCChip.prototype.remove = function () { 3258 var parent = this.root.parentNode; 3259 if (parent !== null) { 3260 parent.removeChild(this.root); 3261 } 3262 }; 3263 return MDCChip; 3264}(component_1.MDCComponent); 3265exports.MDCChip = MDCChip; 3266 3267/***/ }), 3268 3269/***/ "./packages/mdc-chips/deprecated/chip/constants.ts": 3270/*!*********************************************************!*\ 3271 !*** ./packages/mdc-chips/deprecated/chip/constants.ts ***! 3272 \*********************************************************/ 3273/*! no static exports found */ 3274/***/ (function(module, exports, __webpack_require__) { 3275 3276"use strict"; 3277 3278/** 3279 * @license 3280 * Copyright 2016 Google Inc. 3281 * 3282 * Permission is hereby granted, free of charge, to any person obtaining a copy 3283 * of this software and associated documentation files (the "Software"), to deal 3284 * in the Software without restriction, including without limitation the rights 3285 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3286 * copies of the Software, and to permit persons to whom the Software is 3287 * furnished to do so, subject to the following conditions: 3288 * 3289 * The above copyright notice and this permission notice shall be included in 3290 * all copies or substantial portions of the Software. 3291 * 3292 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3293 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3294 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3295 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3296 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3297 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3298 * THE SOFTWARE. 3299 */ 3300 3301Object.defineProperty(exports, "__esModule", { value: true }); 3302exports.jumpChipKeys = exports.navigationKeys = exports.cssClasses = exports.strings = exports.EventSource = exports.Direction = void 0; 3303var Direction; 3304(function (Direction) { 3305 Direction["LEFT"] = "left"; 3306 Direction["RIGHT"] = "right"; 3307})(Direction = exports.Direction || (exports.Direction = {})); 3308var EventSource; 3309(function (EventSource) { 3310 EventSource["PRIMARY"] = "primary"; 3311 EventSource["TRAILING"] = "trailing"; 3312 EventSource["NONE"] = "none"; 3313})(EventSource = exports.EventSource || (exports.EventSource = {})); 3314exports.strings = { 3315 ADDED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-added-announcement', 3316 ARIA_CHECKED: 'aria-checked', 3317 ARROW_DOWN_KEY: 'ArrowDown', 3318 ARROW_LEFT_KEY: 'ArrowLeft', 3319 ARROW_RIGHT_KEY: 'ArrowRight', 3320 ARROW_UP_KEY: 'ArrowUp', 3321 BACKSPACE_KEY: 'Backspace', 3322 CHECKMARK_SELECTOR: '.mdc-chip__checkmark', 3323 DELETE_KEY: 'Delete', 3324 END_KEY: 'End', 3325 ENTER_KEY: 'Enter', 3326 ENTRY_ANIMATION_NAME: 'mdc-chip-entry', 3327 HOME_KEY: 'Home', 3328 IE_ARROW_DOWN_KEY: 'Down', 3329 IE_ARROW_LEFT_KEY: 'Left', 3330 IE_ARROW_RIGHT_KEY: 'Right', 3331 IE_ARROW_UP_KEY: 'Up', 3332 IE_DELETE_KEY: 'Del', 3333 INTERACTION_EVENT: 'MDCChip:interaction', 3334 LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading', 3335 NAVIGATION_EVENT: 'MDCChip:navigation', 3336 PRIMARY_ACTION_SELECTOR: '.mdc-chip__primary-action', 3337 REMOVED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-removed-announcement', 3338 REMOVAL_EVENT: 'MDCChip:removal', 3339 SELECTION_EVENT: 'MDCChip:selection', 3340 SPACEBAR_KEY: ' ', 3341 TAB_INDEX: 'tabindex', 3342 TRAILING_ACTION_SELECTOR: '.mdc-chip-trailing-action', 3343 TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction', 3344 TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing' 3345}; 3346exports.cssClasses = { 3347 CHECKMARK: 'mdc-chip__checkmark', 3348 CHIP_EXIT: 'mdc-chip--exit', 3349 DELETABLE: 'mdc-chip--deletable', 3350 EDITABLE: 'mdc-chip--editable', 3351 EDITING: 'mdc-chip--editing', 3352 HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden', 3353 LEADING_ICON: 'mdc-chip__icon--leading', 3354 PRIMARY_ACTION: 'mdc-chip__primary-action', 3355 PRIMARY_ACTION_FOCUSED: 'mdc-chip--primary-action-focused', 3356 SELECTED: 'mdc-chip--selected', 3357 TEXT: 'mdc-chip__text', 3358 TRAILING_ACTION: 'mdc-chip__trailing-action', 3359 TRAILING_ICON: 'mdc-chip__icon--trailing' 3360}; 3361exports.navigationKeys = new Set(); 3362// IE11 has no support for new Set with iterable so we need to initialize this by hand 3363exports.navigationKeys.add(exports.strings.ARROW_LEFT_KEY); 3364exports.navigationKeys.add(exports.strings.ARROW_RIGHT_KEY); 3365exports.navigationKeys.add(exports.strings.ARROW_DOWN_KEY); 3366exports.navigationKeys.add(exports.strings.ARROW_UP_KEY); 3367exports.navigationKeys.add(exports.strings.END_KEY); 3368exports.navigationKeys.add(exports.strings.HOME_KEY); 3369exports.navigationKeys.add(exports.strings.IE_ARROW_LEFT_KEY); 3370exports.navigationKeys.add(exports.strings.IE_ARROW_RIGHT_KEY); 3371exports.navigationKeys.add(exports.strings.IE_ARROW_DOWN_KEY); 3372exports.navigationKeys.add(exports.strings.IE_ARROW_UP_KEY); 3373exports.jumpChipKeys = new Set(); 3374// IE11 has no support for new Set with iterable so we need to initialize this by hand 3375exports.jumpChipKeys.add(exports.strings.ARROW_UP_KEY); 3376exports.jumpChipKeys.add(exports.strings.ARROW_DOWN_KEY); 3377exports.jumpChipKeys.add(exports.strings.HOME_KEY); 3378exports.jumpChipKeys.add(exports.strings.END_KEY); 3379exports.jumpChipKeys.add(exports.strings.IE_ARROW_UP_KEY); 3380exports.jumpChipKeys.add(exports.strings.IE_ARROW_DOWN_KEY); 3381 3382/***/ }), 3383 3384/***/ "./packages/mdc-chips/deprecated/chip/foundation.ts": 3385/*!**********************************************************!*\ 3386 !*** ./packages/mdc-chips/deprecated/chip/foundation.ts ***! 3387 \**********************************************************/ 3388/*! no static exports found */ 3389/***/ (function(module, exports, __webpack_require__) { 3390 3391"use strict"; 3392 3393/** 3394 * @license 3395 * Copyright 2016 Google Inc. 3396 * 3397 * Permission is hereby granted, free of charge, to any person obtaining a copy 3398 * of this software and associated documentation files (the "Software"), to deal 3399 * in the Software without restriction, including without limitation the rights 3400 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3401 * copies of the Software, and to permit persons to whom the Software is 3402 * furnished to do so, subject to the following conditions: 3403 * 3404 * The above copyright notice and this permission notice shall be included in 3405 * all copies or substantial portions of the Software. 3406 * 3407 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3408 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3409 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3410 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3411 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3412 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3413 * THE SOFTWARE. 3414 */ 3415 3416var __extends = this && this.__extends || function () { 3417 var _extendStatics = function extendStatics(d, b) { 3418 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 3419 d.__proto__ = b; 3420 } || function (d, b) { 3421 for (var p in b) { 3422 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 3423 } 3424 }; 3425 return _extendStatics(d, b); 3426 }; 3427 return function (d, b) { 3428 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 3429 _extendStatics(d, b); 3430 function __() { 3431 this.constructor = d; 3432 } 3433 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 3434 }; 3435}(); 3436var __assign = this && this.__assign || function () { 3437 __assign = Object.assign || function (t) { 3438 for (var s, i = 1, n = arguments.length; i < n; i++) { 3439 s = arguments[i]; 3440 for (var p in s) { 3441 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 3442 } 3443 } 3444 return t; 3445 }; 3446 return __assign.apply(this, arguments); 3447}; 3448Object.defineProperty(exports, "__esModule", { value: true }); 3449exports.MDCChipFoundation = void 0; 3450var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 3451var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/deprecated/chip/constants.ts"); 3452var emptyClientRect = { 3453 bottom: 0, 3454 height: 0, 3455 left: 0, 3456 right: 0, 3457 top: 0, 3458 width: 0 3459}; 3460var FocusBehavior; 3461(function (FocusBehavior) { 3462 FocusBehavior[FocusBehavior["SHOULD_FOCUS"] = 0] = "SHOULD_FOCUS"; 3463 FocusBehavior[FocusBehavior["SHOULD_NOT_FOCUS"] = 1] = "SHOULD_NOT_FOCUS"; 3464})(FocusBehavior || (FocusBehavior = {})); 3465var MDCChipFoundation = /** @class */function (_super) { 3466 __extends(MDCChipFoundation, _super); 3467 function MDCChipFoundation(adapter) { 3468 var _this = _super.call(this, __assign(__assign({}, MDCChipFoundation.defaultAdapter), adapter)) || this; 3469 /** Whether a trailing icon click should immediately trigger exit/removal of the chip. */ 3470 _this.shouldRemoveOnTrailingIconClick
3470_ = true; 3471 /** 3472 * Whether the primary action should receive focus on click. Should only be 3473 * set to true for clients who programmatically give focus to a different 3474 * element on the page when a chip is clicked (like a menu). 3475 */ 3476 _this.shouldFocusPrimaryActionOnClick_
vendor: 4,242 bytes, lines 3476-3586
3476 = true; 3477 return _this; 3478 } 3479 Object.defineProperty(MDCChipFoundation, "strings", { 3480 get: function get() { 3481 return constants_1.strings; 3482 }, 3483 enumerable: false, 3484 configurable: true 3485 }); 3486 Object.defineProperty(MDCChipFoundation, "cssClasses", { 3487 get: function get() { 3488 return constants_1.cssClasses; 3489 }, 3490 enumerable: false, 3491 configurable: true 3492 }); 3493 Object.defineProperty(MDCChipFoundation, "defaultAdapter", { 3494 get: function get() { 3495 return { 3496 addClass: function addClass() { 3497 return undefined; 3498 }, 3499 addClassToLeadingIcon: function addClassToLeadingIcon() { 3500 return undefined; 3501 }, 3502 eventTargetHasClass: function eventTargetHasClass() { 3503 return false; 3504 }, 3505 focusPrimaryAction: function focusPrimaryAction() { 3506 return undefined; 3507 }, 3508 focusTrailingAction: function focusTrailingAction() { 3509 return undefined; 3510 }, 3511 getAttribute: function getAttribute() { 3512 return null; 3513 }, 3514 getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() { 3515 return emptyClientRect; 3516 }, 3517 getComputedStyleValue: function getComputedStyleValue() { 3518 return ''; 3519 }, 3520 getRootBoundingClientRect: function getRootBoundingClientRect() { 3521 return emptyClientRect; 3522 }, 3523 hasClass: function hasClass() { 3524 return false; 3525 }, 3526 hasLeadingIcon: function hasLeadingIcon() { 3527 return false; 3528 }, 3529 isRTL: function isRTL() { 3530 return false; 3531 }, 3532 isTrailingActionNavigable: function isTrailingActionNavigable() { 3533 return false; 3534 }, 3535 notifyEditFinish: function notifyEditFinish() { 3536 return undefined; 3537 }, 3538 notifyEditStart: function notifyEditStart() { 3539 return undefined; 3540 }, 3541 notifyInteraction: function notifyInteraction() { 3542 return undefined; 3543 }, 3544 notifyNavigation: function notifyNavigation() { 3545 return undefined; 3546 }, 3547 notifyRemoval: function notifyRemoval() { 3548 return undefined; 3549 }, 3550 notifySelection: function notifySelection() { 3551 return undefined; 3552 }, 3553 notifyTrailingIconInteraction: function notifyTrailingIconInteraction() { 3554 return undefined; 3555 }, 3556 removeClass: function removeClass() { 3557 return undefined; 3558 }, 3559 removeClassFromLeadingIcon: function removeClassFromLeadingIcon() { 3560 return undefined; 3561 }, 3562 removeTrailingActionFocus: function removeTrailingActionFocus() { 3563 return undefined; 3564 }, 3565 setPrimaryActionAttr: function setPrimaryActionAttr() { 3566 return undefined; 3567 }, 3568 setStyleProperty: function setStyleProperty() { 3569 return undefined; 3570 } 3571 }; 3572 }, 3573 enumerable: false, 3574 configurable: true 3575 }); 3576 MDCChipFoundation.prototype.isSelected = function () { 3577 return this.adapter.hasClass(constants_1.cssClasses.SELECTED); 3578 }; 3579 MDCChipFoundation.prototype.isEditable = function () { 3580 return this.adapter.hasClass(constants_1.cssClasses.EDITABLE); 3581 }; 3582 MDCChipFoundation.prototype.isEditing = function () { 3583 return this.adapter.hasClass(constants_1.cssClasses.EDITING); 3584 }; 3585 MDCChipFoundation.prototype.setSelected = function (selected) { 3586 this.setSelected
3586_(selected); 3587 this.notifySelection_(selected); 3588 }; 3589 MDCChipFoundation.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) { 3590 this.setSelected_(selected); 3591 if (shouldNotifyClients) { 3592 this.notifyIgnoredSelection_(selected); 3593 } 3594 }; 3595 MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () { 3596 return this.shouldRemoveOnTrailingIconClick_; 3597 }; 3598 MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) { 3599 this.shouldRemoveOnTrailingIconClick_ = shouldRemove; 3600 }; 3601 MDCChipFoundation.prototype.setShouldFocusPrimaryActionOnClick = function (shouldFocus) { 3602 this.shouldFocusPrimaryActionOnClick_ = shouldFocus; 3603 }; 3604 MDCChipFoundation.prototype.getDimensions = function () { 3605 var _this = this; 3606 var getRootRect = function getRootRect() { 3607 return _this.adapter.getRootBoundingClientRect(); 3608 }; 3609 var getCheckmarkRect = function getCheckmarkRect() { 3610 return _this.adapter.getCheckmarkBoundingClientRect(); 3611 }; 3612 // When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current 3613 // size of the checkmark. 3614 if (!this.adapter.hasLeadingIcon()) { 3615 var checkmarkRect = getCheckmarkRect(); 3616 if (checkmarkRect) { 3617 var rootRect = getRootRect(); 3618 // Checkmark is a square, meaning the client rect's width and height are identical once the animation completes. 3619 // However, the checkbox is initially hidden by setting the width to 0. 3620 // To account for an initial width of 0, we use the checkbox's height instead (which equals the end-state width) 3621 // when adding it to the root client rect's width. 3622 return { 3623 bottom: rootRect.bottom, 3624 height: rootRect.height, 3625 left: rootRect.left, 3626 right: rootRect.right, 3627 top: rootRect.top, 3628 width: rootRect.width + checkmarkRect.height 3629 }; 3630 } 3631 } 3632 return getRootRect(); 3633 }; 3634 /** 3635 * Begins the exit animation which leads to removal of the chip. 3636 */ 3637 MDCChipFoundation.prototype.beginExit = function () {
vendor: 9,257 bytes, lines 3638-3839
3638 this.adapter.addClass(constants_1.cssClasses.CHIP_EXIT); 3639 }; 3640 MDCChipFoundation.prototype.handleClick = function () { 3641 this.adapter.notifyInteraction(); 3642 this.setPrimaryActionFocusable_(this.getFocusBehavior_()); 3643 }; 3644 MDCChipFoundation.prototype.handleDoubleClick = function () { 3645 if (this.isEditable()) { 3646 this.startEditing(); 3647 } 3648 }; 3649 /** 3650 * Handles a transition end event on the root element. 3651 */ 3652 MDCChipFoundation.prototype.handleTransitionEnd = function (evt) { 3653 var _this = this; 3654 // Handle transition end event on the chip when it is about to be removed. 3655 var shouldHandle = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHIP_EXIT); 3656 var widthIsAnimating = evt.propertyName === 'width'; 3657 var opacityIsAnimating = evt.propertyName === 'opacity'; 3658 if (shouldHandle && opacityIsAnimating) { 3659 // See: https://css-tricks.com/using-css-transitions-auto-dimensions/#article-header-id-5 3660 var chipWidth_1 = this.adapter.getComputedStyleValue('width'); 3661 // On the next frame (once we get the computed width), explicitly set the chip's width 3662 // to its current pixel width, so we aren't transitioning out of 'auto'. 3663 requestAnimationFrame(function () { 3664 _this.adapter.setStyleProperty('width', chipWidth_1); 3665 // To mitigate jitter, start transitioning padding and margin before width. 3666 _this.adapter.setStyleProperty('padding', '0'); 3667 _this.adapter.setStyleProperty('margin', '0'); 3668 // On the next frame (once width is explicitly set), transition width to 0. 3669 requestAnimationFrame(function () { 3670 _this.adapter.setStyleProperty('width', '0'); 3671 }); 3672 }); 3673 return; 3674 } 3675 if (shouldHandle && widthIsAnimating) { 3676 this.removeFocus(); 3677 var removedAnnouncement = this.adapter.getAttribute(constants_1.strings.REMOVED_ANNOUNCEMENT_ATTRIBUTE); 3678 this.adapter.notifyRemoval(removedAnnouncement); 3679 } 3680 // Handle a transition end event on the leading icon or checkmark, since the transition end event bubbles. 3681 if (!opacityIsAnimating) { 3682 return; 3683 } 3684 var shouldHideLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.LEADING_ICON) && this.adapter.hasClass(constants_1.cssClasses.SELECTED); 3685 var shouldShowLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHECKMARK) && !this.adapter.hasClass(constants_1.cssClasses.SELECTED); 3686 if (shouldHideLeadingIcon) { 3687 this.adapter.addClassToLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON); 3688 return; 3689 } 3690 if (shouldShowLeadingIcon) { 3691 this.adapter.removeClassFromLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON); 3692 return; 3693 } 3694 }; 3695 MDCChipFoundation.prototype.handleFocusIn = function (evt) { 3696 // Early exit if the event doesn't come from the primary action 3697 if (!this.eventFromPrimaryAction_(evt)) { 3698 return; 3699 } 3700 this.adapter.addClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED); 3701 }; 3702 MDCChipFoundation.prototype.handleFocusOut = function (evt) { 3703 // Early exit if the event doesn't come from the primary action 3704 if (!this.eventFromPrimaryAction_(evt)) { 3705 return; 3706 } 3707 if (this.isEditing()) { 3708 this.finishEditing(); 3709 } 3710 this.adapter.removeClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED); 3711 }; 3712 /** 3713 * Handles an interaction event on the trailing icon element. This is used to 3714 * prevent the ripple from activating on interaction with the trailing icon. 3715 */ 3716 MDCChipFoundation.prototype.handleTrailingActionInteraction = function () { 3717 this.adapter.notifyTrailingIconInteraction(); 3718 this.removeChip_(); 3719 }; 3720 /** 3721 * Handles a keydown event from the root element. 3722 */ 3723 MDCChipFoundation.prototype.handleKeydown = function (evt) { 3724 if (this.isEditing()) { 3725 if (this.shouldFinishEditing(evt)) { 3726 evt.preventDefault(); 3727 this.finishEditing(); 3728 } 3729 // When editing, the foundation should only handle key events that finish 3730 // the editing process. 3731 return; 3732 } 3733 if (this.isEditable()) { 3734 if (this.shouldStartEditing(evt)) { 3735 evt.preventDefault(); 3736 this.startEditing(); 3737 } 3738 } 3739 if (this.shouldNotifyInteraction_(evt)) { 3740 this.adapter.notifyInteraction(); 3741 this.setPrimaryActionFocusable_(this.getFocusBehavior_()); 3742 return; 3743 } 3744 if (this.isDeleteAction_(evt)) { 3745 evt.preventDefault(); 3746 this.removeChip_(); 3747 return; 3748 } 3749 // Early exit if the key is not usable 3750 if (!constants_1.navigationKeys.has(evt.key)) { 3751 return; 3752 } 3753 // Prevent default behavior for movement keys which could include scrolling 3754 evt.preventDefault(); 3755 this.focusNextAction_(evt.key, constants_1.EventSource.PRIMARY); 3756 }; 3757 MDCChipFoundation.prototype.handleTrailingActionNavigation = function (evt) { 3758 return this.focusNextAction_(evt.detail.key, constants_1.EventSource.TRAILING); 3759 }; 3760 /** 3761 * Called by the chip set to remove focus from the chip actions. 3762 */ 3763 MDCChipFoundation.prototype.removeFocus = function () { 3764 this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1'); 3765 this.adapter.removeTrailingActionFocus(); 3766 }; 3767 /** 3768 * Called by the chip set to focus the primary action. 3769 * 3770 */ 3771 MDCChipFoundation.prototype.focusPrimaryAction = function () { 3772 this.setPrimaryActionFocusable_(FocusBehavior.SHOULD_FOCUS); 3773 }; 3774 /** 3775 * Called by the chip set to focus the trailing action (if present), otherwise 3776 * gives focus to the trailing action. 3777 */ 3778 MDCChipFoundation.prototype.focusTrailingAction = function () { 3779 var trailingActionIsNavigable = this.adapter.isTrailingActionNavigable(); 3780 if (trailingActionIsNavigable) { 3781 this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1'); 3782 this.adapter.focusTrailingAction(); 3783 return; 3784 } 3785 this.focusPrimaryAction(); 3786 }; 3787 MDCChipFoundation.prototype.setPrimaryActionFocusable_ = function (focusBehavior) { 3788 this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '0'); 3789 if (focusBehavior === FocusBehavior.SHOULD_FOCUS) { 3790 this.adapter.focusPrimaryAction(); 3791 } 3792 this.adapter.removeTrailingActionFocus(); 3793 }; 3794 MDCChipFoundation.prototype.getFocusBehavior_ = function () { 3795 if (this.shouldFocusPrimaryActionOnClick_) { 3796 return FocusBehavior.SHOULD_FOCUS; 3797 } 3798 return FocusBehavior.SHOULD_NOT_FOCUS; 3799 }; 3800 MDCChipFoundation.prototype.focusNextAction_ = function (key, source) { 3801 var isTrailingActionNavigable = this.adapter.isTrailingActionNavigable(); 3802 var dir = this.getDirection_(key); 3803 // Early exit if the key should jump chips 3804 if (constants_1.jumpChipKeys.has(key) || !isTrailingActionNavigable) { 3805 return this.adapter.notifyNavigation(key, source); 3806 } 3807 if (source === constants_1.EventSource.PRIMARY && dir === constants_1.Direction.RIGHT) { 3808 return this.focusTrailingAction(); 3809 } 3810 if (source === constants_1.EventSource.TRAILING && dir === constants_1.Direction.LEFT) { 3811 return this.focusPrimaryAction(); 3812 } 3813 this.adapter.notifyNavigation(key, constants_1.EventSource.NONE); 3814 }; 3815 MDCChipFoundation.prototype.getDirection_ = function (key) { 3816 var isRTL = this.adapter.isRTL(); 3817 var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; 3818 var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; 3819 if (!isRTL && isLeftKey || isRTL && isRightKey) { 3820 return constants_1.Direction.LEFT; 3821 } 3822 return constants_1.Direction.RIGHT; 3823 }; 3824 MDCChipFoundation.prototype.removeChip_ = function () { 3825 if (this.shouldRemoveOnTrailingIconClick_) { 3826 this.beginExit(); 3827 } 3828 }; 3829 MDCChipFoundation.prototype.shouldStartEditing = function (evt) { 3830 return this.eventFromPrimaryAction_(evt) && evt.key === constants_1.strings.ENTER_KEY; 3831 }; 3832 MDCChipFoundation.prototype.shouldFinishEditing = function (evt) { 3833 return evt.key === constants_1.strings.ENTER_KEY; 3834 }; 3835 MDCChipFoundation.prototype.shouldNotifyInteraction_ = function (evt) { 3836 return evt.key === constants_1.strings.ENTER_KEY || evt.key === constants_1.strings.SPACEBAR_KEY; 3837 }; 3838 MDCChipFoundation.prototype.isDeleteAction_ = function (evt) { 3839 var isDeletable = this.adapter.hasClass(constants_1.cssClasse
3839s.DELETABLE); 3840 return isDeletable && (evt.key === constants_1.strings.BACKSPACE_KEY || evt.key === constants_1.strings.DELETE_KEY || evt.key === constants_1.strings.IE_DELETE_KEY); 3841 }; 3842 MDCChipFoundation.prototype.setSelected_ = function (selected) { 3843 if (selected) { 3844 this.adapter.addClass(constants_1.cssClasses.SELECTED); 3845 this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'true'); 3846 } else { 3847 this.adapter.removeClass(constants_1.cssClasses.SELECTED); 3848 this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'false'); 3849 } 3850 }; 3851 MDCChipFoundation.prototype.notifySelection_ = function (selected) { 3852 this.adapter.notifySelection(selected, false); 3853 }; 3854 MDCChipFoundation.prototype.notifyIgnoredSelection_ = function (selected) { 3855 this.adapter.notifySelection(selected, true); 3856 }; 3857 MDCChipFoundation.prototype.eventFromPrimaryAction_
vendor: 12,650 bytes, lines 3857-4129
3857 = function (evt) { 3858 return this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.PRIMARY_ACTION); 3859 }; 3860 MDCChipFoundation.prototype.startEditing = function () { 3861 this.adapter.addClass(constants_1.cssClasses.EDITING); 3862 this.adapter.notifyEditStart(); 3863 }; 3864 MDCChipFoundation.prototype.finishEditing = function () { 3865 this.adapter.removeClass(constants_1.cssClasses.EDITING); 3866 this.adapter.notifyEditFinish(); 3867 }; 3868 return MDCChipFoundation; 3869}(foundation_1.MDCFoundation); 3870exports.MDCChipFoundation = MDCChipFoundation; 3871// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 3872exports.default = MDCChipFoundation; 3873 3874/***/ }), 3875 3876/***/ "./packages/mdc-chips/deprecated/chip/index.ts": 3877/*!*****************************************************!*\ 3878 !*** ./packages/mdc-chips/deprecated/chip/index.ts ***! 3879 \*****************************************************/ 3880/*! no static exports found */ 3881/***/ (function(module, exports, __webpack_require__) { 3882 3883"use strict"; 3884 3885/** 3886 * @license 3887 * Copyright 2019 Google Inc. 3888 * 3889 * Permission is hereby granted, free of charge, to any person obtaining a copy 3890 * of this software and associated documentation files (the "Software"), to deal 3891 * in the Software without restriction, including without limitation the rights 3892 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3893 * copies of the Software, and to permit persons to whom the Software is 3894 * furnished to do so, subject to the following conditions: 3895 * 3896 * The above copyright notice and this permission notice shall be included in 3897 * all copies or substantial portions of the Software. 3898 * 3899 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3900 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3901 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3902 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3903 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3904 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3905 * THE SOFTWARE. 3906 */ 3907 3908var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 3909 if (k2 === undefined) k2 = k; 3910 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 3911 return m[k]; 3912 } }); 3913} : function (o, m, k, k2) { 3914 if (k2 === undefined) k2 = k; 3915 o[k2] = m[k]; 3916}); 3917var __exportStar = this && this.__exportStar || function (m, exports) { 3918 for (var p in m) { 3919 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 3920 } 3921}; 3922Object.defineProperty(exports, "__esModule", { value: true }); 3923exports.chipStrings = exports.chipCssClasses = void 0; 3924__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-chips/deprecated/chip/adapter.ts"), exports); 3925__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-chips/deprecated/chip/component.ts"), exports); 3926__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/deprecated/chip/foundation.ts"), exports); 3927__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-chips/deprecated/chip/types.ts"), exports); 3928var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/deprecated/chip/constants.ts"); 3929Object.defineProperty(exports, "chipCssClasses", { enumerable: true, get: function get() { 3930 return constants_1.cssClasses; 3931 } }); 3932Object.defineProperty(exports, "chipStrings", { enumerable: true, get: function get() { 3933 return constants_1.strings; 3934 } }); 3935 3936/***/ }), 3937 3938/***/ "./packages/mdc-chips/deprecated/chip/types.ts": 3939/*!*****************************************************!*\ 3940 !*** ./packages/mdc-chips/deprecated/chip/types.ts ***! 3941 \*****************************************************/ 3942/*! no static exports found */ 3943/***/ (function(module, exports, __webpack_require__) { 3944 3945"use strict"; 3946 3947/** 3948 * @license 3949 * Copyright 2019 Google Inc. 3950 * 3951 * Permission is hereby granted, free of charge, to any person obtaining a copy 3952 * of this software and associated documentation files (the "Software"), to deal 3953 * in the Software without restriction, including without limitation the rights 3954 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3955 * copies of the Software, and to permit persons to whom the Software is 3956 * furnished to do so, subject to the following conditions: 3957 * 3958 * The above copyright notice and this permission notice shall be included in 3959 * all copies or substantial portions of the Software. 3960 * 3961 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3962 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3963 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3964 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3965 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3966 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3967 * THE SOFTWARE. 3968 */ 3969 3970Object.defineProperty(exports, "__esModule", { value: true }); 3971 3972/***/ }), 3973 3974/***/ "./packages/mdc-chips/deprecated/index.ts": 3975/*!************************************************!*\ 3976 !*** ./packages/mdc-chips/deprecated/index.ts ***! 3977 \************************************************/ 3978/*! no static exports found */ 3979/***/ (function(module, exports, __webpack_require__) { 3980 3981"use strict"; 3982 3983/** 3984 * @license 3985 * Copyright 2019 Google Inc. 3986 * 3987 * Permission is hereby granted, free of charge, to any person obtaining a copy 3988 * of this software and associated documentation files (the "Software"), to deal 3989 * in the Software without restriction, including without limitation the rights 3990 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3991 * copies of the Software, and to permit persons to whom the Software is 3992 * furnished to do so, subject to the following conditions: 3993 * 3994 * The above copyright notice and this permission notice shall be included in 3995 * all copies or substantial portions of the Software. 3996 * 3997 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3998 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3999 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4000 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4001 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4002 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4003 * THE SOFTWARE. 4004 */ 4005 4006var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 4007 if (k2 === undefined) k2 = k; 4008 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 4009 return m[k]; 4010 } }); 4011} : function (o, m, k, k2) { 4012 if (k2 === undefined) k2 = k; 4013 o[k2] = m[k]; 4014}); 4015var __exportStar = this && this.__exportStar || function (m, exports) { 4016 for (var p in m) { 4017 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 4018 } 4019}; 4020Object.defineProperty(exports, "__esModule", { value: true }); 4021__exportStar(__webpack_require__(/*! ./trailingaction/index */ "./packages/mdc-chips/deprecated/trailingaction/index.ts"), exports); 4022__exportStar(__webpack_require__(/*! ./chip/index */ "./packages/mdc-chips/deprecated/chip/index.ts"), exports); 4023__exportStar(__webpack_require__(/*! ./chip-set/index */ "./packages/mdc-chips/deprecated/chip-set/index.ts"), exports); 4024 4025/***/ }), 4026 4027/***/ "./packages/mdc-chips/deprecated/trailingaction/adapter.ts": 4028/*!*****************************************************************!*\ 4029 !*** ./packages/mdc-chips/deprecated/trailingaction/adapter.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 4059Object.defineProperty(exports, "__esModule", { value: true }); 4060 4061/***/ }), 4062 4063/***/ "./packages/mdc-chips/deprecated/trailingaction/component.ts": 4064/*!*******************************************************************!*\ 4065 !*** ./packages/mdc-chips/deprecated/trailingaction/component.ts ***! 4066 \*******************************************************************/ 4067/*! no static exports found */ 4068/***/ (function(module, exports, __webpack_require__) { 4069 4070"use strict"; 4071 4072/** 4073 * @license 4074 * Copyright 2020 Google Inc. 4075 * 4076 * Permission is hereby granted, free of charge, to any person obtaining a copy 4077 * of this software and associated documentation files (the "Software"), to deal 4078 * in the Software without restriction, including without limitation the rights 4079 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4080 * copies of the Software, and to permit persons to whom the Software is 4081 * furnished to do so, subject to the following conditions: 4082 * 4083 * The above copyright notice and this permission notice shall be included in 4084 * all copies or substantial portions of the Software. 4085 * 4086 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4087 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4088 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4089 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4090 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4091 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4092 * THE SOFTWARE. 4093 */ 4094 4095var __extends = this && this.__extends || function () { 4096 var _extendStatics = function extendStatics(d, b) { 4097 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 4098 d.__proto__ = b; 4099 } || function (d, b) { 4100 for (var p in b) { 4101 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 4102 } 4103 }; 4104 return _extendStatics(d, b); 4105 }; 4106 return function (d, b) { 4107 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 4108 _extendStatics(d, b); 4109 function __() { 4110 this.constructor = d; 4111 } 4112 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4113 }; 4114}(); 4115Object.defineProperty(exports, "__esModule", { value: true }); 4116exports.MDCChipTrailingAction = void 0; 4117var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 4118var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 4119var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 4120var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/deprecated/trailingaction/constants.ts"); 4121var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/deprecated/trailingaction/foundation.ts"); 4122var MDCChipTrailingAction = /** @class */function (_super) { 4123 __extends(MDCChipTrailingAction, _super); 4124 function MDCChipTrailingAction() { 4125 return _super !== null && _super.apply(this, arguments) || this; 4126 } 4127 Object.defineProperty(MDCChipTrailingAction.prototype, "ripple", { 4128 get: function get() { 4129 return this.ripple
vendor: 1,489 bytes, lines 4129-4163
4129_; 4130 }, 4131 enumerable: false, 4132 configurable: true 4133 }); 4134 MDCChipTrailingAction.attachTo = function (root) { 4135 return new MDCChipTrailingAction(root); 4136 }; 4137 MDCChipTrailingAction.prototype.initialize = function (rippleFactory) { 4138 if (rippleFactory === void 0) { 4139 rippleFactory = function rippleFactory(el, foundation) { 4140 return new component_2.MDCRipple(el, foundation); 4141 }; 4142 } 4143 // DO NOT INLINE this variable. For backward compatibility, foundations take 4144 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 4145 // methods, we need a separate, strongly typed adapter variable. 4146 var rippleAdapter = component_2.MDCRipple.createAdapter(this); 4147 this.ripple_ = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter)); 4148 }; 4149 MDCChipTrailingAction.prototype.initialSyncWithDOM = function () { 4150 var _this = this; 4151 this.handleClick_ = function (evt) { 4152 _this.foundation.handleClick(evt); 4153 }; 4154 this.handleKeydown_ = function (evt) { 4155 _this.foundation.handleKeydown(evt); 4156 }; 4157 this.listen('click', this.handleClick_); 4158 this.listen('keydown', this.handleKeydown_); 4159 }; 4160 MDCChipTrailingAction.prototype.destroy = function () { 4161 this.ripple_.destroy(); 4162 this.unlisten('click', this.handleClick_); 4163 this.unlisten('keydown', this.handleKeydown_
vendor: 9,126 bytes, lines 4163-4369
4163); 4164 _super.prototype.destroy.call(this); 4165 }; 4166 MDCChipTrailingAction.prototype.getDefaultFoundation = function () { 4167 var _this = this; 4168 // DO NOT INLINE this variable. For backward compatibility, foundations take 4169 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 4170 // methods, we need a separate, strongly typed adapter variable. 4171 var adapter = { 4172 focus: function focus() { 4173 // TODO(b/157231863): Migate MDCComponent#root to HTMLElement 4174 _this.root.focus(); 4175 }, 4176 getAttribute: function getAttribute(attr) { 4177 return _this.root.getAttribute(attr); 4178 }, 4179 notifyInteraction: function notifyInteraction(trigger) { 4180 return _this.emit(constants_1.strings.INTERACTION_EVENT, { trigger: trigger }, true /* shouldBubble */); 4181 }, 4182 notifyNavigation: function notifyNavigation(key) { 4183 _this.emit(constants_1.strings.NAVIGATION_EVENT, { key: key }, true /* shouldBubble */); 4184 }, 4185 setAttribute: function setAttribute(attr, value) { 4186 _this.root.setAttribute(attr, value); 4187 } 4188 }; 4189 return new foundation_2.MDCChipTrailingActionFoundation(adapter); 4190 }; 4191 MDCChipTrailingAction.prototype.isNavigable = function () { 4192 return this.foundation.isNavigable(); 4193 }; 4194 MDCChipTrailingAction.prototype.focus = function () { 4195 this.foundation.focus(); 4196 }; 4197 MDCChipTrailingAction.prototype.removeFocus = function () { 4198 this.foundation.removeFocus(); 4199 }; 4200 return MDCChipTrailingAction; 4201}(component_1.MDCComponent); 4202exports.MDCChipTrailingAction = MDCChipTrailingAction; 4203 4204/***/ }), 4205 4206/***/ "./packages/mdc-chips/deprecated/trailingaction/constants.ts": 4207/*!*******************************************************************!*\ 4208 !*** ./packages/mdc-chips/deprecated/trailingaction/constants.ts ***! 4209 \*******************************************************************/ 4210/*! no static exports found */ 4211/***/ (function(module, exports, __webpack_require__) { 4212 4213"use strict"; 4214 4215/** 4216 * @license 4217 * Copyright 2020 Google Inc. 4218 * 4219 * Permission is hereby granted, free of charge, to any person obtaining a copy 4220 * of this software and associated documentation files (the "Software"), to deal 4221 * in the Software without restriction, including without limitation the rights 4222 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4223 * copies of the Software, and to permit persons to whom the Software is 4224 * furnished to do so, subject to the following conditions: 4225 * 4226 * The above copyright notice and this permission notice shall be included in 4227 * all copies or substantial portions of the Software. 4228 * 4229 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4230 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4231 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4232 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4233 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4234 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4235 * THE SOFTWARE. 4236 */ 4237 4238Object.defineProperty(exports, "__esModule", { value: true }); 4239exports.strings = exports.InteractionTrigger = void 0; 4240var InteractionTrigger; 4241(function (InteractionTrigger) { 4242 InteractionTrigger[InteractionTrigger["UNSPECIFIED"] = 0] = "UNSPECIFIED"; 4243 InteractionTrigger[InteractionTrigger["CLICK"] = 1] = "CLICK"; 4244 InteractionTrigger[InteractionTrigger["BACKSPACE_KEY"] = 2] = "BACKSPACE_KEY"; 4245 InteractionTrigger[InteractionTrigger["DELETE_KEY"] = 3] = "DELETE_KEY"; 4246 InteractionTrigger[InteractionTrigger["SPACEBAR_KEY"] = 4] = "SPACEBAR_KEY"; 4247 InteractionTrigger[InteractionTrigger["ENTER_KEY"] = 5] = "ENTER_KEY"; 4248})(InteractionTrigger = exports.InteractionTrigger || (exports.InteractionTrigger = {})); 4249exports.strings = { 4250 ARIA_HIDDEN: 'aria-hidden', 4251 INTERACTION_EVENT: 'MDCChipTrailingAction:interaction', 4252 NAVIGATION_EVENT: 'MDCChipTrailingAction:navigation', 4253 TAB_INDEX: 'tabindex' 4254}; 4255 4256/***/ }), 4257 4258/***/ "./packages/mdc-chips/deprecated/trailingaction/foundation.ts": 4259/*!********************************************************************!*\ 4260 !*** ./packages/mdc-chips/deprecated/trailingaction/foundation.ts ***! 4261 \********************************************************************/ 4262/*! no static exports found */ 4263/***/ (function(module, exports, __webpack_require__) { 4264 4265"use strict"; 4266 4267/** 4268 * @license 4269 * Copyright 2020 Google Inc. 4270 * 4271 * Permission is hereby granted, free of charge, to any person obtaining a copy 4272 * of this software and associated documentation files (the "Software"), to deal 4273 * in the Software without restriction, including without limitation the rights 4274 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4275 * copies of the Software, and to permit persons to whom the Software is 4276 * furnished to do so, subject to the following conditions: 4277 * 4278 * The above copyright notice and this permission notice shall be included in 4279 * all copies or substantial portions of the Software. 4280 * 4281 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4282 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4283 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4284 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4285 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4286 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4287 * THE SOFTWARE. 4288 */ 4289 4290var __extends = this && this.__extends || function () { 4291 var _extendStatics = function extendStatics(d, b) { 4292 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 4293 d.__proto__ = b; 4294 } || function (d, b) { 4295 for (var p in b) { 4296 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 4297 } 4298 }; 4299 return _extendStatics(d, b); 4300 }; 4301 return function (d, b) { 4302 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 4303 _extendStatics(d, b); 4304 function __() { 4305 this.constructor = d; 4306 } 4307 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4308 }; 4309}(); 4310var __assign = this && this.__assign || function () { 4311 __assign = Object.assign || function (t) { 4312 for (var s, i = 1, n = arguments.length; i < n; i++) { 4313 s = arguments[i]; 4314 for (var p in s) { 4315 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 4316 } 4317 } 4318 return t; 4319 }; 4320 return __assign.apply(this, arguments); 4321}; 4322Object.defineProperty(exports, "__esModule", { value: true }); 4323exports.MDCChipTrailingActionFoundation = void 0; 4324var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 4325var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 4326var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/deprecated/trailingaction/constants.ts"); 4327var MDCChipTrailingActionFoundation = /** @class */function (_super) { 4328 __extends(MDCChipTrailingActionFoundation, _super); 4329 function MDCChipTrailingActionFoundation(adapter) { 4330 return _super.call(this, __assign(__assign({}, MDCChipTrailingActionFoundation.defaultAdapter), adapter)) || this; 4331 } 4332 Object.defineProperty(MDCChipTrailingActionFoundation, "strings", { 4333 get: function get() { 4334 return constants_1.strings; 4335 }, 4336 enumerable: false, 4337 configurable: true 4338 }); 4339 Object.defineProperty(MDCChipTrailingActionFoundation, "defaultAdapter", { 4340 get: function get() { 4341 return { 4342 focus: function focus() { 4343 return undefined; 4344 }, 4345 getAttribute: function getAttribute() { 4346 return null; 4347 }, 4348 setAttribute: function setAttribute() { 4349 return undefined; 4350 }, 4351 notifyInteraction: function notifyInteraction() { 4352 return undefined; 4353 }, 4354 notifyNavigation: function notifyNavigation() { 4355 return undefined; 4356 } 4357 }; 4358 }, 4359 enumerable: false, 4360 configurable: true 4361 }); 4362 MDCChipTrailingActionFoundation.prototype.handleClick = function (evt) { 4363 evt.stopPropagation(); 4364 this.adapter.notifyInteraction(constants_1.InteractionTrigger.CLICK); 4365 }; 4366 MDCChipTrailingActionFoundation.prototype.handleKeydown = function (evt) { 4367 evt.stopPropagation(); 4368 var key = keyboard_1.normalizeKey(evt); 4369 if (this.shouldNotifyInteractionFromKey
4369_(key)) { 4370 var trigger = this.getTriggerFromKey_(key); 4371 this.adapter.notifyInteraction(trigger); 4372 return; 4373 } 4374 if (keyboard_1.isNavigationEvent(evt)) { 4375 this.adapter.notifyNavigation(key); 4376 return; 4377 } 4378 }; 4379 MDCChipTrailingActionFoundation.prototype.removeFocus = function () { 4380 this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '-1'); 4381 };
vendor: 754 bytes, lines 4382-4394
4382 MDCChipTrailingActionFoundation.prototype.focus = function () { 4383 this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '0'); 4384 this.adapter.focus(); 4385 }; 4386 MDCChipTrailingActionFoundation.prototype.isNavigable = function () { 4387 return this.adapter.getAttribute(constants_1.strings.ARIA_HIDDEN) !== 'true'; 4388 }; 4389 MDCChipTrailingActionFoundation.prototype.shouldNotifyInteractionFromKey_ = function (key) { 4390 var isFromActionKey = key === keyboard_1.KEY.ENTER || key === keyboard_1.KEY.SPACEBAR; 4391 var isFromDeleteKey = key === keyboard_1.KEY.BACKSPACE || key === keyboard_1.KEY.DELETE; 4392 return isFromActionKey || isFromDeleteKey; 4393 }; 4394 MDCChipTrailingActionFoundation.prototype.getTriggerFromKey_
vendor: 5,435 bytes, lines 4394-4512
4394 = function (key) { 4395 if (key === keyboard_1.KEY.SPACEBAR) { 4396 return constants_1.InteractionTrigger.SPACEBAR_KEY; 4397 } 4398 if (key === keyboard_1.KEY.ENTER) { 4399 return constants_1.InteractionTrigger.ENTER_KEY; 4400 } 4401 if (key === keyboard_1.KEY.DELETE) { 4402 return constants_1.InteractionTrigger.DELETE_KEY; 4403 } 4404 if (key === keyboard_1.KEY.BACKSPACE) { 4405 return constants_1.InteractionTrigger.BACKSPACE_KEY; 4406 } 4407 // Default case, should never be returned 4408 return constants_1.InteractionTrigger.UNSPECIFIED; 4409 }; 4410 return MDCChipTrailingActionFoundation; 4411}(foundation_1.MDCFoundation); 4412exports.MDCChipTrailingActionFoundation = MDCChipTrailingActionFoundation; 4413// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 4414exports.default = MDCChipTrailingActionFoundation; 4415 4416/***/ }), 4417 4418/***/ "./packages/mdc-chips/deprecated/trailingaction/index.ts": 4419/*!***************************************************************!*\ 4420 !*** ./packages/mdc-chips/deprecated/trailingaction/index.ts ***! 4421 \***************************************************************/ 4422/*! no static exports found */ 4423/***/ (function(module, exports, __webpack_require__) { 4424 4425"use strict"; 4426 4427/** 4428 * @license 4429 * Copyright 2020 Google Inc. 4430 * 4431 * Permission is hereby granted, free of charge, to any person obtaining a copy 4432 * of this software and associated documentation files (the "Software"), to deal 4433 * in the Software without restriction, including without limitation the rights 4434 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4435 * copies of the Software, and to permit persons to whom the Software is 4436 * furnished to do so, subject to the following conditions: 4437 * 4438 * The above copyright notice and this permission notice shall be included in 4439 * all copies or substantial portions of the Software. 4440 * 4441 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4442 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4443 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4444 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4445 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4446 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4447 * THE SOFTWARE. 4448 */ 4449 4450var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 4451 if (k2 === undefined) k2 = k; 4452 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 4453 return m[k]; 4454 } }); 4455} : function (o, m, k, k2) { 4456 if (k2 === undefined) k2 = k; 4457 o[k2] = m[k]; 4458}); 4459var __exportStar = this && this.__exportStar || function (m, exports) { 4460 for (var p in m) { 4461 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 4462 } 4463}; 4464Object.defineProperty(exports, "__esModule", { value: true }); 4465exports.trailingActionStrings = void 0; 4466__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-chips/deprecated/trailingaction/adapter.ts"), exports); 4467__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-chips/deprecated/trailingaction/component.ts"), exports); 4468__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/deprecated/trailingaction/foundation.ts"), exports); 4469__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-chips/deprecated/trailingaction/types.ts"), exports); 4470var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/deprecated/trailingaction/constants.ts"); 4471Object.defineProperty(exports, "trailingActionStrings", { enumerable: true, get: function get() { 4472 return constants_1.strings; 4473 } }); 4474 4475/***/ }), 4476 4477/***/ "./packages/mdc-chips/deprecated/trailingaction/types.ts": 4478/*!***************************************************************!*\ 4479 !*** ./packages/mdc-chips/deprecated/trailingaction/types.ts ***! 4480 \***************************************************************/ 4481/*! no static exports found */ 4482/***/ (function(module, exports, __webpack_require__) { 4483 4484"use strict"; 4485 4486/** 4487 * @license 4488 * Copyright 2020 Google Inc. 4489 * 4490 * Permission is hereby granted, free of charge, to any person obtaining a copy 4491 * of this software and associated documentation files (the "Software"), to deal 4492 * in the Software without restriction, including without limitation the rights 4493 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4494 * copies of the Software, and to permit persons to whom the Software is 4495 * furnished to do so, subject to the following conditions: 4496 * 4497 * The above copyright notice and this permission notice shall be included in 4498 * all copies or substantial portions of the Software. 4499 * 4500 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4501 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4502 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4503 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4504 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4505 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4506 * THE SOFTWARE. 4507 */ 4508 4509Object.defineProperty(exports, "__esModule", { value: true }); 4510 4511/***/ }), 4512
vendor: 4,445 bytes, lines 4513-4611
4513/***/ "./packages/mdc-circular-progress/adapter.ts": 4514/*!***************************************************!*\ 4515 !*** ./packages/mdc-circular-progress/adapter.ts ***! 4516 \***************************************************/ 4517/*! no static exports found */ 4518/***/ (function(module, exports, __webpack_require__) { 4519 4520"use strict"; 4521 4522/** 4523 * @license 4524 * Copyright 2020 Google Inc. 4525 * 4526 * Permission is hereby granted, free of charge, to any person obtaining a copy 4527 * of this software and associated documentation files (the "Software"), to deal 4528 * in the Software without restriction, including without limitation the rights 4529 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4530 * copies of the Software, and to permit persons to whom the Software is 4531 * furnished to do so, subject to the following conditions: 4532 * 4533 * The above copyright notice and this permission notice shall be included in 4534 * all copies or substantial portions of the Software. 4535 * 4536 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4537 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4538 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4539 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4540 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4541 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4542 * THE SOFTWARE. 4543 */ 4544 4545Object.defineProperty(exports, "__esModule", { value: true }); 4546 4547/***/ }), 4548 4549/***/ "./packages/mdc-circular-progress/component.ts": 4550/*!*****************************************************!*\ 4551 !*** ./packages/mdc-circular-progress/component.ts ***! 4552 \*****************************************************/ 4553/*! no static exports found */ 4554/***/ (function(module, exports, __webpack_require__) { 4555 4556"use strict"; 4557 4558/** 4559 * @license 4560 * Copyright 2020 Google Inc. 4561 * 4562 * Permission is hereby granted, free of charge, to any person obtaining a copy 4563 * of this software and associated documentation files (the "Software"), to deal 4564 * in the Software without restriction, including without limitation the rights 4565 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4566 * copies of the Software, and to permit persons to whom the Software is 4567 * furnished to do so, subject to the following conditions: 4568 * 4569 * The above copyright notice and this permission notice shall be included in 4570 * all copies or substantial portions of the Software. 4571 * 4572 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4573 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4574 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4575 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4576 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4577 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4578 * THE SOFTWARE. 4579 */ 4580 4581var __extends = this && this.__extends || function () { 4582 var _extendStatics = function extendStatics(d, b) { 4583 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 4584 d.__proto__ = b; 4585 } || function (d, b) { 4586 for (var p in b) { 4587 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 4588 } 4589 }; 4590 return _extendStatics(d, b); 4591 }; 4592 return function (d, b) { 4593 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 4594 _extendStatics(d, b); 4595 function __() { 4596 this.constructor = d; 4597 } 4598 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4599 }; 4600}(); 4601Object.defineProperty(exports, "__esModule", { value: true }); 4602exports.MDCCircularProgress = void 0; 4603var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 4604var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-circular-progress/foundation.ts"); 4605var MDCCircularProgress = /** @class */function (_super) { 4606 __extends(MDCCircularProgress, _super); 4607 function MDCCircularProgress() { 4608 return _super !== null && _super.apply(this, arguments) || this; 4609 } 4610 MDCCircularProgress.prototype.initialize = function () { 4611 this.determinateCircle
4611_ = this.root.querySelector(foundation_1.MDCCircularProgressFoundation.strings.DETERMINATE_CIRCLE_SELECTOR); 4612 }; 4613 MDCCircularProgress.attachTo = function (root) { 4614 return new MDCCircularProgress(root); 4615 }; 4616 Object.defineProperty(MDCCircularProgress.prototype, "determinate", { 4617 /** 4618 * Sets whether the progress indicator is in determinate mode. 4619 * @param isDeterminate Whether the indicator should be determinate. 4620 */ 4621 set: function set(value) { 4622 this.foundation.setDeterminate(value); 4623 }, 4624 enumerable: false, 4625 configurable: true 4626 }); 4627 Object.defineProperty(MDCCircularProgress.prototype, "progress", { 4628 /** 4629 * Sets the current progress value. In indeterminate mode, this has no 4630 * visual effect but will be reflected if the indicator is switched to 4631 * determinate mode. 4632 * @param value The current progress value, which must be between 0 and 1. 4633 */ 4634 set: function set(value) { 4635 this.foundation.setProgress(value); 4636 }, 4637 enumerable: false, 4638 configurable: true 4639 }); 4640 Object.defineProperty(MDCCircularProgress.prototype, "isClosed", { 4641 /** 4642 * Whether the progress indicator is hidden. 4643 */ 4644 get: function get() { 4645 return this.foundation.isClosed(); 4646 }, 4647 enumerable: false, 4648 configurable: true 4649 }); 4650 /** 4651 * Shows the progress indicator. 4652 */ 4653 MDCCircularProgress.prototype.open = function () { 4654 this.foundation.open(); 4655 }; 4656 /** 4657 * Hides the progress indicator. 4658 */ 4659 MDCCircularProgress.prototype.close = function () { 4660 this.foundation.close(); 4661 }; 4662 MDCCircularProgress.prototype.getDefaultFoundation = function () { 4663 var _this = this; 4664 // DO NOT INLINE this variable. For backward compatibility, foundations take 4665 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 4666 // methods, we need a separate, strongly typed adapter variable. 4667 var adapter = { 4668 addClass: function addClass(className) { 4669 return _this.root.classList.add(className); 4670 }, 4671 getDeterminateCircleAttribute: function getDeterminateCircleAttribute(attributeName) { 4672 return _this.determinateCircle_.getAttribute(attributeName); 4673 }, 4674 hasClass: function hasClass(className) { 4675 return _this.root.classList.contains(className); 4676 }, 4677 removeClass: function removeClass(className) { 4678 return _this.root.classList.remove(className); 4679 }, 4680 removeAttribute: function removeAttribute(attributeName) { 4681 return _this.root.removeAttribute(attributeName); 4682 }, 4683 setAttribute: function setAttribute(attributeName, value) { 4684 return _this.root.setAttribute(attributeName, value); 4685 }, 4686 setDeterminateCircleAttribute: function setDeterminateCircleAttribute(attributeName, value) { 4687 return _this.determinateCircle_
vendor: 10,316 bytes, lines 4687-4940
4687.setAttribute(attributeName, value); 4688 } 4689 }; 4690 return new foundation_1.MDCCircularProgressFoundation(adapter); 4691 }; 4692 return MDCCircularProgress; 4693}(component_1.MDCComponent); 4694exports.MDCCircularProgress = MDCCircularProgress; 4695 4696/***/ }), 4697 4698/***/ "./packages/mdc-circular-progress/constants.ts": 4699/*!*****************************************************!*\ 4700 !*** ./packages/mdc-circular-progress/constants.ts ***! 4701 \*****************************************************/ 4702/*! no static exports found */ 4703/***/ (function(module, exports, __webpack_require__) { 4704 4705"use strict"; 4706 4707/** 4708 * @license 4709 * Copyright 2020 Google Inc. 4710 * 4711 * Permission is hereby granted, free of charge, to any person obtaining a copy 4712 * of this software and associated documentation files (the "Software"), to deal 4713 * in the Software without restriction, including without limitation the rights 4714 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4715 * copies of the Software, and to permit persons to whom the Software is 4716 * furnished to do so, subject to the following conditions: 4717 * 4718 * The above copyright notice and this permission notice shall be included in 4719 * all copies or substantial portions of the Software. 4720 * 4721 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4722 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4723 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4724 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4725 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4726 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4727 * THE SOFTWARE. 4728 */ 4729 4730Object.defineProperty(exports, "__esModule", { value: true }); 4731exports.strings = exports.cssClasses = void 0; 4732/** 4733 * CSS class names used in component. 4734 */ 4735exports.cssClasses = { 4736 INDETERMINATE_CLASS: 'mdc-circular-progress--indeterminate', 4737 CLOSED_CLASS: 'mdc-circular-progress--closed' 4738}; 4739/** 4740 * Attributes and selectors used in component. 4741 */ 4742exports.strings = { 4743 ARIA_HIDDEN: 'aria-hidden', 4744 ARIA_VALUENOW: 'aria-valuenow', 4745 DETERMINATE_CIRCLE_SELECTOR: '.mdc-circular-progress__determinate-circle', 4746 RADIUS: 'r', 4747 STROKE_DASHOFFSET: 'stroke-dashoffset' 4748}; 4749 4750/***/ }), 4751 4752/***/ "./packages/mdc-circular-progress/foundation.ts": 4753/*!******************************************************!*\ 4754 !*** ./packages/mdc-circular-progress/foundation.ts ***! 4755 \******************************************************/ 4756/*! no static exports found */ 4757/***/ (function(module, exports, __webpack_require__) { 4758 4759"use strict"; 4760 4761/** 4762 * @license 4763 * Copyright 2020 Google Inc. 4764 * 4765 * Permission is hereby granted, free of charge, to any person obtaining a copy 4766 * of this software and associated documentation files (the "Software"), to deal 4767 * in the Software without restriction, including without limitation the rights 4768 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4769 * copies of the Software, and to permit persons to whom the Software is 4770 * furnished to do so, subject to the following conditions: 4771 * 4772 * The above copyright notice and this permission notice shall be included in 4773 * all copies or substantial portions of the Software. 4774 * 4775 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4776 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4777 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4778 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4779 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4780 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4781 * THE SOFTWARE. 4782 */ 4783 4784var __extends = this && this.__extends || function () { 4785 var _extendStatics = function extendStatics(d, b) { 4786 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 4787 d.__proto__ = b; 4788 } || function (d, b) { 4789 for (var p in b) { 4790 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 4791 } 4792 }; 4793 return _extendStatics(d, b); 4794 }; 4795 return function (d, b) { 4796 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 4797 _extendStatics(d, b); 4798 function __() { 4799 this.constructor = d; 4800 } 4801 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4802 }; 4803}(); 4804var __assign = this && this.__assign || function () { 4805 __assign = Object.assign || function (t) { 4806 for (var s, i = 1, n = arguments.length; i < n; i++) { 4807 s = arguments[i]; 4808 for (var p in s) { 4809 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 4810 } 4811 } 4812 return t; 4813 }; 4814 return __assign.apply(this, arguments); 4815}; 4816Object.defineProperty(exports, "__esModule", { value: true }); 4817exports.MDCCircularProgressFoundation = void 0; 4818var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 4819var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-circular-progress/constants.ts"); 4820var MDCCircularProgressFoundation = /** @class */function (_super) { 4821 __extends(MDCCircularProgressFoundation, _super); 4822 function MDCCircularProgressFoundation(adapter) { 4823 return _super.call(this, __assign(__assign({}, MDCCircularProgressFoundation.defaultAdapter), adapter)) || this; 4824 } 4825 Object.defineProperty(MDCCircularProgressFoundation, "cssClasses", { 4826 get: function get() { 4827 return constants_1.cssClasses; 4828 }, 4829 enumerable: false, 4830 configurable: true 4831 }); 4832 Object.defineProperty(MDCCircularProgressFoundation, "strings", { 4833 get: function get() { 4834 return constants_1.strings; 4835 }, 4836 enumerable: false, 4837 configurable: true 4838 }); 4839 Object.defineProperty(MDCCircularProgressFoundation, "defaultAdapter", { 4840 get: function get() { 4841 return { 4842 addClass: function addClass() { 4843 return undefined; 4844 }, 4845 getDeterminateCircleAttribute: function getDeterminateCircleAttribute() { 4846 return null; 4847 }, 4848 hasClass: function hasClass() { 4849 return false; 4850 }, 4851 removeClass: function removeClass() { 4852 return undefined; 4853 }, 4854 removeAttribute: function removeAttribute() { 4855 return undefined; 4856 }, 4857 setAttribute: function setAttribute() { 4858 return undefined; 4859 }, 4860 setDeterminateCircleAttribute: function setDeterminateCircleAttribute() { 4861 return undefined; 4862 } 4863 }; 4864 }, 4865 enumerable: false, 4866 configurable: true 4867 }); 4868 MDCCircularProgressFoundation.prototype.init = function () { 4869 this.closed = this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS); 4870 this.determinate = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS); 4871 this.progress = 0; 4872 if (this.determinate) { 4873 this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString()); 4874 } 4875 this.radius = Number(this.adapter.getDeterminateCircleAttribute(constants_1.strings.RADIUS)); 4876 }; 4877 /** 4878 * Sets whether the progress indicator is in determinate mode. 4879 * @param determinate Whether the indicator should be determinate. 4880 */ 4881 MDCCircularProgressFoundation.prototype.setDeterminate = function (determinate) { 4882 this.determinate = determinate; 4883 if (this.determinate) { 4884 this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS); 4885 this.setProgress(this.progress); 4886 } else { 4887 this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS); 4888 this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW); 4889 } 4890 }; 4891 MDCCircularProgressFoundation.prototype.isDeterminate = function () { 4892 return this.determinate; 4893 }; 4894 /** 4895 * Sets the current progress value. In indeterminate mode, this has no 4896 * visual effect but will be reflected if the indicator is switched to 4897 * determinate mode. 4898 * @param value The current progress value, which must be between 0 and 1. 4899 */ 4900 MDCCircularProgressFoundation.prototype.setProgress = function (value) { 4901 this.progress = value; 4902 if (this.determinate) { 4903 var unfilledArcLength = (1 - this.progress) * (2 * Math.PI * this.radius); 4904 this.adapter.setDeterminateCircleAttribute(constants_1.strings.STROKE_DASHOFFSET, "" + unfilledArcLength); 4905 this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString()); 4906 } 4907 }; 4908 MDCCircularProgressFoundation.prototype.getProgress = function () { 4909 return this.progress; 4910 }; 4911 /** 4912 * Shows the progress indicator. 4913 */ 4914 MDCCircularProgressFoundation.prototype.open = function () { 4915 this.closed = false; 4916 this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS); 4917 this.adapter.removeAttribute(constants_1.strings.ARIA_HIDDEN); 4918 }; 4919 /** 4920 * Hides the progress indicator 4921 */ 4922 MDCCircularProgressFoundation.prototype.close = function () { 4923 this.closed = true; 4924 this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS); 4925 this.adapter.setAttribute(constants_1.strings.ARIA_HIDDEN, 'true'); 4926 }; 4927 /** 4928 * @return Returns whether the progress indicator is hidden. 4929 */ 4930 MDCCircularProgressFoundation.prototype.isClosed = function () { 4931 return this.closed; 4932 }; 4933 return MDCCircularProgressFoundation; 4934}(foundation_1.MDCFoundation); 4935exports.MDCCircularProgressFoundation = MDCCircularProgressFoundation; 4936// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 4937exports.default = MDCCircularProgressFoundation; 4938 4939/***/ }), 4940
vendor: 8,852 bytes, lines 4941-5135
4941/***/ "./packages/mdc-circular-progress/index.ts": 4942/*!*************************************************!*\ 4943 !*** ./packages/mdc-circular-progress/index.ts ***! 4944 \*************************************************/ 4945/*! no static exports found */ 4946/***/ (function(module, exports, __webpack_require__) { 4947 4948"use strict"; 4949 4950/** 4951 * @license 4952 * Copyright 2020 Google Inc. 4953 * 4954 * Permission is hereby granted, free of charge, to any person obtaining a copy 4955 * of this software and associated documentation files (the "Software"), to deal 4956 * in the Software without restriction, including without limitation the rights 4957 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4958 * copies of the Software, and to permit persons to whom the Software is 4959 * furnished to do so, subject to the following conditions: 4960 * 4961 * The above copyright notice and this permission notice shall be included in 4962 * all copies or substantial portions of the Software. 4963 * 4964 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4965 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4966 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4967 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4968 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4969 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 4970 * THE SOFTWARE. 4971 */ 4972 4973var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 4974 if (k2 === undefined) k2 = k; 4975 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 4976 return m[k]; 4977 } }); 4978} : function (o, m, k, k2) { 4979 if (k2 === undefined) k2 = k; 4980 o[k2] = m[k]; 4981}); 4982var __exportStar = this && this.__exportStar || function (m, exports) { 4983 for (var p in m) { 4984 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 4985 } 4986}; 4987Object.defineProperty(exports, "__esModule", { value: true }); 4988__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-circular-progress/adapter.ts"), exports); 4989__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-circular-progress/component.ts"), exports); 4990__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-circular-progress/constants.ts"), exports); 4991__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-circular-progress/foundation.ts"), exports); 4992 4993/***/ }), 4994 4995/***/ "./packages/mdc-data-table/adapter.ts": 4996/*!********************************************!*\ 4997 !*** ./packages/mdc-data-table/adapter.ts ***! 4998 \********************************************/ 4999/*! no static exports found */ 5000/***/ (function(module, exports, __webpack_require__) { 5001 5002"use strict"; 5003 5004/** 5005 * @license 5006 * Copyright 2019 Google Inc. 5007 * 5008 * Permission is hereby granted, free of charge, to any person obtaining a copy 5009 * of this software and associated documentation files (the "Software"), to deal 5010 * in the Software without restriction, including without limitation the rights 5011 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5012 * copies of the Software, and to permit persons to whom the Software is 5013 * furnished to do so, subject to the following conditions: 5014 * 5015 * The above copyright notice and this permission notice shall be included in 5016 * all copies or substantial portions of the Software. 5017 * 5018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5021 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5022 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5023 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5024 * THE SOFTWARE. 5025 */ 5026 5027Object.defineProperty(exports, "__esModule", { value: true }); 5028 5029/***/ }), 5030 5031/***/ "./packages/mdc-data-table/component.ts": 5032/*!**********************************************!*\ 5033 !*** ./packages/mdc-data-table/component.ts ***! 5034 \**********************************************/ 5035/*! no static exports found */ 5036/***/ (function(module, exports, __webpack_require__) { 5037 5038"use strict"; 5039 5040/** 5041 * @license 5042 * Copyright 2019 Google Inc. 5043 * 5044 * Permission is hereby granted, free of charge, to any person obtaining a copy 5045 * of this software and associated documentation files (the "Software"), to deal 5046 * in the Software without restriction, including without limitation the rights 5047 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5048 * copies of the Software, and to permit persons to whom the Software is 5049 * furnished to do so, subject to the following conditions: 5050 * 5051 * The above copyright notice and this permission notice shall be included in 5052 * all copies or substantial portions of the Software. 5053 * 5054 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5055 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5056 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5057 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5058 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5059 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5060 * THE SOFTWARE. 5061 */ 5062 5063var __extends = this && this.__extends || function () { 5064 var _extendStatics = function extendStatics(d, b) { 5065 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 5066 d.__proto__ = b; 5067 } || function (d, b) { 5068 for (var p in b) { 5069 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 5070 } 5071 }; 5072 return _extendStatics(d, b); 5073 }; 5074 return function (d, b) { 5075 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 5076 _extendStatics(d, b); 5077 function __() { 5078 this.constructor = d; 5079 } 5080 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5081 }; 5082}(); 5083var __values = this && this.__values || function (o) { 5084 var s = typeof Symbol === "function" && Symbol.iterator, 5085 m = s && o[s], 5086 i = 0; 5087 if (m) return m.call(o); 5088 if (o && typeof o.length === "number") return { 5089 next: function next() { 5090 if (o && i >= o.length) o = void 0; 5091 return { value: o && o[i++], done: !o }; 5092 } 5093 }; 5094 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 5095}; 5096Object.defineProperty(exports, "__esModule", { value: true }); 5097exports.MDCDataTable = void 0; 5098var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 5099var component_2 = __webpack_require__(/*! @material/checkbox/component */ "./packages/mdc-checkbox/component.ts"); 5100var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 5101var component_3 = __webpack_require__(/*! @material/linear-progress/component */ "./packages/mdc-linear-progress/component.ts"); 5102var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"); 5103var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts"); 5104/** 5105 * Implementation of `MDCDataTableFoundation` 5106 */ 5107var MDCDataTable = /** @class */function (_super) { 5108 __extends(MDCDataTable, _super); 5109 function MDCDataTable() { 5110 return _super !== null && _super.apply(this, arguments) || this; 5111 } 5112 MDCDataTable.attachTo = function (root) { 5113 return new MDCDataTable(root); 5114 }; 5115 MDCDataTable.prototype.initialize = function (checkboxFactory) { 5116 if (checkboxFactory === void 0) { 5117 checkboxFactory = function checkboxFactory(el) { 5118 return new component_2.MDCCheckbox(el); 5119 }; 5120 } 5121 this.checkboxFactory = checkboxFactory; 5122 }; 5123 MDCDataTable.prototype.initialSyncWithDOM = function () { 5124 var _this = this; 5125 this.headerRow = this.root.querySelector("." + constants_1.cssClasses.HEADER_ROW); 5126 this.handleHeaderRowCheckboxChange = function () { 5127 _this.foundation.handleHeaderRowCheckboxChange(); 5128 }; 5129 this.headerRow.addEventListener('change', this.handleHeaderRowCheckboxChange); 5130 this.headerRowClickListener = function (event) { 5131 _this.handleHeaderRowClick(event); 5132 }; 5133 this.headerRow.addEventListener('click', this.headerRowClickListener); 5134 this.content = this.root.querySelector("." + constants_1.cssClasses.CONTENT); 5135 this.handle
vendor: 8,443 bytes, lines 5135-5312
5135RowCheckboxChange = function (event) { 5136 _this.foundation.handleRowCheckboxChange(event); 5137 }; 5138 this.content.addEventListener('change', this.handleRowCheckboxChange); 5139 this.layout(); 5140 }; 5141 /** 5142 * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. 5143 */ 5144 MDCDataTable.prototype.layout = function () { 5145 this.foundation.layout(); 5146 }; 5147 /** 5148 * @return Returns array of header row cell elements. 5149 */ 5150 MDCDataTable.prototype.getHeaderCells = function () { 5151 return [].slice.call(this.root.querySelectorAll(constants_1.selectors.HEADER_CELL)); 5152 }; 5153 /** 5154 * @return Returns array of row elements. 5155 */ 5156 MDCDataTable.prototype.getRows = function () { 5157 return this.foundation.getRows(); 5158 }; 5159 /** 5160 * @return Returns array of selected row ids. 5161 */ 5162 MDCDataTable.prototype.getSelectedRowIds = function () { 5163 return this.foundation.getSelectedRowIds(); 5164 }; 5165 /** 5166 * Sets selected row ids. Overwrites previously selected rows. 5167 * @param rowIds Array of row ids that needs to be selected. 5168 */ 5169 MDCDataTable.prototype.setSelectedRowIds = function (rowIds) { 5170 this.foundation.setSelectedRowIds(rowIds); 5171 }; 5172 /** 5173 * Shows progress indicator when data table is in loading state. 5174 */ 5175 MDCDataTable.prototype.showProgress = function () { 5176 this.getLinearProgress().open(); 5177 this.foundation.showProgress(); 5178 }; 5179 /** 5180 * Hides progress indicator after data table is finished loading. 5181 */ 5182 MDCDataTable.prototype.hideProgress = function () { 5183 this.foundation.hideProgress(); 5184 this.getLinearProgress().close(); 5185 }; 5186 MDCDataTable.prototype.destroy = function () { 5187 var e_1, _a; 5188 if (this.handleHeaderRowCheckboxChange) { 5189 this.headerRow.removeEventListener('change', this.handleHeaderRowCheckboxChange); 5190 } 5191 if (this.headerRowClickListener) { 5192 this.headerRow.removeEventListener('click', this.headerRowClickListener); 5193 } 5194 if (this.handleRowCheckboxChange) { 5195 this.content.removeEventListener('change', this.handleRowCheckboxChange); 5196 } 5197 if (this.headerRowCheckbox) { 5198 this.headerRowCheckbox.destroy(); 5199 } 5200 if (this.rowCheckboxList) { 5201 try { 5202 for (var _b = __values(this.rowCheckboxList), _c = _b.next(); !_c.done; _c = _b.next()) { 5203 var checkbox = _c.value; 5204 checkbox.destroy(); 5205 } 5206 } catch (e_1_1) { 5207 e_1 = { error: e_1_1 }; 5208 } finally { 5209 try { 5210 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 5211 } finally { 5212 if (e_1) throw e_1.error; 5213 } 5214 } 5215 } 5216 }; 5217 MDCDataTable.prototype.getDefaultFoundation = function () { 5218 var _this = this; 5219 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 5220 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 5221 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 5222 var adapter = { 5223 addClass: function addClass(className) { 5224 _this.root.classList.add(className); 5225 }, 5226 removeClass: function removeClass(className) { 5227 _this.root.classList.remove(className); 5228 }, 5229 getHeaderCellElements: function getHeaderCellElements() { 5230 return _this.getHeaderCells(); 5231 }, 5232 getHeaderCellCount: function getHeaderCellCount() { 5233 return _this.getHeaderCells().length; 5234 }, 5235 getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex(index, attribute) { 5236 return _this.getHeaderCells()[index].getAttribute(attribute); 5237 }, 5238 setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex(index, attribute, value) { 5239 _this.getHeaderCells()[index].setAttribute(attribute, value); 5240 }, 5241 setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex(index, className) { 5242 _this.getHeaderCells()[index].classList.add(className); 5243 }, 5244 removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex(index, className) { 5245 _this.getHeaderCells()[index].classList.remove(className); 5246 }, 5247 notifySortAction: function notifySortAction(data) { 5248 _this.emit(constants_1.events.SORTED, data, /** shouldBubble */true); 5249 }, 5250 getTableContainerHeight: function getTableContainerHeight() { 5251 var tableContainer = _this.root.querySelector("." + constants_1.cssClasses.TABLE_CONTAINER); 5252 if (!tableContainer) { 5253 throw new Error('MDCDataTable: Table container element not found.'); 5254 } 5255 return tableContainer.getBoundingClientRect().height; 5256 }, 5257 getTableHeaderHeight: function getTableHeaderHeight() { 5258 var tableHeader = _this.root.querySelector(constants_1.selectors.HEADER_ROW); 5259 if (!tableHeader) { 5260 throw new Error('MDCDataTable: Table header element not found.'); 5261 } 5262 return tableHeader.getBoundingClientRect().height; 5263 }, 5264 setProgressIndicatorStyles: function setProgressIndicatorStyles(styles) { 5265 var progressIndicator = _this.root.querySelector(constants_1.selectors.PROGRESS_INDICATOR); 5266 if (!progressIndicator) { 5267 throw new Error('MDCDataTable: Progress indicator element not found.'); 5268 } 5269 progressIndicator.style.setProperty('height', styles.height); 5270 progressIndicator.style.setProperty('top', styles.top); 5271 }, 5272 addClassAtRowIndex: function addClassAtRowIndex(rowIndex, className) { 5273 _this.getRows()[rowIndex].classList.add(className); 5274 }, 5275 getRowCount: function getRowCount() { 5276 return _this.getRows().length; 5277 }, 5278 getRowElements: function getRowElements() { 5279 return [].slice.call(_this.root.querySelectorAll(constants_1.selectors.ROW)); 5280 }, 5281 getRowIdAtIndex: function getRowIdAtIndex(rowIndex) { 5282 return _this.getRows()[rowIndex].getAttribute(constants_1.dataAttributes.ROW_ID); 5283 }, 5284 getRowIndexByChildElement: function getRowIndexByChildElement(el) { 5285 return _this.getRows().indexOf(ponyfill_1.closest(el, constants_1.selectors.ROW)); 5286 }, 5287 getSelectedRowCount: function getSelectedRowCount() { 5288 return _this.root.querySelectorAll(constants_1.selectors.ROW_SELECTED).length; 5289 }, 5290 isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked(rowIndex) { 5291 return _this.rowCheckboxList[rowIndex].checked; 5292 }, 5293 isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() { 5294 return _this.headerRowCheckbox.checked; 5295 }, 5296 isRowsSelectable: function isRowsSelectable() { 5297 return !!_this.root.querySelector(constants_1.selectors.ROW_CHECKBOX) || !!_this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX); 5298 }, 5299 notifyRowSelectionChanged: function notifyRowSelectionChanged(data) { 5300 _this.emit(constants_1.events.ROW_SELECTION_CHANGED, { 5301 row: _this.getRowByIndex(data.rowIndex), 5302 rowId: _this.getRowIdByIndex(data.rowIndex), 5303 rowIndex: data.rowIndex, 5304 selected: data.selected 5305 }, 5306 /** shouldBubble */true); 5307 }, 5308 notifySelectedAll: function notifySelectedAll() { 5309 _this.emit(constants_1.events.SELECTED_ALL, {}, /** shouldBubble */true); 5310 }, 5311 notifyUnselectedAll: function notifyUnselectedAll() { 5312 _this.emit(constants_1.events.UNSELECTED_ALL, {}
vendor: 4,270 bytes, lines 5312-5399
5312, /** shouldBubble */true); 5313 }, 5314 registerHeaderRowCheckbox: function registerHeaderRowCheckbox() { 5315 if (_this.headerRowCheckbox) { 5316 _this.headerRowCheckbox.destroy(); 5317 } 5318 var checkboxEl = _this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX); 5319 _this.headerRowCheckbox = _this.checkboxFactory(checkboxEl); 5320 }, 5321 registerRowCheckboxes: function registerRowCheckboxes() { 5322 if (_this.rowCheckboxList) { 5323 _this.rowCheckboxList.forEach(function (checkbox) { 5324 checkbox.destroy(); 5325 }); 5326 } 5327 _this.rowCheckboxList = []; 5328 _this.getRows().forEach(function (rowEl) { 5329 var checkbox = _this.checkboxFactory(rowEl.querySelector(constants_1.selectors.ROW_CHECKBOX)); 5330 _this.rowCheckboxList.push(checkbox); 5331 }); 5332 }, 5333 removeClassAtRowIndex: function removeClassAtRowIndex(rowIndex, className) { 5334 _this.getRows()[rowIndex].classList.remove(className); 5335 }, 5336 setAttributeAtRowIndex: function setAttributeAtRowIndex(rowIndex, attr, value) { 5337 _this.getRows()[rowIndex].setAttribute(attr, value); 5338 }, 5339 setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked(checked) { 5340 _this.headerRowCheckbox.checked = checked; 5341 }, 5342 setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate(indeterminate) { 5343 _this.headerRowCheckbox.indeterminate = indeterminate; 5344 }, 5345 setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex(rowIndex, checked) { 5346 _this.rowCheckboxList[rowIndex].checked = checked; 5347 }, 5348 setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue) { 5349 var headerCell = _this.getHeaderCells()[columnIndex]; 5350 var sortStatusLabel = headerCell.querySelector(constants_1.selectors.SORT_STATUS_LABEL); 5351 if (!sortStatusLabel) return; 5352 sortStatusLabel.textContent = _this.getSortStatusMessageBySortValue(sortValue); 5353 } 5354 }; 5355 return new foundation_1.MDCDataTableFoundation(adapter); 5356 }; 5357 MDCDataTable.prototype.getRowByIndex = function (index) { 5358 return this.getRows()[index]; 5359 }; 5360 MDCDataTable.prototype.getRowIdByIndex = function (index) { 5361 return this.getRowByIndex(index).getAttribute(constants_1.dataAttributes.ROW_ID); 5362 }; 5363 MDCDataTable.prototype.handleHeaderRowClick = function (event) { 5364 var headerCell = ponyfill_1.closest(event.target, constants_1.selectors.HEADER_CELL_WITH_SORT); 5365 if (!headerCell) { 5366 return; 5367 } 5368 var columnId = headerCell.getAttribute(constants_1.dataAttributes.COLUMN_ID); 5369 var columnIndex = this.getHeaderCells().indexOf(headerCell); 5370 if (columnIndex === -1) { 5371 return; 5372 } 5373 this.foundation.handleSortAction({ columnId: columnId, columnIndex: columnIndex, headerCell: headerCell }); 5374 }; 5375 MDCDataTable.prototype.getSortStatusMessageBySortValue = function (sortValue) { 5376 switch (sortValue) { 5377 case constants_1.SortValue.ASCENDING: 5378 return constants_1.messages.SORTED_IN_ASCENDING; 5379 case constants_1.SortValue.DESCENDING: 5380 return constants_1.messages.SORTED_IN_DESCENDING; 5381 default: 5382 return ''; 5383 } 5384 }; 5385 MDCDataTable.prototype.getLinearProgressElement = function () { 5386 var el = this.root.querySelector("." + constants_1.cssClasses.LINEAR_PROGRESS); 5387 if (!el) { 5388 throw new Error('MDCDataTable: linear progress element is not found.'); 5389 } 5390 return el; 5391 }; 5392 MDCDataTable.prototype.getLinearProgress = function () { 5393 if (!this.linearProgress) { 5394 var el = this.getLinearProgressElement(); 5395 this.linearProgress = new component_3.MDCLinearProgress(el); 5396 } 5397 return this.linearProgress; 5398 }; 5399
5399return MDCDataTable; 5400}(component_1.MDCComponent); 5401exports.MDCDataTable = MDCDataTable; 5402 5403/***/ }), 5404
5405/***/ "./packages/mdc-data-table/constants.ts": 5406/*!**********************************************!*\ 5407 !*** ./packages/mdc-data-table/constants.ts ***! 5408 \**********************************************/ 5409/*! no static exports found */ 5410/***/ (function(module, exports, __webpack_require__) { 5411 5412"use strict"; 5413 5414/** 5415 * @license 5416 * Copyright 2019 Google Inc. 5417 * 5418 * Permission is hereby granted, free of charge, to any person obtaining a copy 5419 * of this software and associated documentation files (the "Software"), to deal 5420 * in the Software without restriction, including without limitation the rights 5421 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5422 * copies of the Software, and to permit persons to whom the Software is 5423 * furnished to do so, subject to the following conditions: 5424 * 5425 * The above copyright notice and this permission notice shall be included in 5426 * all copies or substantial portions of the Software. 5427 * 5428 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5429 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5430 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5431 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5432 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5433 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5434 * THE SOFTWARE. 5435 */ 5436 5437Object.defineProperty(exports, "__esModule", { value: true }); 5438exports.events = exports.SortValue = exports.strings = exports.messages = exports.selectors = exports.dataAttributes = exports.attributes = exports.cssClasses = void 0; 5439/** 5440 * CSS class names used in component. 5441 */ 5442exports.cssClasses = { 5443 CELL: 'mdc-data-table__cell', 5444 CELL_NUMERIC: 'mdc-data-table__cell--numeric', 5445 CONTENT: 'mdc-data-table__content', 5446 HEADER_CELL: 'mdc-data-table__header-cell', 5447 HEADER_CELL_LABEL: 'mdc-data-table__header-cell-label', 5448 HEADER_CELL_SORTED: 'mdc-data-table__header-cell--sorted', 5449 HEADER_CELL_SORTED_DESCENDING: 'mdc-data-table__header-cell--sorted-descending', 5450 HEADER_CELL_WITH_SORT: 'mdc-data-table__header-cell--with-sort', 5451 HEADER_CELL_WRAPPER: 'mdc-data-table__header-cell-wrapper', 5452 HEADER_ROW: 'mdc-data-table__header-row', 5453 HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox', 5454 IN_PROGRESS: 'mdc-data-table--in-progress', 5455 LINEAR_PROGRESS: 'mdc-data-table__linear-progress', 5456 PAGINATION_ROWS_PER_PAGE_LABEL: 'mdc-data-table__pagination-rows-per-page-label', 5457 PAGINATION_ROWS_PER_PAGE_SELECT: 'mdc-data-table__pagination-rows-per-page-select', 5458 PROGRESS_INDICATOR: 'mdc-data-table__progress-indicator', 5459 ROOT: 'mdc-data-table', 5460 ROW: 'mdc-data-table__row', 5461 ROW_CHECKBOX: 'mdc-data-table__row-checkbox', 5462 ROW_SELECTED: 'mdc-data-table__row--selected', 5463 SORT_ICON_BUTTON: 'mdc-data-table__sort-icon-button', 5464 SORT_STATUS_LABEL: 'mdc-data-table__sort-status-label', 5465 TABLE_CONTAINER: 'mdc-data-table__table-container' 5466}; 5467/** 5468 * DOM attributes used in component. 5469 */ 5470exports.attributes = { 5471 ARIA_SELECTED: 'aria-selected', 5472 ARIA_SORT: 'aria-sort' 5473}; 5474/** 5475 * List of data attributes used in component. 5476 */ 5477exports.dataAttributes = { 5478 COLUMN_ID: 'data-column-id', 5479 ROW_ID: 'data-row-id' 5480}; 5481/** 5482 * CSS selectors used in component. 5483 */ 5484exports.selectors = { 5485 CONTENT: "." + exports.cssClasses.CONTENT, 5486 HEADER_CELL: "." + exports.cssClasses.HEADER_CELL, 5487 HEADER_CELL_WITH_SORT: "." + exports.cssClasses.HEADER_CELL_WITH_SORT, 5488 HEADER_ROW: "." + exports.cssClasses.HEADER_ROW, 5489 HEADER_ROW_CHECKBOX: "." + exports.cssClasses.HEADER_ROW_CHECKBOX, 5490 PROGRESS_INDICATOR: "." + exports.cssClasses.PROGRESS_INDICATOR, 5491 ROW: "." + exports.cssClasses.ROW, 5492 ROW_CHECKBOX: "." + exports.cssClasses.ROW_CHECKBOX, 5493 ROW_SELECTED: "." + exports.cssClasses.ROW_SELECTED, 5494 SORT_ICON_BUTTON: "." + exports.cssClasses.SORT_ICON_BUTTON, 5495 SORT_STATUS_LABEL: "." + exports.cssClasses.SORT_STATUS_LABEL 5496}; 5497/** 5498 * Messages used in component. 5499 */ 5500exports.messages = { 5501 SORTED_IN_DESCENDING: 'Sorted in descending order', 5502 SORTED_IN_ASCENDING: 'Sorted in ascending order' 5503}; 5504/** 5505 * Attributes and selectors used in component. 5506 * @deprecated Use `attributes`, `dataAttributes` and `selectors` instead. 5507 */ 5508exports.strings = { 5509 ARIA_SELECTED: exports.attributes.ARIA_SELECTED, 5510 ARIA_SORT: exports.attributes.ARIA_SORT, 5511 DATA_ROW_ID_ATTR: exports.dataAttributes.ROW_ID, 5512 HEADER_ROW_CHECKBOX_SELECTOR: exports.selectors.HEADER_ROW_CHECKBOX, 5513 ROW_CHECKBOX_SELECTOR: exports.selectors.ROW_CHECKBOX, 5514 ROW_SELECTED_SELECTOR: exports.selectors.ROW_SELECTED, 5515 ROW_SELECTOR: exports.selectors.ROW 5516}; 5517/** 5518 * Sort values defined by ARIA. 5519 * See https://www.w3.org/WAI/PF/aria/states_and_properties#aria-sort 5520 */ 5521var SortValue; 5522(function (SortValue) { 5523 // Items are sorted in ascending order by this column. 5524 SortValue["ASCENDING"] = "ascending"; 5525 // Items are sorted in descending order by this column. 5526 SortValue["DESCENDING"] = "descending"; 5527 // There is no defined sort applied to the column. 5528 SortValue["NONE"] = "none"; 5529 // A sort algorithm other than ascending or descending has been applied. 5530 SortValue["OTHER"] = "other"; 5531})(SortValue = exports.SortValue || (exports.SortValue = {})); 5532/** 5533 * Event names used in component. 5534 */ 5535exports.events = { 5536 ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged', 5537 SELECTED_ALL: 'MDCDataTable:selectedAll', 5538 UNSELECTED_ALL: 'MDCDataTable:unselectedAll', 5539 SORTED: 'MDCDataTable:sorted
vendor: 9,098 bytes, lines 5539-5764
5539' 5540}; 5541 5542/***/ }), 5543 5544/***/ "./packages/mdc-data-table/foundation.ts": 5545/*!***********************************************!*\ 5546 !*** ./packages/mdc-data-table/foundation.ts ***! 5547 \***********************************************/ 5548/*! no static exports found */ 5549/***/ (function(module, exports, __webpack_require__) { 5550 5551"use strict"; 5552 5553/** 5554 * @license 5555 * Copyright 2019 Google Inc. 5556 * 5557 * Permission is hereby granted, free of charge, to any person obtaining a copy 5558 * of this software and associated documentation files (the "Software"), to deal 5559 * in the Software without restriction, including without limitation the rights 5560 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5561 * copies of the Software, and to permit persons to whom the Software is 5562 * furnished to do so, subject to the following conditions: 5563 * 5564 * The above copyright notice and this permission notice shall be included in 5565 * all copies or substantial portions of the Software. 5566 * 5567 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5568 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 5569 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 5570 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5571 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 5572 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 5573 * THE SOFTWARE. 5574 */ 5575 5576var __extends = this && this.__extends || function () { 5577 var _extendStatics = function extendStatics(d, b) { 5578 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 5579 d.__proto__ = b; 5580 } || function (d, b) { 5581 for (var p in b) { 5582 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 5583 } 5584 }; 5585 return _extendStatics(d, b); 5586 }; 5587 return function (d, b) { 5588 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 5589 _extendStatics(d, b); 5590 function __() { 5591 this.constructor = d; 5592 } 5593 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5594 }; 5595}(); 5596var __assign = this && this.__assign || function () { 5597 __assign = Object.assign || function (t) { 5598 for (var s, i = 1, n = arguments.length; i < n; i++) { 5599 s = arguments[i]; 5600 for (var p in s) { 5601 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 5602 } 5603 } 5604 return t; 5605 }; 5606 return __assign.apply(this, arguments); 5607}; 5608var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 5609 function adopt(value) { 5610 return value instanceof P ? value : new P(function (resolve) { 5611 resolve(value); 5612 }); 5613 } 5614 return new (P || (P = Promise))(function (resolve, reject) { 5615 function fulfilled(value) { 5616 try { 5617 step(generator.next(value)); 5618 } catch (e) { 5619 reject(e); 5620 } 5621 } 5622 function rejected(value) { 5623 try { 5624 step(generator["throw"](value)); 5625 } catch (e) { 5626 reject(e); 5627 } 5628 } 5629 function step(result) { 5630 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 5631 } 5632 step((generator = generator.apply(thisArg, _arguments || [])).next()); 5633 }); 5634}; 5635var __generator = this && this.__generator || function (thisArg, body) { 5636 var _ = { label: 0, sent: function sent() { 5637 if (t[0] & 1) throw t[1];return t[1]; 5638 }, trys: [], ops: [] }, 5639 f, 5640 y, 5641 t, 5642 g; 5643 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { 5644 return this; 5645 }), g; 5646 function verb(n) { 5647 return function (v) { 5648 return step([n, v]); 5649 }; 5650 } 5651 function step(op) { 5652 if (f) throw new TypeError("Generator is already executing."); 5653 while (_) { 5654 try { 5655 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; 5656 if (y = 0, t) op = [op[0] & 2, t.value]; 5657 switch (op[0]) { 5658 case 0:case 1: 5659 t = op;break; 5660 case 4: 5661 _.label++;return { value: op[1], done: false }; 5662 case 5: 5663 _.label++;y = op[1];op = [0];continue; 5664 case 7: 5665 op = _.ops.pop();_.trys.pop();continue; 5666 default: 5667 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { 5668 _ = 0;continue; 5669 } 5670 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { 5671 _.label = op[1];break; 5672 } 5673 if (op[0] === 6 && _.label < t[1]) { 5674 _.label = t[1];t = op;break; 5675 } 5676 if (t && _.label < t[2]) { 5677 _.label = t[2];_.ops.push(op);break; 5678 } 5679 if (t[2]) _.ops.pop(); 5680 _.trys.pop();continue; 5681 } 5682 op = body.call(thisArg, _); 5683 } catch (e) { 5684 op = [6, e];y = 0; 5685 } finally { 5686 f = t = 0; 5687 } 5688 }if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true }; 5689 } 5690}; 5691Object.defineProperty(exports, "__esModule", { value: true }); 5692exports.MDCDataTableFoundation = void 0; 5693var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 5694var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"); 5695/** 5696 * The Foundation of data table component containing pure business logic, any 5697 * logic requiring DOM manipulation are delegated to adapter methods. 5698 */ 5699var MDCDataTableFoundation = /** @class */function (_super) { 5700 __extends(MDCDataTableFoundation, _super); 5701 function MDCDataTableFoundation(adapter) { 5702 return _super.call(this, __assign(__assign({}, MDCDataTableFoundation.defaultAdapter), adapter)) || this; 5703 } 5704 Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", { 5705 get: function get() { 5706 return { 5707 addClass: function addClass() { 5708 return undefined; 5709 }, 5710 addClassAtRowIndex: function addClassAtRowIndex() { 5711 return undefined; 5712 }, 5713 getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex() { 5714 return ''; 5715 }, 5716 getHeaderCellCount: function getHeaderCellCount() { 5717 return 0; 5718 }, 5719 getHeaderCellElements: function getHeaderCellElements() { 5720 return []; 5721 }, 5722 getRowCount: function getRowCount() { 5723 return 0; 5724 }, 5725 getRowElements: function getRowElements() { 5726 return []; 5727 }, 5728 getRowIdAtIndex: function getRowIdAtIndex() { 5729 return ''; 5730 }, 5731 getRowIndexByChildElement: function getRowIndexByChildElement() { 5732 return 0; 5733 }, 5734 getSelectedRowCount: function getSelectedRowCount() { 5735 return 0; 5736 }, 5737 getTableContainerHeight: function getTableContainerHeight() { 5738 return 0; 5739 }, 5740 getTableHeaderHeight: function getTableHeaderHeight() { 5741 return 0; 5742 }, 5743 isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked() { 5744 return false; 5745 }, 5746 isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() { 5747 return false; 5748 }, 5749 isRowsSelectable: function isRowsSelectable() { 5750 return false; 5751 }, 5752 notifyRowSelectionChanged: function notifyRowSelectionChanged() { 5753 return undefined; 5754 }, 5755 notifySelectedAll: function notifySelectedAll() { 5756 return undefined; 5757 }, 5758 notifySortAction: function notifySortAction() { 5759 return undefined; 5760 }, 5761 notifyUnselectedAll: function notifyUnselectedAll() { 5762 return undefined; 5763 }, 5764
5764registerHeaderRowCheckbox: function registerHeaderRowCheckbox() { 5765 return undefined; 5766 }, 5767 registerRowCheckboxes: function registerRowCheckboxes() { 5768 return undefined; 5769 }, 5770 removeClass: function removeClass() { 5771 return undefined; 5772 }, 5773 removeClassAtRowIndex: function removeClassAtRowIndex() { 5774 return undefined; 5775 }, 5776 removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex() { 5777 return undefined; 5778 }, 5779 setAttributeAtRowIndex: function setAttributeAtRowIndex() { 5780 return undefined; 5781 }, 5782 setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex() { 5783 return undefined; 5784 }, 5785 setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex() { 5786 return undefined; 5787 }, 5788 setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked() { 5789 return undefined; 5790 }, 5791 setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate() { 5792 return undefined; 5793 }, 5794 setProgressIndicatorStyles: function setProgressIndicatorStyles() { 5795 return undefined; 5796 }, 5797 setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex() { 5798 return undefined; 5799 }, 5800 setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex() { 5801 return undefined; 5802 } 5803 }; 5804 }, 5805 enumerable: false, 5806 configurable: true 5807 }); 5808 /** 5809 * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. 5810 * Use this if registering checkbox is synchronous. 5811 */ 5812 MDCDataTableFoundation.prototype.layout = function () { 5813 if (this.adapter.isRowsSelectable()) { 5814 this.adapter.registerHeaderRowCheckbox(); 5815 this.adapter.registerRowCheckboxes(); 5816 this.setHeaderRowCheckboxState(); 5817 } 5818 }; 5819 /** 5820 * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. 5821 * Use this if registering checkbox is
vendor: 41,332 bytes, lines 5821-6763
5821 asynchronous. 5822 */ 5823 MDCDataTableFoundation.prototype.layoutAsync = function () { 5824 return __awaiter(this, void 0, void 0, function () { 5825 return __generator(this, function (_a) { 5826 switch (_a.label) { 5827 case 0: 5828 if (!this.adapter.isRowsSelectable()) return [3 /*break*/, 3]; 5829 return [4 /*yield*/, this.adapter.registerHeaderRowCheckbox()]; 5830 case 1: 5831 _a.sent(); 5832 return [4 /*yield*/, this.adapter.registerRowCheckboxes()]; 5833 case 2: 5834 _a.sent(); 5835 this.setHeaderRowCheckboxState(); 5836 _a.label = 3; 5837 case 3: 5838 return [2 /*return*/]; 5839 } 5840 }); 5841 }); 5842 }; 5843 /** 5844 * @return Returns array of row elements. 5845 */ 5846 MDCDataTableFoundation.prototype.getRows = function () { 5847 return this.adapter.getRowElements(); 5848 }; 5849 /** 5850 * @return Array of header cell elements. 5851 */ 5852 MDCDataTableFoundation.prototype.getHeaderCells = function () { 5853 return this.adapter.getHeaderCellElements(); 5854 }; 5855 /** 5856 * Sets selected row ids. Overwrites previously selected rows. 5857 * @param rowIds Array of row ids that needs to be selected. 5858 */ 5859 MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) { 5860 for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { 5861 var rowId = this.adapter.getRowIdAtIndex(rowIndex); 5862 var isSelected = false; 5863 if (rowId && rowIds.indexOf(rowId) >= 0) { 5864 isSelected = true; 5865 } 5866 this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isSelected); 5867 this.selectRowAtIndex(rowIndex, isSelected); 5868 } 5869 this.setHeaderRowCheckboxState(); 5870 }; 5871 /** 5872 * @return Returns array of all row ids. 5873 */ 5874 MDCDataTableFoundation.prototype.getRowIds = function () { 5875 var rowIds = []; 5876 for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { 5877 rowIds.push(this.adapter.getRowIdAtIndex(rowIndex)); 5878 } 5879 return rowIds; 5880 }; 5881 /** 5882 * @return Returns array of selected row ids. 5883 */ 5884 MDCDataTableFoundation.prototype.getSelectedRowIds = function () { 5885 var selectedRowIds = []; 5886 for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { 5887 if (this.adapter.isCheckboxAtRowIndexChecked(rowIndex)) { 5888 selectedRowIds.push(this.adapter.getRowIdAtIndex(rowIndex)); 5889 } 5890 } 5891 return selectedRowIds; 5892 }; 5893 /** 5894 * Handles header row checkbox change event. 5895 */ 5896 MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () { 5897 var isHeaderChecked = this.adapter.isHeaderRowCheckboxChecked(); 5898 for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { 5899 this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked); 5900 this.selectRowAtIndex(rowIndex, isHeaderChecked); 5901 } 5902 if (isHeaderChecked) { 5903 this.adapter.notifySelectedAll(); 5904 } else { 5905 this.adapter.notifyUnselectedAll(); 5906 } 5907 }; 5908 /** 5909 * Handles change event originated from row checkboxes. 5910 */ 5911 MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) { 5912 var rowIndex = this.adapter.getRowIndexByChildElement(event.target); 5913 if (rowIndex === -1) { 5914 return; 5915 } 5916 var selected = this.adapter.isCheckboxAtRowIndexChecked(rowIndex); 5917 this.selectRowAtIndex(rowIndex, selected); 5918 this.setHeaderRowCheckboxState(); 5919 var rowId = this.adapter.getRowIdAtIndex(rowIndex); 5920 this.adapter.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected }); 5921 }; 5922 /** 5923 * Handles sort action on sortable header cell. 5924 */ 5925 MDCDataTableFoundation.prototype.handleSortAction = function (eventData) { 5926 var columnId = eventData.columnId, 5927 columnIndex = eventData.columnIndex, 5928 headerCell = eventData.headerCell; 5929 // Reset sort attributes / classes on other header cells. 5930 for (var index = 0; index < this.adapter.getHeaderCellCount(); index++) { 5931 if (index === columnIndex) { 5932 continue; 5933 } 5934 this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED); 5935 this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING); 5936 this.adapter.setAttributeByHeaderCellIndex(index, constants_1.strings.ARIA_SORT, constants_1.SortValue.NONE); 5937 this.adapter.setSortStatusLabelByHeaderCellIndex(index, constants_1.SortValue.NONE); 5938 } 5939 // Set appropriate sort attributes / classes on target header cell. 5940 this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED); 5941 var currentSortValue = this.adapter.getAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT); 5942 var sortValue = constants_1.SortValue.NONE; 5943 // Set to descending if sorted on ascending order. 5944 if (currentSortValue === constants_1.SortValue.ASCENDING) { 5945 this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING); 5946 this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.DESCENDING); 5947 sortValue = constants_1.SortValue.DESCENDING; 5948 // Set to ascending if sorted on descending order. 5949 } else if (currentSortValue === constants_1.SortValue.DESCENDING) { 5950 this.adapter.removeClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING); 5951 this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING); 5952 sortValue = constants_1.SortValue.ASCENDING; 5953 } else { 5954 // Set to ascending by default when not sorted. 5955 this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING); 5956 sortValue = constants_1.SortValue.ASCENDING; 5957 } 5958 this.adapter.setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue); 5959 this.adapter.notifySortAction({ 5960 columnId: columnId, 5961 columnIndex: columnIndex, 5962 headerCell: headerCell, 5963 sortValue: sortValue 5964 }); 5965 }; 5966 /** 5967 * Shows progress indicator blocking only the table body content when in 5968 * loading state. 5969 */ 5970 MDCDataTableFoundation.prototype.showProgress = function () { 5971 var tableHeaderHeight = this.adapter.getTableHeaderHeight(); 5972 // Calculate the height of table content (Not scroll content) excluding 5973 // header row height. 5974 var height = this.adapter.getTableContainerHeight() - tableHeaderHeight; 5975 var top = tableHeaderHeight; 5976 this.adapter.setProgressIndicatorStyles({ 5977 height: height + "px", 5978 top: top + "px" 5979 }); 5980 this.adapter.addClass(constants_1.cssClasses.IN_PROGRESS); 5981 }; 5982 /** 5983 * Hides progress indicator when data table is finished loading. 5984 */ 5985 MDCDataTableFoundation.prototype.hideProgress = function () { 5986 this.adapter.removeClass(constants_1.cssClasses.IN_PROGRESS); 5987 }; 5988 /** 5989 * Updates header row checkbox state based on number of rows selected. 5990 */ 5991 MDCDataTableFoundation.prototype.setHeaderRowCheckboxState = function () { 5992 if (this.adapter.getSelectedRowCount() === 0) { 5993 this.adapter.setHeaderRowCheckboxChecked(false); 5994 this.adapter.setHeaderRowCheckboxIndeterminate(false); 5995 } else if (this.adapter.getSelectedRowCount() === this.adapter.getRowCount()) { 5996 this.adapter.setHeaderRowCheckboxChecked(true); 5997 this.adapter.setHeaderRowCheckboxIndeterminate(false); 5998 } else { 5999 this.adapter.setHeaderRowCheckboxIndeterminate(true); 6000 this.adapter.setHeaderRowCheckboxChecked(false); 6001 } 6002 }; 6003 /** 6004 * Sets the attributes of row element based on selection state. 6005 */ 6006 MDCDataTableFoundation.prototype.selectRowAtIndex = function (rowIndex, selected) { 6007 if (selected) { 6008 this.adapter.addClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED); 6009 this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'true'); 6010 } else { 6011 this.adapter.removeClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED); 6012 this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'false'); 6013 } 6014 }; 6015 return MDCDataTableFoundation; 6016}(foundation_1.MDCFoundation); 6017exports.MDCDataTableFoundation = MDCDataTableFoundation; 6018 6019/***/ }), 6020 6021/***/ "./packages/mdc-data-table/index.ts": 6022/*!******************************************!*\ 6023 !*** ./packages/mdc-data-table/index.ts ***! 6024 \******************************************/ 6025/*! no static exports found */ 6026/***/ (function(module, exports, __webpack_require__) { 6027 6028"use strict"; 6029 6030/** 6031 * @license 6032 * Copyright 2019 Google Inc. 6033 * 6034 * Permission is hereby granted, free of charge, to any person obtaining a copy 6035 * of this software and associated documentation files (the "Software"), to deal 6036 * in the Software without restriction, including without limitation the rights 6037 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6038 * copies of the Software, and to permit persons to whom the Software is 6039 * furnished to do so, subject to the following conditions: 6040 * 6041 * The above copyright notice and this permission notice shall be included in 6042 * all copies or substantial portions of the Software. 6043 * 6044 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6045 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6046 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6047 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6048 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6049 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6050 * THE SOFTWARE. 6051 */ 6052 6053var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 6054 if (k2 === undefined) k2 = k; 6055 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 6056 return m[k]; 6057 } }); 6058} : function (o, m, k, k2) { 6059 if (k2 === undefined) k2 = k; 6060 o[k2] = m[k]; 6061}); 6062var __exportStar = this && this.__exportStar || function (m, exports) { 6063 for (var p in m) { 6064 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 6065 } 6066}; 6067Object.defineProperty(exports, "__esModule", { value: true }); 6068__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-data-table/adapter.ts"), exports); 6069__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-data-table/component.ts"), exports); 6070__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts"), exports); 6071__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"), exports); 6072__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-data-table/types.ts"), exports); 6073 6074/***/ }), 6075 6076/***/ "./packages/mdc-data-table/types.ts": 6077/*!******************************************!*\ 6078 !*** ./packages/mdc-data-table/types.ts ***! 6079 \******************************************/ 6080/*! no static exports found */ 6081/***/ (function(module, exports, __webpack_require__) { 6082 6083"use strict"; 6084 6085/** 6086 * @license 6087 * Copyright 2019 Google Inc. 6088 * 6089 * Permission is hereby granted, free of charge, to any person obtaining a copy 6090 * of this software and associated documentation files (the "Software"), to deal 6091 * in the Software without restriction, including without limitation the rights 6092 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6093 * copies of the Software, and to permit persons to whom the Software is 6094 * furnished to do so, subject to the following conditions: 6095 * 6096 * The above copyright notice and this permission notice shall be included in 6097 * all copies or substantial portions of the Software. 6098 * 6099 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6100 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6101 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6102 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6103 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6104 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6105 * THE SOFTWARE. 6106 */ 6107 6108Object.defineProperty(exports, "__esModule", { value: true }); 6109 6110/***/ }), 6111 6112/***/ "./packages/mdc-dialog/adapter.ts": 6113/*!****************************************!*\ 6114 !*** ./packages/mdc-dialog/adapter.ts ***! 6115 \****************************************/ 6116/*! no static exports found */ 6117/***/ (function(module, exports, __webpack_require__) { 6118 6119"use strict"; 6120 6121/** 6122 * @license 6123 * Copyright 2018 Google Inc. 6124 * 6125 * Permission is hereby granted, free of charge, to any person obtaining a copy 6126 * of this software and associated documentation files (the "Software"), to deal 6127 * in the Software without restriction, including without limitation the rights 6128 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6129 * copies of the Software, and to permit persons to whom the Software is 6130 * furnished to do so, subject to the following conditions: 6131 * 6132 * The above copyright notice and this permission notice shall be included in 6133 * all copies or substantial portions of the Software. 6134 * 6135 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6136 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6137 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6138 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6139 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6140 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6141 * THE SOFTWARE. 6142 */ 6143 6144Object.defineProperty(exports, "__esModule", { value: true }); 6145 6146/***/ }), 6147 6148/***/ "./packages/mdc-dialog/component.ts": 6149/*!******************************************!*\ 6150 !*** ./packages/mdc-dialog/component.ts ***! 6151 \******************************************/ 6152/*! no static exports found */ 6153/***/ (function(module, exports, __webpack_require__) { 6154 6155"use strict"; 6156 6157/** 6158 * @license 6159 * Copyright 2017 Google Inc. 6160 * 6161 * Permission is hereby granted, free of charge, to any person obtaining a copy 6162 * of this software and associated documentation files (the "Software"), to deal 6163 * in the Software without restriction, including without limitation the rights 6164 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6165 * copies of the Software, and to permit persons to whom the Software is 6166 * furnished to do so, subject to the following conditions: 6167 * 6168 * The above copyright notice and this permission notice shall be included in 6169 * all copies or substantial portions of the Software. 6170 * 6171 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6172 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6173 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6174 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6175 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6176 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6177 * THE SOFTWARE. 6178 */ 6179 6180var __extends = this && this.__extends || function () { 6181 var _extendStatics = function extendStatics(d, b) { 6182 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 6183 d.__proto__ = b; 6184 } || function (d, b) { 6185 for (var p in b) { 6186 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 6187 } 6188 }; 6189 return _extendStatics(d, b); 6190 }; 6191 return function (d, b) { 6192 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 6193 _extendStatics(d, b); 6194 function __() { 6195 this.constructor = d; 6196 } 6197 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 6198 }; 6199}(); 6200var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 6201 if (k2 === undefined) k2 = k; 6202 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 6203 return m[k]; 6204 } }); 6205} : function (o, m, k, k2) { 6206 if (k2 === undefined) k2 = k; 6207 o[k2] = m[k]; 6208}); 6209var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 6210 Object.defineProperty(o, "default", { enumerable: true, value: v }); 6211} : function (o, v) { 6212 o["default"] = v; 6213}); 6214var __importStar = this && this.__importStar || function (mod) { 6215 if (mod && mod.__esModule) return mod; 6216 var result = {}; 6217 if (mod != null) for (var k in mod) { 6218 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 6219 }__setModuleDefault(result, mod); 6220 return result; 6221}; 6222var __values = this && this.__values || function (o) { 6223 var s = typeof Symbol === "function" && Symbol.iterator, 6224 m = s && o[s], 6225 i = 0; 6226 if (m) return m.call(o); 6227 if (o && typeof o.length === "number") return { 6228 next: function next() { 6229 if (o && i >= o.length) o = void 0; 6230 return { value: o && o[i++], done: !o }; 6231 } 6232 }; 6233 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 6234}; 6235Object.defineProperty(exports, "__esModule", { value: true }); 6236exports.MDCDialog = void 0; 6237var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 6238var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts"); 6239var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 6240var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 6241var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts"); 6242var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts")); 6243var strings = foundation_1.MDCDialogFoundation.strings; 6244var MDCDialog = /** @class */function (_super) { 6245 __extends(MDCDialog, _super); 6246 function MDCDialog() { 6247 return _super !== null && _super.apply(this, arguments) || this; 6248 } 6249 Object.defineProperty(MDCDialog.prototype, "isOpen", { 6250 get: function get() { 6251 return this.foundation.isOpen(); 6252 }, 6253 enumerable: false, 6254 configurable: true 6255 }); 6256 Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", { 6257 get: function get() { 6258 return this.foundation.getEscapeKeyAction(); 6259 }, 6260 set: function set(action) { 6261 this.foundation.setEscapeKeyAction(action); 6262 }, 6263 enumerable: false, 6264 configurable: true 6265 }); 6266 Object.defineProperty(MDCDialog.prototype, "scrimClickAction", { 6267 get: function get() { 6268 return this.foundation.getScrimClickAction(); 6269 }, 6270 set: function set(action) { 6271 this.foundation.setScrimClickAction(action); 6272 }, 6273 enumerable: false, 6274 configurable: true 6275 }); 6276 Object.defineProperty(MDCDialog.prototype, "autoStackButtons", { 6277 get: function get() { 6278 return this.foundation.getAutoStackButtons(); 6279 }, 6280 set: function set(autoStack) { 6281 this.foundation.setAutoStackButtons(autoStack); 6282 }, 6283 enumerable: false, 6284 configurable: true 6285 }); 6286 MDCDialog.attachTo = function (root) { 6287 return new MDCDialog(root); 6288 }; 6289 MDCDialog.prototype.initialize = function (focusTrapFactory) { 6290 var e_1, _a; 6291 if (focusTrapFactory === void 0) { 6292 focusTrapFactory = function focusTrapFactory(el, focusOptions) { 6293 return new focus_trap_1.FocusTrap(el, focusOptions); 6294 }; 6295 } 6296 var container = this.root.querySelector(strings.CONTAINER_SELECTOR); 6297 if (!container) { 6298 throw new Error("Dialog component requires a " + strings.CONTAINER_SELECTOR + " container element"); 6299 } 6300 this.container = container; 6301 this.content = this.root.querySelector(strings.CONTENT_SELECTOR); 6302 this.buttons = [].slice.call(this.root.querySelectorAll(strings.BUTTON_SELECTOR)); 6303 this.defaultButton = this.root.querySelector("[" + strings.BUTTON_DEFAULT_ATTRIBUTE + "]"); 6304 this.focusTrapFactory = focusTrapFactory; 6305 this.buttonRipples = []; 6306 try { 6307 for (var _b = __values(this.buttons), _c = _b.next(); !_c.done; _c = _b.next()) { 6308 var buttonEl = _c.value; 6309 this.buttonRipples.push(new component_2.MDCRipple(buttonEl)); 6310 } 6311 } catch (e_1_1) { 6312 e_1 = { error: e_1_1 }; 6313 } finally { 6314 try { 6315 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 6316 } finally { 6317 if (e_1) throw e_1.error; 6318 } 6319 } 6320 }; 6321 MDCDialog.prototype.initialSyncWithDOM = function () { 6322 var _this = this; 6323 this.focusTrap = util.createFocusTrapInstance(this.container, this.focusTrapFactory, this.getInitialFocusEl() || undefined); 6324 this.handleClick = this.foundation.handleClick.bind(this.foundation); 6325 this.handleKeydown = this.foundation.handleKeydown.bind(this.foundation); 6326 this.handleDocumentKeydown = this.foundation.handleDocumentKeydown.bind(this.foundation); 6327 // this.handleLayout = this.layout.bind(this); 6328 this.handleOpening = function () { 6329 document.addEventListener('keydown', _this.handleDocumentKeydown); 6330 }; 6331 this.handleClosing = function () { 6332 document.removeEventListener('keydown', _this.handleDocumentKeydown); 6333 }; 6334 this.listen('click', this.handleClick); 6335 this.listen('keydown', this.handleKeydown); 6336 this.listen(strings.OPENING_EVENT, this.handleOpening); 6337 this.listen(strings.CLOSING_EVENT, this.handleClosing); 6338 }; 6339 MDCDialog.prototype.destroy = function () { 6340 this.unlisten('click', this.handleClick); 6341 this.unlisten('keydown', this.handleKeydown); 6342 this.unlisten(strings.OPENING_EVENT, this.handleOpening); 6343 this.unlisten(strings.CLOSING_EVENT, this.handleClosing); 6344 this.handleClosing(); 6345 this.buttonRipples.forEach(function (ripple) { 6346 ripple.destroy(); 6347 }); 6348 _super.prototype.destroy.call(this); 6349 }; 6350 MDCDialog.prototype.layout = function () { 6351 this.foundation.layout(); 6352 }; 6353 MDCDialog.prototype.open = function () { 6354 this.foundation.open(); 6355 }; 6356 MDCDialog.prototype.close = function (action) { 6357 if (action === void 0) { 6358 action = ''; 6359 } 6360 this.foundation.close(action); 6361 }; 6362 MDCDialog.prototype.getDefaultFoundation = function () { 6363 var _this = this; 6364 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 6365 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 6366 var adapter = { 6367 addBodyClass: function addBodyClass(className) { 6368 return document.body.classList.add(className); 6369 }, 6370 addClass: function addClass(className) { 6371 return _this.root.classList.add(className); 6372 }, 6373 areButtonsStacked: function areButtonsStacked() { 6374 return util.areTopsMisaligned(_this.buttons); 6375 }, 6376 clickDefaultButton: function clickDefaultButton() { 6377 if (_this.defaultButton) { 6378 _this.defaultButton.click(); 6379 } 6380 }, 6381 eventTargetMatches: function eventTargetMatches(target, selector) { 6382 return target ? ponyfill_1.matches(target, selector) : false; 6383 }, 6384 getActionFromEvent: function getActionFromEvent(evt) { 6385 if (!evt.target) { 6386 return ''; 6387 } 6388 var element = ponyfill_1.closest(evt.target, "[" + strings.ACTION_ATTRIBUTE + "]"); 6389 return element && element.getAttribute(strings.ACTION_ATTRIBUTE); 6390 }, 6391 getInitialFocusEl: function getInitialFocusEl() { 6392 return _this.getInitialFocusEl(); 6393 }, 6394 hasClass: function hasClass(className) { 6395 return _this.root.classList.contains(className); 6396 }, 6397 isContentScrollable: function isContentScrollable() { 6398 return util.isScrollable(_this.content); 6399 }, 6400 notifyClosed: function notifyClosed(action) { 6401 return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {}); 6402 }, 6403 notifyClosing: function notifyClosing(action) { 6404 return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {}); 6405 }, 6406 notifyOpened: function notifyOpened() { 6407 return _this.emit(strings.OPENED_EVENT, {}); 6408 }, 6409 notifyOpening: function notifyOpening() { 6410 return _this.emit(strings.OPENING_EVENT, {}); 6411 }, 6412 releaseFocus: function releaseFocus() { 6413 _this.focusTrap.releaseFocus(); 6414 }, 6415 removeBodyClass: function removeBodyClass(className) { 6416 return document.body.classList.remove(className); 6417 }, 6418 removeClass: function removeClass(className) { 6419 return _this.root.classList.remove(className); 6420 }, 6421 reverseButtons: function reverseButtons() { 6422 _this.buttons.reverse(); 6423 _this.buttons.forEach(function (button) { 6424 button.parentElement.appendChild(button); 6425 }); 6426 }, 6427 trapFocus: function trapFocus() { 6428 _this.focusTrap.trapFocus(); 6429 }, 6430 registerContentEventHandler: function registerContentEventHandler(evt, handler) { 6431 if (_this.content instanceof HTMLElement) { 6432 _this.content.addEventListener(evt, handler); 6433 } 6434 }, 6435 deregisterContentEventHandler: function deregisterContentEventHandler(evt, handler) { 6436 if (_this.content instanceof HTMLElement) { 6437 _this.content.removeEventListener(evt, handler); 6438 } 6439 }, 6440 isScrollableContentAtTop: function isScrollableContentAtTop() { 6441 return util.isScrollAtTop(_this.content); 6442 }, 6443 isScrollableContentAtBottom: function isScrollableContentAtBottom() { 6444 return util.isScrollAtBottom(_this.content); 6445 }, 6446 registerWindowEventHandler: function registerWindowEventHandler(evt, handler) { 6447 window.addEventListener(evt, handler); 6448 }, 6449 deregisterWindowEventHandler: function deregisterWindowEventHandler(evt, handler) { 6450 window.removeEventListener(evt, handler); 6451 } 6452 }; 6453 return new foundation_1.MDCDialogFoundation(adapter); 6454 }; 6455 MDCDialog.prototype.getInitialFocusEl = function () { 6456 return this.root.querySelector("[" + strings.INITIAL_FOCUS_ATTRIBUTE + "]"); 6457 }; 6458 return MDCDialog; 6459}(component_1.MDCComponent); 6460exports.MDCDialog = MDCDialog; 6461 6462/***/ }), 6463 6464/***/ "./packages/mdc-dialog/constants.ts": 6465/*!******************************************!*\ 6466 !*** ./packages/mdc-dialog/constants.ts ***! 6467 \******************************************/ 6468/*! no static exports found */ 6469/***/ (function(module, exports, __webpack_require__) { 6470 6471"use strict"; 6472 6473/** 6474 * @license 6475 * Copyright 2016 Google Inc. 6476 * 6477 * Permission is hereby granted, free of charge, to any person obtaining a copy 6478 * of this software and associated documentation files (the "Software"), to deal 6479 * in the Software without restriction, including without limitation the rights 6480 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6481 * copies of the Software, and to permit persons to whom the Software is 6482 * furnished to do so, subject to the following conditions: 6483 * 6484 * The above copyright notice and this permission notice shall be included in 6485 * all copies or substantial portions of the Software. 6486 * 6487 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6488 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6489 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6490 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6491 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6492 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6493 * THE SOFTWARE. 6494 */ 6495 6496Object.defineProperty(exports, "__esModule", { value: true }); 6497exports.numbers = exports.strings = exports.cssClasses = void 0; 6498exports.cssClasses = { 6499 CLOSING: 'mdc-dialog--closing', 6500 OPEN: 'mdc-dialog--open', 6501 OPENING: 'mdc-dialog--opening', 6502 SCROLLABLE: 'mdc-dialog--scrollable', 6503 SCROLL_LOCK: 'mdc-dialog-scroll-lock', 6504 STACKED: 'mdc-dialog--stacked', 6505 FULLSCREEN: 'mdc-dialog--fullscreen', 6506 // Class for showing a scroll divider on full-screen dialog header element. 6507 // Should only be displayed on scrollable content, when the dialog content is 6508 // scrolled "underneath" the header. 6509 SCROLL_DIVIDER_HEADER: 'mdc-dialog-scroll-divider-header', 6510 // Class for showing a scroll divider on a full-screen dialog footer element. 6511 // Should only be displayed on scrolalble content, when the dialog content is 6512 // obscured "underneath" the footer. 6513 SCROLL_DIVIDER_FOOTER: 'mdc-dialog-scroll-divider-footer', 6514 // The "surface scrim" is a scrim covering only the surface of a dialog. This 6515 // is used in situations where a confirmation dialog is shown over an already 6516 // opened full-screen dialog. On larger screen-sizes, the full-screen dialog 6517 // is sized as a modal and so in these situations we display a "surface scrim" 6518 // to prevent a "double scrim" (where the scrim from the secondary 6519 // confirmation dialog would overlap with the scrim from the full-screen 6520 // dialog). 6521 SURFACE_SCRIM_SHOWN: 'mdc-dialog__surface-scrim--shown', 6522 // "Showing" animating class for the surface-scrim. 6523 SURFACE_SCRIM_SHOWING: 'mdc-dialog__surface-scrim--showing', 6524 // "Hiding" animating class for the surface-scrim. 6525 SURFACE_SCRIM_HIDING: 'mdc-dialog__surface-scrim--hiding', 6526 // Class to hide a dialog's scrim (used in conjunction with a surface-scrim). 6527 // Note that we only hide the original scrim rather than removing it entirely 6528 // to prevent interactions with the content behind this scrim, and to capture 6529 // scrim clicks. 6530 SCRIM_HIDDEN: 'mdc-dialog__scrim--hidden' 6531}; 6532exports.strings = { 6533 ACTION_ATTRIBUTE: 'data-mdc-dialog-action', 6534 BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default', 6535 BUTTON_SELECTOR: '.mdc-dialog__button', 6536 CLOSED_EVENT: 'MDCDialog:closed', 6537 CLOSE_ACTION: 'close', 6538 CLOSING_EVENT: 'MDCDialog:closing', 6539 CONTAINER_SELECTOR: '.mdc-dialog__container', 6540 CONTENT_SELECTOR: '.mdc-dialog__content', 6541 DESTROY_ACTION: 'destroy', 6542 INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus', 6543 OPENED_EVENT: 'MDCDialog:opened', 6544 OPENING_EVENT: 'MDCDialog:opening', 6545 SCRIM_SELECTOR: '.mdc-dialog__scrim', 6546 SUPPRESS_DEFAULT_PRESS_SELECTOR: ['textarea', '.mdc-menu .mdc-list-item', '.mdc-menu .mdc-deprecated-list-item'].join(', '), 6547 SURFACE_SELECTOR: '.mdc-dialog__surface' 6548}; 6549exports.numbers = { 6550 DIALOG_ANIMATION_CLOSE_TIME_MS: 75, 6551 DIALOG_ANIMATION_OPEN_TIME_MS: 150 6552}; 6553 6554/***/ }), 6555 6556/***/ "./packages/mdc-dialog/foundation.ts": 6557/*!*******************************************!*\ 6558 !*** ./packages/mdc-dialog/foundation.ts ***! 6559 \*******************************************/ 6560/*! no static exports found */ 6561/***/ (function(module, exports, __webpack_require__) { 6562 6563"use strict"; 6564 6565/** 6566 * @license 6567 * Copyright 2017 Google Inc. 6568 * 6569 * Permission is hereby granted, free of charge, to any person obtaining a copy 6570 * of this software and associated documentation files (the "Software"), to deal 6571 * in the Software without restriction, including without limitation the rights 6572 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6573 * copies of the Software, and to permit persons to whom the Software is 6574 * furnished to do so, subject to the following conditions: 6575 * 6576 * The above copyright notice and this permission notice shall be included in 6577 * all copies or substantial portions of the Software. 6578 * 6579 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6580 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6581 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6582 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6583 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6584 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 6585 * THE SOFTWARE. 6586 */ 6587 6588var __extends = this && this.__extends || function () { 6589 var _extendStatics = function extendStatics(d, b) { 6590 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 6591 d.__proto__ = b; 6592 } || function (d, b) { 6593 for (var p in b) { 6594 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 6595 } 6596 }; 6597 return _extendStatics(d, b); 6598 }; 6599 return function (d, b) { 6600 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 6601 _extendStatics(d, b); 6602 function __() { 6603 this.constructor = d; 6604 } 6605 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 6606 }; 6607}(); 6608var __assign = this && this.__assign || function () { 6609 __assign = Object.assign || function (t) { 6610 for (var s, i = 1, n = arguments.length; i < n; i++) { 6611 s = arguments[i]; 6612 for (var p in s) { 6613 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 6614 } 6615 } 6616 return t; 6617 }; 6618 return __assign.apply(this, arguments); 6619}; 6620Object.defineProperty(exports, "__esModule", { value: true }); 6621exports.MDCDialogFoundation = void 0; 6622var animationframe_1 = __webpack_require__(/*! @material/animation/animationframe */ "./packages/mdc-animation/animationframe.ts"); 6623var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 6624var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts"); 6625var AnimationKeys; 6626(function (AnimationKeys) { 6627 AnimationKeys["POLL_SCROLL_POS"] = "poll_scroll_position"; 6628 AnimationKeys["POLL_LAYOUT_CHANGE"] = "poll_layout_change"; 6629})(AnimationKeys || (AnimationKeys = {})); 6630var MDCDialogFoundation = /** @class */function (_super) { 6631 __extends(MDCDialogFoundation, _super); 6632 function MDCDialogFoundation(adapter) { 6633 var _this = _super.call(this, __assign(__assign({}, MDCDialogFoundation.defaultAdapter), adapter)) || this; 6634 _this.dialogOpen = false; 6635 _this.isFullscreen = false; 6636 _this.animationFrame = 0; 6637 _this.animationTimer = 0; 6638 _this.escapeKeyAction = constants_1.strings.CLOSE_ACTION; 6639 _this.scrimClickAction = constants_1.strings.CLOSE_ACTION; 6640 _this.autoStackButtons = true; 6641 _this.areButtonsStacked = false; 6642 _this.suppressDefaultPressSelector = constants_1.strings.SUPPRESS_DEFAULT_PRESS_SELECTOR; 6643 _this.animFrame = new animationframe_1.AnimationFrame(); 6644 _this.contentScrollHandler = function () { 6645 _this.handleScrollEvent(); 6646 }; 6647 _this.windowResizeHandler = function () { 6648 _this.layout(); 6649 }; 6650 _this.windowOrientationChangeHandler = function () { 6651 _this.layout(); 6652 }; 6653 return _this; 6654 } 6655 Object.defineProperty(MDCDialogFoundation, "cssClasses", { 6656 get: function get() { 6657 return constants_1.cssClasses; 6658 }, 6659 enumerable: false, 6660 configurable: true 6661 }); 6662 Object.defineProperty(MDCDialogFoundation, "strings", { 6663 get: function get() { 6664 return constants_1.strings; 6665 }, 6666 enumerable: false, 6667 configurable: true 6668 }); 6669 Object.defineProperty(MDCDialogFoundation, "numbers", { 6670 get: function get() { 6671 return constants_1.numbers; 6672 }, 6673 enumerable: false, 6674 configurable: true 6675 }); 6676 Object.defineProperty(MDCDialogFoundation, "defaultAdapter", { 6677 get: function get() { 6678 return { 6679 addBodyClass: function addBodyClass() { 6680 return undefined; 6681 }, 6682 addClass: function addClass() { 6683 return undefined; 6684 }, 6685 areButtonsStacked: function areButtonsStacked() { 6686 return false; 6687 }, 6688 clickDefaultButton: function clickDefaultButton() { 6689 return undefined; 6690 }, 6691 eventTargetMatches: function eventTargetMatches() { 6692 return false; 6693 }, 6694 getActionFromEvent: function getActionFromEvent() { 6695 return ''; 6696 }, 6697 getInitialFocusEl: function getInitialFocusEl() { 6698 return null; 6699 }, 6700 hasClass: function hasClass() { 6701 return false; 6702 }, 6703 isContentScrollable: function isContentScrollable() { 6704 return false; 6705 }, 6706 notifyClosed: function notifyClosed() { 6707 return undefined; 6708 }, 6709 notifyClosing: function notifyClosing() { 6710 return undefined; 6711 }, 6712 notifyOpened: function notifyOpened() { 6713 return undefined; 6714 }, 6715 notifyOpening: function notifyOpening() { 6716 return undefined; 6717 }, 6718 releaseFocus: function releaseFocus() { 6719 return undefined; 6720 }, 6721 removeBodyClass: function removeBodyClass() { 6722 return undefined; 6723 }, 6724 removeClass: function removeClass() { 6725 return undefined; 6726 }, 6727 reverseButtons: function reverseButtons() { 6728 return undefined; 6729 }, 6730 trapFocus: function trapFocus() { 6731 return undefined; 6732 }, 6733 registerContentEventHandler: function registerContentEventHandler() { 6734 return undefined; 6735 }, 6736 deregisterContentEventHandler: function deregisterContentEventHandler() { 6737 return undefined; 6738 }, 6739 isScrollableContentAtTop: function isScrollableContentAtTop() { 6740 return false; 6741 }, 6742 isScrollableContentAtBottom: function isScrollableContentAtBottom() { 6743 return false; 6744 }, 6745 registerWindowEventHandler: function registerWindowEventHandler() { 6746 return undefined; 6747 }, 6748 deregisterWindowEventHandler: function deregisterWindowEventHandler() { 6749 return undefined; 6750 } 6751 }; 6752 }, 6753 enumerable: false, 6754 configurable: true 6755 }); 6756 MDCDialogFoundation.prototype.init = function () { 6757 if (this.adapter.hasClass(constants_1.cssClasses.STACKED)) { 6758 this.setAutoStackButtons(false); 6759 } 6760 this.isFullscreen = this.adapter.hasClass(constants_1.cssClasses.FULLSCREEN); 6761 }; 6762 MDCDialogFoundation.prototype.destroy = function () { 6763 if (this.
6763dialogOpen) { 6764 this.close(constants_1.strings.DESTROY_ACTION); 6765 }
vendor: 21,498 bytes, lines 6765-7247
6765 6766 if (this.animationTimer) { 6767 clearTimeout(this.animationTimer); 6768 this.handleAnimationTimerEnd(); 6769 } 6770 if (this.isFullscreen) { 6771 this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler); 6772 } 6773 this.animFrame.cancelAll(); 6774 this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler); 6775 this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler); 6776 }; 6777 MDCDialogFoundation.prototype.open = function (dialogOptions) { 6778 var _this = this; 6779 this.dialogOpen = true; 6780 this.adapter.notifyOpening(); 6781 this.adapter.addClass(constants_1.cssClasses.OPENING); 6782 if (this.isFullscreen) { 6783 // A scroll event listener is registered even if the dialog is not 6784 // scrollable on open, since the window resize event, or orientation 6785 // change may make the dialog scrollable after it is opened. 6786 this.adapter.registerContentEventHandler('scroll', this.contentScrollHandler); 6787 } 6788 if (dialogOptions && dialogOptions.isAboveFullscreenDialog) { 6789 this.adapter.addClass(constants_1.cssClasses.SCRIM_HIDDEN); 6790 } 6791 this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler); 6792 this.adapter.registerWindowEventHandler('orientationchange', this.windowOrientationChangeHandler); 6793 // Wait a frame once display is no longer "none", to establish basis for 6794 // animation 6795 this.runNextAnimationFrame(function () { 6796 _this.adapter.addClass(constants_1.cssClasses.OPEN); 6797 _this.adapter.addBodyClass(constants_1.cssClasses.SCROLL_LOCK); 6798 _this.layout(); 6799 _this.animationTimer = setTimeout(function () { 6800 _this.handleAnimationTimerEnd(); 6801 _this.adapter.trapFocus(_this.adapter.getInitialFocusEl()); 6802 _this.adapter.notifyOpened(); 6803 }, constants_1.numbers.DIALOG_ANIMATION_OPEN_TIME_MS); 6804 }); 6805 }; 6806 MDCDialogFoundation.prototype.close = function (action) { 6807 var _this = this; 6808 if (action === void 0) { 6809 action = ''; 6810 } 6811 if (!this.dialogOpen) { 6812 // Avoid redundant close calls (and events), e.g. from keydown on elements 6813 // that inherently emit click 6814 return; 6815 } 6816 this.dialogOpen = false; 6817 this.adapter.notifyClosing(action); 6818 this.adapter.addClass(constants_1.cssClasses.CLOSING); 6819 this.adapter.removeClass(constants_1.cssClasses.OPEN); 6820 this.adapter.removeBodyClass(constants_1.cssClasses.SCROLL_LOCK); 6821 if (this.isFullscreen) { 6822 this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler); 6823 } 6824 this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler); 6825 this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler); 6826 cancelAnimationFrame(this.animationFrame); 6827 this.animationFrame = 0; 6828 clearTimeout(this.animationTimer); 6829 this.animationTimer = setTimeout(function () { 6830 _this.adapter.releaseFocus(); 6831 _this.handleAnimationTimerEnd(); 6832 _this.adapter.notifyClosed(action); 6833 }, constants_1.numbers.DIALOG_ANIMATION_CLOSE_TIME_MS); 6834 }; 6835 /** 6836 * Used only in instances of showing a secondary dialog over a full-screen 6837 * dialog. Shows the "surface scrim" displayed over the full-screen dialog. 6838 */ 6839 MDCDialogFoundation.prototype.showSurfaceScrim = function () { 6840 var _this = this; 6841 this.adapter.addClass(constants_1.cssClasses.SURFACE_SCRIM_SHOWING); 6842 this.runNextAnimationFrame(function () { 6843 _this.adapter.addClass(constants_1.cssClasses.SURFACE_SCRIM_SHOWN); 6844 }); 6845 }; 6846 /** 6847 * Used only in instances of showing a secondary dialog over a full-screen 6848 * dialog. Hides the "surface scrim" displayed over the full-screen dialog. 6849 */ 6850 MDCDialogFoundation.prototype.hideSurfaceScrim = function () { 6851 this.adapter.removeClass(constants_1.cssClasses.SURFACE_SCRIM_SHOWN); 6852 this.adapter.addClass(constants_1.cssClasses.SURFACE_SCRIM_HIDING); 6853 }; 6854 /** 6855 * Handles `transitionend` event triggered when surface scrim animation is 6856 * finished. 6857 */ 6858 MDCDialogFoundation.prototype.handleSurfaceScrimTransitionEnd = function () { 6859 this.adapter.removeClass(constants_1.cssClasses.SURFACE_SCRIM_HIDING); 6860 this.adapter.removeClass(constants_1.cssClasses.SURFACE_SCRIM_SHOWING); 6861 }; 6862 MDCDialogFoundation.prototype.isOpen = function () { 6863 return this.dialogOpen; 6864 }; 6865 MDCDialogFoundation.prototype.getEscapeKeyAction = function () { 6866 return this.escapeKeyAction; 6867 }; 6868 MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) { 6869 this.escapeKeyAction = action; 6870 }; 6871 MDCDialogFoundation.prototype.getScrimClickAction = function () { 6872 return this.scrimClickAction; 6873 }; 6874 MDCDialogFoundation.prototype.setScrimClickAction = function (action) { 6875 this.scrimClickAction = action; 6876 }; 6877 MDCDialogFoundation.prototype.getAutoStackButtons = function () { 6878 return this.autoStackButtons; 6879 }; 6880 MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) { 6881 this.autoStackButtons = autoStack; 6882 }; 6883 MDCDialogFoundation.prototype.getSuppressDefaultPressSelector = function () { 6884 return this.suppressDefaultPressSelector; 6885 }; 6886 MDCDialogFoundation.prototype.setSuppressDefaultPressSelector = function (selector) { 6887 this.suppressDefaultPressSelector = selector; 6888 }; 6889 MDCDialogFoundation.prototype.layout = function () { 6890 var _this = this; 6891 this.animFrame.request(AnimationKeys.POLL_LAYOUT_CHANGE, function () { 6892 _this.layoutInternal(); 6893 }); 6894 }; 6895 /** Handles click on the dialog root element. */ 6896 MDCDialogFoundation.prototype.handleClick = function (evt) { 6897 var isScrim = this.adapter.eventTargetMatches(evt.target, constants_1.strings.SCRIM_SELECTOR); 6898 // Check for scrim click first since it doesn't require querying ancestors. 6899 if (isScrim && this.scrimClickAction !== '') { 6900 this.close(this.scrimClickAction); 6901 } else { 6902 var action = this.adapter.getActionFromEvent(evt); 6903 if (action) { 6904 this.close(action); 6905 } 6906 } 6907 }; 6908 /** Handles keydown on the dialog root element. */ 6909 MDCDialogFoundation.prototype.handleKeydown = function (evt) { 6910 var isEnter = evt.key === 'Enter' || evt.keyCode === 13; 6911 if (!isEnter) { 6912 return; 6913 } 6914 var action = this.adapter.getActionFromEvent(evt); 6915 if (action) { 6916 // Action button callback is handled in `handleClick`, 6917 // since space/enter keydowns on buttons trigger click events. 6918 return; 6919 } 6920 // `composedPath` is used here, when available, to account for use cases 6921 // where a target meant to suppress the default press behaviour 6922 // may exist in a shadow root. 6923 // For example, a textarea inside a web component: 6924 // <mwc-dialog> 6925 // <horizontal-layout> 6926 // #shadow-root (open) 6927 // <mwc-textarea> 6928 // #shadow-root (open) 6929 // <textarea></textarea> 6930 // </mwc-textarea> 6931 // </horizontal-layout> 6932 // </mwc-dialog> 6933 var target = evt.composedPath ? evt.composedPath()[0] : evt.target; 6934 var isDefault = this.suppressDefaultPressSelector ? !this.adapter.eventTargetMatches(target, this.suppressDefaultPressSelector) : true; 6935 if (isEnter && isDefault) { 6936 this.adapter.clickDefaultButton(); 6937 } 6938 }; 6939 /** Handles keydown on the document. */ 6940 MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) { 6941 var isEscape = evt.key === 'Escape' || evt.keyCode === 27; 6942 if (isEscape && this.escapeKeyAction !== '') { 6943 this.close(this.escapeKeyAction); 6944 } 6945 }; 6946 /** 6947 * Handles scroll event on the dialog's content element -- showing a scroll 6948 * divider on the header or footer based on the scroll position. This handler 6949 * should only be registered on full-screen dialogs with scrollable content. 6950 */ 6951 MDCDialogFoundation.prototype.handleScrollEvent = function () { 6952 var _this = this; 6953 // Since scroll events can fire at a high rate, we throttle these events by 6954 // using requestAnimationFrame. 6955 this.animFrame.request(AnimationKeys.POLL_SCROLL_POS, function () { 6956 _this.toggleScrollDividerHeader(); 6957 _this.toggleScrollDividerFooter(); 6958 }); 6959 }; 6960 MDCDialogFoundation.prototype.layoutInternal = function () { 6961 if (this.autoStackButtons) { 6962 this.detectStackedButtons(); 6963 } 6964 this.toggleScrollableClasses(); 6965 }; 6966 MDCDialogFoundation.prototype.handleAnimationTimerEnd = function () { 6967 this.animationTimer = 0; 6968 this.adapter.removeClass(constants_1.cssClasses.OPENING); 6969 this.adapter.removeClass(constants_1.cssClasses.CLOSING); 6970 }; 6971 /** 6972 * Runs the given logic on the next animation frame, using setTimeout to 6973 * factor in Firefox reflow behavior. 6974 */ 6975 MDCDialogFoundation.prototype.runNextAnimationFrame = function (callback) { 6976 var _this = this; 6977 cancelAnimationFrame(this.animationFrame); 6978 this.animationFrame = requestAnimationFrame(function () { 6979 _this.animationFrame = 0; 6980 clearTimeout(_this.animationTimer); 6981 _this.animationTimer = setTimeout(callback, 0); 6982 }); 6983 }; 6984 MDCDialogFoundation.prototype.detectStackedButtons = function () { 6985 // Remove the class first to let us measure the buttons' natural positions. 6986 this.adapter.removeClass(constants_1.cssClasses.STACKED); 6987 var areButtonsStacked = this.adapter.areButtonsStacked(); 6988 if (areButtonsStacked) { 6989 this.adapter.addClass(constants_1.cssClasses.STACKED); 6990 } 6991 if (areButtonsStacked !== this.areButtonsStacked) { 6992 this.adapter.reverseButtons(); 6993 this.areButtonsStacked = areButtonsStacked; 6994 } 6995 }; 6996 MDCDialogFoundation.prototype.toggleScrollableClasses = function () { 6997 // Remove the class first to let us measure the natural height of the 6998 // content. 6999 this.adapter.removeClass(constants_1.cssClasses.SCROLLABLE); 7000 if (this.adapter.isContentScrollable()) { 7001 this.adapter.addClass(constants_1.cssClasses.SCROLLABLE); 7002 if (this.isFullscreen) { 7003 // If dialog is full-screen and scrollable, check if a scroll divider 7004 // should be shown. 7005 this.toggleScrollDividerHeader(); 7006 this.toggleScrollDividerFooter(); 7007 } 7008 } 7009 }; 7010 MDCDialogFoundation.prototype.toggleScrollDividerHeader = function () { 7011 if (!this.adapter.isScrollableContentAtTop()) { 7012 this.adapter.addClass(constants_1.cssClasses.SCROLL_DIVIDER_HEADER); 7013 } else if (this.adapter.hasClass(constants_1.cssClasses.SCROLL_DIVIDER_HEADER)) { 7014 this.adapter.removeClass(constants_1.cssClasses.SCROLL_DIVIDER_HEADER); 7015 } 7016 }; 7017 MDCDialogFoundation.prototype.toggleScrollDividerFooter = function () { 7018 if (!this.adapter.isScrollableContentAtBottom()) { 7019 this.adapter.addClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER); 7020 } else if (this.adapter.hasClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER)) { 7021 this.adapter.removeClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER); 7022 } 7023 }; 7024 return MDCDialogFoundation; 7025}(foundation_1.MDCFoundation); 7026exports.MDCDialogFoundation = MDCDialogFoundation; 7027// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 7028exports.default = MDCDialogFoundation; 7029 7030/***/ }), 7031 7032/***/ "./packages/mdc-dialog/index.ts": 7033/*!**************************************!*\ 7034 !*** ./packages/mdc-dialog/index.ts ***! 7035 \**************************************/ 7036/*! no static exports found */ 7037/***/ (function(module, exports, __webpack_require__) { 7038 7039"use strict"; 7040 7041/** 7042 * @license 7043 * Copyright 2019 Google Inc. 7044 * 7045 * Permission is hereby granted, free of charge, to any person obtaining a copy 7046 * of this software and associated documentation files (the "Software"), to deal 7047 * in the Software without restriction, including without limitation the rights 7048 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7049 * copies of the Software, and to permit persons to whom the Software is 7050 * furnished to do so, subject to the following conditions: 7051 * 7052 * The above copyright notice and this permission notice shall be included in 7053 * all copies or substantial portions of the Software. 7054 * 7055 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7056 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7057 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7058 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7059 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7060 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7061 * THE SOFTWARE. 7062 */ 7063 7064var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 7065 if (k2 === undefined) k2 = k; 7066 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 7067 return m[k]; 7068 } }); 7069} : function (o, m, k, k2) { 7070 if (k2 === undefined) k2 = k; 7071 o[k2] = m[k]; 7072}); 7073var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 7074 Object.defineProperty(o, "default", { enumerable: true, value: v }); 7075} : function (o, v) { 7076 o["default"] = v; 7077}); 7078var __importStar = this && this.__importStar || function (mod) { 7079 if (mod && mod.__esModule) return mod; 7080 var result = {}; 7081 if (mod != null) for (var k in mod) { 7082 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 7083 }__setModuleDefault(result, mod); 7084 return result; 7085}; 7086var __exportStar = this && this.__exportStar || function (m, exports) { 7087 for (var p in m) { 7088 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 7089 } 7090}; 7091Object.defineProperty(exports, "__esModule", { value: true }); 7092exports.util = void 0; 7093var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts")); 7094exports.util = util; 7095__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-dialog/adapter.ts"), exports); 7096__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-dialog/component.ts"), exports); 7097__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts"), exports); 7098__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts"), exports); 7099__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-dialog/types.ts"), exports); 7100 7101/***/ }), 7102 7103/***/ "./packages/mdc-dialog/types.ts": 7104/*!**************************************!*\ 7105 !*** ./packages/mdc-dialog/types.ts ***! 7106 \**************************************/ 7107/*! no static exports found */ 7108/***/ (function(module, exports, __webpack_require__) { 7109 7110"use strict"; 7111 7112/** 7113 * @license 7114 * Copyright 2019 Google Inc. 7115 * 7116 * Permission is hereby granted, free of charge, to any person obtaining a copy 7117 * of this software and associated documentation files (the "Software"), to deal 7118 * in the Software without restriction, including without limitation the rights 7119 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7120 * copies of the Software, and to permit persons to whom the Software is 7121 * furnished to do so, subject to the following conditions: 7122 * 7123 * The above copyright notice and this permission notice shall be included in 7124 * all copies or substantial portions of the Software. 7125 * 7126 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7127 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7128 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7129 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7130 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7131 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7132 * THE SOFTWARE. 7133 */ 7134 7135Object.defineProperty(exports, "__esModule", { value: true }); 7136 7137/***/ }), 7138 7139/***/ "./packages/mdc-dialog/util.ts": 7140/*!*************************************!*\ 7141 !*** ./packages/mdc-dialog/util.ts ***! 7142 \*************************************/ 7143/*! no static exports found */ 7144/***/ (function(module, exports, __webpack_require__) { 7145 7146"use strict"; 7147 7148/** 7149 * @license 7150 * Copyright 2016 Google Inc. 7151 * 7152 * Permission is hereby granted, free of charge, to any person obtaining a copy 7153 * of this software and associated documentation files (the "Software"), to deal 7154 * in the Software without restriction, including without limitation the rights 7155 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7156 * copies of the Software, and to permit persons to whom the Software is 7157 * furnished to do so, subject to the following conditions: 7158 * 7159 * The above copyright notice and this permission notice shall be included in 7160 * all copies or substantial portions of the Software. 7161 * 7162 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7163 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7164 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7165 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7166 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7167 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7168 * THE SOFTWARE. 7169 */ 7170 7171Object.defineProperty(exports, "__esModule", { value: true }); 7172exports.areTopsMisaligned = exports.isScrollAtBottom = exports.isScrollAtTop = exports.isScrollable = exports.createFocusTrapInstance = void 0; 7173function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) { 7174 return focusTrapFactory(surfaceEl, { initialFocusEl: initialFocusEl }); 7175} 7176exports.createFocusTrapInstance = createFocusTrapInstance; 7177function isScrollable(el) { 7178 return el ? el.scrollHeight > el.offsetHeight : false; 7179} 7180exports.isScrollable = isScrollable; 7181/** 7182 * For scrollable content, returns true if the content has not been scrolled 7183 * (that is, the scroll content is as the "top"). This is used in full-screen 7184 * dialogs, where the scroll divider is expected only to appear once the 7185 * content has been scrolled "underneath" the header bar. 7186 */ 7187function isScrollAtTop(el) { 7188 return el ? el.scrollTop === 0 : false; 7189} 7190exports.isScrollAtTop = isScrollAtTop; 7191/** 7192 * For scrollable content, returns true if the content has been scrolled all the 7193 * way to the bottom. This is used in full-screen dialogs, where the footer 7194 * scroll divider is expected only to appear when the content is "cut-off" by 7195 * the footer bar. 7196 */ 7197function isScrollAtBottom(el) { 7198 return el ? Math.ceil(el.scrollHeight - el.scrollTop) === el.clientHeight : false; 7199} 7200exports.isScrollAtBottom = isScrollAtBottom; 7201function areTopsMisaligned(els) { 7202 var tops = new Set(); 7203 [].forEach.call(els, function (el) { 7204 return tops.add(el.offsetTop); 7205 }); 7206 return tops.size > 1; 7207} 7208exports.areTopsMisaligned = areTopsMisaligned; 7209 7210/***/ }), 7211 7212/***/ "./packages/mdc-dom/announce.ts": 7213/*!**************************************!*\ 7214 !*** ./packages/mdc-dom/announce.ts ***! 7215 \**************************************/ 7216/*! no static exports found */ 7217/***/ (function(module, exports, __webpack_require__) { 7218 7219"use strict"; 7220 7221/** 7222 * @license 7223 * Copyright 2020 Google Inc. 7224 * 7225 * Permission is hereby granted, free of charge, to any person obtaining a copy 7226 * of this software and associated documentation files (the "Software"), to deal 7227 * in the Software without restriction, including without limitation the rights 7228 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7229 * copies of the Software, and to permit persons to whom the Software is 7230 * furnished to do so, subject to the following conditions: 7231 * 7232 * The above copyright notice and this permission notice shall be included in 7233 * all copies or substantial portions of the Software. 7234 * 7235 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7236 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7237 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7238 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7239 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7240 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7241 * THE SOFTWARE. 7242 */ 7243 7244Object.defineProperty(exports, "__esModule", { value: true }); 7245exports.announce = exports.DATA_MDC_DOM_ANNOUNCE = exports.AnnouncerPriority = void 0; 7246/** 7247 * Priorities for the announce function
vendor: 2,624 bytes, lines 7247-7317
7247 7248 */ 7249var AnnouncerPriority; 7250(function (AnnouncerPriority) { 7251 AnnouncerPriority["POLITE"] = "polite"; 7252 AnnouncerPriority["ASSERTIVE"] = "assertive"; 7253})(AnnouncerPriority = exports.AnnouncerPriority || (exports.AnnouncerPriority = {})); 7254/** 7255 * Data attribute added to live region element. 7256 */ 7257exports.DATA_MDC_DOM_ANNOUNCE = 'data-mdc-dom-announce'; 7258/** 7259 * Announces the given message with optional priority, defaulting to "polite" 7260 */ 7261function announce(message, priority) { 7262 Announcer.getInstance().say(message, priority); 7263} 7264exports.announce = announce; 7265var Announcer = /** @class */function () { 7266 // Constructor made private to ensure only the singleton is used 7267 function Announcer() { 7268 this.liveRegions = new Map(); 7269 } 7270 Announcer.getInstance = function () { 7271 if (!Announcer.instance) { 7272 Announcer.instance = new Announcer(); 7273 } 7274 return Announcer.instance; 7275 }; 7276 Announcer.prototype.say = function (message, priority) { 7277 if (priority === void 0) { 7278 priority = AnnouncerPriority.POLITE; 7279 } 7280 var liveRegion = this.getLiveRegion(priority); 7281 // Reset the region to pick up the message, even if the message is the 7282 // exact same as before. 7283 liveRegion.textContent = ''; 7284 // Timeout is necessary for screen readers like NVDA and VoiceOver. 7285 setTimeout(function () { 7286 liveRegion.textContent = message; 7287 document.addEventListener('click', clearLiveRegion); 7288 }, 1); 7289 function clearLiveRegion() { 7290 liveRegion.textContent = ''; 7291 document.removeEventListener('click', clearLiveRegion); 7292 } 7293 }; 7294 Announcer.prototype.getLiveRegion = function (priority) { 7295 var existingLiveRegion = this.liveRegions.get(priority); 7296 if (existingLiveRegion && document.body.contains(existingLiveRegion)) { 7297 return existingLiveRegion; 7298 } 7299 var liveRegion = this.createLiveRegion(priority); 7300 this.liveRegions.set(priority, liveRegion); 7301 return liveRegion; 7302 }; 7303 Announcer.prototype.createLiveRegion = function (priority) { 7304 var el = document.createElement('div'); 7305 el.style.position = 'absolute'; 7306 el.style.top = '-9999px'; 7307 el.style.left = '-9999px'; 7308 el.style.height = '1px'; 7309 el.style.overflow = 'hidden'; 7310 el.setAttribute('aria-atomic', 'true'); 7311 el.setAttribute('aria-live', priority); 7312 el.setAttribute(exports.DATA_MDC_DOM_ANNOUNCE, 'true'); 7313 document.body.appendChild(el); 7314 return el; 7315 }; 7316 return Announcer; 7317}()
vendor: 2,628 bytes, lines 7317-7392
7317; 7318 7319/***/ }), 7320 7321/***/ "./packages/mdc-dom/events.ts": 7322/*!************************************!*\ 7323 !*** ./packages/mdc-dom/events.ts ***! 7324 \************************************/ 7325/*! no static exports found */ 7326/***/ (function(module, exports, __webpack_require__) { 7327 7328"use strict"; 7329 7330/** 7331 * @license 7332 * Copyright 2019 Google Inc. 7333 * 7334 * Permission is hereby granted, free of charge, to any person obtaining a copy 7335 * of this software and associated documentation files (the "Software"), to deal 7336 * in the Software without restriction, including without limitation the rights 7337 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7338 * copies of the Software, and to permit persons to whom the Software is 7339 * furnished to do so, subject to the following conditions: 7340 * 7341 * The above copyright notice and this permission notice shall be included in 7342 * all copies or substantial portions of the Software. 7343 * 7344 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7345 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7346 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7347 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7348 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7349 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7350 * THE SOFTWARE. 7351 */ 7352 7353Object.defineProperty(exports, "__esModule", { value: true }); 7354exports.applyPassive = void 0; 7355/** 7356 * Determine whether the current browser supports passive event listeners, and 7357 * if so, use them. 7358 */ 7359function applyPassive(globalObj) { 7360 if (globalObj === void 0) { 7361 globalObj = window; 7362 } 7363 return supportsPassiveOption(globalObj) ? { passive: true } : false; 7364} 7365exports.applyPassive = applyPassive; 7366function supportsPassiveOption(globalObj) { 7367 if (globalObj === void 0) { 7368 globalObj = window; 7369 } 7370 // See 7371 // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener 7372 var passiveSupported = false; 7373 try { 7374 var options = { 7375 // This function will be called when the browser 7376 // attempts to access the passive property. 7377 get passive() { 7378 passiveSupported = true; 7379 return false; 7380 } 7381 }; 7382 var handler = function handler() {}; 7383 globalObj.document.addEventListener('test', handler, options); 7384 globalObj.document.removeEventListener('test', handler, options); 7385 } catch (err) { 7386 passiveSupported = false; 7387 } 7388 return passiveSupported; 7389} 7390 7391/***/ }), 7392
vendor: 9,319 bytes, lines 7393-7602
7393/***/ "./packages/mdc-dom/focus-trap.ts": 7394/*!****************************************!*\ 7395 !*** ./packages/mdc-dom/focus-trap.ts ***! 7396 \****************************************/ 7397/*! no static exports found */ 7398/***/ (function(module, exports, __webpack_require__) { 7399 7400"use strict"; 7401 7402/** 7403 * @license 7404 * Copyright 2020 Google Inc. 7405 * 7406 * Permission is hereby granted, free of charge, to any person obtaining a copy 7407 * of this software and associated documentation files (the "Software"), to deal 7408 * in the Software without restriction, including without limitation the rights 7409 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7410 * copies of the Software, and to permit persons to whom the Software is 7411 * furnished to do so, subject to the following conditions: 7412 * 7413 * The above copyright notice and this permission notice shall be included in 7414 * all copies or substantial portions of the Software. 7415 * 7416 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7417 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7418 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7419 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7420 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7421 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7422 * THE SOFTWARE. 7423 */ 7424 7425Object.defineProperty(exports, "__esModule", { value: true }); 7426exports.FocusTrap = void 0; 7427var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel'; 7428/** 7429 * Utility to trap focus in a given root element, e.g. for modal components such 7430 * as dialogs. The root should have at least one focusable child element, 7431 * for setting initial focus when trapping focus. 7432 * Also tracks the previously focused element, and restores focus to that 7433 * element when releasing focus. 7434 */ 7435var FocusTrap = /** @class */function () { 7436 function FocusTrap(root, options) { 7437 if (options === void 0) { 7438 options = {}; 7439 } 7440 this.root = root; 7441 this.options = options; 7442 // Previously focused element before trapping focus. 7443 this.elFocusedBeforeTrapFocus = null; 7444 } 7445 /** 7446 * Traps focus in `root`. Also focuses on either `initialFocusEl` if set; 7447 * otherwises sets initial focus to the first focusable child element. 7448 */ 7449 FocusTrap.prototype.trapFocus = function () { 7450 var focusableEls = this.getFocusableElements(this.root); 7451 if (focusableEls.length === 0) { 7452 throw new Error('FocusTrap: Element must have at least one focusable child.'); 7453 } 7454 this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null; 7455 this.wrapTabFocus(this.root); 7456 if (!this.options.skipInitialFocus) { 7457 this.focusInitialElement(focusableEls, this.options.initialFocusEl); 7458 } 7459 }; 7460 /** 7461 * Releases focus from `root`. Also restores focus to the previously focused 7462 * element. 7463 */ 7464 FocusTrap.prototype.releaseFocus = function () { 7465 [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS)).forEach(function (sentinelEl) { 7466 sentinelEl.parentElement.removeChild(sentinelEl); 7467 }); 7468 if (!this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus) { 7469 this.elFocusedBeforeTrapFocus.focus(); 7470 } 7471 }; 7472 /** 7473 * Wraps tab focus within `el` by adding two hidden sentinel divs which are 7474 * used to mark the beginning and the end of the tabbable region. When 7475 * focused, these sentinel elements redirect focus to the first/last 7476 * children elements of the tabbable region, ensuring that focus is trapped 7477 * within that region. 7478 */ 7479 FocusTrap.prototype.wrapTabFocus = function (el) { 7480 var _this = this; 7481 var sentinelStart = this.createSentinel(); 7482 var sentinelEnd = this.createSentinel(); 7483 sentinelStart.addEventListener('focus', function () { 7484 var focusableEls = _this.getFocusableElements(el); 7485 if (focusableEls.length > 0) { 7486 focusableEls[focusableEls.length - 1].focus(); 7487 } 7488 }); 7489 sentinelEnd.addEventListener('focus', function () { 7490 var focusableEls = _this.getFocusableElements(el); 7491 if (focusableEls.length > 0) { 7492 focusableEls[0].focus(); 7493 } 7494 }); 7495 el.insertBefore(sentinelStart, el.children[0]); 7496 el.appendChild(sentinelEnd); 7497 }; 7498 /** 7499 * Focuses on `initialFocusEl` if defined and a child of the root element. 7500 * Otherwise, focuses on the first focusable child element of the root. 7501 */ 7502 FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) { 7503 var focusIndex = 0; 7504 if (initialFocusEl) { 7505 focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0); 7506 } 7507 focusableEls[focusIndex].focus(); 7508 }; 7509 FocusTrap.prototype.getFocusableElements = function (root) { 7510 var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button')); 7511 return focusableEls.filter(function (el) { 7512 var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' || el.getAttribute('disabled') != null || el.getAttribute('hidden') != null || el.getAttribute('aria-hidden') === 'true'; 7513 var isTabbableAndVisible = el.tabIndex >= 0 && el.getBoundingClientRect().width > 0 && !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden; 7514 var isProgrammaticallyHidden = false; 7515 if (isTabbableAndVisible) { 7516 var style = getComputedStyle(el); 7517 isProgrammaticallyHidden = style.display === 'none' || style.visibility === 'hidden'; 7518 } 7519 return isTabbableAndVisible && !isProgrammaticallyHidden; 7520 }); 7521 }; 7522 FocusTrap.prototype.createSentinel = function () { 7523 var sentinel = document.createElement('div'); 7524 sentinel.setAttribute('tabindex', '0'); 7525 // Don't announce in screen readers. 7526 sentinel.setAttribute('aria-hidden', 'true'); 7527 sentinel.classList.add(FOCUS_SENTINEL_CLASS); 7528 return sentinel; 7529 }; 7530 return FocusTrap; 7531}(); 7532exports.FocusTrap = FocusTrap; 7533 7534/***/ }), 7535 7536/***/ "./packages/mdc-dom/index.ts": 7537/*!***********************************!*\ 7538 !*** ./packages/mdc-dom/index.ts ***! 7539 \***********************************/ 7540/*! no static exports found */ 7541/***/ (function(module, exports, __webpack_require__) { 7542 7543"use strict"; 7544 7545/** 7546 * @license 7547 * Copyright 2018 Google Inc. 7548 * 7549 * Permission is hereby granted, free of charge, to any person obtaining a copy 7550 * of this software and associated documentation files (the "Software"), to deal 7551 * in the Software without restriction, including without limitation the rights 7552 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7553 * copies of the Software, and to permit persons to whom the Software is 7554 * furnished to do so, subject to the following conditions: 7555 * 7556 * The above copyright notice and this permission notice shall be included in 7557 * all copies or substantial portions of the Software. 7558 * 7559 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7560 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7561 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7562 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7563 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7564 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7565 * THE SOFTWARE. 7566 */ 7567 7568var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 7569 if (k2 === undefined) k2 = k; 7570 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 7571 return m[k]; 7572 } }); 7573} : function (o, m, k, k2) { 7574 if (k2 === undefined) k2 = k; 7575 o[k2] = m[k]; 7576}); 7577var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 7578 Object.defineProperty(o, "default", { enumerable: true, value: v }); 7579} : function (o, v) { 7580 o["default"] = v; 7581}); 7582var __importStar = this && this.__importStar || function (mod) { 7583 if (mod && mod.__esModule) return mod; 7584 var result = {}; 7585 if (mod != null) for (var k in mod) { 7586 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 7587 }__setModuleDefault(result, mod); 7588 return result; 7589}; 7590Object.defineProperty(exports, "__esModule", { value: true }); 7591exports.ponyfill = exports.keyboard = exports.focusTrap = exports.events = void 0; 7592var events = __importStar(__webpack_require__(/*! ./events */ "./packages/mdc-dom/events.ts")); 7593exports.events = events; 7594var focusTrap = __importStar(__webpack_require__(/*! ./focus-trap */ "./packages/mdc-dom/focus-trap.ts")); 7595exports.focusTrap = focusTrap; 7596var keyboard = __importStar(__webpack_require__(/*! ./keyboard */ "./packages/mdc-dom/keyboard.ts")); 7597exports.keyboard = keyboard; 7598var ponyfill = __importStar(__webpack_require__(/*! ./ponyfill */ "./packages/mdc-dom/ponyfill.ts")); 7599exports.ponyfill = ponyfill; 7600 7601/***/ }), 7602
vendor: 8,575 bytes, lines 7603-7830
7603/***/ "./packages/mdc-dom/keyboard.ts": 7604/*!**************************************!*\ 7605 !*** ./packages/mdc-dom/keyboard.ts ***! 7606 \**************************************/ 7607/*! no static exports found */ 7608/***/ (function(module, exports, __webpack_require__) { 7609 7610"use strict"; 7611 7612/** 7613 * @license 7614 * Copyright 2020 Google Inc. 7615 * 7616 * Permission is hereby granted, free of charge, to any person obtaining a copy 7617 * of this software and associated documentation files (the "Software"), to deal 7618 * in the Software without restriction, including without limitation the rights 7619 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7620 * copies of the Software, and to permit persons to whom the Software is 7621 * furnished to do so, subject to the following conditions: 7622 * 7623 * The above copyright notice and this permission notice shall be included in 7624 * all copies or substantial portions of the Software. 7625 * 7626 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7627 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7628 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7629 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7630 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7631 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7632 * THE SOFTWARE. 7633 */ 7634 7635Object.defineProperty(exports, "__esModule", { value: true }); 7636exports.isNavigationEvent = exports.normalizeKey = exports.KEY = void 0; 7637/** 7638 * KEY provides normalized string values for keys. 7639 */ 7640exports.KEY = { 7641 UNKNOWN: 'Unknown', 7642 BACKSPACE: 'Backspace', 7643 ENTER: 'Enter', 7644 SPACEBAR: 'Spacebar', 7645 PAGE_UP: 'PageUp', 7646 PAGE_DOWN: 'PageDown', 7647 END: 'End', 7648 HOME: 'Home', 7649 ARROW_LEFT: 'ArrowLeft', 7650 ARROW_UP: 'ArrowUp', 7651 ARROW_RIGHT: 'ArrowRight', 7652 ARROW_DOWN: 'ArrowDown', 7653 DELETE: 'Delete', 7654 ESCAPE: 'Escape', 7655 TAB: 'Tab' 7656}; 7657var normalizedKeys = new Set(); 7658// IE11 has no support for new Map with iterable so we need to initialize this 7659// by hand. 7660normalizedKeys.add(exports.KEY.BACKSPACE); 7661normalizedKeys.add(exports.KEY.ENTER); 7662normalizedKeys.add(exports.KEY.SPACEBAR); 7663normalizedKeys.add(exports.KEY.PAGE_UP); 7664normalizedKeys.add(exports.KEY.PAGE_DOWN); 7665normalizedKeys.add(exports.KEY.END); 7666normalizedKeys.add(exports.KEY.HOME); 7667normalizedKeys.add(exports.KEY.ARROW_LEFT); 7668normalizedKeys.add(exports.KEY.ARROW_UP); 7669normalizedKeys.add(exports.KEY.ARROW_RIGHT); 7670normalizedKeys.add(exports.KEY.ARROW_DOWN); 7671normalizedKeys.add(exports.KEY.DELETE); 7672normalizedKeys.add(exports.KEY.ESCAPE); 7673normalizedKeys.add(exports.KEY.TAB); 7674var KEY_CODE = { 7675 BACKSPACE: 8, 7676 ENTER: 13, 7677 SPACEBAR: 32, 7678 PAGE_UP: 33, 7679 PAGE_DOWN: 34, 7680 END: 35, 7681 HOME: 36, 7682 ARROW_LEFT: 37, 7683 ARROW_UP: 38, 7684 ARROW_RIGHT: 39, 7685 ARROW_DOWN: 40, 7686 DELETE: 46, 7687 ESCAPE: 27, 7688 TAB: 9 7689}; 7690var mappedKeyCodes = new Map(); 7691// IE11 has no support for new Map with iterable so we need to initialize this 7692// by hand. 7693mappedKeyCodes.set(KEY_CODE.BACKSPACE, exports.KEY.BACKSPACE); 7694mappedKeyCodes.set(KEY_CODE.ENTER, exports.KEY.ENTER); 7695mappedKeyCodes.set(KEY_CODE.SPACEBAR, exports.KEY.SPACEBAR); 7696mappedKeyCodes.set(KEY_CODE.PAGE_UP, exports.KEY.PAGE_UP); 7697mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, exports.KEY.PAGE_DOWN); 7698mappedKeyCodes.set(KEY_CODE.END, exports.KEY.END); 7699mappedKeyCodes.set(KEY_CODE.HOME, exports.KEY.HOME); 7700mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, exports.KEY.ARROW_LEFT); 7701mappedKeyCodes.set(KEY_CODE.ARROW_UP, exports.KEY.ARROW_UP); 7702mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, exports.KEY.ARROW_RIGHT); 7703mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, exports.KEY.ARROW_DOWN); 7704mappedKeyCodes.set(KEY_CODE.DELETE, exports.KEY.DELETE); 7705mappedKeyCodes.set(KEY_CODE.ESCAPE, exports.KEY.ESCAPE); 7706mappedKeyCodes.set(KEY_CODE.TAB, exports.KEY.TAB); 7707var navigationKeys = new Set(); 7708// IE11 has no support for new Set with iterable so we need to initialize this 7709// by hand. 7710navigationKeys.add(exports.KEY.PAGE_UP); 7711navigationKeys.add(exports.KEY.PAGE_DOWN); 7712navigationKeys.add(exports.KEY.END); 7713navigationKeys.add(exports.KEY.HOME); 7714navigationKeys.add(exports.KEY.ARROW_LEFT); 7715navigationKeys.add(exports.KEY.ARROW_UP); 7716navigationKeys.add(exports.KEY.ARROW_RIGHT); 7717navigationKeys.add(exports.KEY.ARROW_DOWN); 7718/** 7719 * normalizeKey returns the normalized string for a navigational action. 7720 */ 7721function normalizeKey(evt) { 7722 var key = evt.key; 7723 // If the event already has a normalized key, return it 7724 if (normalizedKeys.has(key)) { 7725 return key; 7726 } 7727 // tslint:disable-next-line:deprecation 7728 var mappedKey = mappedKeyCodes.get(evt.keyCode); 7729 if (mappedKey) { 7730 return mappedKey; 7731 } 7732 return exports.KEY.UNKNOWN; 7733} 7734exports.normalizeKey = normalizeKey; 7735/** 7736 * isNavigationEvent returns whether the event is a navigation event 7737 */ 7738function isNavigationEvent(evt) { 7739 return navigationKeys.has(normalizeKey(evt)); 7740} 7741exports.isNavigationEvent = isNavigationEvent; 7742 7743/***/ }), 7744 7745/***/ "./packages/mdc-dom/ponyfill.ts": 7746/*!**************************************!*\ 7747 !*** ./packages/mdc-dom/ponyfill.ts ***! 7748 \**************************************/ 7749/*! no static exports found */ 7750/***/ (function(module, exports, __webpack_require__) { 7751 7752"use strict"; 7753 7754/** 7755 * @license 7756 * Copyright 2018 Google Inc. 7757 * 7758 * Permission is hereby granted, free of charge, to any person obtaining a copy 7759 * of this software and associated documentation files (the "Software"), to deal 7760 * in the Software without restriction, including without limitation the rights 7761 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7762 * copies of the Software, and to permit persons to whom the Software is 7763 * furnished to do so, subject to the following conditions: 7764 * 7765 * The above copyright notice and this permission notice shall be included in 7766 * all copies or substantial portions of the Software. 7767 * 7768 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7769 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7770 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7771 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7772 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7773 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7774 * THE SOFTWARE. 7775 */ 7776 7777Object.defineProperty(exports, "__esModule", { value: true }); 7778exports.estimateScrollWidth = exports.matches = exports.closest = void 0; 7779/** 7780 * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. 7781 * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. 7782 */ 7783function closest(element, selector) { 7784 if (element.closest) { 7785 return element.closest(selector); 7786 } 7787 var el = element; 7788 while (el) { 7789 if (matches(el, selector)) { 7790 return el; 7791 } 7792 el = el.parentElement; 7793 } 7794 return null; 7795} 7796exports.closest = closest; 7797function matches(element, selector) { 7798 var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; 7799 return nativeMatches.call(element, selector); 7800} 7801exports.matches = matches; 7802/** 7803 * Used to compute the estimated scroll width of elements. When an element is 7804 * hidden due to display: none; being applied to a parent element, the width is 7805 * returned as 0. However, the element will have a true width once no longer 7806 * inside a display: none context. This method computes an estimated width when 7807 * the element is hidden or returns the true width when the element is visble. 7808 * @param {Element} element the element whose width to estimate 7809 */ 7810function estimateScrollWidth(element) { 7811 // Check the offsetParent. If the element inherits display: none from any 7812 // parent, the offsetParent property will be null (see 7813 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent). 7814 // This check ensures we only clone the node when necessary. 7815 var htmlEl = element; 7816 if (htmlEl.offsetParent !== null) { 7817 return htmlEl.scrollWidth; 7818 } 7819 var clone = htmlEl.cloneNode(true); 7820 clone.style.setProperty('position', 'absolute'); 7821 clone.style.setProperty('transform', 'translate(-9999px, -9999px)'); 7822 document.documentElement.appendChild(clone); 7823 var scrollWidth = clone.scrollWidth; 7824 document.documentElement.removeChild(clone); 7825 return scrollWidth; 7826} 7827exports.estimateScrollWidth = estimateScrollWidth; 7828 7829/***/ }), 7830
vendor: 6,709 bytes, lines 7831-7987
7831/***/ "./packages/mdc-drawer/adapter.ts": 7832/*!****************************************!*\ 7833 !*** ./packages/mdc-drawer/adapter.ts ***! 7834 \****************************************/ 7835/*! no static exports found */ 7836/***/ (function(module, exports, __webpack_require__) { 7837 7838"use strict"; 7839 7840/** 7841 * @license 7842 * Copyright 2018 Google Inc. 7843 * 7844 * Permission is hereby granted, free of charge, to any person obtaining a copy 7845 * of this software and associated documentation files (the "Software"), to deal 7846 * in the Software without restriction, including without limitation the rights 7847 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7848 * copies of the Software, and to permit persons to whom the Software is 7849 * furnished to do so, subject to the following conditions: 7850 * 7851 * The above copyright notice and this permission notice shall be included in 7852 * all copies or substantial portions of the Software. 7853 * 7854 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7855 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7856 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7857 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7858 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7859 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7860 * THE SOFTWARE. 7861 */ 7862 7863Object.defineProperty(exports, "__esModule", { value: true }); 7864 7865/***/ }), 7866 7867/***/ "./packages/mdc-drawer/component.ts": 7868/*!******************************************!*\ 7869 !*** ./packages/mdc-drawer/component.ts ***! 7870 \******************************************/ 7871/*! no static exports found */ 7872/***/ (function(module, exports, __webpack_require__) { 7873 7874"use strict"; 7875 7876/** 7877 * @license 7878 * Copyright 2016 Google Inc. 7879 * 7880 * Permission is hereby granted, free of charge, to any person obtaining a copy 7881 * of this software and associated documentation files (the "Software"), to deal 7882 * in the Software without restriction, including without limitation the rights 7883 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7884 * copies of the Software, and to permit persons to whom the Software is 7885 * furnished to do so, subject to the following conditions: 7886 * 7887 * The above copyright notice and this permission notice shall be included in 7888 * all copies or substantial portions of the Software. 7889 * 7890 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7891 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7892 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7893 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7894 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 7895 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 7896 * THE SOFTWARE. 7897 */ 7898 7899var __extends = this && this.__extends || function () { 7900 var _extendStatics = function extendStatics(d, b) { 7901 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 7902 d.__proto__ = b; 7903 } || function (d, b) { 7904 for (var p in b) { 7905 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 7906 } 7907 }; 7908 return _extendStatics(d, b); 7909 }; 7910 return function (d, b) { 7911 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 7912 _extendStatics(d, b); 7913 function __() { 7914 this.constructor = d; 7915 } 7916 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 7917 }; 7918}(); 7919var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 7920 if (k2 === undefined) k2 = k; 7921 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 7922 return m[k]; 7923 } }); 7924} : function (o, m, k, k2) { 7925 if (k2 === undefined) k2 = k; 7926 o[k2] = m[k]; 7927}); 7928var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 7929 Object.defineProperty(o, "default", { enumerable: true, value: v }); 7930} : function (o, v) { 7931 o["default"] = v; 7932}); 7933var __importStar = this && this.__importStar || function (mod) { 7934 if (mod && mod.__esModule) return mod; 7935 var result = {}; 7936 if (mod != null) for (var k in mod) { 7937 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 7938 }__setModuleDefault(result, mod); 7939 return result; 7940}; 7941Object.defineProperty(exports, "__esModule", { value: true }); 7942exports.MDCDrawer = void 0; 7943var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 7944var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts"); 7945var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts"); 7946var foundation_1 = __webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"); 7947var foundation_2 = __webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts"); 7948var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts")); 7949var cssClasses = foundation_1.MDCDismissibleDrawerFoundation.cssClasses, 7950 strings = foundation_1.MDCDismissibleDrawerFoundation.strings; 7951/** 7952 * @events `MDCDrawer:closed {}` Emits when the navigation drawer has closed. 7953 * @events `MDCDrawer:opened {}` Emits when the navigation drawer has opened. 7954 */ 7955var MDCDrawer = /** @class */function (_super) { 7956 __extends(MDCDrawer, _super); 7957 function MDCDrawer() { 7958 return _super !== null && _super.apply(this, arguments) || this; 7959 } 7960 MDCDrawer.attachTo = function (root) { 7961 return new MDCDrawer(root); 7962 }; 7963 Object.defineProperty(MDCDrawer.prototype, "open", { 7964 /** 7965 * @return boolean Proxies to the foundation's `open`/`close` methods. 7966 * Also returns true if drawer is in the open position. 7967 */ 7968 get: function get() { 7969 return this.foundation.isOpen(); 7970 }, 7971 /** 7972 * Toggles the drawer open and closed. 7973 */ 7974 set: function set(isOpen) { 7975 if (isOpen) { 7976 this.foundation.open(); 7977 } else { 7978 this.foundation.close(); 7979 } 7980 }, 7981 enumerable: false, 7982 configurable: true 7983 }); 7984 Object.defineProperty(MDCDrawer.prototype, "list", { 7985 // initialSyncWithDOM() 7986 get: function get() { 7987 return this.
vendor: 3,968 bytes, lines 7987-8074
7987list_; 7988 }, 7989 enumerable: false, 7990 configurable: true 7991 }); 7992 MDCDrawer.prototype.initialize = function (focusTrapFactory, listFactory) { 7993 if (focusTrapFactory === void 0) { 7994 focusTrapFactory = function focusTrapFactory(el) { 7995 return new focus_trap_1.FocusTrap(el); 7996 }; 7997 } 7998 if (listFactory === void 0) { 7999 listFactory = function listFactory(el) { 8000 return new component_2.MDCList(el); 8001 }; 8002 } 8003 var listEl = this.root.querySelector(strings.LIST_SELECTOR); 8004 if (listEl) { 8005 this.list_ = listFactory(listEl); 8006 this.list_.wrapFocus = true; 8007 } 8008 this.focusTrapFactory_ = focusTrapFactory; 8009 }; 8010 MDCDrawer.prototype.initialSyncWithDOM = function () { 8011 var _this = this; 8012 var MODAL = cssClasses.MODAL; 8013 var SCRIM_SELECTOR = strings.SCRIM_SELECTOR; 8014 this.scrim_ = this.root.parentNode.querySelector(SCRIM_SELECTOR); 8015 if (this.scrim_ && this.root.classList.contains(MODAL)) { 8016 this.handleScrimClick_ = function () { 8017 return _this.foundation.handleScrimClick(); 8018 }; 8019 this.scrim_.addEventListener('click', this.handleScrimClick_); 8020 this.focusTrap_ = util.createFocusTrapInstance(this.root, this.focusTrapFactory_); 8021 } 8022 this.handleKeydown_ = function (evt) { 8023 return _this.foundation.handleKeydown(evt); 8024 }; 8025 this.handleTransitionEnd_ = function (evt) { 8026 return _this.foundation.handleTransitionEnd(evt); 8027 }; 8028 this.listen('keydown', this.handleKeydown_); 8029 this.listen('transitionend', this.handleTransitionEnd_); 8030 }; 8031 MDCDrawer.prototype.destroy = function () { 8032 this.unlisten('keydown', this.handleKeydown_); 8033 this.unlisten('transitionend', this.handleTransitionEnd_); 8034 if (this.list_) { 8035 this.list_.destroy(); 8036 } 8037 var MODAL = cssClasses.MODAL; 8038 if (this.scrim_ && this.handleScrimClick_ && this.root.classList.contains(MODAL)) { 8039 this.scrim_.removeEventListener('click', this.handleScrimClick_); 8040 // Ensure drawer is closed to hide scrim and release focus 8041 this.open = false; 8042 } 8043 }; 8044 MDCDrawer.prototype.getDefaultFoundation = function () { 8045 var _this = this; 8046 // DO NOT INLINE this variable. For backward compatibility, foundations take 8047 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 8048 // methods, we need a separate, strongly typed adapter variable. 8049 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 8050 var adapter = { 8051 addClass: function addClass(className) { 8052 return _this.root.classList.add(className); 8053 }, 8054 removeClass: function removeClass(className) { 8055 return _this.root.classList.remove(className); 8056 }, 8057 hasClass: function hasClass(className) { 8058 return _this.root.classList.contains(className); 8059 }, 8060 elementHasClass: function elementHasClass(element, className) { 8061 return element.classList.contains(className); 8062 }, 8063 saveFocus: function saveFocus() { 8064 return _this.previousFocus_ = document.activeElement; 8065 }, 8066 restoreFocus: function restoreFocus() { 8067 var previousFocus = _this.previousFocus_; 8068 if (previousFocus && previousFocus.focus && _this.root.contains(document.activeElement)) { 8069 previousFocus.focus(); 8070 } 8071 }, 8072 focusActiveNavigationItem: function focusActiveNavigationItem() { 8073 var activeNavItemEl = _this.root.querySelector(strings.LIST_ITEM_ACTIVATED_SELECTOR); 8074 if (activeNavItemEl) {
8075 activeNavItemEl.focus(); 8076 } 8077 }, 8078 notifyClose: function notifyClose() { 8079 return _this.emit(strings.CLOSE_EVENT, {}, true /* shouldBubble */); 8080 }, 8081 notifyOpen: function notifyOpen() { 8082 return _this.emit(strings.OPEN_EVENT, {}, true /* shouldBubble */); 8083 }, 8084 trapFocus: function trapFocus() { 8085 return _this.focusTrap_.trapFocus(); 8086 }, 8087 releaseFocus: function releaseFocus() { 8088 return _this.focusTrap_
vendor: 6,254 bytes, lines 8088-8236
8088.releaseFocus(); 8089 } 8090 }; 8091 // tslint:enable:object-literal-sort-keys 8092 var DISMISSIBLE = cssClasses.DISMISSIBLE, 8093 MODAL = cssClasses.MODAL; 8094 if (this.root.classList.contains(DISMISSIBLE)) { 8095 return new foundation_1.MDCDismissibleDrawerFoundation(adapter); 8096 } else if (this.root.classList.contains(MODAL)) { 8097 return new foundation_2.MDCModalDrawerFoundation(adapter); 8098 } else { 8099 throw new Error("MDCDrawer: Failed to instantiate component. Supported variants are " + DISMISSIBLE + " and " + MODAL + "."); 8100 } 8101 }; 8102 return MDCDrawer; 8103}(component_1.MDCComponent); 8104exports.MDCDrawer = MDCDrawer; 8105 8106/***/ }), 8107 8108/***/ "./packages/mdc-drawer/constants.ts": 8109/*!******************************************!*\ 8110 !*** ./packages/mdc-drawer/constants.ts ***! 8111 \******************************************/ 8112/*! no static exports found */ 8113/***/ (function(module, exports, __webpack_require__) { 8114 8115"use strict"; 8116 8117/** 8118 * @license 8119 * Copyright 2016 Google Inc. 8120 * 8121 * Permission is hereby granted, free of charge, to any person obtaining a copy 8122 * of this software and associated documentation files (the "Software"), to deal 8123 * in the Software without restriction, including without limitation the rights 8124 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8125 * copies of the Software, and to permit persons to whom the Software is 8126 * furnished to do so, subject to the following conditions: 8127 * 8128 * The above copyright notice and this permission notice shall be included in 8129 * all copies or substantial portions of the Software. 8130 * 8131 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8132 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8133 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8134 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8135 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8136 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8137 * THE SOFTWARE. 8138 */ 8139 8140Object.defineProperty(exports, "__esModule", { value: true }); 8141exports.strings = exports.cssClasses = void 0; 8142var cssClasses = { 8143 ANIMATE: 'mdc-drawer--animate', 8144 CLOSING: 'mdc-drawer--closing', 8145 DISMISSIBLE: 'mdc-drawer--dismissible', 8146 MODAL: 'mdc-drawer--modal', 8147 OPEN: 'mdc-drawer--open', 8148 OPENING: 'mdc-drawer--opening', 8149 ROOT: 'mdc-drawer' 8150}; 8151exports.cssClasses = cssClasses; 8152var strings = { 8153 APP_CONTENT_SELECTOR: '.mdc-drawer-app-content', 8154 CLOSE_EVENT: 'MDCDrawer:closed', 8155 OPEN_EVENT: 'MDCDrawer:opened', 8156 SCRIM_SELECTOR: '.mdc-drawer-scrim', 8157 LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list', 8158 LIST_ITEM_ACTIVATED_SELECTOR: '.mdc-list-item--activated,.mdc-deprecated-list-item--activated' 8159}; 8160exports.strings = strings; 8161 8162/***/ }), 8163 8164/***/ "./packages/mdc-drawer/dismissible/foundation.ts": 8165/*!*******************************************************!*\ 8166 !*** ./packages/mdc-drawer/dismissible/foundation.ts ***! 8167 \*******************************************************/ 8168/*! no static exports found */ 8169/***/ (function(module, exports, __webpack_require__) { 8170 8171"use strict"; 8172 8173/** 8174 * @license 8175 * Copyright 2018 Google Inc. 8176 * 8177 * Permission is hereby granted, free of charge, to any person obtaining a copy 8178 * of this software and associated documentation files (the "Software"), to deal 8179 * in the Software without restriction, including without limitation the rights 8180 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8181 * copies of the Software, and to permit persons to whom the Software is 8182 * furnished to do so, subject to the following conditions: 8183 * 8184 * The above copyright notice and this permission notice shall be included in 8185 * all copies or substantial portions of the Software. 8186 * 8187 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8188 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8189 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8190 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8191 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8192 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8193 * THE SOFTWARE. 8194 */ 8195 8196var __extends = this && this.__extends || function () { 8197 var _extendStatics = function extendStatics(d, b) { 8198 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8199 d.__proto__ = b; 8200 } || function (d, b) { 8201 for (var p in b) { 8202 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 8203 } 8204 }; 8205 return _extendStatics(d, b); 8206 }; 8207 return function (d, b) { 8208 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 8209 _extendStatics(d, b); 8210 function __() { 8211 this.constructor = d; 8212 } 8213 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8214 }; 8215}(); 8216var __assign = this && this.__assign || function () { 8217 __assign = Object.assign || function (t) { 8218 for (var s, i = 1, n = arguments.length; i < n; i++) { 8219 s = arguments[i]; 8220 for (var p in s) { 8221 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 8222 } 8223 } 8224 return t; 8225 }; 8226 return __assign.apply(this, arguments); 8227}; 8228Object.defineProperty(exports, "__esModule", { value: true }); 8229exports.MDCDismissibleDrawerFoundation = void 0; 8230var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 8231var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-drawer/constants.ts"); 8232var MDCDismissibleDrawerFoundation = /** @class */function (_super) { 8233 __extends(MDCDismissibleDrawerFoundation, _super); 8234 function MDCDismissibleDrawerFoundation(adapter) { 8235 var _this = _super.call(this, __assign(__assign({}, MDCDismissibleDrawerFoundation.defaultAdapter), adapter)) || this; 8236 _this.animationFrame
8236_ = 0; 8237 _this.animationTimer_ = 0; 8238 return _this; 8239 } 8240 Object.defineProperty(MDCDismissibleDrawerFoundation, "strings", { 8241 get: function get() { 8242 return constants_1.strings; 8243 }, 8244 enumerable: false, 8245 configurable: true 8246 }); 8247 Object.defineProperty(MDCDismissibleDrawerFoundation, "cssClasses", { 8248 get: function get() {
vendor: 2,260 bytes, lines 8249-8312
8249 return constants_1.cssClasses; 8250 }, 8251 enumerable: false, 8252 configurable: true 8253 }); 8254 Object.defineProperty(MDCDismissibleDrawerFoundation, "defaultAdapter", { 8255 get: function get() { 8256 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 8257 return { 8258 addClass: function addClass() { 8259 return undefined; 8260 }, 8261 removeClass: function removeClass() { 8262 return undefined; 8263 }, 8264 hasClass: function hasClass() { 8265 return false; 8266 }, 8267 elementHasClass: function elementHasClass() { 8268 return false; 8269 }, 8270 notifyClose: function notifyClose() { 8271 return undefined; 8272 }, 8273 notifyOpen: function notifyOpen() { 8274 return undefined; 8275 }, 8276 saveFocus: function saveFocus() { 8277 return undefined; 8278 }, 8279 restoreFocus: function restoreFocus() { 8280 return undefined; 8281 }, 8282 focusActiveNavigationItem: function focusActiveNavigationItem() { 8283 return undefined; 8284 }, 8285 trapFocus: function trapFocus() { 8286 return undefined; 8287 }, 8288 releaseFocus: function releaseFocus() { 8289 return undefined; 8290 } 8291 }; 8292 // tslint:enable:object-literal-sort-keys 8293 }, 8294 enumerable: false, 8295 configurable: true 8296 }); 8297 MDCDismissibleDrawerFoundation.prototype.destroy = function () { 8298 if (this.animationFrame_) { 8299 cancelAnimationFrame(this.animationFrame_); 8300 } 8301 if (this.animationTimer_) { 8302 clearTimeout(this.animationTimer_); 8303 } 8304 }; 8305 /** 8306 * Opens the drawer from the closed state. 8307 */ 8308 MDCDismissibleDrawerFoundation.prototype.open = function () { 8309 var _this = this; 8310 if (this.isOpen() || this.isOpening() || this.isClosing()) { 8311 return; 8312 }
8313 this.adapter.addClass(constants_1.cssClasses.OPEN); 8314 this.adapter.addClass(constants_1.cssClasses.ANIMATE); 8315 // Wait a frame once display is no longer "none", to establish basis for animation 8316 this.runNextAnimationFrame_
vendor: 2,240 bytes, lines 8316-8372
8316(function () { 8317 _this.adapter.addClass(constants_1.cssClasses.OPENING); 8318 }); 8319 this.adapter.saveFocus(); 8320 }; 8321 /** 8322 * Closes the drawer from the open state. 8323 */ 8324 MDCDismissibleDrawerFoundation.prototype.close = function () { 8325 if (!this.isOpen() || this.isOpening() || this.isClosing()) { 8326 return; 8327 } 8328 this.adapter.addClass(constants_1.cssClasses.CLOSING); 8329 }; 8330 /** 8331 * Returns true if the drawer is in the open position. 8332 * @return true if drawer is in open state. 8333 */ 8334 MDCDismissibleDrawerFoundation.prototype.isOpen = function () { 8335 return this.adapter.hasClass(constants_1.cssClasses.OPEN); 8336 }; 8337 /** 8338 * Returns true if the drawer is animating open. 8339 * @return true if drawer is animating open. 8340 */ 8341 MDCDismissibleDrawerFoundation.prototype.isOpening = function () { 8342 return this.adapter.hasClass(constants_1.cssClasses.OPENING) || this.adapter.hasClass(constants_1.cssClasses.ANIMATE); 8343 }; 8344 /** 8345 * Returns true if the drawer is animating closed. 8346 * @return true if drawer is animating closed. 8347 */ 8348 MDCDismissibleDrawerFoundation.prototype.isClosing = function () { 8349 return this.adapter.hasClass(constants_1.cssClasses.CLOSING); 8350 }; 8351 /** 8352 * Keydown handler to close drawer when key is escape. 8353 */ 8354 MDCDismissibleDrawerFoundation.prototype.handleKeydown = function (evt) { 8355 var keyCode = evt.keyCode, 8356 key = evt.key; 8357 var isEscape = key === 'Escape' || keyCode === 27; 8358 if (isEscape) { 8359 this.close(); 8360 } 8361 }; 8362 /** 8363 * Handles the `transitionend` event when the drawer finishes opening/closing. 8364 */ 8365 MDCDismissibleDrawerFoundation.prototype.handleTransitionEnd = function (evt) { 8366 var OPENING = constants_1.cssClasses.OPENING, 8367 CLOSING = constants_1.cssClasses.CLOSING, 8368 OPEN = constants_1.cssClasses.OPEN, 8369 ANIMATE = constants_1.cssClasses.ANIMATE, 8370 ROOT = constants_1.cssClasses.ROOT; 8371 // In Edge, transitionend on ripple pseudo-elements yields a target without classList, so check for Element first. 8372 var isRootElement = this.isElement
8372_(evt.target) && this.adapter.elementHasClass(evt.target, ROOT); 8373 if (!isRootElement) { 8374 return; 8375 } 8376 if (this.isClosing()) { 8377 this.adapter.removeClass(OPEN); 8378 this.closed_(); 8379 this.adapter.restoreFocus(); 8380 this.adapter.notifyClose(); 8381 } else { 8382 this.adapter.focusActiveNavigationItem(); 8383 this.opened_(); 8384 this.adapter.notifyOpen(); 8385 } 8386 this.adapter.removeClass(ANIMATE); 8387 this.adapter.removeClass(OPENING); 8388 this.adapter.removeClass(CLOSING); 8389 }; 8390 /** 8391 * Extension point for when drawer finishes open animation. 8392 */ 8393 MDCDismissibleDrawerFoundation.prototype.opened_ = function () {}; // tslint:disable-line:no-empty 8394 /** 8395 * Extension point for when drawer finishes close animation. 8396 */ 8397 MDCDismissibleDrawerFoundation.prototype.closed_ = function () {}; // tslint:disable-line:no-empty 8398 /** 8399 * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. 8400 */ 8401 MDCDismissibleDrawerFoundation.prototype.runNextAnimationFrame_ = function (callback) { 8402 var _this = this; 8403 cancelAnimationFrame(this.animationFrame_); 8404 this.animationFrame_ = requestAnimationFrame(function () { 8405 _this.animationFrame_ = 0; 8406 clearTimeout(_this.animationTimer_); 8407 _this.animationTimer_ = setTimeout(callback, 0); 8408 }); 8409 }; 8410 MDCDismissibleDrawerFoundation.prototype.isElement_
vendor: 6,816 bytes, lines 8410-8563
8410 = function (element) { 8411 // In Edge, transitionend on ripple pseudo-elements yields a target without classList. 8412 return Boolean(element.classList); 8413 }; 8414 return MDCDismissibleDrawerFoundation; 8415}(foundation_1.MDCFoundation); 8416exports.MDCDismissibleDrawerFoundation = MDCDismissibleDrawerFoundation; 8417// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 8418exports.default = MDCDismissibleDrawerFoundation; 8419 8420/***/ }), 8421 8422/***/ "./packages/mdc-drawer/index.ts": 8423/*!**************************************!*\ 8424 !*** ./packages/mdc-drawer/index.ts ***! 8425 \**************************************/ 8426/*! no static exports found */ 8427/***/ (function(module, exports, __webpack_require__) { 8428 8429"use strict"; 8430 8431/** 8432 * @license 8433 * Copyright 2019 Google Inc. 8434 * 8435 * Permission is hereby granted, free of charge, to any person obtaining a copy 8436 * of this software and associated documentation files (the "Software"), to deal 8437 * in the Software without restriction, including without limitation the rights 8438 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8439 * copies of the Software, and to permit persons to whom the Software is 8440 * furnished to do so, subject to the following conditions: 8441 * 8442 * The above copyright notice and this permission notice shall be included in 8443 * all copies or substantial portions of the Software. 8444 * 8445 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8446 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8447 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8448 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8449 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8450 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8451 * THE SOFTWARE. 8452 */ 8453 8454var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 8455 if (k2 === undefined) k2 = k; 8456 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 8457 return m[k]; 8458 } }); 8459} : function (o, m, k, k2) { 8460 if (k2 === undefined) k2 = k; 8461 o[k2] = m[k]; 8462}); 8463var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 8464 Object.defineProperty(o, "default", { enumerable: true, value: v }); 8465} : function (o, v) { 8466 o["default"] = v; 8467}); 8468var __importStar = this && this.__importStar || function (mod) { 8469 if (mod && mod.__esModule) return mod; 8470 var result = {}; 8471 if (mod != null) for (var k in mod) { 8472 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 8473 }__setModuleDefault(result, mod); 8474 return result; 8475}; 8476var __exportStar = this && this.__exportStar || function (m, exports) { 8477 for (var p in m) { 8478 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 8479 } 8480}; 8481Object.defineProperty(exports, "__esModule", { value: true }); 8482exports.util = void 0; 8483var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts")); 8484exports.util = util; 8485__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-drawer/adapter.ts"), exports); 8486__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-drawer/component.ts"), exports); 8487__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-drawer/constants.ts"), exports); 8488__exportStar(__webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"), exports); 8489__exportStar(__webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts"), exports); 8490 8491/***/ }), 8492 8493/***/ "./packages/mdc-drawer/modal/foundation.ts": 8494/*!*************************************************!*\ 8495 !*** ./packages/mdc-drawer/modal/foundation.ts ***! 8496 \*************************************************/ 8497/*! no static exports found */ 8498/***/ (function(module, exports, __webpack_require__) { 8499 8500"use strict"; 8501 8502/** 8503 * @license 8504 * Copyright 2018 Google Inc. 8505 * 8506 * Permission is hereby granted, free of charge, to any person obtaining a copy 8507 * of this software and associated documentation files (the "Software"), to deal 8508 * in the Software without restriction, including without limitation the rights 8509 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8510 * copies of the Software, and to permit persons to whom the Software is 8511 * furnished to do so, subject to the following conditions: 8512 * 8513 * The above copyright notice and this permission notice shall be included in 8514 * all copies or substantial portions of the Software. 8515 * 8516 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8517 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8518 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8519 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8520 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8521 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8522 * THE SOFTWARE. 8523 */ 8524 8525var __extends = this && this.__extends || function () { 8526 var _extendStatics = function extendStatics(d, b) { 8527 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8528 d.__proto__ = b; 8529 } || function (d, b) { 8530 for (var p in b) { 8531 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 8532 } 8533 }; 8534 return _extendStatics(d, b); 8535 }; 8536 return function (d, b) { 8537 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 8538 _extendStatics(d, b); 8539 function __() { 8540 this.constructor = d; 8541 } 8542 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8543 }; 8544}(); 8545Object.defineProperty(exports, "__esModule", { value: true }); 8546exports.MDCModalDrawerFoundation = void 0; 8547var foundation_1 = __webpack_require__(/*! ../dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"); 8548/* istanbul ignore next: subclass is not a branch statement */ 8549var MDCModalDrawerFoundation = /** @class */function (_super) { 8550 __extends(MDCModalDrawerFoundation, _super); 8551 function MDCModalDrawerFoundation() { 8552 return _super !== null && _super.apply(this, arguments) || this; 8553 } 8554 /** 8555 * Handles click event on scrim. 8556 */ 8557 MDCModalDrawerFoundation.prototype.handleScrimClick = function () { 8558 this.close(); 8559 }; 8560 /** 8561 * Called when drawer finishes open animation. 8562 */ 8563 MDCModalDrawerFoundation.prototype.opened
8563_ = function () { 8564 this.adapter.trapFocus(); 8565 }; 8566 /** 8567 * Called when drawer finishes close animation. 8568 */ 8569 MDCModalDrawerFoundation.prototype.closed_
vendor: 14,180 bytes, lines 8569-8895
8569 = function () { 8570 this.adapter.releaseFocus(); 8571 }; 8572 return MDCModalDrawerFoundation; 8573}(foundation_1.MDCDismissibleDrawerFoundation); 8574exports.MDCModalDrawerFoundation = MDCModalDrawerFoundation; 8575// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 8576exports.default = MDCModalDrawerFoundation; 8577 8578/***/ }), 8579 8580/***/ "./packages/mdc-drawer/util.ts": 8581/*!*************************************!*\ 8582 !*** ./packages/mdc-drawer/util.ts ***! 8583 \*************************************/ 8584/*! no static exports found */ 8585/***/ (function(module, exports, __webpack_require__) { 8586 8587"use strict"; 8588 8589/** 8590 * @license 8591 * Copyright 2016 Google Inc. 8592 * 8593 * Permission is hereby granted, free of charge, to any person obtaining a copy 8594 * of this software and associated documentation files (the "Software"), to deal 8595 * in the Software without restriction, including without limitation the rights 8596 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8597 * copies of the Software, and to permit persons to whom the Software is 8598 * furnished to do so, subject to the following conditions: 8599 * 8600 * The above copyright notice and this permission notice shall be included in 8601 * all copies or substantial portions of the Software. 8602 * 8603 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8604 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8605 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8606 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8607 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8608 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8609 * THE SOFTWARE. 8610 */ 8611 8612Object.defineProperty(exports, "__esModule", { value: true }); 8613exports.createFocusTrapInstance = void 0; 8614function createFocusTrapInstance(surfaceEl, focusTrapFactory) { 8615 return focusTrapFactory(surfaceEl, { 8616 // Component handles focusing on active nav item. 8617 skipInitialFocus: true 8618 }); 8619} 8620exports.createFocusTrapInstance = createFocusTrapInstance; 8621 8622/***/ }), 8623 8624/***/ "./packages/mdc-floating-label/adapter.ts": 8625/*!************************************************!*\ 8626 !*** ./packages/mdc-floating-label/adapter.ts ***! 8627 \************************************************/ 8628/*! no static exports found */ 8629/***/ (function(module, exports, __webpack_require__) { 8630 8631"use strict"; 8632 8633/** 8634 * @license 8635 * Copyright 2017 Google Inc. 8636 * 8637 * Permission is hereby granted, free of charge, to any person obtaining a copy 8638 * of this software and associated documentation files (the "Software"), to deal 8639 * in the Software without restriction, including without limitation the rights 8640 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8641 * copies of the Software, and to permit persons to whom the Software is 8642 * furnished to do so, subject to the following conditions: 8643 * 8644 * The above copyright notice and this permission notice shall be included in 8645 * all copies or substantial portions of the Software. 8646 * 8647 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8648 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8649 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8650 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8651 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8652 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8653 * THE SOFTWARE. 8654 */ 8655 8656Object.defineProperty(exports, "__esModule", { value: true }); 8657 8658/***/ }), 8659 8660/***/ "./packages/mdc-floating-label/component.ts": 8661/*!**************************************************!*\ 8662 !*** ./packages/mdc-floating-label/component.ts ***! 8663 \**************************************************/ 8664/*! no static exports found */ 8665/***/ (function(module, exports, __webpack_require__) { 8666 8667"use strict"; 8668 8669/** 8670 * @license 8671 * Copyright 2016 Google Inc. 8672 * 8673 * Permission is hereby granted, free of charge, to any person obtaining a copy 8674 * of this software and associated documentation files (the "Software"), to deal 8675 * in the Software without restriction, including without limitation the rights 8676 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8677 * copies of the Software, and to permit persons to whom the Software is 8678 * furnished to do so, subject to the following conditions: 8679 * 8680 * The above copyright notice and this permission notice shall be included in 8681 * all copies or substantial portions of the Software. 8682 * 8683 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8684 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8685 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8686 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8687 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8688 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8689 * THE SOFTWARE. 8690 */ 8691 8692var __extends = this && this.__extends || function () { 8693 var _extendStatics = function extendStatics(d, b) { 8694 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8695 d.__proto__ = b; 8696 } || function (d, b) { 8697 for (var p in b) { 8698 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 8699 } 8700 }; 8701 return _extendStatics(d, b); 8702 }; 8703 return function (d, b) { 8704 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 8705 _extendStatics(d, b); 8706 function __() { 8707 this.constructor = d; 8708 } 8709 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8710 }; 8711}(); 8712Object.defineProperty(exports, "__esModule", { value: true }); 8713exports.MDCFloatingLabel = void 0; 8714var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 8715var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 8716var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts"); 8717var MDCFloatingLabel = /** @class */function (_super) { 8718 __extends(MDCFloatingLabel, _super); 8719 function MDCFloatingLabel() { 8720 return _super !== null && _super.apply(this, arguments) || this; 8721 } 8722 MDCFloatingLabel.attachTo = function (root) { 8723 return new MDCFloatingLabel(root); 8724 }; 8725 /** 8726 * Styles the label to produce the label shake for errors. 8727 * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class. 8728 */ 8729 MDCFloatingLabel.prototype.shake = function (shouldShake) { 8730 this.foundation.shake(shouldShake); 8731 }; 8732 /** 8733 * Styles the label to float/dock. 8734 * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class. 8735 */ 8736 MDCFloatingLabel.prototype.float = function (shouldFloat) { 8737 this.foundation.float(shouldFloat); 8738 }; 8739 /** 8740 * Styles the label as required. 8741 * @param isRequired If true, adds an asterisk to the label, indicating that it is required. 8742 */ 8743 MDCFloatingLabel.prototype.setRequired = function (isRequired) { 8744 this.foundation.setRequired(isRequired); 8745 }; 8746 MDCFloatingLabel.prototype.getWidth = function () { 8747 return this.foundation.getWidth(); 8748 }; 8749 MDCFloatingLabel.prototype.getDefaultFoundation = function () { 8750 var _this = this; 8751 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 8752 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 8753 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 8754 var adapter = { 8755 addClass: function addClass(className) { 8756 return _this.root.classList.add(className); 8757 }, 8758 removeClass: function removeClass(className) { 8759 return _this.root.classList.remove(className); 8760 }, 8761 getWidth: function getWidth() { 8762 return ponyfill_1.estimateScrollWidth(_this.root); 8763 }, 8764 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 8765 return _this.listen(evtType, handler); 8766 }, 8767 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 8768 return _this.unlisten(evtType, handler); 8769 } 8770 }; 8771 // tslint:enable:object-literal-sort-keys 8772 return new foundation_1.MDCFloatingLabelFoundation(adapter); 8773 }; 8774 return MDCFloatingLabel; 8775}(component_1.MDCComponent); 8776exports.MDCFloatingLabel = MDCFloatingLabel; 8777 8778/***/ }), 8779 8780/***/ "./packages/mdc-floating-label/constants.ts": 8781/*!**************************************************!*\ 8782 !*** ./packages/mdc-floating-label/constants.ts ***! 8783 \**************************************************/ 8784/*! no static exports found */ 8785/***/ (function(module, exports, __webpack_require__) { 8786 8787"use strict"; 8788 8789/** 8790 * @license 8791 * Copyright 2016 Google Inc. 8792 * 8793 * Permission is hereby granted, free of charge, to any person obtaining a copy 8794 * of this software and associated documentation files (the "Software"), to deal 8795 * in the Software without restriction, including without limitation the rights 8796 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8797 * copies of the Software, and to permit persons to whom the Software is 8798 * furnished to do so, subject to the following conditions: 8799 * 8800 * The above copyright notice and this permission notice shall be included in 8801 * all copies or substantial portions of the Software. 8802 * 8803 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8804 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8805 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8806 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8807 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8808 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8809 * THE SOFTWARE. 8810 */ 8811 8812Object.defineProperty(exports, "__esModule", { value: true }); 8813exports.cssClasses = void 0; 8814exports.cssClasses = { 8815 LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above', 8816 LABEL_REQUIRED: 'mdc-floating-label--required', 8817 LABEL_SHAKE: 'mdc-floating-label--shake', 8818 ROOT: 'mdc-floating-label' 8819}; 8820 8821/***/ }), 8822 8823/***/ "./packages/mdc-floating-label/foundation.ts": 8824/*!***************************************************!*\ 8825 !*** ./packages/mdc-floating-label/foundation.ts ***! 8826 \***************************************************/ 8827/*! no static exports found */ 8828/***/ (function(module, exports, __webpack_require__) { 8829 8830"use strict"; 8831 8832/** 8833 * @license 8834 * Copyright 2016 Google Inc. 8835 * 8836 * Permission is hereby granted, free of charge, to any person obtaining a copy 8837 * of this software and associated documentation files (the "Software"), to deal 8838 * in the Software without restriction, including without limitation the rights 8839 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8840 * copies of the Software, and to permit persons to whom the Software is 8841 * furnished to do so, subject to the following conditions: 8842 * 8843 * The above copyright notice and this permission notice shall be included in 8844 * all copies or substantial portions of the Software. 8845 * 8846 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8847 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 8848 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 8849 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 8850 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 8851 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 8852 * THE SOFTWARE. 8853 */ 8854 8855var __extends = this && this.__extends || function () { 8856 var _extendStatics = function extendStatics(d, b) { 8857 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 8858 d.__proto__ = b; 8859 } || function (d, b) { 8860 for (var p in b) { 8861 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 8862 } 8863 }; 8864 return _extendStatics(d, b); 8865 }; 8866 return function (d, b) { 8867 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 8868 _extendStatics(d, b); 8869 function __() { 8870 this.constructor = d; 8871 } 8872 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 8873 }; 8874}(); 8875var __assign = this && this.__assign || function () { 8876 __assign = Object.assign || function (t) { 8877 for (var s, i = 1, n = arguments.length; i < n; i++) { 8878 s = arguments[i]; 8879 for (var p in s) { 8880 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 8881 } 8882 } 8883 return t; 8884 }; 8885 return __assign.apply(this, arguments); 8886}; 8887Object.defineProperty(exports, "__esModule", { value: true }); 8888exports.MDCFloatingLabelFoundation = void 0; 8889var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 8890var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts"); 8891var MDCFloatingLabelFoundation = /** @class */function (_super) { 8892 __extends(MDCFloatingLabelFoundation, _super); 8893 function MDCFloatingLabelFoundation(adapter) { 8894 var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this; 8895 _this.shakeAnimationEndHandler
8895_ = function () { 8896 return _this.handleShakeAnimationEnd_(); 8897 }; 8898 return _this; 8899 } 8900 Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", { 8901 get: function get() { 8902 return constants_1.cssClasses; 8903 }, 8904 enumerable: false, 8905 configurable: true 8906 }); 8907 Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", { 8908 /** 8909 * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types. 8910 */ 8911 get: function get() { 8912 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 8913 return { 8914 addClass: function addClass() { 8915 return undefined; 8916 }, 8917 removeClass: function removeClass() { 8918 return undefined; 8919 }, 8920 getWidth: function getWidth() { 8921 return 0; 8922 }, 8923 registerInteractionHandler: function registerInteractionHandler() { 8924 return undefined; 8925 }, 8926 deregisterInteractionHandler: function deregisterInteractionHandler() { 8927 return undefined; 8928 } 8929 }; 8930 // tslint:enable:object-literal-sort-keys 8931 }, 8932 enumerable: false, 8933 configurable: true 8934 }); 8935 MDCFloatingLabelFoundation.prototype.init = function () { 8936 this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_); 8937 }; 8938 MDCFloatingLabelFoundation.prototype.destroy = function () { 8939 this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_); 8940 }; 8941 /** 8942 * Returns the width of the label element. 8943 */ 8944 MDCFloatingLabelFoundation.prototype.getWidth = function () { 8945 return this.adapter.getWidth(); 8946 }; 8947 /** 8948 * Styles the label to produce a shake animation to indicate an error. 8949 * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class. 8950 */ 8951 MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) { 8952 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; 8953 if (shouldShake) { 8954 this.adapter.addClass(LABEL_SHAKE); 8955 } else { 8956 this.adapter.removeClass(LABEL_SHAKE); 8957 } 8958 }; 8959 /** 8960 * Styles the label to float or dock. 8961 * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label. 8962 */ 8963 MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) { 8964 var _a = MDCFloatingLabelFoundation.cssClasses, 8965 LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, 8966 LABEL_SHAKE = _a.LABEL_SHAKE; 8967 if (shouldFloat) { 8968 this.adapter.addClass(LABEL_FLOAT_ABOVE); 8969 } else { 8970 this.adapter.removeClass(LABEL_FLOAT_ABOVE); 8971 this.adapter.removeClass(LABEL_SHAKE); 8972 } 8973 }; 8974 /** 8975 * Styles the label as required. 8976 * @param isRequired If true, adds an asterisk to the label, indicating that it is required. 8977 */ 8978 MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) { 8979 var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED; 8980 if (isRequired) { 8981 this.adapter.addClass(LABEL_REQUIRED); 8982 } else { 8983 this.adapter.removeClass(LABEL_REQUIRED); 8984 } 8985 }; 8986 MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_
vendor: 49,995 bytes, lines 8986-10161
8986 = function () { 8987 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; 8988 this.adapter.removeClass(LABEL_SHAKE); 8989 }; 8990 return MDCFloatingLabelFoundation; 8991}(foundation_1.MDCFoundation); 8992exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation; 8993// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 8994exports.default = MDCFloatingLabelFoundation; 8995 8996/***/ }), 8997 8998/***/ "./packages/mdc-floating-label/index.ts": 8999/*!**********************************************!*\ 9000 !*** ./packages/mdc-floating-label/index.ts ***! 9001 \**********************************************/ 9002/*! no static exports found */ 9003/***/ (function(module, exports, __webpack_require__) { 9004 9005"use strict"; 9006 9007/** 9008 * @license 9009 * Copyright 2019 Google Inc. 9010 * 9011 * Permission is hereby granted, free of charge, to any person obtaining a copy 9012 * of this software and associated documentation files (the "Software"), to deal 9013 * in the Software without restriction, including without limitation the rights 9014 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9015 * copies of the Software, and to permit persons to whom the Software is 9016 * furnished to do so, subject to the following conditions: 9017 * 9018 * The above copyright notice and this permission notice shall be included in 9019 * all copies or substantial portions of the Software. 9020 * 9021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9022 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9024 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9026 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9027 * THE SOFTWARE. 9028 */ 9029 9030var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 9031 if (k2 === undefined) k2 = k; 9032 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 9033 return m[k]; 9034 } }); 9035} : function (o, m, k, k2) { 9036 if (k2 === undefined) k2 = k; 9037 o[k2] = m[k]; 9038}); 9039var __exportStar = this && this.__exportStar || function (m, exports) { 9040 for (var p in m) { 9041 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 9042 } 9043}; 9044Object.defineProperty(exports, "__esModule", { value: true }); 9045__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-floating-label/adapter.ts"), exports); 9046__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-floating-label/component.ts"), exports); 9047__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts"), exports); 9048__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts"), exports); 9049 9050/***/ }), 9051 9052/***/ "./packages/mdc-form-field/adapter.ts": 9053/*!********************************************!*\ 9054 !*** ./packages/mdc-form-field/adapter.ts ***! 9055 \********************************************/ 9056/*! no static exports found */ 9057/***/ (function(module, exports, __webpack_require__) { 9058 9059"use strict"; 9060 9061/** 9062 * @license 9063 * Copyright 2016 Google Inc. 9064 * 9065 * Permission is hereby granted, free of charge, to any person obtaining a copy 9066 * of this software and associated documentation files (the "Software"), to deal 9067 * in the Software without restriction, including without limitation the rights 9068 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9069 * copies of the Software, and to permit persons to whom the Software is 9070 * furnished to do so, subject to the following conditions: 9071 * 9072 * The above copyright notice and this permission notice shall be included in 9073 * all copies or substantial portions of the Software. 9074 * 9075 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9076 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9077 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9078 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9079 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9080 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9081 * THE SOFTWARE. 9082 */ 9083 9084Object.defineProperty(exports, "__esModule", { value: true }); 9085 9086/***/ }), 9087 9088/***/ "./packages/mdc-form-field/component.ts": 9089/*!**********************************************!*\ 9090 !*** ./packages/mdc-form-field/component.ts ***! 9091 \**********************************************/ 9092/*! no static exports found */ 9093/***/ (function(module, exports, __webpack_require__) { 9094 9095"use strict"; 9096 9097/** 9098 * @license 9099 * Copyright 2017 Google Inc. 9100 * 9101 * Permission is hereby granted, free of charge, to any person obtaining a copy 9102 * of this software and associated documentation files (the "Software"), to deal 9103 * in the Software without restriction, including without limitation the rights 9104 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9105 * copies of the Software, and to permit persons to whom the Software is 9106 * furnished to do so, subject to the following conditions: 9107 * 9108 * The above copyright notice and this permission notice shall be included in 9109 * all copies or substantial portions of the Software. 9110 * 9111 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9112 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9113 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9114 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9115 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9116 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9117 * THE SOFTWARE. 9118 */ 9119 9120var __extends = this && this.__extends || function () { 9121 var _extendStatics = function extendStatics(d, b) { 9122 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9123 d.__proto__ = b; 9124 } || function (d, b) { 9125 for (var p in b) { 9126 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 9127 } 9128 }; 9129 return _extendStatics(d, b); 9130 }; 9131 return function (d, b) { 9132 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 9133 _extendStatics(d, b); 9134 function __() { 9135 this.constructor = d; 9136 } 9137 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9138 }; 9139}(); 9140Object.defineProperty(exports, "__esModule", { value: true }); 9141exports.MDCFormField = void 0; 9142var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 9143var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts"); 9144var MDCFormField = /** @class */function (_super) { 9145 __extends(MDCFormField, _super); 9146 function MDCFormField() { 9147 return _super !== null && _super.apply(this, arguments) || this; 9148 } 9149 MDCFormField.attachTo = function (root) { 9150 return new MDCFormField(root); 9151 }; 9152 MDCFormField.prototype.labelEl = function () { 9153 var LABEL_SELECTOR = foundation_1.MDCFormFieldFoundation.strings.LABEL_SELECTOR; 9154 return this.root.querySelector(LABEL_SELECTOR); 9155 }; 9156 MDCFormField.prototype.getDefaultFoundation = function () { 9157 var _this = this; 9158 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 9159 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 9160 var adapter = { 9161 activateInputRipple: function activateInputRipple() { 9162 if (_this.input && _this.input.ripple) { 9163 _this.input.ripple.activate(); 9164 } 9165 }, 9166 deactivateInputRipple: function deactivateInputRipple() { 9167 if (_this.input && _this.input.ripple) { 9168 _this.input.ripple.deactivate(); 9169 } 9170 }, 9171 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 9172 var labelEl = _this.labelEl(); 9173 if (labelEl) { 9174 labelEl.removeEventListener(evtType, handler); 9175 } 9176 }, 9177 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 9178 var labelEl = _this.labelEl(); 9179 if (labelEl) { 9180 labelEl.addEventListener(evtType, handler); 9181 } 9182 } 9183 }; 9184 return new foundation_1.MDCFormFieldFoundation(adapter); 9185 }; 9186 return MDCFormField; 9187}(component_1.MDCComponent); 9188exports.MDCFormField = MDCFormField; 9189 9190/***/ }), 9191 9192/***/ "./packages/mdc-form-field/constants.ts": 9193/*!**********************************************!*\ 9194 !*** ./packages/mdc-form-field/constants.ts ***! 9195 \**********************************************/ 9196/*! no static exports found */ 9197/***/ (function(module, exports, __webpack_require__) { 9198 9199"use strict"; 9200 9201/** 9202 * @license 9203 * Copyright 2017 Google Inc. 9204 * 9205 * Permission is hereby granted, free of charge, to any person obtaining a copy 9206 * of this software and associated documentation files (the "Software"), to deal 9207 * in the Software without restriction, including without limitation the rights 9208 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9209 * copies of the Software, and to permit persons to whom the Software is 9210 * furnished to do so, subject to the following conditions: 9211 * 9212 * The above copyright notice and this permission notice shall be included in 9213 * all copies or substantial portions of the Software. 9214 * 9215 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9216 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9217 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9218 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9219 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9220 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9221 * THE SOFTWARE. 9222 */ 9223 9224Object.defineProperty(exports, "__esModule", { value: true }); 9225exports.strings = exports.cssClasses = void 0; 9226exports.cssClasses = { 9227 ROOT: 'mdc-form-field' 9228}; 9229exports.strings = { 9230 LABEL_SELECTOR: '.mdc-form-field > label' 9231}; 9232 9233/***/ }), 9234 9235/***/ "./packages/mdc-form-field/foundation.ts": 9236/*!***********************************************!*\ 9237 !*** ./packages/mdc-form-field/foundation.ts ***! 9238 \***********************************************/ 9239/*! no static exports found */ 9240/***/ (function(module, exports, __webpack_require__) { 9241 9242"use strict"; 9243 9244/** 9245 * @license 9246 * Copyright 2017 Google Inc. 9247 * 9248 * Permission is hereby granted, free of charge, to any person obtaining a copy 9249 * of this software and associated documentation files (the "Software"), to deal 9250 * in the Software without restriction, including without limitation the rights 9251 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9252 * copies of the Software, and to permit persons to whom the Software is 9253 * furnished to do so, subject to the following conditions: 9254 * 9255 * The above copyright notice and this permission notice shall be included in 9256 * all copies or substantial portions of the Software. 9257 * 9258 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9259 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9260 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9261 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9262 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9263 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9264 * THE SOFTWARE. 9265 */ 9266 9267var __extends = this && this.__extends || function () { 9268 var _extendStatics = function extendStatics(d, b) { 9269 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9270 d.__proto__ = b; 9271 } || function (d, b) { 9272 for (var p in b) { 9273 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 9274 } 9275 }; 9276 return _extendStatics(d, b); 9277 }; 9278 return function (d, b) { 9279 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 9280 _extendStatics(d, b); 9281 function __() { 9282 this.constructor = d; 9283 } 9284 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9285 }; 9286}(); 9287var __assign = this && this.__assign || function () { 9288 __assign = Object.assign || function (t) { 9289 for (var s, i = 1, n = arguments.length; i < n; i++) { 9290 s = arguments[i]; 9291 for (var p in s) { 9292 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 9293 } 9294 } 9295 return t; 9296 }; 9297 return __assign.apply(this, arguments); 9298}; 9299Object.defineProperty(exports, "__esModule", { value: true }); 9300exports.MDCFormFieldFoundation = void 0; 9301var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 9302var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts"); 9303var MDCFormFieldFoundation = /** @class */function (_super) { 9304 __extends(MDCFormFieldFoundation, _super); 9305 function MDCFormFieldFoundation(adapter) { 9306 var _this = _super.call(this, __assign(__assign({}, MDCFormFieldFoundation.defaultAdapter), adapter)) || this; 9307 _this.click = function () { 9308 _this.handleClick(); 9309 }; 9310 return _this; 9311 } 9312 Object.defineProperty(MDCFormFieldFoundation, "cssClasses", { 9313 get: function get() { 9314 return constants_1.cssClasses; 9315 }, 9316 enumerable: false, 9317 configurable: true 9318 }); 9319 Object.defineProperty(MDCFormFieldFoundation, "strings", { 9320 get: function get() { 9321 return constants_1.strings; 9322 }, 9323 enumerable: false, 9324 configurable: true 9325 }); 9326 Object.defineProperty(MDCFormFieldFoundation, "defaultAdapter", { 9327 get: function get() { 9328 return { 9329 activateInputRipple: function activateInputRipple() { 9330 return undefined; 9331 }, 9332 deactivateInputRipple: function deactivateInputRipple() { 9333 return undefined; 9334 }, 9335 deregisterInteractionHandler: function deregisterInteractionHandler() { 9336 return undefined; 9337 }, 9338 registerInteractionHandler: function registerInteractionHandler() { 9339 return undefined; 9340 } 9341 }; 9342 }, 9343 enumerable: false, 9344 configurable: true 9345 }); 9346 MDCFormFieldFoundation.prototype.init = function () { 9347 this.adapter.registerInteractionHandler('click', this.click); 9348 }; 9349 MDCFormFieldFoundation.prototype.destroy = function () { 9350 this.adapter.deregisterInteractionHandler('click', this.click); 9351 }; 9352 MDCFormFieldFoundation.prototype.handleClick = function () { 9353 var _this = this; 9354 this.adapter.activateInputRipple(); 9355 requestAnimationFrame(function () { 9356 _this.adapter.deactivateInputRipple(); 9357 }); 9358 }; 9359 return MDCFormFieldFoundation; 9360}(foundation_1.MDCFoundation); 9361exports.MDCFormFieldFoundation = MDCFormFieldFoundation; 9362// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 9363exports.default = MDCFormFieldFoundation; 9364 9365/***/ }), 9366 9367/***/ "./packages/mdc-form-field/index.ts": 9368/*!******************************************!*\ 9369 !*** ./packages/mdc-form-field/index.ts ***! 9370 \******************************************/ 9371/*! no static exports found */ 9372/***/ (function(module, exports, __webpack_require__) { 9373 9374"use strict"; 9375 9376/** 9377 * @license 9378 * Copyright 2019 Google Inc. 9379 * 9380 * Permission is hereby granted, free of charge, to any person obtaining a copy 9381 * of this software and associated documentation files (the "Software"), to deal 9382 * in the Software without restriction, including without limitation the rights 9383 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9384 * copies of the Software, and to permit persons to whom the Software is 9385 * furnished to do so, subject to the following conditions: 9386 * 9387 * The above copyright notice and this permission notice shall be included in 9388 * all copies or substantial portions of the Software. 9389 * 9390 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9391 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9392 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9393 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9394 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9395 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9396 * THE SOFTWARE. 9397 */ 9398 9399var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 9400 if (k2 === undefined) k2 = k; 9401 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 9402 return m[k]; 9403 } }); 9404} : function (o, m, k, k2) { 9405 if (k2 === undefined) k2 = k; 9406 o[k2] = m[k]; 9407}); 9408var __exportStar = this && this.__exportStar || function (m, exports) { 9409 for (var p in m) { 9410 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 9411 } 9412}; 9413Object.defineProperty(exports, "__esModule", { value: true }); 9414__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-form-field/adapter.ts"), exports); 9415__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-form-field/component.ts"), exports); 9416__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts"), exports); 9417__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts"), exports); 9418 9419/***/ }), 9420 9421/***/ "./packages/mdc-icon-button/adapter.ts": 9422/*!*********************************************!*\ 9423 !*** ./packages/mdc-icon-button/adapter.ts ***! 9424 \*********************************************/ 9425/*! no static exports found */ 9426/***/ (function(module, exports, __webpack_require__) { 9427 9428"use strict"; 9429 9430/** 9431 * @license 9432 * Copyright 2018 Google Inc. 9433 * 9434 * Permission is hereby granted, free of charge, to any person obtaining a copy 9435 * of this software and associated documentation files (the "Software"), to deal 9436 * in the Software without restriction, including without limitation the rights 9437 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9438 * copies of the Software, and to permit persons to whom the Software is 9439 * furnished to do so, subject to the following conditions: 9440 * 9441 * The above copyright notice and this permission notice shall be included in 9442 * all copies or substantial portions of the Software. 9443 * 9444 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9445 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9446 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9447 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9448 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9449 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9450 * THE SOFTWARE. 9451 */ 9452 9453Object.defineProperty(exports, "__esModule", { value: true }); 9454 9455/***/ }), 9456 9457/***/ "./packages/mdc-icon-button/component.ts": 9458/*!***********************************************!*\ 9459 !*** ./packages/mdc-icon-button/component.ts ***! 9460 \***********************************************/ 9461/*! no static exports found */ 9462/***/ (function(module, exports, __webpack_require__) { 9463 9464"use strict"; 9465 9466/** 9467 * @license 9468 * Copyright 2018 Google Inc. 9469 * 9470 * Permission is hereby granted, free of charge, to any person obtaining a copy 9471 * of this software and associated documentation files (the "Software"), to deal 9472 * in the Software without restriction, including without limitation the rights 9473 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9474 * copies of the Software, and to permit persons to whom the Software is 9475 * furnished to do so, subject to the following conditions: 9476 * 9477 * The above copyright notice and this permission notice shall be included in 9478 * all copies or substantial portions of the Software. 9479 * 9480 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9481 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9482 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9483 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9484 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9485 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9486 * THE SOFTWARE. 9487 */ 9488 9489var __extends = this && this.__extends || function () { 9490 var _extendStatics = function extendStatics(d, b) { 9491 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9492 d.__proto__ = b; 9493 } || function (d, b) { 9494 for (var p in b) { 9495 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 9496 } 9497 }; 9498 return _extendStatics(d, b); 9499 }; 9500 return function (d, b) { 9501 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 9502 _extendStatics(d, b); 9503 function __() { 9504 this.constructor = d; 9505 } 9506 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9507 }; 9508}(); 9509Object.defineProperty(exports, "__esModule", { value: true }); 9510exports.MDCIconButtonToggle = void 0; 9511var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 9512var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 9513var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts"); 9514var strings = foundation_1.MDCIconButtonToggleFoundation.strings; 9515var MDCIconButtonToggle = /** @class */function (_super) { 9516 __extends(MDCIconButtonToggle, _super); 9517 function MDCIconButtonToggle() { 9518 var _this = _super !== null && _super.apply(this, arguments) || this; 9519 _this.rippleComponent = _this.createRipple(); 9520 return _this; 9521 } 9522 MDCIconButtonToggle.attachTo = function (root) { 9523 return new MDCIconButtonToggle(root); 9524 }; 9525 MDCIconButtonToggle.prototype.initialSyncWithDOM = function () { 9526 var _this = this; 9527 this.handleClick = function () { 9528 _this.foundation.handleClick(); 9529 }; 9530 this.listen('click', this.handleClick); 9531 }; 9532 MDCIconButtonToggle.prototype.destroy = function () { 9533 this.unlisten('click', this.handleClick); 9534 this.ripple.destroy(); 9535 _super.prototype.destroy.call(this); 9536 }; 9537 MDCIconButtonToggle.prototype.getDefaultFoundation = function () { 9538 var _this = this; 9539 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 9540 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 9541 var adapter = { 9542 addClass: function addClass(className) { 9543 return _this.root.classList.add(className); 9544 }, 9545 hasClass: function hasClass(className) { 9546 return _this.root.classList.contains(className); 9547 }, 9548 notifyChange: function notifyChange(evtData) { 9549 _this.emit(strings.CHANGE_EVENT, evtData); 9550 }, 9551 removeClass: function removeClass(className) { 9552 return _this.root.classList.remove(className); 9553 }, 9554 getAttr: function getAttr(attrName) { 9555 return _this.root.getAttribute(attrName); 9556 }, 9557 setAttr: function setAttr(attrName, attrValue) { 9558 return _this.root.setAttribute(attrName, attrValue); 9559 } 9560 }; 9561 return new foundation_1.MDCIconButtonToggleFoundation(adapter); 9562 }; 9563 Object.defineProperty(MDCIconButtonToggle.prototype, "ripple", { 9564 get: function get() { 9565 return this.rippleComponent; 9566 }, 9567 enumerable: false, 9568 configurable: true 9569 }); 9570 Object.defineProperty(MDCIconButtonToggle.prototype, "on", { 9571 get: function get() { 9572 return this.foundation.isOn(); 9573 }, 9574 set: function set(isOn) { 9575 this.foundation.toggle(isOn); 9576 }, 9577 enumerable: false, 9578 configurable: true 9579 }); 9580 MDCIconButtonToggle.prototype.createRipple = function () { 9581 var ripple = new component_2.MDCRipple(this.root); 9582 ripple.unbounded = true; 9583 return ripple; 9584 }; 9585 return MDCIconButtonToggle; 9586}(component_1.MDCComponent); 9587exports.MDCIconButtonToggle = MDCIconButtonToggle; 9588 9589/***/ }), 9590 9591/***/ "./packages/mdc-icon-button/constants.ts": 9592/*!***********************************************!*\ 9593 !*** ./packages/mdc-icon-button/constants.ts ***! 9594 \***********************************************/ 9595/*! no static exports found */ 9596/***/ (function(module, exports, __webpack_require__) { 9597 9598"use strict"; 9599 9600/** 9601 * @license 9602 * Copyright 2018 Google Inc. 9603 * 9604 * Permission is hereby granted, free of charge, to any person obtaining a copy 9605 * of this software and associated documentation files (the "Software"), to deal 9606 * in the Software without restriction, including without limitation the rights 9607 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9608 * copies of the Software, and to permit persons to whom the Software is 9609 * furnished to do so, subject to the following conditions: 9610 * 9611 * The above copyright notice and this permission notice shall be included in 9612 * all copies or substantial portions of the Software. 9613 * 9614 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9615 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9616 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9617 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9618 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9619 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9620 * THE SOFTWARE. 9621 */ 9622 9623Object.defineProperty(exports, "__esModule", { value: true }); 9624exports.strings = exports.cssClasses = void 0; 9625exports.cssClasses = { 9626 ICON_BUTTON_ON: 'mdc-icon-button--on', 9627 ROOT: 'mdc-icon-button' 9628}; 9629exports.strings = { 9630 ARIA_LABEL: 'aria-label', 9631 ARIA_PRESSED: 'aria-pressed', 9632 DATA_ARIA_LABEL_OFF: 'data-aria-label-off', 9633 DATA_ARIA_LABEL_ON: 'data-aria-label-on', 9634 CHANGE_EVENT: 'MDCIconButtonToggle:change' 9635}; 9636 9637/***/ }), 9638 9639/***/ "./packages/mdc-icon-button/foundation.ts": 9640/*!************************************************!*\ 9641 !*** ./packages/mdc-icon-button/foundation.ts ***! 9642 \************************************************/ 9643/*! no static exports found */ 9644/***/ (function(module, exports, __webpack_require__) { 9645 9646"use strict"; 9647 9648/** 9649 * @license 9650 * Copyright 2018 Google Inc. 9651 * 9652 * Permission is hereby granted, free of charge, to any person obtaining a copy 9653 * of this software and associated documentation files (the "Software"), to deal 9654 * in the Software without restriction, including without limitation the rights 9655 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9656 * copies of the Software, and to permit persons to whom the Software is 9657 * furnished to do so, subject to the following conditions: 9658 * 9659 * The above copyright notice and this permission notice shall be included in 9660 * all copies or substantial portions of the Software. 9661 * 9662 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9663 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9664 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9665 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9666 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9667 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9668 * THE SOFTWARE. 9669 */ 9670 9671var __extends = this && this.__extends || function () { 9672 var _extendStatics = function extendStatics(d, b) { 9673 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9674 d.__proto__ = b; 9675 } || function (d, b) { 9676 for (var p in b) { 9677 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 9678 } 9679 }; 9680 return _extendStatics(d, b); 9681 }; 9682 return function (d, b) { 9683 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 9684 _extendStatics(d, b); 9685 function __() { 9686 this.constructor = d; 9687 } 9688 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9689 }; 9690}(); 9691var __assign = this && this.__assign || function () { 9692 __assign = Object.assign || function (t) { 9693 for (var s, i = 1, n = arguments.length; i < n; i++) { 9694 s = arguments[i]; 9695 for (var p in s) { 9696 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 9697 } 9698 } 9699 return t; 9700 }; 9701 return __assign.apply(this, arguments); 9702}; 9703Object.defineProperty(exports, "__esModule", { value: true }); 9704exports.MDCIconButtonToggleFoundation = void 0; 9705var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 9706var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts"); 9707var MDCIconButtonToggleFoundation = /** @class */function (_super) { 9708 __extends(MDCIconButtonToggleFoundation, _super); 9709 function MDCIconButtonToggleFoundation(adapter) { 9710 var _this = _super.call(this, __assign(__assign({}, MDCIconButtonToggleFoundation.defaultAdapter), adapter)) || this; 9711 /** 9712 * Whether the icon button has an aria label that changes depending on 9713 * toggled state. 9714 */ 9715 _this.hasToggledAriaLabel = false; 9716 return _this; 9717 } 9718 Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", { 9719 get: function get() { 9720 return constants_1.cssClasses; 9721 }, 9722 enumerable: false, 9723 configurable: true 9724 }); 9725 Object.defineProperty(MDCIconButtonToggleFoundation, "strings", { 9726 get: function get() { 9727 return constants_1.strings; 9728 }, 9729 enumerable: false, 9730 configurable: true 9731 }); 9732 Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", { 9733 get: function get() { 9734 return { 9735 addClass: function addClass() { 9736 return undefined; 9737 }, 9738 hasClass: function hasClass() { 9739 return false; 9740 }, 9741 notifyChange: function notifyChange() { 9742 return undefined; 9743 }, 9744 removeClass: function removeClass() { 9745 return undefined; 9746 }, 9747 getAttr: function getAttr() { 9748 return null; 9749 }, 9750 setAttr: function setAttr() { 9751 return undefined; 9752 } 9753 }; 9754 }, 9755 enumerable: false, 9756 configurable: true 9757 }); 9758 MDCIconButtonToggleFoundation.prototype.init = function () { 9759 var ariaLabelOn = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON); 9760 var ariaLabelOff = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF); 9761 if (ariaLabelOn && ariaLabelOff) { 9762 if (this.adapter.getAttr(constants_1.strings.ARIA_PRESSED) !== null) { 9763 throw new Error('MDCIconButtonToggleFoundation: Button should not set ' + '`aria-pressed` if it has a toggled aria label.'); 9764 } 9765 this.hasToggledAriaLabel = true; 9766 } else { 9767 this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, String(this.isOn())); 9768 } 9769 }; 9770 MDCIconButtonToggleFoundation.prototype.handleClick = function () { 9771 this.toggle(); 9772 this.adapter.notifyChange({ isOn: this.isOn() }); 9773 }; 9774 MDCIconButtonToggleFoundation.prototype.isOn = function () { 9775 return this.adapter.hasClass(constants_1.cssClasses.ICON_BUTTON_ON); 9776 }; 9777 MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) { 9778 if (isOn === void 0) { 9779 isOn = !this.isOn(); 9780 } 9781 // Toggle UI based on state. 9782 if (isOn) { 9783 this.adapter.addClass(constants_1.cssClasses.ICON_BUTTON_ON); 9784 } else { 9785 this.adapter.removeClass(constants_1.cssClasses.ICON_BUTTON_ON); 9786 } 9787 // Toggle aria attributes based on state. 9788 if (this.hasToggledAriaLabel) { 9789 var ariaLabel = isOn ? this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON) : this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF); 9790 this.adapter.setAttr(constants_1.strings.ARIA_LABEL, ariaLabel || ''); 9791 } else { 9792 this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, "" + isOn); 9793 } 9794 }; 9795 return MDCIconButtonToggleFoundation; 9796}(foundation_1.MDCFoundation); 9797exports.MDCIconButtonToggleFoundation = MDCIconButtonToggleFoundation; 9798// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 9799exports.default = MDCIconButtonToggleFoundation; 9800 9801/***/ }), 9802 9803/***/ "./packages/mdc-icon-button/index.ts": 9804/*!*******************************************!*\ 9805 !*** ./packages/mdc-icon-button/index.ts ***! 9806 \*******************************************/ 9807/*! no static exports found */ 9808/***/ (function(module, exports, __webpack_require__) { 9809 9810"use strict"; 9811 9812/** 9813 * @license 9814 * Copyright 2019 Google Inc. 9815 * 9816 * Permission is hereby granted, free of charge, to any person obtaining a copy 9817 * of this software and associated documentation files (the "Software"), to deal 9818 * in the Software without restriction, including without limitation the rights 9819 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9820 * copies of the Software, and to permit persons to whom the Software is 9821 * furnished to do so, subject to the following conditions: 9822 * 9823 * The above copyright notice and this permission notice shall be included in 9824 * all copies or substantial portions of the Software. 9825 * 9826 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9827 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9828 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9829 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9830 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9831 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9832 * THE SOFTWARE. 9833 */ 9834 9835var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 9836 if (k2 === undefined) k2 = k; 9837 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 9838 return m[k]; 9839 } }); 9840} : function (o, m, k, k2) { 9841 if (k2 === undefined) k2 = k; 9842 o[k2] = m[k]; 9843}); 9844var __exportStar = this && this.__exportStar || function (m, exports) { 9845 for (var p in m) { 9846 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 9847 } 9848}; 9849Object.defineProperty(exports, "__esModule", { value: true }); 9850__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-icon-button/adapter.ts"), exports); 9851__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-icon-button/component.ts"), exports); 9852__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts"), exports); 9853__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts"), exports); 9854__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-icon-button/types.ts"), exports); 9855 9856/***/ }), 9857 9858/***/ "./packages/mdc-icon-button/types.ts": 9859/*!*******************************************!*\ 9860 !*** ./packages/mdc-icon-button/types.ts ***! 9861 \*******************************************/ 9862/*! no static exports found */ 9863/***/ (function(module, exports, __webpack_require__) { 9864 9865"use strict"; 9866 9867/** 9868 * @license 9869 * Copyright 2019 Google Inc. 9870 * 9871 * Permission is hereby granted, free of charge, to any person obtaining a copy 9872 * of this software and associated documentation files (the "Software"), to deal 9873 * in the Software without restriction, including without limitation the rights 9874 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9875 * copies of the Software, and to permit persons to whom the Software is 9876 * furnished to do so, subject to the following conditions: 9877 * 9878 * The above copyright notice and this permission notice shall be included in 9879 * all copies or substantial portions of the Software. 9880 * 9881 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9882 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9883 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9884 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9885 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9886 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9887 * THE SOFTWARE. 9888 */ 9889 9890Object.defineProperty(exports, "__esModule", { value: true }); 9891 9892/***/ }), 9893 9894/***/ "./packages/mdc-line-ripple/adapter.ts": 9895/*!*********************************************!*\ 9896 !*** ./packages/mdc-line-ripple/adapter.ts ***! 9897 \*********************************************/ 9898/*! no static exports found */ 9899/***/ (function(module, exports, __webpack_require__) { 9900 9901"use strict"; 9902 9903/** 9904 * @license 9905 * Copyright 2018 Google Inc. 9906 * 9907 * Permission is hereby granted, free of charge, to any person obtaining a copy 9908 * of this software and associated documentation files (the "Software"), to deal 9909 * in the Software without restriction, including without limitation the rights 9910 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9911 * copies of the Software, and to permit persons to whom the Software is 9912 * furnished to do so, subject to the following conditions: 9913 * 9914 * The above copyright notice and this permission notice shall be included in 9915 * all copies or substantial portions of the Software. 9916 * 9917 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9918 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9919 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9920 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9921 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9922 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9923 * THE SOFTWARE. 9924 */ 9925 9926Object.defineProperty(exports, "__esModule", { value: true }); 9927 9928/***/ }), 9929 9930/***/ "./packages/mdc-line-ripple/component.ts": 9931/*!***********************************************!*\ 9932 !*** ./packages/mdc-line-ripple/component.ts ***! 9933 \***********************************************/ 9934/*! no static exports found */ 9935/***/ (function(module, exports, __webpack_require__) { 9936 9937"use strict"; 9938 9939/** 9940 * @license 9941 * Copyright 2018 Google Inc. 9942 * 9943 * Permission is hereby granted, free of charge, to any person obtaining a copy 9944 * of this software and associated documentation files (the "Software"), to deal 9945 * in the Software without restriction, including without limitation the rights 9946 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9947 * copies of the Software, and to permit persons to whom the Software is 9948 * furnished to do so, subject to the following conditions: 9949 * 9950 * The above copyright notice and this permission notice shall be included in 9951 * all copies or substantial portions of the Software. 9952 * 9953 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9954 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9955 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9956 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9957 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9958 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9959 * THE SOFTWARE. 9960 */ 9961 9962var __extends = this && this.__extends || function () { 9963 var _extendStatics = function extendStatics(d, b) { 9964 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 9965 d.__proto__ = b; 9966 } || function (d, b) { 9967 for (var p in b) { 9968 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 9969 } 9970 }; 9971 return _extendStatics(d, b); 9972 }; 9973 return function (d, b) { 9974 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 9975 _extendStatics(d, b); 9976 function __() { 9977 this.constructor = d; 9978 } 9979 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 9980 }; 9981}(); 9982Object.defineProperty(exports, "__esModule", { value: true }); 9983exports.MDCLineRipple = void 0; 9984var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 9985var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts"); 9986var MDCLineRipple = /** @class */function (_super) { 9987 __extends(MDCLineRipple, _super); 9988 function MDCLineRipple() { 9989 return _super !== null && _super.apply(this, arguments) || this; 9990 } 9991 MDCLineRipple.attachTo = function (root) { 9992 return new MDCLineRipple(root); 9993 }; 9994 /** 9995 * Activates the line ripple 9996 */ 9997 MDCLineRipple.prototype.activate = function () { 9998 this.foundation.activate(); 9999 }; 10000 /** 10001 * Deactivates the line ripple 10002 */ 10003 MDCLineRipple.prototype.deactivate = function () { 10004 this.foundation.deactivate(); 10005 }; 10006 /** 10007 * Sets the transform origin given a user's click location. 10008 * The `rippleCenter` is the x-coordinate of the middle of the ripple. 10009 */ 10010 MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) { 10011 this.foundation.setRippleCenter(xCoordinate); 10012 }; 10013 MDCLineRipple.prototype.getDefaultFoundation = function () { 10014 var _this = this; 10015 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 10016 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 10017 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 10018 var adapter = { 10019 addClass: function addClass(className) { 10020 return _this.root.classList.add(className); 10021 }, 10022 removeClass: function removeClass(className) { 10023 return _this.root.classList.remove(className); 10024 }, 10025 hasClass: function hasClass(className) { 10026 return _this.root.classList.contains(className); 10027 }, 10028 setStyle: function setStyle(propertyName, value) { 10029 return _this.root.style.setProperty(propertyName, value); 10030 }, 10031 registerEventHandler: function registerEventHandler(evtType, handler) { 10032 return _this.listen(evtType, handler); 10033 }, 10034 deregisterEventHandler: function deregisterEventHandler(evtType, handler) { 10035 return _this.unlisten(evtType, handler); 10036 } 10037 }; 10038 // tslint:enable:object-literal-sort-keys 10039 return new foundation_1.MDCLineRippleFoundation(adapter); 10040 }; 10041 return MDCLineRipple; 10042}(component_1.MDCComponent); 10043exports.MDCLineRipple = MDCLineRipple; 10044 10045/***/ }), 10046 10047/***/ "./packages/mdc-line-ripple/constants.ts": 10048/*!***********************************************!*\ 10049 !*** ./packages/mdc-line-ripple/constants.ts ***! 10050 \***********************************************/ 10051/*! no static exports found */ 10052/***/ (function(module, exports, __webpack_require__) { 10053 10054"use strict"; 10055 10056/** 10057 * @license 10058 * Copyright 2018 Google Inc. 10059 * 10060 * Permission is hereby granted, free of charge, to any person obtaining a copy 10061 * of this software and associated documentation files (the "Software"), to deal 10062 * in the Software without restriction, including without limitation the rights 10063 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10064 * copies of the Software, and to permit persons to whom the Software is 10065 * furnished to do so, subject to the following conditions: 10066 * 10067 * The above copyright notice and this permission notice shall be included in 10068 * all copies or substantial portions of the Software. 10069 * 10070 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10071 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10072 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10073 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10074 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10075 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10076 * THE SOFTWARE. 10077 */ 10078 10079Object.defineProperty(exports, "__esModule", { value: true }); 10080exports.cssClasses = void 0; 10081var cssClasses = { 10082 LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active', 10083 LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating' 10084}; 10085exports.cssClasses = cssClasses; 10086 10087/***/ }), 10088 10089/***/ "./packages/mdc-line-ripple/foundation.ts": 10090/*!************************************************!*\ 10091 !*** ./packages/mdc-line-ripple/foundation.ts ***! 10092 \************************************************/ 10093/*! no static exports found */ 10094/***/ (function(module, exports, __webpack_require__) { 10095 10096"use strict"; 10097 10098/** 10099 * @license 10100 * Copyright 2018 Google Inc. 10101 * 10102 * Permission is hereby granted, free of charge, to any person obtaining a copy 10103 * of this software and associated documentation files (the "Software"), to deal 10104 * in the Software without restriction, including without limitation the rights 10105 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10106 * copies of the Software, and to permit persons to whom the Software is 10107 * furnished to do so, subject to the following conditions: 10108 * 10109 * The above copyright notice and this permission notice shall be included in 10110 * all copies or substantial portions of the Software. 10111 * 10112 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10113 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10114 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10115 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10116 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10117 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10118 * THE SOFTWARE. 10119 */ 10120 10121var __extends = this && this.__extends || function () { 10122 var _extendStatics = function extendStatics(d, b) { 10123 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 10124 d.__proto__ = b; 10125 } || function (d, b) { 10126 for (var p in b) { 10127 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 10128 } 10129 }; 10130 return _extendStatics(d, b); 10131 }; 10132 return function (d, b) { 10133 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 10134 _extendStatics(d, b); 10135 function __() { 10136 this.constructor = d; 10137 } 10138 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10139 }; 10140}(); 10141var __assign = this && this.__assign || function () { 10142 __assign = Object.assign || function (t) { 10143 for (var s, i = 1, n = arguments.length; i < n; i++) { 10144 s = arguments[i]; 10145 for (var p in s) { 10146 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 10147 } 10148 } 10149 return t; 10150 }; 10151 return __assign.apply(this, arguments); 10152}; 10153Object.defineProperty(exports, "__esModule", { value: true }); 10154exports.MDCLineRippleFoundation = void 0; 10155var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 10156var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts"); 10157var MDCLineRippleFoundation = /** @class */function (_super) { 10158 __extends(MDCLineRippleFoundation, _super); 10159 function MDCLineRippleFoundation(adapter) { 10160 var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this; 10161 _this.transitionEndHandler
10161_ = function (evt) { 10162 return _this.handleTransitionEnd(evt); 10163 }; 10164 return _this; 10165 } 10166 Object.defineProperty(MDCLineRippleFoundation, "cssClasses", { 10167 get: function get() { 10168 return constants_1.cssClasses; 10169 }, 10170 enumerable: false, 10171 configurable: true 10172 }); 10173 Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", { 10174 /** 10175 * See {@link MDCLineRippleAdapter} for typing information on parameters and return types. 10176 */ 10177 get: function get() { 10178 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 10179 return { 10180 addClass: function addClass() { 10181 return undefined; 10182 }, 10183 removeClass: function removeClass() { 10184 return undefined; 10185 }, 10186 hasClass: function hasClass() { 10187 return false; 10188 }, 10189 setStyle: function setStyle() { 10190 return undefined; 10191 }, 10192 registerEventHandler: function registerEventHandler() { 10193 return undefined; 10194 }, 10195 deregisterEventHandler: function deregisterEventHandler() { 10196 return undefined; 10197 } 10198 }; 10199 // tslint:enable:object-literal-sort-keys 10200 }, 10201 enumerable: false, 10202 configurable: true 10203 }); 10204 MDCLineRippleFoundation.prototype.init = function () { 10205 this.adapter.registerEventHandler('transitionend', this.transitionEndHandler_); 10206 }; 10207 MDCLineRippleFoundation.prototype.destroy = function () { 10208 this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler_
vendor: 3,901 bytes, lines 10208-10292
10208); 10209 }; 10210 MDCLineRippleFoundation.prototype.activate = function () { 10211 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); 10212 this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE); 10213 }; 10214 MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) { 10215 this.adapter.setStyle('transform-origin', xCoordinate + "px center"); 10216 }; 10217 MDCLineRippleFoundation.prototype.deactivate = function () { 10218 this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); 10219 }; 10220 MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) { 10221 // Wait for the line ripple to be either transparent or opaque 10222 // before emitting the animation end event 10223 var isDeactivating = this.adapter.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); 10224 if (evt.propertyName === 'opacity') { 10225 if (isDeactivating) { 10226 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE); 10227 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); 10228 } 10229 } 10230 }; 10231 return MDCLineRippleFoundation; 10232}(foundation_1.MDCFoundation); 10233exports.MDCLineRippleFoundation = MDCLineRippleFoundation; 10234// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 10235exports.default = MDCLineRippleFoundation; 10236 10237/***/ }), 10238 10239/***/ "./packages/mdc-line-ripple/index.ts": 10240/*!*******************************************!*\ 10241 !*** ./packages/mdc-line-ripple/index.ts ***! 10242 \*******************************************/ 10243/*! no static exports found */ 10244/***/ (function(module, exports, __webpack_require__) { 10245 10246"use strict"; 10247 10248/** 10249 * @license 10250 * Copyright 2019 Google Inc. 10251 * 10252 * Permission is hereby granted, free of charge, to any person obtaining a copy 10253 * of this software and associated documentation files (the "Software"), to deal 10254 * in the Software without restriction, including without limitation the rights 10255 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10256 * copies of the Software, and to permit persons to whom the Software is 10257 * furnished to do so, subject to the following conditions: 10258 * 10259 * The above copyright notice and this permission notice shall be included in 10260 * all copies or substantial portions of the Software. 10261 * 10262 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10263 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10264 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10265 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10266 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10267 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10268 * THE SOFTWARE. 10269 */ 10270 10271var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 10272 if (k2 === undefined) k2 = k; 10273 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 10274 return m[k]; 10275 } }); 10276} : function (o, m, k, k2) { 10277 if (k2 === undefined) k2 = k; 10278 o[k2] = m[k]; 10279}); 10280var __exportStar = this && this.__exportStar || function (m, exports) { 10281 for (var p in m) { 10282 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 10283 } 10284}; 10285Object.defineProperty(exports, "__esModule", { value: true }); 10286__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-line-ripple/adapter.ts"), exports); 10287__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-line-ripple/component.ts"), exports); 10288__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts"), exports); 10289__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts"), exports); 10290 10291/***/ }), 10292
vendor: 26,564 bytes, lines 10293-10891
10293/***/ "./packages/mdc-linear-progress/adapter.ts": 10294/*!*************************************************!*\ 10295 !*** ./packages/mdc-linear-progress/adapter.ts ***! 10296 \*************************************************/ 10297/*! no static exports found */ 10298/***/ (function(module, exports, __webpack_require__) { 10299 10300"use strict"; 10301 10302/** 10303 * @license 10304 * Copyright 2019 Google Inc. 10305 * 10306 * Permission is hereby granted, free of charge, to any person obtaining a copy 10307 * of this software and associated documentation files (the "Software"), to deal 10308 * in the Software without restriction, including without limitation the rights 10309 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10310 * copies of the Software, and to permit persons to whom the Software is 10311 * furnished to do so, subject to the following conditions: 10312 * 10313 * The above copyright notice and this permission notice shall be included in 10314 * all copies or substantial portions of the Software. 10315 * 10316 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10317 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10318 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10319 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10320 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10321 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10322 * THE SOFTWARE. 10323 */ 10324 10325Object.defineProperty(exports, "__esModule", { value: true }); 10326 10327/***/ }), 10328 10329/***/ "./packages/mdc-linear-progress/component.ts": 10330/*!***************************************************!*\ 10331 !*** ./packages/mdc-linear-progress/component.ts ***! 10332 \***************************************************/ 10333/*! no static exports found */ 10334/***/ (function(module, exports, __webpack_require__) { 10335 10336"use strict"; 10337 10338/** 10339 * @license 10340 * Copyright 2017 Google Inc. 10341 * 10342 * Permission is hereby granted, free of charge, to any person obtaining a copy 10343 * of this software and associated documentation files (the "Software"), to deal 10344 * in the Software without restriction, including without limitation the rights 10345 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10346 * copies of the Software, and to permit persons to whom the Software is 10347 * furnished to do so, subject to the following conditions: 10348 * 10349 * The above copyright notice and this permission notice shall be included in 10350 * all copies or substantial portions of the Software. 10351 * 10352 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10353 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10354 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10355 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10356 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10357 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10358 * THE SOFTWARE. 10359 */ 10360 10361var __extends = this && this.__extends || function () { 10362 var _extendStatics = function extendStatics(d, b) { 10363 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 10364 d.__proto__ = b; 10365 } || function (d, b) { 10366 for (var p in b) { 10367 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 10368 } 10369 }; 10370 return _extendStatics(d, b); 10371 }; 10372 return function (d, b) { 10373 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 10374 _extendStatics(d, b); 10375 function __() { 10376 this.constructor = d; 10377 } 10378 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10379 }; 10380}(); 10381Object.defineProperty(exports, "__esModule", { value: true }); 10382exports.MDCLinearProgress = void 0; 10383var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 10384var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts"); 10385var MDCLinearProgress = /** @class */function (_super) { 10386 __extends(MDCLinearProgress, _super); 10387 function MDCLinearProgress() { 10388 return _super !== null && _super.apply(this, arguments) || this; 10389 } 10390 MDCLinearProgress.attachTo = function (root) { 10391 return new MDCLinearProgress(root); 10392 }; 10393 Object.defineProperty(MDCLinearProgress.prototype, "determinate", { 10394 set: function set(value) { 10395 this.foundation.setDeterminate(value); 10396 }, 10397 enumerable: false, 10398 configurable: true 10399 }); 10400 Object.defineProperty(MDCLinearProgress.prototype, "progress", { 10401 set: function set(value) { 10402 this.foundation.setProgress(value); 10403 }, 10404 enumerable: false, 10405 configurable: true 10406 }); 10407 Object.defineProperty(MDCLinearProgress.prototype, "buffer", { 10408 set: function set(value) { 10409 this.foundation.setBuffer(value); 10410 }, 10411 enumerable: false, 10412 configurable: true 10413 }); 10414 MDCLinearProgress.prototype.open = function () { 10415 this.foundation.open(); 10416 }; 10417 MDCLinearProgress.prototype.close = function () { 10418 this.foundation.close(); 10419 }; 10420 MDCLinearProgress.prototype.initialSyncWithDOM = function () { 10421 var _this = this; 10422 this.root.addEventListener('transitionend', function () { 10423 _this.foundation.handleTransitionEnd(); 10424 }); 10425 }; 10426 MDCLinearProgress.prototype.getDefaultFoundation = function () { 10427 var _this = this; 10428 // DO NOT INLINE this variable. For backward compatibility, foundations take 10429 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 10430 // methods, we need a separate, strongly typed adapter variable. 10431 var adapter = { 10432 addClass: function addClass(className) { 10433 _this.root.classList.add(className); 10434 }, 10435 forceLayout: function forceLayout() { 10436 _this.root.getBoundingClientRect(); 10437 }, 10438 setBufferBarStyle: function setBufferBarStyle(styleProperty, value) { 10439 var bufferBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR); 10440 if (bufferBar) { 10441 bufferBar.style.setProperty(styleProperty, value); 10442 } 10443 }, 10444 setPrimaryBarStyle: function setPrimaryBarStyle(styleProperty, value) { 10445 var primaryBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR); 10446 if (primaryBar) { 10447 primaryBar.style.setProperty(styleProperty, value); 10448 } 10449 }, 10450 hasClass: function hasClass(className) { 10451 return _this.root.classList.contains(className); 10452 }, 10453 removeAttribute: function removeAttribute(attributeName) { 10454 _this.root.removeAttribute(attributeName); 10455 }, 10456 removeClass: function removeClass(className) { 10457 _this.root.classList.remove(className); 10458 }, 10459 setAttribute: function setAttribute(attributeName, value) { 10460 _this.root.setAttribute(attributeName, value); 10461 }, 10462 setStyle: function setStyle(name, value) { 10463 _this.root.style.setProperty(name, value); 10464 }, 10465 attachResizeObserver: function attachResizeObserver(callback) { 10466 var RO = window.ResizeObserver; 10467 if (RO) { 10468 var ro = new RO(callback); 10469 ro.observe(_this.root); 10470 return ro; 10471 } 10472 return null; 10473 }, 10474 getWidth: function getWidth() { 10475 return _this.root.offsetWidth; 10476 } 10477 }; 10478 return new foundation_1.MDCLinearProgressFoundation(adapter); 10479 }; 10480 return MDCLinearProgress; 10481}(component_1.MDCComponent); 10482exports.MDCLinearProgress = MDCLinearProgress; 10483 10484/***/ }), 10485 10486/***/ "./packages/mdc-linear-progress/constants.ts": 10487/*!***************************************************!*\ 10488 !*** ./packages/mdc-linear-progress/constants.ts ***! 10489 \***************************************************/ 10490/*! no static exports found */ 10491/***/ (function(module, exports, __webpack_require__) { 10492 10493"use strict"; 10494 10495/** 10496 * @license 10497 * Copyright 2017 Google Inc. 10498 * 10499 * Permission is hereby granted, free of charge, to any person obtaining a copy 10500 * of this software and associated documentation files (the "Software"), to deal 10501 * in the Software without restriction, including without limitation the rights 10502 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10503 * copies of the Software, and to permit persons to whom the Software is 10504 * furnished to do so, subject to the following conditions: 10505 * 10506 * The above copyright notice and this permission notice shall be included in 10507 * all copies or substantial portions of the Software. 10508 * 10509 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10510 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10511 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10512 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10513 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10514 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10515 * THE SOFTWARE. 10516 */ 10517 10518Object.defineProperty(exports, "__esModule", { value: true }); 10519exports.animationDimensionPercentages = exports.strings = exports.cssClasses = void 0; 10520exports.cssClasses = { 10521 CLOSED_CLASS: 'mdc-linear-progress--closed', 10522 CLOSED_ANIMATION_OFF_CLASS: 'mdc-linear-progress--closed-animation-off', 10523 INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate', 10524 REVERSED_CLASS: 'mdc-linear-progress--reversed', 10525 ANIMATION_READY_CLASS: 'mdc-linear-progress--animation-ready' 10526}; 10527exports.strings = { 10528 ARIA_HIDDEN: 'aria-hidden', 10529 ARIA_VALUEMAX: 'aria-valuemax', 10530 ARIA_VALUEMIN: 'aria-valuemin', 10531 ARIA_VALUENOW: 'aria-valuenow', 10532 BUFFER_BAR_SELECTOR: '.mdc-linear-progress__buffer-bar', 10533 FLEX_BASIS: 'flex-basis', 10534 PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar' 10535}; 10536// these are percentages pulled from keyframes.scss 10537exports.animationDimensionPercentages = { 10538 PRIMARY_HALF: .8367142, 10539 PRIMARY_FULL: 2.00611057, 10540 SECONDARY_QUARTER: .37651913, 10541 SECONDARY_HALF: .84386165, 10542 SECONDARY_FULL: 1.60277782 10543}; 10544 10545/***/ }), 10546 10547/***/ "./packages/mdc-linear-progress/foundation.ts": 10548/*!****************************************************!*\ 10549 !*** ./packages/mdc-linear-progress/foundation.ts ***! 10550 \****************************************************/ 10551/*! no static exports found */ 10552/***/ (function(module, exports, __webpack_require__) { 10553 10554"use strict"; 10555 10556/** 10557 * @license 10558 * Copyright 2017 Google Inc. 10559 * 10560 * Permission is hereby granted, free of charge, to any person obtaining a copy 10561 * of this software and associated documentation files (the "Software"), to deal 10562 * in the Software without restriction, including without limitation the rights 10563 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10564 * copies of the Software, and to permit persons to whom the Software is 10565 * furnished to do so, subject to the following conditions: 10566 * 10567 * The above copyright notice and this permission notice shall be included in 10568 * all copies or substantial portions of the Software. 10569 * 10570 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10571 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10572 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10573 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10574 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10575 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10576 * THE SOFTWARE. 10577 */ 10578 10579var __extends = this && this.__extends || function () { 10580 var _extendStatics = function extendStatics(d, b) { 10581 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 10582 d.__proto__ = b; 10583 } || function (d, b) { 10584 for (var p in b) { 10585 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 10586 } 10587 }; 10588 return _extendStatics(d, b); 10589 }; 10590 return function (d, b) { 10591 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 10592 _extendStatics(d, b); 10593 function __() { 10594 this.constructor = d; 10595 } 10596 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10597 }; 10598}(); 10599var __assign = this && this.__assign || function () { 10600 __assign = Object.assign || function (t) { 10601 for (var s, i = 1, n = arguments.length; i < n; i++) { 10602 s = arguments[i]; 10603 for (var p in s) { 10604 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 10605 } 10606 } 10607 return t; 10608 }; 10609 return __assign.apply(this, arguments); 10610}; 10611var __values = this && this.__values || function (o) { 10612 var s = typeof Symbol === "function" && Symbol.iterator, 10613 m = s && o[s], 10614 i = 0; 10615 if (m) return m.call(o); 10616 if (o && typeof o.length === "number") return { 10617 next: function next() { 10618 if (o && i >= o.length) o = void 0; 10619 return { value: o && o[i++], done: !o }; 10620 } 10621 }; 10622 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 10623}; 10624Object.defineProperty(exports, "__esModule", { value: true }); 10625exports.MDCLinearProgressFoundation = void 0; 10626var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 10627var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 10628var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts"); 10629var MDCLinearProgressFoundation = /** @class */function (_super) { 10630 __extends(MDCLinearProgressFoundation, _super); 10631 function MDCLinearProgressFoundation(adapter) { 10632 var _this = _super.call(this, __assign(__assign({}, MDCLinearProgressFoundation.defaultAdapter), adapter)) || this; 10633 _this.observer = null; 10634 return _this; 10635 } 10636 Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", { 10637 get: function get() { 10638 return constants_1.cssClasses; 10639 }, 10640 enumerable: false, 10641 configurable: true 10642 }); 10643 Object.defineProperty(MDCLinearProgressFoundation, "strings", { 10644 get: function get() { 10645 return constants_1.strings; 10646 }, 10647 enumerable: false, 10648 configurable: true 10649 }); 10650 Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", { 10651 get: function get() { 10652 return { 10653 addClass: function addClass() { 10654 return undefined; 10655 }, 10656 attachResizeObserver: function attachResizeObserver() { 10657 return null; 10658 }, 10659 forceLayout: function forceLayout() { 10660 return undefined; 10661 }, 10662 getWidth: function getWidth() { 10663 return 0; 10664 }, 10665 hasClass: function hasClass() { 10666 return false; 10667 }, 10668 setBufferBarStyle: function setBufferBarStyle() { 10669 return null; 10670 }, 10671 setPrimaryBarStyle: function setPrimaryBarStyle() { 10672 return null; 10673 }, 10674 setStyle: function setStyle() { 10675 return undefined; 10676 }, 10677 removeAttribute: function removeAttribute() { 10678 return undefined; 10679 }, 10680 removeClass: function removeClass() { 10681 return undefined; 10682 }, 10683 setAttribute: function setAttribute() { 10684 return undefined; 10685 } 10686 }; 10687 }, 10688 enumerable: false, 10689 configurable: true 10690 }); 10691 MDCLinearProgressFoundation.prototype.init = function () { 10692 var _this = this; 10693 this.determinate = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS); 10694 this.adapter.addClass(constants_1.cssClasses.ANIMATION_READY_CLASS); 10695 this.progress = 0; 10696 this.buffer = 1; 10697 this.observer = this.adapter.attachResizeObserver(function (entries) { 10698 var e_1, _a; 10699 if (_this.determinate) { 10700 return; 10701 } 10702 try { 10703 for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) { 10704 var entry = entries_1_1.value; 10705 if (entry.contentRect) { 10706 _this.calculateAndSetDimensions(entry.contentRect.width); 10707 } 10708 } 10709 } catch (e_1_1) { 10710 e_1 = { error: e_1_1 }; 10711 } finally { 10712 try { 10713 if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1); 10714 } finally { 10715 if (e_1) throw e_1.error; 10716 } 10717 } 10718 }); 10719 if (!this.determinate && this.observer) { 10720 this.calculateAndSetDimensions(this.adapter.getWidth()); 10721 } 10722 }; 10723 MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) { 10724 this.determinate = isDeterminate; 10725 if (this.determinate) { 10726 this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS); 10727 this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString()); 10728 this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMAX, '1'); 10729 this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMIN, '0'); 10730 this.setPrimaryBarProgress(this.progress); 10731 this.setBufferBarProgress(this.buffer); 10732 return; 10733 } 10734 if (this.observer) { 10735 this.calculateAndSetDimensions(this.adapter.getWidth()); 10736 } 10737 this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS); 10738 this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW); 10739 this.adapter.removeAttribute(constants_1.strings.ARIA_VALUEMAX); 10740 this.adapter.removeAttribute(constants_1.strings.ARIA_VALUEMIN); 10741 this.setPrimaryBarProgress(1); 10742 this.setBufferBarProgress(1); 10743 }; 10744 MDCLinearProgressFoundation.prototype.isDeterminate = function () { 10745 return this.determinate; 10746 }; 10747 MDCLinearProgressFoundation.prototype.setProgress = function (value) { 10748 this.progress = value; 10749 if (this.determinate) { 10750 this.setPrimaryBarProgress(value); 10751 this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, value.toString()); 10752 } 10753 }; 10754 MDCLinearProgressFoundation.prototype.getProgress = function () { 10755 return this.progress; 10756 }; 10757 MDCLinearProgressFoundation.prototype.setBuffer = function (value) { 10758 this.buffer = value; 10759 if (this.determinate) { 10760 this.setBufferBarProgress(value); 10761 } 10762 }; 10763 MDCLinearProgressFoundation.prototype.getBuffer = function () { 10764 return this.buffer; 10765 }; 10766 MDCLinearProgressFoundation.prototype.open = function () { 10767 this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS); 10768 this.adapter.removeClass(constants_1.cssClasses.CLOSED_ANIMATION_OFF_CLASS); 10769 this.adapter.removeAttribute(constants_1.strings.ARIA_HIDDEN); 10770 }; 10771 MDCLinearProgressFoundation.prototype.close = function () { 10772 this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS); 10773 this.adapter.setAttribute(constants_1.strings.ARIA_HIDDEN, 'true'); 10774 }; 10775 MDCLinearProgressFoundation.prototype.isClosed = function () { 10776 return this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS); 10777 }; 10778 /** 10779 * Handles the transitionend event emitted after `close()` is called and the 10780 * opacity fades out. This is so that animations are removed only after the 10781 * progress indicator is completely hidden. 10782 */ 10783 MDCLinearProgressFoundation.prototype.handleTransitionEnd = function () { 10784 if (this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS)) { 10785 this.adapter.addClass(constants_1.cssClasses.CLOSED_ANIMATION_OFF_CLASS); 10786 } 10787 }; 10788 MDCLinearProgressFoundation.prototype.destroy = function () { 10789 _super.prototype.destroy.call(this); 10790 if (this.observer) { 10791 this.observer.disconnect(); 10792 } 10793 }; 10794 MDCLinearProgressFoundation.prototype.restartAnimation = function () { 10795 this.adapter.removeClass(constants_1.cssClasses.ANIMATION_READY_CLASS); 10796 this.adapter.forceLayout(); 10797 this.adapter.addClass(constants_1.cssClasses.ANIMATION_READY_CLASS); 10798 }; 10799 MDCLinearProgressFoundation.prototype.setPrimaryBarProgress = function (progressValue) { 10800 var value = "scaleX(" + progressValue + ")"; 10801 // Accessing `window` without a `typeof` check will throw on Node 10802 // environments. 10803 var transformProp = typeof window !== 'undefined' ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; 10804 this.adapter.setPrimaryBarStyle(transformProp, value); 10805 }; 10806 MDCLinearProgressFoundation.prototype.setBufferBarProgress = function (progressValue) { 10807 var value = progressValue * 100 + "%"; 10808 this.adapter.setBufferBarStyle(constants_1.strings.FLEX_BASIS, value); 10809 }; 10810 MDCLinearProgressFoundation.prototype.calculateAndSetDimensions = function (width) { 10811 var primaryHalf = width * constants_1.animationDimensionPercentages.PRIMARY_HALF; 10812 var primaryFull = width * constants_1.animationDimensionPercentages.PRIMARY_FULL; 10813 var secondaryQuarter = width * constants_1.animationDimensionPercentages.SECONDARY_QUARTER; 10814 var secondaryHalf = width * constants_1.animationDimensionPercentages.SECONDARY_HALF; 10815 var secondaryFull = width * constants_1.animationDimensionPercentages.SECONDARY_FULL; 10816 this.adapter.setStyle('--mdc-linear-progress-primary-half', primaryHalf + "px"); 10817 this.adapter.setStyle('--mdc-linear-progress-primary-half-neg', -primaryHalf + "px"); 10818 this.adapter.setStyle('--mdc-linear-progress-primary-full', primaryFull + "px"); 10819 this.adapter.setStyle('--mdc-linear-progress-primary-full-neg', -primaryFull + "px"); 10820 this.adapter.setStyle('--mdc-linear-progress-secondary-quarter', secondaryQuarter + "px"); 10821 this.adapter.setStyle('--mdc-linear-progress-secondary-quarter-neg', -secondaryQuarter + "px"); 10822 this.adapter.setStyle('--mdc-linear-progress-secondary-half', secondaryHalf + "px"); 10823 this.adapter.setStyle('--mdc-linear-progress-secondary-half-neg', -secondaryHalf + "px"); 10824 this.adapter.setStyle('--mdc-linear-progress-secondary-full', secondaryFull + "px"); 10825 this.adapter.setStyle('--mdc-linear-progress-secondary-full-neg', -secondaryFull + "px"); 10826 // need to restart animation for custom props to apply to keyframes 10827 this.restartAnimation(); 10828 }; 10829 return MDCLinearProgressFoundation; 10830}(foundation_1.MDCFoundation); 10831exports.MDCLinearProgressFoundation = MDCLinearProgressFoundation; 10832// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 10833exports.default = MDCLinearProgressFoundation; 10834 10835/***/ }), 10836 10837/***/ "./packages/mdc-linear-progress/index.ts": 10838/*!***********************************************!*\ 10839 !*** ./packages/mdc-linear-progress/index.ts ***! 10840 \***********************************************/ 10841/*! no static exports found */ 10842/***/ (function(module, exports, __webpack_require__) { 10843 10844"use strict"; 10845 10846/** 10847 * @license 10848 * Copyright 2019 Google Inc. 10849 * 10850 * Permission is hereby granted, free of charge, to any person obtaining a copy 10851 * of this software and associated documentation files (the "Software"), to deal 10852 * in the Software without restriction, including without limitation the rights 10853 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10854 * copies of the Software, and to permit persons to whom the Software is 10855 * furnished to do so, subject to the following conditions: 10856 * 10857 * The above copyright notice and this permission notice shall be included in 10858 * all copies or substantial portions of the Software. 10859 * 10860 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10861 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10862 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10863 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10864 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10865 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10866 * THE SOFTWARE. 10867 */ 10868 10869var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 10870 if (k2 === undefined) k2 = k; 10871 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 10872 return m[k]; 10873 } }); 10874} : function (o, m, k, k2) { 10875 if (k2 === undefined) k2 = k; 10876 o[k2] = m[k]; 10877}); 10878var __exportStar = this && this.__exportStar || function (m, exports) { 10879 for (var p in m) { 10880 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 10881 } 10882}; 10883Object.defineProperty(exports, "__esModule", { value: true }); 10884__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-linear-progress/adapter.ts"), exports); 10885__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-linear-progress/component.ts"), exports); 10886__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts"), exports); 10887__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts"), exports); 10888__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-linear-progress/types.ts"), exports); 10889 10890/***/ }), 10891
vendor: 2,986 bytes, lines 10892-10963
10892/***/ "./packages/mdc-linear-progress/types.ts": 10893/*!***********************************************!*\ 10894 !*** ./packages/mdc-linear-progress/types.ts ***! 10895 \***********************************************/ 10896/*! no static exports found */ 10897/***/ (function(module, exports, __webpack_require__) { 10898 10899"use strict"; 10900 10901/** 10902 * @license 10903 * Copyright 2021 Google Inc. 10904 * 10905 * Permission is hereby granted, free of charge, to any person obtaining a copy 10906 * of this software and associated documentation files (the "Software"), to deal 10907 * in the Software without restriction, including without limitation the rights 10908 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10909 * copies of the Software, and to permit persons to whom the Software is 10910 * furnished to do so, subject to the following conditions: 10911 * 10912 * The above copyright notice and this permission notice shall be included in 10913 * all copies or substantial portions of the Software. 10914 * 10915 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10916 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10917 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10918 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10919 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10920 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10921 * THE SOFTWARE. 10922 */ 10923 10924Object.defineProperty(exports, "__esModule", { value: true }); 10925 10926/***/ }), 10927 10928/***/ "./packages/mdc-list/adapter.ts": 10929/*!**************************************!*\ 10930 !*** ./packages/mdc-list/adapter.ts ***! 10931 \**************************************/ 10932/*! no static exports found */ 10933/***/ (function(module, exports, __webpack_require__) { 10934 10935"use strict"; 10936 10937/** 10938 * @license 10939 * Copyright 2018 Google Inc. 10940 * 10941 * Permission is hereby granted, free of charge, to any person obtaining a copy 10942 * of this software and associated documentation files (the "Software"), to deal 10943 * in the Software without restriction, including without limitation the rights 10944 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10945 * copies of the Software, and to permit persons to whom the Software is 10946 * furnished to do so, subject to the following conditions: 10947 * 10948 * The above copyright notice and this permission notice shall be included in 10949 * all copies or substantial portions of the Software. 10950 * 10951 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10952 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10953 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10954 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10955 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10956 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10957 * THE SOFTWARE. 10958 */ 10959 10960Object.defineProperty(exports, "__esModule", { value: true }); 10961 10962/***/ }), 10963
vendor: 17,707 bytes, lines 10964-11336
10964/***/ "./packages/mdc-list/component.ts": 10965/*!****************************************!*\ 10966 !*** ./packages/mdc-list/component.ts ***! 10967 \****************************************/ 10968/*! no static exports found */ 10969/***/ (function(module, exports, __webpack_require__) { 10970 10971"use strict"; 10972 10973/** 10974 * @license 10975 * Copyright 2018 Google Inc. 10976 * 10977 * Permission is hereby granted, free of charge, to any person obtaining a copy 10978 * of this software and associated documentation files (the "Software"), to deal 10979 * in the Software without restriction, including without limitation the rights 10980 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10981 * copies of the Software, and to permit persons to whom the Software is 10982 * furnished to do so, subject to the following conditions: 10983 * 10984 * The above copyright notice and this permission notice shall be included in 10985 * all copies or substantial portions of the Software. 10986 * 10987 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10988 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10989 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10990 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10991 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10992 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 10993 * THE SOFTWARE. 10994 */ 10995 10996var __extends = this && this.__extends || function () { 10997 var _extendStatics = function extendStatics(d, b) { 10998 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 10999 d.__proto__ = b; 11000 } || function (d, b) { 11001 for (var p in b) { 11002 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 11003 } 11004 }; 11005 return _extendStatics(d, b); 11006 }; 11007 return function (d, b) { 11008 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 11009 _extendStatics(d, b); 11010 function __() { 11011 this.constructor = d; 11012 } 11013 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 11014 }; 11015}(); 11016Object.defineProperty(exports, "__esModule", { value: true }); 11017exports.MDCList = void 0; 11018var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 11019var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 11020var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); 11021var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts"); 11022var MDCList = /** @class */function (_super) { 11023 __extends(MDCList, _super); 11024 function MDCList() { 11025 return _super !== null && _super.apply(this, arguments) || this; 11026 } 11027 Object.defineProperty(MDCList.prototype, "vertical", { 11028 set: function set(value) { 11029 this.foundation.setVerticalOrientation(value); 11030 }, 11031 enumerable: false, 11032 configurable: true 11033 }); 11034 Object.defineProperty(MDCList.prototype, "listElements", { 11035 get: function get() { 11036 return Array.from(this.root.querySelectorAll("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS])); 11037 }, 11038 enumerable: false, 11039 configurable: true 11040 }); 11041 Object.defineProperty(MDCList.prototype, "wrapFocus", { 11042 set: function set(value) { 11043 this.foundation.setWrapFocus(value); 11044 }, 11045 enumerable: false, 11046 configurable: true 11047 }); 11048 Object.defineProperty(MDCList.prototype, "typeaheadInProgress", { 11049 /** 11050 * @return Whether typeahead is currently matching a user-specified prefix. 11051 */ 11052 get: function get() { 11053 return this.foundation.isTypeaheadInProgress(); 11054 }, 11055 enumerable: false, 11056 configurable: true 11057 }); 11058 Object.defineProperty(MDCList.prototype, "hasTypeahead", { 11059 /** 11060 * Sets whether typeahead functionality is enabled on the list. 11061 * @param hasTypeahead Whether typeahead is enabled. 11062 */ 11063 set: function set(hasTypeahead) { 11064 this.foundation.setHasTypeahead(hasTypeahead); 11065 }, 11066 enumerable: false, 11067 configurable: true 11068 }); 11069 Object.defineProperty(MDCList.prototype, "singleSelection", { 11070 set: function set(isSingleSelectionList) { 11071 this.foundation.setSingleSelection(isSingleSelectionList); 11072 }, 11073 enumerable: false, 11074 configurable: true 11075 }); 11076 Object.defineProperty(MDCList.prototype, "selectedIndex", { 11077 get: function get() { 11078 return this.foundation.getSelectedIndex(); 11079 }, 11080 set: function set(index) { 11081 this.foundation.setSelectedIndex(index); 11082 }, 11083 enumerable: false, 11084 configurable: true 11085 }); 11086 MDCList.attachTo = function (root) { 11087 return new MDCList(root); 11088 }; 11089 MDCList.prototype.initialSyncWithDOM = function () { 11090 this.isEvolutionEnabled = constants_1.evolutionAttribute in this.root.dataset; 11091 if (this.isEvolutionEnabled) { 11092 this.classNameMap = constants_1.evolutionClassNameMap; 11093 } else if (ponyfill_1.matches(this.root, constants_1.strings.DEPRECATED_SELECTOR)) { 11094 this.classNameMap = constants_1.deprecatedClassNameMap; 11095 } else { 11096 this.classNameMap = Object.values(constants_1.cssClasses).reduce(function (obj, className) { 11097 obj[className] = className; 11098 return obj; 11099 }, {}); 11100 } 11101 this.handleClick = this.handleClickEvent.bind(this); 11102 this.handleKeydown = this.handleKeydownEvent.bind(this); 11103 this.focusInEventListener = this.handleFocusInEvent.bind(this); 11104 this.focusOutEventListener = this.handleFocusOutEvent.bind(this); 11105 this.listen('keydown', this.handleKeydown); 11106 this.listen('click', this.handleClick); 11107 this.listen('focusin', this.focusInEventListener); 11108 this.listen('focusout', this.focusOutEventListener); 11109 this.layout(); 11110 this.initializeListType(); 11111 this.ensureFocusable(); 11112 }; 11113 MDCList.prototype.destroy = function () { 11114 this.unlisten('keydown', this.handleKeydown); 11115 this.unlisten('click', this.handleClick); 11116 this.unlisten('focusin', this.focusInEventListener); 11117 this.unlisten('focusout', this.focusOutEventListener); 11118 }; 11119 MDCList.prototype.layout = function () { 11120 var direction = this.root.getAttribute(constants_1.strings.ARIA_ORIENTATION); 11121 this.vertical = direction !== constants_1.strings.ARIA_ORIENTATION_HORIZONTAL; 11122 var itemSelector = "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + ":not([tabindex])"; 11123 var childSelector = constants_1.strings.FOCUSABLE_CHILD_ELEMENTS; 11124 // List items need to have at least tabindex=-1 to be focusable. 11125 var itemEls = this.root.querySelectorAll(itemSelector); 11126 if (itemEls.length) { 11127 Array.prototype.forEach.call(itemEls, function (el) { 11128 el.setAttribute('tabindex', '-1'); 11129 }); 11130 } 11131 // Child button/a elements are not tabbable until the list item is focused. 11132 var focusableChildEls = this.root.querySelectorAll(childSelector); 11133 if (focusableChildEls.length) { 11134 Array.prototype.forEach.call(focusableChildEls, function (el) { 11135 el.setAttribute('tabindex', '-1'); 11136 }); 11137 } 11138 if (this.isEvolutionEnabled) { 11139 this.foundation.setUseSelectedAttribute(true); 11140 } 11141 this.foundation.layout(); 11142 }; 11143 /** 11144 * Extracts the primary text from a list item. 11145 * @param item The list item element. 11146 * @return The primary text in the element. 11147 */ 11148 MDCList.prototype.getPrimaryText = function (item) { 11149 var _a; 11150 var primaryText = item.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS]); 11151 if (this.isEvolutionEnabled || primaryText) { 11152 return (_a = primaryText === null || primaryText === void 0 ? void 0 : primaryText.textContent) !== null && _a !== void 0 ? _a : ''; 11153 } 11154 var singleLineText = item.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_TEXT_CLASS]); 11155 return singleLineText && singleLineText.textContent || ''; 11156 }; 11157 /** 11158 * Initialize selectedIndex value based on pre-selected list items. 11159 */ 11160 MDCList.prototype.initializeListType = function () { 11161 var _this = this; 11162 this.isInteractive = ponyfill_1.matches(this.root, constants_1.strings.ARIA_INTERACTIVE_ROLES_SELECTOR); 11163 if (this.isEvolutionEnabled && this.isInteractive) { 11164 var selection = Array.from(this.root.querySelectorAll(constants_1.strings.SELECTED_ITEM_SELECTOR), function (listItem) { 11165 return _this.listElements.indexOf(listItem); 11166 }); 11167 if (ponyfill_1.matches(this.root, constants_1.strings.ARIA_MULTI_SELECTABLE_SELECTOR)) { 11168 this.selectedIndex = selection; 11169 } else if (selection.length > 0) { 11170 this.selectedIndex = selection[0]; 11171 } 11172 return; 11173 } 11174 var checkboxListItems = this.root.querySelectorAll(constants_1.strings.ARIA_ROLE_CHECKBOX_SELECTOR); 11175 var radioSelectedListItem = this.root.querySelector(constants_1.strings.ARIA_CHECKED_RADIO_SELECTOR); 11176 if (checkboxListItems.length) { 11177 var preselectedItems = this.root.querySelectorAll(constants_1.strings.ARIA_CHECKED_CHECKBOX_SELECTOR); 11178 this.selectedIndex = Array.from(preselectedItems, function (listItem) { 11179 return _this.listElements.indexOf(listItem); 11180 }); 11181 } else if (radioSelectedListItem) { 11182 this.selectedIndex = this.listElements.indexOf(radioSelectedListItem); 11183 } 11184 }; 11185 /** 11186 * Updates the list item at itemIndex to the desired isEnabled state. 11187 * @param itemIndex Index of the list item 11188 * @param isEnabled Sets the list item to enabled or disabled. 11189 */ 11190 MDCList.prototype.setEnabled = function (itemIndex, isEnabled) { 11191 this.foundation.setEnabled(itemIndex, isEnabled); 11192 }; 11193 /** 11194 * Given the next desired character from the user, adds it to the typeahead 11195 * buffer. Then, attempts to find the next option matching the buffer. Wraps 11196 * around if at the end of options. 11197 * 11198 * @param nextChar The next character to add to the prefix buffer. 11199 * @param startingIndex The index from which to start matching. Defaults to 11200 * the currently focused index. 11201 * @return The index of the matched item. 11202 */ 11203 MDCList.prototype.typeaheadMatchItem = function (nextChar, startingIndex) { 11204 return this.foundation.typeaheadMatchItem(nextChar, startingIndex, /** skipFocus */true); 11205 }; 11206 MDCList.prototype.getDefaultFoundation = function () { 11207 var _this = this; 11208 // DO NOT INLINE this variable. For backward compatibility, foundations take 11209 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 11210 // methods, we need a separate, strongly typed adapter variable. 11211 var adapter = { 11212 addClassForElementIndex: function addClassForElementIndex(index, className) { 11213 var element = _this.listElements[index]; 11214 if (element) { 11215 element.classList.add(_this.classNameMap[className]); 11216 } 11217 }, 11218 focusItemAtIndex: function focusItemAtIndex(index) { 11219 var element = _this.listElements[index]; 11220 if (element) { 11221 element.focus(); 11222 } 11223 }, 11224 getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) { 11225 return _this.listElements[index].getAttribute(attr); 11226 }, 11227 getFocusedElementIndex: function getFocusedElementIndex() { 11228 return _this.listElements.indexOf(document.activeElement); 11229 }, 11230 getListItemCount: function getListItemCount() { 11231 return _this.listElements.length; 11232 }, 11233 getPrimaryTextAtIndex: function getPrimaryTextAtIndex(index) { 11234 return _this.getPrimaryText(_this.listElements[index]); 11235 }, 11236 hasCheckboxAtIndex: function hasCheckboxAtIndex(index) { 11237 var listItem = _this.listElements[index]; 11238 return !!listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR); 11239 }, 11240 hasRadioAtIndex: function hasRadioAtIndex(index) { 11241 var listItem = _this.listElements[index]; 11242 return !!listItem.querySelector(constants_1.strings.RADIO_SELECTOR); 11243 }, 11244 isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) { 11245 var listItem = _this.listElements[index]; 11246 var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR); 11247 return toggleEl.checked; 11248 }, 11249 isFocusInsideList: function isFocusInsideList() { 11250 return _this.root !== document.activeElement && _this.root.contains(document.activeElement); 11251 }, 11252 isRootFocused: function isRootFocused() { 11253 return document.activeElement === _this.root; 11254 }, 11255 listItemAtIndexHasClass: function listItemAtIndexHasClass(index, className) { 11256 return _this.listElements[index].classList.contains(_this.classNameMap[className]); 11257 }, 11258 notifyAction: function notifyAction(index) { 11259 _this.emit(constants_1.strings.ACTION_EVENT, { index: index }, /** shouldBubble */true); 11260 }, 11261 removeClassForElementIndex: function removeClassForElementIndex(index, className) { 11262 var element = _this.listElements[index]; 11263 if (element) { 11264 element.classList.remove(_this.classNameMap[className]); 11265 } 11266 }, 11267 setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { 11268 var element = _this.listElements[index]; 11269 if (element) { 11270 element.setAttribute(attr, value); 11271 } 11272 }, 11273 setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) { 11274 var listItem = _this.listElements[index]; 11275 var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_RADIO_SELECTOR); 11276 toggleEl.checked = isChecked; 11277 var event = document.createEvent('Event'); 11278 event.initEvent('change', true, true); 11279 toggleEl.dispatchEvent(event); 11280 }, 11281 setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { 11282 var element = _this.listElements[listItemIndex]; 11283 var selector = constants_1.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX; 11284 Array.prototype.forEach.call(element.querySelectorAll(selector), function (el) { 11285 el.setAttribute('tabindex', tabIndexValue); 11286 }); 11287 } 11288 }; 11289 return new foundation_1.MDCListFoundation(adapter); 11290 }; 11291 /** 11292 * Ensures that at least one item is focusable if the list is interactive and 11293 * doesn't specify a suitable tabindex. 11294 */ 11295 MDCList.prototype.ensureFocusable = function () { 11296 if (this.isEvolutionEnabled && this.isInteractive) { 11297 if (!this.root.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + "[tabindex=\"0\"]")) { 11298 var index = this.initialFocusIndex(); 11299 if (index !== -1) { 11300 this.listElements[index].tabIndex = 0; 11301 } 11302 } 11303 } 11304 }; 11305 MDCList.prototype.initialFocusIndex = function () { 11306 if (this.selectedIndex instanceof Array && this.selectedIndex.length > 0) { 11307 return this.selectedIndex[0]; 11308 } 11309 if (typeof this.selectedIndex === 'number' && this.selectedIndex !== constants_1.numbers.UNSET_INDEX) { 11310 return this.selectedIndex; 11311 } 11312 var el = this.root.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + ":not(." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS] + ")"); 11313 if (el === null) { 11314 return -1; 11315 } 11316 return this.getListItemIndex(el); 11317 }; 11318 /** 11319 * Used to figure out which list item this event is targetting. Or returns -1 11320 * if there is no list item 11321 */ 11322 MDCList.prototype.getListItemIndex = function (el) { 11323 var nearestParent = ponyfill_1.closest(el, "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + ", ." + this.classNameMap[constants_1.cssClasses.ROOT]); 11324 // Get the index of the element if it is a list item. 11325 if (nearestParent && ponyfill_1.matches(nearestParent, "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS])) { 11326 return this.listElements.indexOf(nearestParent); 11327 } 11328 return -1; 11329 }; 11330 /** 11331 * Used to figure out which element was clicked before sending the event to 11332 * the foundation. 11333 */ 11334 MDCList.prototype.handleFocusInEvent = function (evt) { 11335 var index = this.getListItemIndex(evt.target); 11336 this.foundation.handleFocusIn(
11336evt, index); 11337 }; 11338 /** 11339 * Used to figure out which element was clicked before sending the event to 11340 * the foundation. 11341 */ 11342 MDCList.prototype.handleFocusOutEvent = function (evt) { 11343 var index = this.getListItemIndex(evt.target); 11344 this.foundation.handleFocusOut(evt, index); 11345 }; 11346 /** 11347 * Used to figure out which element was focused when keydown event occurred 11348 * before sending the event to the foundation. 11349 */ 11350 MDCList.prototype.handleKeydownEvent = function (evt) { 11351 var index = this.getListItemIndex(evt.target); 11352 var target = evt.target; 11353 this.foundation.handleKeydown(evt, target.classList.contains(this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS]), index); 11354 }; 11355 /** 11356 * Used to figure out which element was clicked before sending the event to 11357 * the foundation. 11358 */ 11359 MDCList.prototype.handleClickEvent = function (evt) { 11360 var index = this.getListItemIndex(evt.target); 11361 var target = evt.target; 11362 // Toggle the checkbox only if it's not the target of the event, or the 11363 // checkbox will have 2 change events. 11364 var toggleCheckbox = !ponyfill_1.matches(target, constants_1.strings.CHECKBOX_RADIO_SELECTOR); 11365 this.foundation.handleClick(index, toggleCheckbox
vendor: 11,065 bytes, lines 11365-11594
11365); 11366 }; 11367 return MDCList; 11368}(component_1.MDCComponent); 11369exports.MDCList = MDCList; 11370 11371/***/ }), 11372 11373/***/ "./packages/mdc-list/constants.ts": 11374/*!****************************************!*\ 11375 !*** ./packages/mdc-list/constants.ts ***! 11376 \****************************************/ 11377/*! no static exports found */ 11378/***/ (function(module, exports, __webpack_require__) { 11379 11380"use strict"; 11381 11382/** 11383 * @license 11384 * Copyright 2018 Google Inc. 11385 * 11386 * Permission is hereby granted, free of charge, to any person obtaining a copy 11387 * of this software and associated documentation files (the "Software"), to deal 11388 * in the Software without restriction, including without limitation the rights 11389 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11390 * copies of the Software, and to permit persons to whom the Software is 11391 * furnished to do so, subject to the following conditions: 11392 * 11393 * The above copyright notice and this permission notice shall be included in 11394 * all copies or substantial portions of the Software. 11395 * 11396 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11397 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11398 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11399 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11400 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11401 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 11402 * THE SOFTWARE. 11403 */ 11404 11405var _a, _b; 11406Object.defineProperty(exports, "__esModule", { value: true }); 11407exports.evolutionClassNameMap = exports.evolutionAttribute = exports.deprecatedClassNameMap = exports.numbers = exports.cssClasses = exports.strings = void 0; 11408var cssClasses = { 11409 LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated', 11410 LIST_ITEM_CLASS: 'mdc-list-item', 11411 LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled', 11412 LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected', 11413 LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text', 11414 LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text', 11415 ROOT: 'mdc-list' 11416}; 11417exports.cssClasses = cssClasses; 11418var evolutionClassNameMap = (_a = {}, _a["" + cssClasses.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-list-item--activated', _a["" + cssClasses.LIST_ITEM_CLASS] = 'mdc-list-item', _a["" + cssClasses.LIST_ITEM_DISABLED_CLASS] = 'mdc-list-item--disabled', _a["" + cssClasses.LIST_ITEM_SELECTED_CLASS] = 'mdc-list-item--selected', _a["" + cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-list-item__primary-text', _a["" + cssClasses.ROOT] = 'mdc-list', _a); 11419exports.evolutionClassNameMap = evolutionClassNameMap; 11420var deprecatedClassNameMap = (_b = {}, _b["" + cssClasses.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-deprecated-list-item--activated', _b["" + cssClasses.LIST_ITEM_CLASS] = 'mdc-deprecated-list-item', _b["" + cssClasses.LIST_ITEM_DISABLED_CLASS] = 'mdc-deprecated-list-item--disabled', _b["" + cssClasses.LIST_ITEM_SELECTED_CLASS] = 'mdc-deprecated-list-item--selected', _b["" + cssClasses.LIST_ITEM_TEXT_CLASS] = 'mdc-deprecated-list-item__text', _b["" + cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-deprecated-list-item__primary-text', _b["" + cssClasses.ROOT] = 'mdc-deprecated-list', _b); 11421exports.deprecatedClassNameMap = deprecatedClassNameMap; 11422var strings = { 11423 ACTION_EVENT: 'MDCList:action', 11424 ARIA_CHECKED: 'aria-checked', 11425 ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]', 11426 ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]', 11427 ARIA_CURRENT: 'aria-current', 11428 ARIA_DISABLED: 'aria-disabled', 11429 ARIA_ORIENTATION: 'aria-orientation', 11430 ARIA_ORIENTATION_HORIZONTAL: 'horizontal', 11431 ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]', 11432 ARIA_SELECTED: 'aria-selected', 11433 ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]', 11434 ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]', 11435 CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]', 11436 CHECKBOX_SELECTOR: 'input[type="checkbox"]', 11437 CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a,\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " a\n ", 11438 DEPRECATED_SELECTOR: '.mdc-deprecated-list', 11439 FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a,\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " a,\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " input[type=\"radio\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " input[type=\"checkbox\"]:not(:disabled)\n ", 11440 RADIO_SELECTOR: 'input[type="radio"]', 11441 SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]' 11442}; 11443exports.strings = strings; 11444var numbers = { 11445 UNSET_INDEX: -1, 11446 TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300 11447}; 11448exports.numbers = numbers; 11449var evolutionAttribute = 'evolution'; 11450exports.evolutionAttribute = evolutionAttribute; 11451 11452/***/ }), 11453 11454/***/ "./packages/mdc-list/events.ts": 11455/*!*************************************!*\ 11456 !*** ./packages/mdc-list/events.ts ***! 11457 \*************************************/ 11458/*! no static exports found */ 11459/***/ (function(module, exports, __webpack_require__) { 11460 11461"use strict"; 11462 11463/** 11464 * @license 11465 * Copyright 2020 Google Inc. 11466 * 11467 * Permission is hereby granted, free of charge, to any person obtaining a copy 11468 * of this software and associated documentation files (the "Software"), to deal 11469 * in the Software without restriction, including without limitation the rights 11470 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11471 * copies of the Software, and to permit persons to whom the Software is 11472 * furnished to do so, subject to the following conditions: 11473 * 11474 * The above copyright notice and this permission notice shall be included in 11475 * all copies or substantial portions of the Software. 11476 * 11477 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11478 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11479 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11480 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11481 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11482 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 11483 * THE SOFTWARE. 11484 */ 11485 11486Object.defineProperty(exports, "__esModule", { value: true }); 11487exports.preventDefaultEvent = void 0; 11488var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select']; 11489/** 11490 * Ensures that preventDefault is only called if the containing element 11491 * doesn't consume the event, and it will cause an unintended scroll. 11492 * 11493 * @param evt keyboard event to be prevented. 11494 */ 11495var preventDefaultEvent = function preventDefaultEvent(evt) { 11496 var target = evt.target; 11497 if (!target) { 11498 return; 11499 } 11500 var tagName = ("" + target.tagName).toLowerCase(); 11501 if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) { 11502 evt.preventDefault(); 11503 } 11504}; 11505exports.preventDefaultEvent = preventDefaultEvent; 11506 11507/***/ }), 11508 11509/***/ "./packages/mdc-list/foundation.ts": 11510/*!*****************************************!*\ 11511 !*** ./packages/mdc-list/foundation.ts ***! 11512 \*****************************************/ 11513/*! no static exports found */ 11514/***/ (function(module, exports, __webpack_require__) { 11515 11516"use strict"; 11517 11518/** 11519 * @license 11520 * Copyright 2018 Google Inc. 11521 * 11522 * Permission is hereby granted, free of charge, to any person obtaining a copy 11523 * of this software and associated documentation files (the "Software"), to deal 11524 * in the Software without restriction, including without limitation the rights 11525 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11526 * copies of the Software, and to permit persons to whom the Software is 11527 * furnished to do so, subject to the following conditions: 11528 * 11529 * The above copyright notice and this permission notice shall be included in 11530 * all copies or substantial portions of the Software. 11531 * 11532 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11533 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11534 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11535 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11536 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11537 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 11538 * THE SOFTWARE. 11539 */ 11540 11541var __extends = this && this.__extends || function () { 11542 var _extendStatics = function extendStatics(d, b) { 11543 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 11544 d.__proto__ = b; 11545 } || function (d, b) { 11546 for (var p in b) { 11547 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 11548 } 11549 }; 11550 return _extendStatics(d, b); 11551 }; 11552 return function (d, b) { 11553 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 11554 _extendStatics(d, b); 11555 function __() { 11556 this.constructor = d; 11557 } 11558 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 11559 }; 11560}(); 11561var __assign = this && this.__assign || function () { 11562 __assign = Object.assign || function (t) { 11563 for (var s, i = 1, n = arguments.length; i < n; i++) { 11564 s = arguments[i]; 11565 for (var p in s) { 11566 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 11567 } 11568 } 11569 return t; 11570 }; 11571 return __assign.apply(this, arguments); 11572}; 11573var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 11574 if (k2 === undefined) k2 = k; 11575 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 11576 return m[k]; 11577 } }); 11578} : function (o, m, k, k2) { 11579 if (k2 === undefined) k2 = k; 11580 o[k2] = m[k]; 11581}); 11582var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 11583 Object.defineProperty(o, "default", { enumerable: true, value: v }); 11584} : function (o, v) { 11585 o["default"] = v; 11586}); 11587var __importStar = this && this.__importStar || function (mod) { 11588 if (mod && mod.__esModule) return mod; 11589 var result = {}; 11590 if (mod != null) for (var k in mod) { 11591 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 11592 }__setModuleDefault(result, mod); 11593 return result; 11594};
11595Object.defineProperty(exports, "__esModule", { value: true }); 11596exports.MDCListFoundation = void 0; 11597// TODO(b/152410470): Remove trailing underscores from private properties 11598// tslint:disable:strip-private-property-underscore 11599var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 11600var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 11601var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); 11602var events_1 = __webpack_require__(/*! ./events */ "./packages/mdc-list/events.ts"); 11603var typeahead = __importStar(__webpack_require__(/*! ./typeahead */ "./packages/mdc-list/typeahead.ts")); 11604function isNumberArray(selectedIndex) { 11605 return selectedIndex instanceof Array; 11606} 11607var MDCListFoundation = /** @class */function (_super) { 11608 __extends(MDCListFoundation, _super); 11609 function MDCListFoundation(adapter) { 11610 var _this = _super.call(this, __assign(__assign({}, MDCListFoundation.defaultAdapter), adapter)) || this; 11611 _this.wrapFocus_ = false;
vendor: 10,297 bytes, lines 11612-11869
11612 _this.isVertical_ = true; 11613 _this.isSingleSelectionList_ = false; 11614 _this.selectedIndex_ = constants_1.numbers.UNSET_INDEX; 11615 _this.focusedItemIndex = constants_1.numbers.UNSET_INDEX; 11616 _this.useActivatedClass_ = false; 11617 _this.useSelectedAttr_ = false; 11618 _this.ariaCurrentAttrValue_ = null; 11619 _this.isCheckboxList_ = false; 11620 _this.isRadioList_ = false; 11621 _this.hasTypeahead = false; 11622 // Transiently holds current typeahead prefix from user. 11623 _this.typeaheadState = typeahead.initState(); 11624 _this.sortedIndexByFirstChar = new Map(); 11625 return _this; 11626 } 11627 Object.defineProperty(MDCListFoundation, "strings", { 11628 get: function get() { 11629 return constants_1.strings; 11630 }, 11631 enumerable: false, 11632 configurable: true 11633 }); 11634 Object.defineProperty(MDCListFoundation, "cssClasses", { 11635 get: function get() { 11636 return constants_1.cssClasses; 11637 }, 11638 enumerable: false, 11639 configurable: true 11640 }); 11641 Object.defineProperty(MDCListFoundation, "numbers", { 11642 get: function get() { 11643 return constants_1.numbers; 11644 }, 11645 enumerable: false, 11646 configurable: true 11647 }); 11648 Object.defineProperty(MDCListFoundation, "defaultAdapter", { 11649 get: function get() { 11650 return { 11651 addClassForElementIndex: function addClassForElementIndex() { 11652 return undefined; 11653 }, 11654 focusItemAtIndex: function focusItemAtIndex() { 11655 return undefined; 11656 }, 11657 getAttributeForElementIndex: function getAttributeForElementIndex() { 11658 return null; 11659 }, 11660 getFocusedElementIndex: function getFocusedElementIndex() { 11661 return 0; 11662 }, 11663 getListItemCount: function getListItemCount() { 11664 return 0; 11665 }, 11666 hasCheckboxAtIndex: function hasCheckboxAtIndex() { 11667 return false; 11668 }, 11669 hasRadioAtIndex: function hasRadioAtIndex() { 11670 return false; 11671 }, 11672 isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() { 11673 return false; 11674 }, 11675 isFocusInsideList: function isFocusInsideList() { 11676 return false; 11677 }, 11678 isRootFocused: function isRootFocused() { 11679 return false; 11680 }, 11681 listItemAtIndexHasClass: function listItemAtIndexHasClass() { 11682 return false; 11683 }, 11684 notifyAction: function notifyAction() { 11685 return undefined; 11686 }, 11687 removeClassForElementIndex: function removeClassForElementIndex() { 11688 return undefined; 11689 }, 11690 setAttributeForElementIndex: function setAttributeForElementIndex() { 11691 return undefined; 11692 }, 11693 setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() { 11694 return undefined; 11695 }, 11696 setTabIndexForListItemChildren: function setTabIndexForListItemChildren() { 11697 return undefined; 11698 }, 11699 getPrimaryTextAtIndex: function getPrimaryTextAtIndex() { 11700 return ''; 11701 } 11702 }; 11703 }, 11704 enumerable: false, 11705 configurable: true 11706 }); 11707 MDCListFoundation.prototype.layout = function () { 11708 if (this.adapter.getListItemCount() === 0) { 11709 return; 11710 } 11711 // TODO(b/172274142): consider all items when determining the list's type. 11712 if (this.adapter.hasCheckboxAtIndex(0)) { 11713 this.isCheckboxList_ = true; 11714 } else if (this.adapter.hasRadioAtIndex(0)) { 11715 this.isRadioList_ = true; 11716 } else { 11717 this.maybeInitializeSingleSelection(); 11718 } 11719 if (this.hasTypeahead) { 11720 this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex(); 11721 } 11722 }; 11723 /** 11724 * Sets the private wrapFocus_ variable. 11725 */ 11726 MDCListFoundation.prototype.setWrapFocus = function (value) { 11727 this.wrapFocus_ = value; 11728 }; 11729 /** 11730 * Sets the isVertical_ private variable. 11731 */ 11732 MDCListFoundation.prototype.setVerticalOrientation = function (value) { 11733 this.isVertical_ = value; 11734 }; 11735 /** 11736 * Sets the isSingleSelectionList_ private variable. 11737 */ 11738 MDCListFoundation.prototype.setSingleSelection = function (value) { 11739 this.isSingleSelectionList_ = value; 11740 if (value) { 11741 this.maybeInitializeSingleSelection(); 11742 } 11743 }; 11744 /** 11745 * Automatically determines whether the list is single selection list. If so, 11746 * initializes the internal state to match the selected item. 11747 */ 11748 MDCListFoundation.prototype.maybeInitializeSingleSelection = function () { 11749 var listItemsCount = this.adapter.getListItemCount(); 11750 for (var i = 0; i < listItemsCount; i++) { 11751 var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS); 11752 var hasActivatedClass = this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS); 11753 if (!(hasSelectedClass || hasActivatedClass)) { 11754 continue; 11755 } 11756 if (hasActivatedClass) { 11757 this.setUseActivatedClass(true); 11758 } 11759 this.isSingleSelectionList_ = true; 11760 this.selectedIndex_ = i; 11761 return; 11762 } 11763 }; 11764 /** 11765 * Sets whether typeahead is enabled on the list. 11766 * @param hasTypeahead Whether typeahead is enabled. 11767 */ 11768 MDCListFoundation.prototype.setHasTypeahead = function (hasTypeahead) { 11769 this.hasTypeahead = hasTypeahead; 11770 if (hasTypeahead) { 11771 this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex(); 11772 } 11773 }; 11774 /** 11775 * @return Whether typeahead is currently matching a user-specified prefix. 11776 */ 11777 MDCListFoundation.prototype.isTypeaheadInProgress = function () { 11778 return this.hasTypeahead && typeahead.isTypingInProgress(this.typeaheadState); 11779 }; 11780 /** 11781 * Sets the useActivatedClass_ private variable. 11782 */ 11783 MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) { 11784 this.useActivatedClass_ = useActivated; 11785 }; 11786 /** 11787 * Sets the useSelectedAttr_ private variable. 11788 */ 11789 MDCListFoundation.prototype.setUseSelectedAttribute = function (useSelected) { 11790 this.useSelectedAttr_ = useSelected; 11791 }; 11792 MDCListFoundation.prototype.getSelectedIndex = function () { 11793 return this.selectedIndex_; 11794 }; 11795 MDCListFoundation.prototype.setSelectedIndex = function (index) { 11796 if (!this.isIndexValid_(index)) { 11797 return; 11798 } 11799 if (this.isCheckboxList_) { 11800 this.setCheckboxAtIndex_(index); 11801 } else if (this.isRadioList_) { 11802 this.setRadioAtIndex_(index); 11803 } else { 11804 this.setSingleSelectionAtIndex_(index); 11805 } 11806 }; 11807 /** 11808 * Focus in handler for the list items. 11809 */ 11810 MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) { 11811 if (listItemIndex >= 0) { 11812 this.focusedItemIndex = listItemIndex; 11813 this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '0'); 11814 this.adapter.setTabIndexForListItemChildren(listItemIndex, '0'); 11815 } 11816 }; 11817 /** 11818 * Focus out handler for the list items. 11819 */ 11820 MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) { 11821 var _this = this; 11822 if (listItemIndex >= 0) { 11823 this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '-1'); 11824 this.adapter.setTabIndexForListItemChildren(listItemIndex, '-1'); 11825 } 11826 /** 11827 * Between Focusout & Focusin some browsers do not have focus on any 11828 * element. Setting a delay to wait till the focus is moved to next element. 11829 */ 11830 setTimeout(function () { 11831 if (!_this.adapter.isFocusInsideList()) { 11832 _this.setTabindexToFirstSelectedOrFocusedItem(); 11833 } 11834 }, 0); 11835 }; 11836 /** 11837 * Key handler for the list. 11838 */ 11839 MDCListFoundation.prototype.handleKeydown = function (event, isRootListItem, listItemIndex) { 11840 var _this = this; 11841 var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft'; 11842 var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp'; 11843 var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight'; 11844 var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown'; 11845 var isHome = keyboard_1.normalizeKey(event) === 'Home'; 11846 var isEnd = keyboard_1.normalizeKey(event) === 'End'; 11847 var isEnter = keyboard_1.normalizeKey(event) === 'Enter'; 11848 var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar'; 11849 // Have to check both upper and lower case, because having caps lock on affects the value. 11850 var isLetterA = event.key === 'A' || event.key === 'a'; 11851 if (this.adapter.isRootFocused()) { 11852 if (isArrowUp || isEnd) { 11853 event.preventDefault(); 11854 this.focusLastElement(); 11855 } else if (isArrowDown || isHome) { 11856 event.preventDefault(); 11857 this.focusFirstElement(); 11858 } 11859 if (this.hasTypeahead) { 11860 var handleKeydownOpts = { 11861 event: event, 11862 focusItemAtIndex: function focusItemAtIndex(index) { 11863 _this.focusItemAtIndex(index); 11864 }, 11865 focusedItemIndex: -1, 11866 isTargetListItem: isRootListItem, 11867 sortedIndexByFirstChar: this.sortedIndexByFirstChar, 11868 isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { 11869 return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasse
11869s.LIST_ITEM_DISABLED_CLASS); 11870 } 11871 }; 11872 typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState); 11873 } 11874 return; 11875 } 11876 var currentIndex = this.adapter.getFocusedElementIndex(); 11877 if (currentIndex === -1) { 11878 currentIndex = listItemIndex; 11879 if (currentIndex < 0) { 11880 // If this event doesn't have a mdc-list-item ancestor from the 11881 // current list (not from a sublist), return early. 11882 return; 11883 } 11884 } 11885 if (this.isVertical_ && isArrowDown || !this.isVertical_ && isArrowRight) { 11886 events_1.preventDefaultEvent(event); 11887 this.focusNextElement(currentIndex); 11888 } else if (this.isVertical_ && isArrowUp || !this.isVertical_ && isArrowLeft) { 11889 events_1.preventDefaultEvent(event); 11890 this.focusPrevElement(currentIndex); 11891 } else if (isHome) { 11892 events_1.preventDefaultEvent(event); 11893 this.focusFirstElement(); 11894 } else if (isEnd) { 11895 events_1.preventDefaultEvent(event); 11896 this.focusLastElement(); 11897 } else if (isLetterA && event.ctrlKey && this.isCheckboxList_) { 11898 event.preventDefault(); 11899 this.toggleAll(this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_); 11900 } else if (isEnter || isSpace) { 11901 if (isRootListItem) { 11902 // Return early if enter key is pressed on anchor element which triggers 11903 // synthetic MouseEvent event. 11904 var target = event.target; 11905 if (target && target.tagName === 'A' && isEnter) { 11906 return; 11907 } 11908 events_1.preventDefaultEvent(event); 11909 if (this.adapter.listItemAtIndexHasClass(currentIndex, constants_1.cssClasse
11909s.LIST_ITEM_DISABLED_CLASS)) { 11910 return; 11911 } 11912 if (!this.isTypeaheadInProgress()) { 11913 if (this.isSelectableList_()) { 11914 this.setSelectedIndexOnAction_(currentIndex); 11915 } 11916 this.adapter.notifyAction(currentIndex); 11917 } 11918 } 11919 } 11920 if (this.hasTypeahead) { 11921 var handleKeydownOpts = { 11922 event: event, 11923 focusItemAtIndex: function focusItemAtIndex(index) { 11924 _this.focusItemAtIndex(index); 11925 }, 11926 focusedItemIndex: this.focusedItemIndex, 11927 isTargetListItem: isRootListItem, 11928 sortedIndexByFirstChar: this.sortedIndexByFirstChar, 11929 isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { 11930 return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); 11931 } 11932 }; 11933 typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState); 11934 } 11935 }; 11936 /** 11937 * Click handler for the list. 11938 */ 11939 MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) { 11940 if (index === constants_1.numbers.UNSET_INDEX) { 11941 return; 11942 } 11943 if (this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasse
vendor: 2,225 bytes, lines 11943-12007
11943s.LIST_ITEM_DISABLED_CLASS)) { 11944 return; 11945 } 11946 if (this.isSelectableList_()) { 11947 this.setSelectedIndexOnAction_(index, toggleCheckbox); 11948 } 11949 this.adapter.notifyAction(index); 11950 }; 11951 /** 11952 * Focuses the next element on the list. 11953 */ 11954 MDCListFoundation.prototype.focusNextElement = function (index) { 11955 var count = this.adapter.getListItemCount(); 11956 var nextIndex = index + 1; 11957 if (nextIndex >= count) { 11958 if (this.wrapFocus_) { 11959 nextIndex = 0; 11960 } else { 11961 // Return early because last item is already focused. 11962 return index; 11963 } 11964 } 11965 this.focusItemAtIndex(nextIndex); 11966 return nextIndex; 11967 }; 11968 /** 11969 * Focuses the previous element on the list. 11970 */ 11971 MDCListFoundation.prototype.focusPrevElement = function (index) { 11972 var prevIndex = index - 1; 11973 if (prevIndex < 0) { 11974 if (this.wrapFocus_) { 11975 prevIndex = this.adapter.getListItemCount() - 1; 11976 } else { 11977 // Return early because first item is already focused. 11978 return index; 11979 } 11980 } 11981 this.focusItemAtIndex(prevIndex); 11982 return prevIndex; 11983 }; 11984 MDCListFoundation.prototype.focusFirstElement = function () { 11985 this.focusItemAtIndex(0); 11986 return 0; 11987 }; 11988 MDCListFoundation.prototype.focusLastElement = function () { 11989 var lastIndex = this.adapter.getListItemCount() - 1; 11990 this.focusItemAtIndex(lastIndex); 11991 return lastIndex; 11992 }; 11993 MDCListFoundation.prototype.focusInitialElement = function () { 11994 var initialIndex = this.getFirstSelectedOrFocusedItemIndex(); 11995 this.focusItemAtIndex(initialIndex); 11996 return initialIndex; 11997 }; 11998 /** 11999 * @param itemIndex Index of the list item 12000 * @param isEnabled Sets the list item to enabled or disabled. 12001 */ 12002 MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) { 12003 if (!this.isIndexValid_(itemIndex)) { 12004 return; 12005 } 12006 if (isEnabled) { 12007 this.adapter.removeClassForElementIndex(itemIndex, constants_1.cssClasse
vendor: 7,130 bytes, lines 12007-12144
12007s.LIST_ITEM_DISABLED_CLASS); 12008 this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'false'); 12009 } else { 12010 this.adapter.addClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); 12011 this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'true'); 12012 } 12013 }; 12014 MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) { 12015 if (this.selectedIndex_ === index) { 12016 return; 12017 } 12018 var selectedClassName = constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS; 12019 if (this.useActivatedClass_) { 12020 selectedClassName = constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS; 12021 } 12022 if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { 12023 this.adapter.removeClassForElementIndex(this.selectedIndex_, selectedClassName); 12024 } 12025 this.setAriaForSingleSelectionAtIndex_(index); 12026 this.setTabindexAtIndex(index); 12027 if (index !== constants_1.numbers.UNSET_INDEX) { 12028 this.adapter.addClassForElementIndex(index, selectedClassName); 12029 } 12030 this.selectedIndex_ = index; 12031 }; 12032 /** 12033 * Sets aria attribute for single selection at given index. 12034 */ 12035 MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) { 12036 // Detect the presence of aria-current and get the value only during list 12037 // initialization when it is in unset state. 12038 if (this.selectedIndex_ === constants_1.numbers.UNSET_INDEX) { 12039 this.ariaCurrentAttrValue_ = this.adapter.getAttributeForElementIndex(index, constants_1.strings.ARIA_CURRENT); 12040 } 12041 var isAriaCurrent = this.ariaCurrentAttrValue_ !== null; 12042 var ariaAttribute = isAriaCurrent ? constants_1.strings.ARIA_CURRENT : constants_1.strings.ARIA_SELECTED; 12043 if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { 12044 this.adapter.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false'); 12045 } 12046 if (index !== constants_1.numbers.UNSET_INDEX) { 12047 var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true'; 12048 this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue); 12049 } 12050 }; 12051 /** 12052 * Returns the attribute to use for indicating selection status. 12053 */ 12054 MDCListFoundation.prototype.getSelectionAttribute = function () { 12055 return this.useSelectedAttr_ ? constants_1.strings.ARIA_SELECTED : constants_1.strings.ARIA_CHECKED; 12056 }; 12057 /** 12058 * Toggles radio at give index. Radio doesn't change the checked state if it 12059 * is already checked. 12060 */ 12061 MDCListFoundation.prototype.setRadioAtIndex_ = function (index) { 12062 var selectionAttribute = this.getSelectionAttribute(); 12063 this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true); 12064 if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { 12065 this.adapter.setAttributeForElementIndex(this.selectedIndex_, selectionAttribute, 'false'); 12066 } 12067 this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true'); 12068 this.selectedIndex_ = index; 12069 }; 12070 MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) { 12071 var selectionAttribute = this.getSelectionAttribute(); 12072 for (var i = 0; i < this.adapter.getListItemCount(); i++) { 12073 var isChecked = false; 12074 if (index.indexOf(i) >= 0) { 12075 isChecked = true; 12076 } 12077 this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked); 12078 this.adapter.setAttributeForElementIndex(i, selectionAttribute, isChecked ? 'true' : 'false'); 12079 } 12080 this.selectedIndex_ = index; 12081 }; 12082 MDCListFoundation.prototype.setTabindexAtIndex = function (index) { 12083 if (this.focusedItemIndex === constants_1.numbers.UNSET_INDEX && index !== 0) { 12084 // If some list item was selected set first list item's tabindex to -1. 12085 // Generally, tabindex is set to 0 on first list item of list that has no 12086 // preselected items. 12087 this.adapter.setAttributeForElementIndex(0, 'tabindex', '-1'); 12088 } else if (this.focusedItemIndex >= 0 && this.focusedItemIndex !== index) { 12089 this.adapter.setAttributeForElementIndex(this.focusedItemIndex, 'tabindex', '-1'); 12090 } 12091 // Set the previous selection's tabindex to -1. We need this because 12092 // in selection menus that are not visible, programmatically setting an 12093 // option will not change focus but will change where tabindex should be 0. 12094 if (!(this.selectedIndex_ instanceof Array) && this.selectedIndex_ !== index) { 12095 this.adapter.setAttributeForElementIndex(this.selectedIndex_, 'tabindex', '-1'); 12096 } 12097 if (index !== constants_1.numbers.UNSET_INDEX) { 12098 this.adapter.setAttributeForElementIndex(index, 'tabindex', '0'); 12099 } 12100 }; 12101 /** 12102 * @return Return true if it is single selectin list, checkbox list or radio 12103 * list. 12104 */ 12105 MDCListFoundation.prototype.isSelectableList_ = function () { 12106 return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_; 12107 }; 12108 MDCListFoundation.prototype.setTabindexToFirstSelectedOrFocusedItem = function () { 12109 var targetIndex = this.getFirstSelectedOrFocusedItemIndex(); 12110 this.setTabindexAtIndex(targetIndex); 12111 }; 12112 MDCListFoundation.prototype.getFirstSelectedOrFocusedItemIndex = function () { 12113 var targetIndex = this.focusedItemIndex >= 0 ? this.focusedItemIndex : 0; 12114 if (this.isSelectableList_()) { 12115 if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { 12116 targetIndex = this.selectedIndex_; 12117 } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) { 12118 targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { 12119 return Math.min(currentIndex, minIndex); 12120 }); 12121 } 12122 } 12123 return targetIndex; 12124 }; 12125 MDCListFoundation.prototype.isIndexValid_ = function (index) { 12126 var _this = this; 12127 if (index instanceof Array) { 12128 if (!this.isCheckboxList_) { 12129 throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list'); 12130 } 12131 if (index.length === 0) { 12132 return true; 12133 } else { 12134 return index.some(function (i) { 12135 return _this.isIndexInRange_(i); 12136 }); 12137 } 12138 } else if (typeof index === 'number') { 12139 if (this.isCheckboxList_) { 12140 throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + index); 12141 } 12142 return this.isIndexInRange_(index) || this.isSingleSelectionList_ && index === constants_1.numbers.UNSET_INDEX; 12143 } else { 12144 return false;
vendor: 2,437 bytes, lines 12145-12199
12145 } 12146 }; 12147 MDCListFoundation.prototype.isIndexInRange_ = function (index) { 12148 var listSize = this.adapter.getListItemCount(); 12149 return index >= 0 && index < listSize; 12150 }; 12151 /** 12152 * Sets selected index on user action, toggles checkbox / radio based on 12153 * toggleCheckbox value. User interaction should not toggle list item(s) when 12154 * disabled. 12155 */ 12156 MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) { 12157 if (toggleCheckbox === void 0) { 12158 toggleCheckbox = true; 12159 } 12160 if (this.isCheckboxList_) { 12161 this.toggleCheckboxAtIndex_(index, toggleCheckbox); 12162 } else { 12163 this.setSelectedIndex(index); 12164 } 12165 }; 12166 MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) { 12167 var selectionAttribute = this.getSelectionAttribute(); 12168 var isChecked = this.adapter.isCheckboxCheckedAtIndex(index); 12169 if (toggleCheckbox) { 12170 isChecked = !isChecked; 12171 this.adapter.setCheckedCheckboxOrRadioAtIndex(index, isChecked); 12172 } 12173 this.adapter.setAttributeForElementIndex(index, selectionAttribute, isChecked ? 'true' : 'false'); 12174 // If none of the checkbox items are selected and selectedIndex is not 12175 // initialized then provide a default value. 12176 var selectedIndexes = this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice(); 12177 if (isChecked) { 12178 selectedIndexes.push(index); 12179 } else { 12180 selectedIndexes = selectedIndexes.filter(function (i) { 12181 return i !== index; 12182 }); 12183 } 12184 this.selectedIndex_ = selectedIndexes; 12185 }; 12186 MDCListFoundation.prototype.focusItemAtIndex = function (index) { 12187 this.adapter.focusItemAtIndex(index); 12188 this.focusedItemIndex = index; 12189 }; 12190 MDCListFoundation.prototype.toggleAll = function (currentlySelectedIndexes) { 12191 var count = this.adapter.getListItemCount(); 12192 // If all items are selected, deselect everything. 12193 if (currentlySelectedIndexes.length === count) { 12194 this.setCheckboxAtIndex_([]); 12195 } else { 12196 // Otherwise select all enabled options. 12197 var allIndexes = []; 12198 for (var i = 0; i < count; i++) { 12199 if (!this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasse
12199s.LIST_ITEM_DISABLED_CLASS) || currentlySelectedIndexes.indexOf(i) > -1) { 12200 allIndexes.push(i); 12201 } 12202 } 12203 this.setCheckboxAtIndex_(allIndexes); 12204 } 12205 }; 12206 /** 12207 * Given the next desired character from the user, adds it to the typeahead 12208 * buffer. Then, attempts to find the next option matching the buffer. Wraps 12209 * around if at the end of options. 12210 * 12211 * @param nextChar The next character to add to the prefix buffer. 12212 * @param startingIndex The index from which to start matching. Only relevant 12213 * when starting a new match sequence. To start a new match sequence, 12214 * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer 12215 * to clear after a set interval defined in list foundation. Defaults to 12216 * the currently focused index. 12217 * @return The index of the matched item, or -1 if no match. 12218 */ 12219 MDCListFoundation.prototype.typeaheadMatchItem = function (nextChar, startingIndex, skipFocus) { 12220 var _this = this; 12221 if (skipFocus === void 0) { 12222 skipFocus = false; 12223 } 12224 var opts = { 12225 focusItemAtIndex: function focusItemAtIndex(index) { 12226 _this.focusItemAtIndex(index); 12227 }, 12228 focusedItemIndex: startingIndex ? startingIndex : this.focusedItemIndex, 12229 nextChar: nextChar, 12230 sortedIndexByFirstChar: this.sortedIndexByFirstChar, 12231 skipFocus: skipFocus, 12232 isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { 12233 return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasse
12233s.LIST_ITEM_DISABLED_CLASS
vendor: 3,461 bytes, lines 12233-12315
12233); 12234 } 12235 }; 12236 return typeahead.matchItem(opts, this.typeaheadState); 12237 }; 12238 /** 12239 * Initializes the MDCListTextAndIndex data structure by indexing the current 12240 * list items by primary text. 12241 * 12242 * @return The primary texts of all the list items sorted by first character. 12243 */ 12244 MDCListFoundation.prototype.typeaheadInitSortedIndex = function () { 12245 return typeahead.initSortedIndex(this.adapter.getListItemCount(), this.adapter.getPrimaryTextAtIndex); 12246 }; 12247 /** 12248 * Clears the typeahead buffer. 12249 */ 12250 MDCListFoundation.prototype.clearTypeaheadBuffer = function () { 12251 typeahead.clearBuffer(this.typeaheadState); 12252 }; 12253 return MDCListFoundation; 12254}(foundation_1.MDCFoundation); 12255exports.MDCListFoundation = MDCListFoundation; 12256// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 12257exports.default = MDCListFoundation; 12258 12259/***/ }), 12260 12261/***/ "./packages/mdc-list/index.ts": 12262/*!************************************!*\ 12263 !*** ./packages/mdc-list/index.ts ***! 12264 \************************************/ 12265/*! no static exports found */ 12266/***/ (function(module, exports, __webpack_require__) { 12267 12268"use strict"; 12269 12270/** 12271 * @license 12272 * Copyright 2019 Google Inc. 12273 * 12274 * Permission is hereby granted, free of charge, to any person obtaining a copy 12275 * of this software and associated documentation files (the "Software"), to deal 12276 * in the Software without restriction, including without limitation the rights 12277 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12278 * copies of the Software, and to permit persons to whom the Software is 12279 * furnished to do so, subject to the following conditions: 12280 * 12281 * The above copyright notice and this permission notice shall be included in 12282 * all copies or substantial portions of the Software. 12283 * 12284 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12285 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12286 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12287 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12288 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12289 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12290 * THE SOFTWARE. 12291 */ 12292 12293var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 12294 if (k2 === undefined) k2 = k; 12295 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 12296 return m[k]; 12297 } }); 12298} : function (o, m, k, k2) { 12299 if (k2 === undefined) k2 = k; 12300 o[k2] = m[k]; 12301}); 12302var __exportStar = this && this.__exportStar || function (m, exports) { 12303 for (var p in m) { 12304 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 12305 } 12306}; 12307Object.defineProperty(exports, "__esModule", { value: true }); 12308__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-list/adapter.ts"), exports); 12309__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-list/component.ts"), exports); 12310__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"), exports); 12311__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts"), exports); 12312__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-list/types.ts"), exports); 12313 12314/***/ }), 12315
vendor: 11,671 bytes, lines 12316-12582
12316/***/ "./packages/mdc-list/typeahead.ts": 12317/*!****************************************!*\ 12318 !*** ./packages/mdc-list/typeahead.ts ***! 12319 \****************************************/ 12320/*! no static exports found */ 12321/***/ (function(module, exports, __webpack_require__) { 12322 12323"use strict"; 12324 12325/** 12326 * @license 12327 * Copyright 2020 Google Inc. 12328 * 12329 * Permission is hereby granted, free of charge, to any person obtaining a copy 12330 * of this software and associated documentation files (the "Software"), to deal 12331 * in the Software without restriction, including without limitation the rights 12332 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12333 * copies of the Software, and to permit persons to whom the Software is 12334 * furnished to do so, subject to the following conditions: 12335 * 12336 * The above copyright notice and this permission notice shall be included in 12337 * all copies or substantial portions of the Software. 12338 * 12339 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12340 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12341 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12342 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12343 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12344 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12345 * THE SOFTWARE. 12346 */ 12347 12348Object.defineProperty(exports, "__esModule", { value: true }); 12349exports.handleKeydown = exports.clearBuffer = exports.isTypingInProgress = exports.matchItem = exports.initSortedIndex = exports.initState = void 0; 12350var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 12351var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); 12352var events_1 = __webpack_require__(/*! ./events */ "./packages/mdc-list/events.ts"); 12353/** 12354 * Initializes a state object for typeahead. Use the same reference for calls to 12355 * typeahead functions. 12356 * 12357 * @return The current state of the typeahead process. Each state reference 12358 * represents a typeahead instance as the reference is typically mutated 12359 * in-place. 12360 */ 12361function initState() { 12362 var state = { 12363 bufferClearTimeout: 0, 12364 currentFirstChar: '', 12365 sortedIndexCursor: 0, 12366 typeaheadBuffer: '' 12367 }; 12368 return state; 12369} 12370exports.initState = initState; 12371/** 12372 * Initializes typeahead state by indexing the current list items by primary 12373 * text into the sortedIndexByFirstChar data structure. 12374 * 12375 * @param listItemCount numer of items in the list 12376 * @param getPrimaryTextByItemIndex function that returns the primary text at a 12377 * given index 12378 * 12379 * @return Map that maps the first character of the primary text to the full 12380 * list text and it's index 12381 */ 12382function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) { 12383 var sortedIndexByFirstChar = new Map(); 12384 // Aggregate item text to index mapping 12385 for (var i = 0; i < listItemCount; i++) { 12386 var primaryText = getPrimaryTextByItemIndex(i).trim(); 12387 if (!primaryText) { 12388 continue; 12389 } 12390 var firstChar = primaryText[0].toLowerCase(); 12391 if (!sortedIndexByFirstChar.has(firstChar)) { 12392 sortedIndexByFirstChar.set(firstChar, []); 12393 } 12394 sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i }); 12395 } 12396 // Sort the mapping 12397 // TODO(b/157162694): Investigate replacing forEach with Map.values() 12398 sortedIndexByFirstChar.forEach(function (values) { 12399 values.sort(function (first, second) { 12400 return first.index - second.index; 12401 }); 12402 }); 12403 return sortedIndexByFirstChar; 12404} 12405exports.initSortedIndex = initSortedIndex; 12406/** 12407 * Given the next desired character from the user, it attempts to find the next 12408 * list option matching the buffer. Wraps around if at the end of options. 12409 * 12410 * @param opts Options and accessors 12411 * - nextChar - the next character to match against items 12412 * - sortedIndexByFirstChar - output of `initSortedIndex(...)` 12413 * - focusedItemIndex - the index of the currently focused item 12414 * - focusItemAtIndex - function that focuses a list item at given index 12415 * - skipFocus - whether or not to focus the matched item 12416 * - isItemAtIndexDisabled - function that determines whether an item at a 12417 * given index is disabled 12418 * @param state The typeahead state instance. See `initState`. 12419 * 12420 * @return The index of the matched item, or -1 if no match. 12421 */ 12422function matchItem(opts, state) { 12423 var nextChar = opts.nextChar, 12424 focusItemAtIndex = opts.focusItemAtIndex, 12425 sortedIndexByFirstChar = opts.sortedIndexByFirstChar, 12426 focusedItemIndex = opts.focusedItemIndex, 12427 skipFocus = opts.skipFocus, 12428 isItemAtIndexDisabled = opts.isItemAtIndexDisabled; 12429 clearTimeout(state.bufferClearTimeout); 12430 state.bufferClearTimeout = setTimeout(function () { 12431 clearBuffer(state); 12432 }, constants_1.numbers.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS); 12433 state.typeaheadBuffer = state.typeaheadBuffer + nextChar; 12434 var index; 12435 if (state.typeaheadBuffer.length === 1) { 12436 index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state); 12437 } else { 12438 index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state); 12439 } 12440 if (index !== -1 && !skipFocus) { 12441 focusItemAtIndex(index); 12442 } 12443 return index; 12444} 12445exports.matchItem = matchItem; 12446/** 12447 * Matches the user's single input character in the buffer to the 12448 * next option that begins with such character. Wraps around if at 12449 * end of options. Returns -1 if no match is found. 12450 */ 12451function matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state) { 12452 var firstChar = state.typeaheadBuffer[0]; 12453 var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar); 12454 if (!itemsMatchingFirstChar) { 12455 return -1; 12456 } 12457 // Has the same firstChar been recently matched? 12458 // Also, did starting index remain the same between key presses? 12459 // If both hold true, simply increment index. 12460 if (firstChar === state.currentFirstChar && itemsMatchingFirstChar[state.sortedIndexCursor].index === focusedItemIndex) { 12461 state.sortedIndexCursor = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length; 12462 var newIndex = itemsMatchingFirstChar[state.sortedIndexCursor].index; 12463 if (!isItemAtIndexDisabled(newIndex)) { 12464 return newIndex; 12465 } 12466 } 12467 // If we're here, it means one of the following happened: 12468 // - either firstChar or startingIndex has changed, invalidating the 12469 // cursor. 12470 // - The next item of typeahead is disabled, so we have to look further. 12471 state.currentFirstChar = firstChar; 12472 var newCursorPosition = -1; 12473 var cursorPosition; 12474 // Find the first non-disabled item as a fallback. 12475 for (cursorPosition = 0; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) { 12476 if (!isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) { 12477 newCursorPosition = cursorPosition; 12478 break; 12479 } 12480 } 12481 // Advance cursor to first item matching the firstChar that is positioned 12482 // after starting item. Cursor is unchanged from fallback if there's no 12483 // such item. 12484 for (; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) { 12485 if (itemsMatchingFirstChar[cursorPosition].index > focusedItemIndex && !isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) { 12486 newCursorPosition = cursorPosition; 12487 break; 12488 } 12489 } 12490 if (newCursorPosition !== -1) { 12491 state.sortedIndexCursor = newCursorPosition; 12492 return itemsMatchingFirstChar[state.sortedIndexCursor].index; 12493 } 12494 return -1; 12495} 12496/** 12497 * Attempts to find the next item that matches all of the typeahead buffer. 12498 * Wraps around if at end of options. Returns -1 if no match is found. 12499 */ 12500function matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state) { 12501 var firstChar = state.typeaheadBuffer[0]; 12502 var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar); 12503 if (!itemsMatchingFirstChar) { 12504 return -1; 12505 } 12506 // Do nothing if text already matches 12507 var startingItem = itemsMatchingFirstChar[state.sortedIndexCursor]; 12508 if (startingItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0 && !isItemAtIndexDisabled(startingItem.index)) { 12509 return startingItem.index; 12510 } 12511 // Find next item that matches completely; if no match, we'll eventually 12512 // loop around to same position 12513 var cursorPosition = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length; 12514 var nextCursorPosition = -1; 12515 while (cursorPosition !== state.sortedIndexCursor) { 12516 var currentItem = itemsMatchingFirstChar[cursorPosition]; 12517 var matches = currentItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0; 12518 var isEnabled = !isItemAtIndexDisabled(currentItem.index); 12519 if (matches && isEnabled) { 12520 nextCursorPosition = cursorPosition; 12521 break; 12522 } 12523 cursorPosition = (cursorPosition + 1) % itemsMatchingFirstChar.length; 12524 } 12525 if (nextCursorPosition !== -1) { 12526 state.sortedIndexCursor = nextCursorPosition; 12527 return itemsMatchingFirstChar[state.sortedIndexCursor].index; 12528 } 12529 return -1; 12530} 12531/** 12532 * Whether or not the given typeahead instaance state is currently typing. 12533 * 12534 * @param state The typeahead state instance. See `initState`. 12535 */ 12536function isTypingInProgress(state) { 12537 return state.typeaheadBuffer.length > 0; 12538} 12539exports.isTypingInProgress = isTypingInProgress; 12540/** 12541 * Clears the typeahaed buffer so that it resets item matching to the first 12542 * character. 12543 * 12544 * @param state The typeahead state instance. See `initState`. 12545 */ 12546function clearBuffer(state) { 12547 state.typeaheadBuffer = ''; 12548} 12549exports.clearBuffer = clearBuffer; 12550/** 12551 * Given a keydown event, it calculates whether or not to automatically focus a 12552 * list item depending on what was typed mimicing the typeahead functionality of 12553 * a standard <select> element that is open. 12554 * 12555 * @param opts Options and accessors 12556 * - event - the KeyboardEvent to handle and parse 12557 * - sortedIndexByFirstChar - output of `initSortedIndex(...)` 12558 * - focusedItemIndex - the index of the currently focused item 12559 * - focusItemAtIndex - function that focuses a list item at given index 12560 * - isItemAtFocusedIndexDisabled - whether or not the currently focused item 12561 * is disabled 12562 * - isTargetListItem - whether or not the event target is a list item 12563 * @param state The typeahead state instance. See `initState`. 12564 * 12565 * @returns index of the item matched by the keydown. -1 if not matched. 12566 */ 12567function handleKeydown(opts, state) { 12568 var event = opts.event, 12569 isTargetListItem = opts.isTargetListItem, 12570 focusedItemIndex = opts.focusedItemIndex, 12571 focusItemAtIndex = opts.focusItemAtIndex, 12572 sortedIndexByFirstChar = opts.sortedIndexByFirstChar, 12573 isItemAtIndexDisabled = opts.isItemAtIndexDisabled; 12574 var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft'; 12575 var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp'; 12576 var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight'; 12577 var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown'; 12578 var isHome = keyboard_1.normalizeKey(event) === 'Home'; 12579 var isEnd = keyboard_1.normalizeKey(event) === 'End'; 12580 var isEnter = keyboard_1.normalizeKey(event) === 'Enter'; 12581 var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar'; 12582 if (event.
vendor: 2,867 bytes, lines 12582-12658
12582ctrlKey || event.metaKey || isArrowLeft || isArrowUp || isArrowRight || isArrowDown || isHome || isEnd || isEnter) { 12583 return -1; 12584 } 12585 var isCharacterKey = !isSpace && event.key.length === 1; 12586 if (isCharacterKey) { 12587 events_1.preventDefaultEvent(event); 12588 var matchItemOpts = { 12589 focusItemAtIndex: focusItemAtIndex, 12590 focusedItemIndex: focusedItemIndex, 12591 nextChar: event.key.toLowerCase(), 12592 sortedIndexByFirstChar: sortedIndexByFirstChar, 12593 skipFocus: false, 12594 isItemAtIndexDisabled: isItemAtIndexDisabled 12595 }; 12596 return matchItem(matchItemOpts, state); 12597 } 12598 if (!isSpace) { 12599 return -1; 12600 } 12601 if (isTargetListItem) { 12602 events_1.preventDefaultEvent(event); 12603 } 12604 var typeaheadOnListItem = isTargetListItem && isTypingInProgress(state); 12605 if (typeaheadOnListItem) { 12606 var matchItemOpts = { 12607 focusItemAtIndex: focusItemAtIndex, 12608 focusedItemIndex: focusedItemIndex, 12609 nextChar: ' ', 12610 sortedIndexByFirstChar: sortedIndexByFirstChar, 12611 skipFocus: false, 12612 isItemAtIndexDisabled: isItemAtIndexDisabled 12613 }; 12614 // space participates in typeahead matching if in rapid typing mode 12615 return matchItem(matchItemOpts, state); 12616 } 12617 return -1; 12618} 12619exports.handleKeydown = handleKeydown; 12620 12621/***/ }), 12622 12623/***/ "./packages/mdc-list/types.ts": 12624/*!************************************!*\ 12625 !*** ./packages/mdc-list/types.ts ***! 12626 \************************************/ 12627/*! no static exports found */ 12628/***/ (function(module, exports, __webpack_require__) { 12629 12630"use strict"; 12631 12632/** 12633 * @license 12634 * Copyright 2019 Google Inc. 12635 * 12636 * Permission is hereby granted, free of charge, to any person obtaining a copy 12637 * of this software and associated documentation files (the "Software"), to deal 12638 * in the Software without restriction, including without limitation the rights 12639 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12640 * copies of the Software, and to permit persons to whom the Software is 12641 * furnished to do so, subject to the following conditions: 12642 * 12643 * The above copyright notice and this permission notice shall be included in 12644 * all copies or substantial portions of the Software. 12645 * 12646 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12647 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12648 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12649 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12650 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12651 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12652 * THE SOFTWARE. 12653 */ 12654 12655Object.defineProperty(exports, "__esModule", { value: true }); 12656 12657/***/ }), 12658
vendor: 1,507 bytes, lines 12659-12694
12659/***/ "./packages/mdc-menu-surface/adapter.ts": 12660/*!**********************************************!*\ 12661 !*** ./packages/mdc-menu-surface/adapter.ts ***! 12662 \**********************************************/ 12663/*! no static exports found */ 12664/***/ (function(module, exports, __webpack_require__) { 12665 12666"use strict"; 12667 12668/** 12669 * @license 12670 * Copyright 2018 Google Inc. 12671 * 12672 * Permission is hereby granted, free of charge, to any person obtaining a copy 12673 * of this software and associated documentation files (the "Software"), to deal 12674 * in the Software without restriction, including without limitation the rights 12675 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12676 * copies of the Software, and to permit persons to whom the Software is 12677 * furnished to do so, subject to the following conditions: 12678 * 12679 * The above copyright notice and this permission notice shall be included in 12680 * all copies or substantial portions of the Software. 12681 * 12682 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12683 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12684 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12685 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12686 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12687 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12688 * THE SOFTWARE. 12689 */ 12690 12691Object.defineProperty(exports, "__esModule", { value: true }); 12692 12693/***/ }), 12694
vendor: 12,641 bytes, lines 12695-12965
12695/***/ "./packages/mdc-menu-surface/component.ts": 12696/*!************************************************!*\ 12697 !*** ./packages/mdc-menu-surface/component.ts ***! 12698 \************************************************/ 12699/*! no static exports found */ 12700/***/ (function(module, exports, __webpack_require__) { 12701 12702"use strict"; 12703 12704/** 12705 * @license 12706 * Copyright 2018 Google Inc. 12707 * 12708 * Permission is hereby granted, free of charge, to any person obtaining a copy 12709 * of this software and associated documentation files (the "Software"), to deal 12710 * in the Software without restriction, including without limitation the rights 12711 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12712 * copies of the Software, and to permit persons to whom the Software is 12713 * furnished to do so, subject to the following conditions: 12714 * 12715 * The above copyright notice and this permission notice shall be included in 12716 * all copies or substantial portions of the Software. 12717 * 12718 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12719 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12720 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12721 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12722 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12723 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12724 * THE SOFTWARE. 12725 */ 12726 12727var __extends = this && this.__extends || function () { 12728 var _extendStatics = function extendStatics(d, b) { 12729 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 12730 d.__proto__ = b; 12731 } || function (d, b) { 12732 for (var p in b) { 12733 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 12734 } 12735 }; 12736 return _extendStatics(d, b); 12737 }; 12738 return function (d, b) { 12739 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 12740 _extendStatics(d, b); 12741 function __() { 12742 this.constructor = d; 12743 } 12744 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 12745 }; 12746}(); 12747Object.defineProperty(exports, "__esModule", { value: true }); 12748exports.MDCMenuSurface = void 0; 12749var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 12750var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"); 12751var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts"); 12752var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 12753var MDCMenuSurface = /** @class */function (_super) { 12754 __extends(MDCMenuSurface, _super); 12755 function MDCMenuSurface() { 12756 return _super !== null && _super.apply(this, arguments) || this; 12757 } 12758 MDCMenuSurface.attachTo = function (root) { 12759 return new MDCMenuSurface(root); 12760 }; 12761 MDCMenuSurface.prototype.initialSyncWithDOM = function () { 12762 var _this = this; 12763 var parentEl = this.root.parentElement; 12764 this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasses.ANCHOR) ? parentEl : null; 12765 if (this.root.classList.contains(constants_1.cssClasses.FIXED)) { 12766 this.setFixedPosition(true); 12767 } 12768 this.handleKeydown = function (event) { 12769 _this.foundation.handleKeydown(event); 12770 }; 12771 this.handleBodyClick = function (event) { 12772 _this.foundation.handleBodyClick(event); 12773 }; 12774 // capture so that no race between handleBodyClick and quickOpen when 12775 // menusurface opened on button click which registers this listener 12776 this.registerBodyClickListener = function () { 12777 document.body.addEventListener('click', _this.handleBodyClick, { capture: true }); 12778 }; 12779 this.deregisterBodyClickListener = function () { 12780 document.body.removeEventListener('click', _this.handleBodyClick, { capture: true }); 12781 }; 12782 this.listen('keydown', this.handleKeydown); 12783 this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener); 12784 this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener); 12785 }; 12786 MDCMenuSurface.prototype.destroy = function () { 12787 this.unlisten('keydown', this.handleKeydown); 12788 this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener); 12789 this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener); 12790 _super.prototype.destroy.call(this); 12791 }; 12792 MDCMenuSurface.prototype.isOpen = function () { 12793 return this.foundation.isOpen(); 12794 }; 12795 MDCMenuSurface.prototype.open = function () { 12796 this.foundation.open(); 12797 }; 12798 MDCMenuSurface.prototype.close = function (skipRestoreFocus) { 12799 if (skipRestoreFocus === void 0) { 12800 skipRestoreFocus = false; 12801 } 12802 this.foundation.close(skipRestoreFocus); 12803 }; 12804 Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", { 12805 set: function set(quickOpen) { 12806 this.foundation.setQuickOpen(quickOpen); 12807 }, 12808 enumerable: false, 12809 configurable: true 12810 }); 12811 /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ 12812 MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) { 12813 this.foundation.setIsHoisted(isHoisted); 12814 }; 12815 /** Sets the element that the menu-surface is anchored to. */ 12816 MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) { 12817 this.anchorElement = element; 12818 }; 12819 /** Sets the menu-surface to position: fixed. */ 12820 MDCMenuSurface.prototype.setFixedPosition = function (isFixed) { 12821 if (isFixed) { 12822 this.root.classList.add(constants_1.cssClasses.FIXED); 12823 } else { 12824 this.root.classList.remove(constants_1.cssClasses.FIXED); 12825 } 12826 this.foundation.setFixedPosition(isFixed); 12827 }; 12828 /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */ 12829 MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) { 12830 this.foundation.setAbsolutePosition(x, y); 12831 this.setIsHoisted(true); 12832 }; 12833 /** 12834 * @param corner Default anchor corner alignment of top-left surface corner. 12835 */ 12836 MDCMenuSurface.prototype.setAnchorCorner = function (corner) { 12837 this.foundation.setAnchorCorner(corner); 12838 }; 12839 MDCMenuSurface.prototype.setAnchorMargin = function (margin) { 12840 this.foundation.setAnchorMargin(margin); 12841 }; 12842 MDCMenuSurface.prototype.getDefaultFoundation = function () { 12843 var _this = this; 12844 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 12845 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 12846 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 12847 var adapter = { 12848 addClass: function addClass(className) { 12849 return _this.root.classList.add(className); 12850 }, 12851 removeClass: function removeClass(className) { 12852 return _this.root.classList.remove(className); 12853 }, 12854 hasClass: function hasClass(className) { 12855 return _this.root.classList.contains(className); 12856 }, 12857 hasAnchor: function hasAnchor() { 12858 return !!_this.anchorElement; 12859 }, 12860 notifyClose: function notifyClose() { 12861 return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {}); 12862 }, 12863 notifyClosing: function notifyClosing() { 12864 _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSING_EVENT, {}); 12865 }, 12866 notifyOpen: function notifyOpen() { 12867 return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {}); 12868 }, 12869 isElementInContainer: function isElementInContainer(el) { 12870 return _this.root.contains(el); 12871 }, 12872 isRtl: function isRtl() { 12873 return getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; 12874 }, 12875 setTransformOrigin: function setTransformOrigin(origin) { 12876 var propertyName = util_1.getCorrectPropertyName(window, 'transform') + "-origin"; 12877 _this.root.style.setProperty(propertyName, origin); 12878 }, 12879 isFocused: function isFocused() { 12880 return document.activeElement === _this.root; 12881 }, 12882 saveFocus: function saveFocus() { 12883 _this.previousFocus = document.activeElement; 12884 }, 12885 restoreFocus: function restoreFocus() { 12886 if (_this.root.contains(document.activeElement)) { 12887 if (_this.previousFocus && _this.previousFocus.focus) { 12888 _this.previousFocus.focus(); 12889 } 12890 } 12891 }, 12892 getInnerDimensions: function getInnerDimensions() { 12893 return { 12894 width: _this.root.offsetWidth, 12895 height: _this.root.offsetHeight 12896 }; 12897 }, 12898 getAnchorDimensions: function getAnchorDimensions() { 12899 return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null; 12900 }, 12901 getWindowDimensions: function getWindowDimensions() { 12902 return { width: window.innerWidth, height: window.innerHeight }; 12903 }, 12904 getBodyDimensions: function getBodyDimensions() { 12905 return { width: document.body.clientWidth, height: document.body.clientHeight }; 12906 }, 12907 getWindowScroll: function getWindowScroll() { 12908 return { x: window.pageXOffset, y: window.pageYOffset }; 12909 }, 12910 setPosition: function setPosition(position) { 12911 var rootHTML = _this.root; 12912 rootHTML.style.left = 'left' in position ? position.left + "px" : ''; 12913 rootHTML.style.right = 'right' in position ? position.right + "px" : ''; 12914 rootHTML.style.top = 'top' in position ? position.top + "px" : ''; 12915 rootHTML.style.bottom = 'bottom' in position ? position.bottom + "px" : ''; 12916 }, 12917 setMaxHeight: function setMaxHeight(height) { 12918 _this.root.style.maxHeight = height; 12919 } 12920 }; 12921 // tslint:enable:object-literal-sort-keys 12922 return new foundation_1.MDCMenuSurfaceFoundation(adapter); 12923 }; 12924 return MDCMenuSurface; 12925}(component_1.MDCComponent); 12926exports.MDCMenuSurface = MDCMenuSurface; 12927 12928/***/ }), 12929 12930/***/ "./packages/mdc-menu-surface/constants.ts": 12931/*!************************************************!*\ 12932 !*** ./packages/mdc-menu-surface/constants.ts ***! 12933 \************************************************/ 12934/*! no static exports found */ 12935/***/ (function(module, exports, __webpack_require__) { 12936 12937"use strict"; 12938 12939/** 12940 * @license 12941 * Copyright 2018 Google Inc. 12942 * 12943 * Permission is hereby granted, free of charge, to any person obtaining a copy 12944 * of this software and associated documentation files (the "Software"), to deal 12945 * in the Software without restriction, including without limitation the rights 12946 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12947 * copies of the Software, and to permit persons to whom the Software is 12948 * furnished to do so, subject to the following conditions: 12949 * 12950 * The above copyright notice and this permission notice shall be included in 12951 * all copies or substantial portions of the Software. 12952 * 12953 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12954 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12955 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12956 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12957 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12958 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 12959 * THE SOFTWARE. 12960 */ 12961 12962Object.defineProperty(exports, "__esModule", { value: true }); 12963exports.Corner = exports.CornerBit = exports.numbers = exports.strings = exports.cssClasses = void 0; 12964var cssClasses = { 12965
12965 ANCHOR: 'mdc-menu-surface--anchor', 12966 ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed', 12967 ANIMATING_OPEN: 'mdc-menu-surface--animating-open', 12968 FIXED: 'mdc-menu-surface--fixed', 12969 IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below', 12970 OPEN: 'mdc-menu-surface--open', 12971 ROOT: 'mdc-menu-surface' 12972}; 12973exports.cssClasses = cssClasses; 12974// tslint:disable:object-literal-sort-keys 12975var strings = { 12976 CLOSED_EVENT: 'MDCMenuSurface:closed', 12977 CLOSING_EVENT: 'MDCMenuSurface:closing', 12978 OPENED_EVENT: 'MDCMenuSurface:opened', 12979 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(', ') 12980}; 12981exports.strings = strings; 12982// tslint:enable:object-literal-sort-keys 12983var numbers = { 12984 /** Total duration of menu-surface open animation. */ 12985 TRANSITION_OPEN_DURATION: 120, 12986 /** Total duration of menu-surface close animation. */ 12987 TRANSITION_CLOSE_DURATION: 75, 12988 /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. Also used as a viewport margin. */ 12989 MARGIN_TO_EDGE: 32, 12990 /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */ 12991 ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67 12992}; 12993exports.numbers = numbers; 12994/** 12995 * Enum for bits in the {@see Corner) bitmap. 12996 */ 12997var CornerBit; 12998(function (CornerBit) { 12999 CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM"; 13000 CornerBit[CornerBit["CENTER"] = 2] = "CENTER"; 13001 CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT"; 13002 CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL"; 13003})(CornerBit || (CornerBit = {})); 13004exports.CornerBit = CornerBit; 13005/** 13006 * Enum for representing an element corner for positioning the menu-surface. 13007 * 13008 * The START constants map to LEFT if element directionality is left 13009 * to right and RIGHT if the directionality is right to left. 13010 * Likewise END maps to RIGHT or LEFT depending on the directionality. 13011 */ 13012var Corner; 13013(function (Corner) { 13014 Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT"; 13015 Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT"; 13016 Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT"; 13017 Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT"; 13018 Corner[Corner["TOP_START"] = 8] = "TOP_START"; 13019 Corner[Corner["TOP_END"] = 12] = "TOP_END"; 13020 Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START"; 13021 Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END"; 13022})(Corner || (Corner = {})); 13023exports.Corner = Corner; 13024 13025/***/ }), 13026
vendor: 27,641 bytes, lines 13027-13636
13027/***/ "./packages/mdc-menu-surface/foundation.ts": 13028/*!*************************************************!*\ 13029 !*** ./packages/mdc-menu-surface/foundation.ts ***! 13030 \*************************************************/ 13031/*! no static exports found */ 13032/***/ (function(module, exports, __webpack_require__) { 13033 13034"use strict"; 13035 13036/** 13037 * @license 13038 * Copyright 2018 Google Inc. 13039 * 13040 * Permission is hereby granted, free of charge, to any person obtaining a copy 13041 * of this software and associated documentation files (the "Software"), to deal 13042 * in the Software without restriction, including without limitation the rights 13043 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13044 * copies of the Software, and to permit persons to whom the Software is 13045 * furnished to do so, subject to the following conditions: 13046 * 13047 * The above copyright notice and this permission notice shall be included in 13048 * all copies or substantial portions of the Software. 13049 * 13050 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13051 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13052 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13053 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13054 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13055 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13056 * THE SOFTWARE. 13057 */ 13058 13059var __extends = this && this.__extends || function () { 13060 var _extendStatics = function extendStatics(d, b) { 13061 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 13062 d.__proto__ = b; 13063 } || function (d, b) { 13064 for (var p in b) { 13065 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 13066 } 13067 }; 13068 return _extendStatics(d, b); 13069 }; 13070 return function (d, b) { 13071 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 13072 _extendStatics(d, b); 13073 function __() { 13074 this.constructor = d; 13075 } 13076 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13077 }; 13078}(); 13079var __assign = this && this.__assign || function () { 13080 __assign = Object.assign || function (t) { 13081 for (var s, i = 1, n = arguments.length; i < n; i++) { 13082 s = arguments[i]; 13083 for (var p in s) { 13084 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 13085 } 13086 } 13087 return t; 13088 }; 13089 return __assign.apply(this, arguments); 13090}; 13091var __values = this && this.__values || function (o) { 13092 var s = typeof Symbol === "function" && Symbol.iterator, 13093 m = s && o[s], 13094 i = 0; 13095 if (m) return m.call(o); 13096 if (o && typeof o.length === "number") return { 13097 next: function next() { 13098 if (o && i >= o.length) o = void 0; 13099 return { value: o && o[i++], done: !o }; 13100 } 13101 }; 13102 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 13103}; 13104Object.defineProperty(exports, "__esModule", { value: true }); 13105exports.MDCMenuSurfaceFoundation = void 0; 13106var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 13107var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"); 13108var MDCMenuSurfaceFoundation = /** @class */function (_super) { 13109 __extends(MDCMenuSurfaceFoundation, _super); 13110 function MDCMenuSurfaceFoundation(adapter) { 13111 var _this = _super.call(this, __assign(__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this; 13112 _this.isSurfaceOpen = false; 13113 _this.isQuickOpen = false; 13114 _this.isHoistedElement = false; 13115 _this.isFixedPosition = false; 13116 _this.isHorizontallyCenteredOnViewport = false; 13117 _this.maxHeight = 0; 13118 _this.openAnimationEndTimerId = 0; 13119 _this.closeAnimationEndTimerId = 0; 13120 _this.animationRequestId = 0; 13121 _this.anchorCorner = constants_1.Corner.TOP_START; 13122 /** 13123 * Corner of the menu surface to which menu surface is attached to anchor. 13124 * 13125 * Anchor corner --->+----------+ 13126 * | ANCHOR | 13127 * +----------+ 13128 * Origin corner --->+--------------+ 13129 * | | 13130 * | | 13131 * | MENU SURFACE | 13132 * | | 13133 * | | 13134 * +--------------+ 13135 */ 13136 _this.originCorner = constants_1.Corner.TOP_START; 13137 _this.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 }; 13138 _this.position = { x: 0, y: 0 }; 13139 return _this; 13140 } 13141 Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", { 13142 get: function get() { 13143 return constants_1.cssClasses; 13144 }, 13145 enumerable: false, 13146 configurable: true 13147 }); 13148 Object.defineProperty(MDCMenuSurfaceFoundation, "strings", { 13149 get: function get() { 13150 return constants_1.strings; 13151 }, 13152 enumerable: false, 13153 configurable: true 13154 }); 13155 Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", { 13156 get: function get() { 13157 return constants_1.numbers; 13158 }, 13159 enumerable: false, 13160 configurable: true 13161 }); 13162 Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", { 13163 get: function get() { 13164 return constants_1.Corner; 13165 }, 13166 enumerable: false, 13167 configurable: true 13168 }); 13169 Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", { 13170 /** 13171 * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types. 13172 */ 13173 get: function get() { 13174 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 13175 return { 13176 addClass: function addClass() { 13177 return undefined; 13178 }, 13179 removeClass: function removeClass() { 13180 return undefined; 13181 }, 13182 hasClass: function hasClass() { 13183 return false; 13184 }, 13185 hasAnchor: function hasAnchor() { 13186 return false; 13187 }, 13188 isElementInContainer: function isElementInContainer() { 13189 return false; 13190 }, 13191 isFocused: function isFocused() { 13192 return false; 13193 }, 13194 isRtl: function isRtl() { 13195 return false; 13196 }, 13197 getInnerDimensions: function getInnerDimensions() { 13198 return { height: 0, width: 0 }; 13199 }, 13200 getAnchorDimensions: function getAnchorDimensions() { 13201 return null; 13202 }, 13203 getWindowDimensions: function getWindowDimensions() { 13204 return { height: 0, width: 0 }; 13205 }, 13206 getBodyDimensions: function getBodyDimensions() { 13207 return { height: 0, width: 0 }; 13208 }, 13209 getWindowScroll: function getWindowScroll() { 13210 return { x: 0, y: 0 }; 13211 }, 13212 setPosition: function setPosition() { 13213 return undefined; 13214 }, 13215 setMaxHeight: function setMaxHeight() { 13216 return undefined; 13217 }, 13218 setTransformOrigin: function setTransformOrigin() { 13219 return undefined; 13220 }, 13221 saveFocus: function saveFocus() { 13222 return undefined; 13223 }, 13224 restoreFocus: function restoreFocus() { 13225 return undefined; 13226 }, 13227 notifyClose: function notifyClose() { 13228 return undefined; 13229 }, 13230 notifyOpen: function notifyOpen() { 13231 return undefined; 13232 }, 13233 notifyClosing: function notifyClosing() { 13234 return undefined; 13235 } 13236 }; 13237 // tslint:enable:object-literal-sort-keys 13238 }, 13239 enumerable: false, 13240 configurable: true 13241 }); 13242 MDCMenuSurfaceFoundation.prototype.init = function () { 13243 var _a = MDCMenuSurfaceFoundation.cssClasses, 13244 ROOT = _a.ROOT, 13245 OPEN = _a.OPEN; 13246 if (!this.adapter.hasClass(ROOT)) { 13247 throw new Error(ROOT + " class required in root element."); 13248 } 13249 if (this.adapter.hasClass(OPEN)) { 13250 this.isSurfaceOpen = true; 13251 } 13252 }; 13253 MDCMenuSurfaceFoundation.prototype.destroy = function () { 13254 clearTimeout(this.openAnimationEndTimerId); 13255 clearTimeout(this.closeAnimationEndTimerId); 13256 // Cancel any currently running animations. 13257 cancelAnimationFrame(this.animationRequestId); 13258 }; 13259 /** 13260 * @param corner Default anchor corner alignment of top-left menu surface corner. 13261 */ 13262 MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) { 13263 this.anchorCorner = corner; 13264 }; 13265 /** 13266 * Flip menu corner horizontally. 13267 */ 13268 MDCMenuSurfaceFoundation.prototype.flipCornerHorizontally = function () { 13269 this.originCorner = this.originCorner ^ constants_1.CornerBit.RIGHT; 13270 }; 13271 /** 13272 * @param margin Set of margin values from anchor. 13273 */ 13274 MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) { 13275 this.anchorMargin.top = margin.top || 0; 13276 this.anchorMargin.right = margin.right || 0; 13277 this.anchorMargin.bottom = margin.bottom || 0; 13278 this.anchorMargin.left = margin.left || 0; 13279 }; 13280 /** Used to indicate if the menu-surface is hoisted to the body. */ 13281 MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) { 13282 this.isHoistedElement = isHoisted; 13283 }; 13284 /** Used to set the menu-surface calculations based on a fixed position menu. */ 13285 MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) { 13286 this.isFixedPosition = isFixedPosition; 13287 }; 13288 /** Sets the menu-surface position on the page. */ 13289 MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) { 13290 this.position.x = this.isFinite(x) ? x : 0; 13291 this.position.y = this.isFinite(y) ? y : 0; 13292 }; 13293 /** Sets whether menu-surface should be horizontally centered to viewport. */ 13294 MDCMenuSurfaceFoundation.prototype.setIsHorizontallyCenteredOnViewport = function (isCentered) { 13295 this.isHorizontallyCenteredOnViewport = isCentered; 13296 }; 13297 MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) { 13298 this.isQuickOpen = quickOpen; 13299 }; 13300 /** 13301 * Sets maximum menu-surface height on open. 13302 * @param maxHeight The desired max-height. Set to 0 (default) to 13303 * automatically calculate max height based on available viewport space. 13304 */ 13305 MDCMenuSurfaceFoundation.prototype.setMaxHeight = function (maxHeight) { 13306 this.maxHeight = maxHeight; 13307 }; 13308 MDCMenuSurfaceFoundation.prototype.isOpen = function () { 13309 return this.isSurfaceOpen; 13310 }; 13311 /** 13312 * Open the menu surface. 13313 */ 13314 MDCMenuSurfaceFoundation.prototype.open = function () { 13315 var _this = this; 13316 if (this.isSurfaceOpen) { 13317 return; 13318 } 13319 this.adapter.saveFocus(); 13320 if (this.isQuickOpen) { 13321 this.isSurfaceOpen = true; 13322 this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); 13323 this.dimensions = this.adapter.getInnerDimensions(); 13324 this.autoposition(); 13325 this.adapter.notifyOpen(); 13326 } else { 13327 this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); 13328 this.animationRequestId = requestAnimationFrame(function () { 13329 _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); 13330 _this.dimensions = _this.adapter.getInnerDimensions(); 13331 _this.autoposition(); 13332 _this.openAnimationEndTimerId = setTimeout(function () { 13333 _this.openAnimationEndTimerId = 0; 13334 _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); 13335 _this.adapter.notifyOpen(); 13336 }, constants_1.numbers.TRANSITION_OPEN_DURATION); 13337 }); 13338 this.isSurfaceOpen = true; 13339 } 13340 }; 13341 /** 13342 * Closes the menu surface. 13343 */ 13344 MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) { 13345 var _this = this; 13346 if (skipRestoreFocus === void 0) { 13347 skipRestoreFocus = false; 13348 } 13349 if (!this.isSurfaceOpen) { 13350 return; 13351 } 13352 this.adapter.notifyClosing(); 13353 if (this.isQuickOpen) { 13354 this.isSurfaceOpen = false; 13355 if (!skipRestoreFocus) { 13356 this.maybeRestoreFocus(); 13357 } 13358 this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); 13359 this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW); 13360 this.adapter.notifyClose(); 13361 return; 13362 } 13363 this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); 13364 requestAnimationFrame(function () { 13365 _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); 13366 _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW); 13367 _this.closeAnimationEndTimerId = setTimeout(function () { 13368 _this.closeAnimationEndTimerId = 0; 13369 _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); 13370 _this.adapter.notifyClose(); 13371 }, constants_1.numbers.TRANSITION_CLOSE_DURATION); 13372 }); 13373 this.isSurfaceOpen = false; 13374 if (!skipRestoreFocus) { 13375 this.maybeRestoreFocus(); 13376 } 13377 }; 13378 /** Handle clicks and close if not within menu-surface element. */ 13379 MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) { 13380 var el = evt.target; 13381 if (this.adapter.isElementInContainer(el)) { 13382 return; 13383 } 13384 this.close(); 13385 }; 13386 /** Handle keys that close the surface. */ 13387 MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) { 13388 var keyCode = evt.keyCode, 13389 key = evt.key; 13390 var isEscape = key === 'Escape' || keyCode === 27; 13391 if (isEscape) { 13392 this.close(); 13393 } 13394 }; 13395 MDCMenuSurfaceFoundation.prototype.autoposition = function () { 13396 var _a; 13397 // Compute measurements for autoposition methods reuse. 13398 this.measurements = this.getAutoLayoutmeasurements(); 13399 var corner = this.getoriginCorner(); 13400 var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner); 13401 var verticalAlignment = this.hasBit(corner, constants_1.CornerBit.BOTTOM) ? 'bottom' : 'top'; 13402 var horizontalAlignment = this.hasBit(corner, constants_1.CornerBit.RIGHT) ? 'right' : 'left'; 13403 var horizontalOffset = this.getHorizontalOriginOffset(corner); 13404 var verticalOffset = this.getVerticalOriginOffset(corner); 13405 var _b = this.measurements, 13406 anchorSize = _b.anchorSize, 13407 surfaceSize = _b.surfaceSize; 13408 var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a); 13409 // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner. 13410 if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) { 13411 horizontalAlignment = 'center'; 13412 } 13413 // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element 13414 if (this.isHoistedElement || this.isFixedPosition) { 13415 this.adjustPositionForHoistedElement(position); 13416 } 13417 this.adapter.setTransformOrigin(horizontalAlignment + " " + verticalAlignment); 13418 this.adapter.setPosition(position); 13419 this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : ''); 13420 // If it is opened from the top then add is-open-below class 13421 if (!this.hasBit(corner, constants_1.CornerBit.BOTTOM)) { 13422 this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW); 13423 } 13424 }; 13425 /** 13426 * @return Measurements used to position menu surface popup. 13427 */ 13428 MDCMenuSurfaceFoundation.prototype.getAutoLayoutmeasurements = function () { 13429 var anchorRect = this.adapter.getAnchorDimensions(); 13430 var bodySize = this.adapter.getBodyDimensions(); 13431 var viewportSize = this.adapter.getWindowDimensions(); 13432 var windowScroll = this.adapter.getWindowScroll(); 13433 if (!anchorRect) { 13434 // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together 13435 anchorRect = { 13436 top: this.position.y, 13437 right: this.position.x, 13438 bottom: this.position.y, 13439 left: this.position.x, 13440 width: 0, 13441 height: 0 13442 }; 13443 // tslint:enable:object-literal-sort-keys 13444 } 13445 return { 13446 anchorSize: anchorRect, 13447 bodySize: bodySize, 13448 surfaceSize: this.dimensions, 13449 viewportDistance: { 13450 // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together 13451 top: anchorRect.top, 13452 right: viewportSize.width - anchorRect.right, 13453 bottom: viewportSize.height - anchorRect.bottom, 13454 left: anchorRect.left 13455 }, 13456 viewportSize: viewportSize, 13457 windowScroll: windowScroll 13458 }; 13459 }; 13460 /** 13461 * Computes the corner of the anchor from which to animate and position the 13462 * menu surface. 13463 * 13464 * Only LEFT or RIGHT bit is used to position the menu surface ignoring RTL 13465 * context. E.g., menu surface will be positioned from right side on TOP_END. 13466 */ 13467 MDCMenuSurfaceFoundation.prototype.getoriginCorner = function () { 13468 var corner = this.originCorner; 13469 var _a = this.measurements, 13470 viewportDistance = _a.viewportDistance, 13471 anchorSize = _a.anchorSize, 13472 surfaceSize = _a.surfaceSize; 13473 var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE; 13474 var isAnchoredToBottom = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM); 13475 var availableTop; 13476 var availableBottom; 13477 if (isAnchoredToBottom) { 13478 availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom; 13479 availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom; 13480 } else { 13481 availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top; 13482 availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE + anchorSize.height - this.anchorMargin.top; 13483 } 13484 var isAvailableBottom = availableBottom - surfaceSize.height > 0; 13485 if (!isAvailableBottom && availableTop > availableBottom) { 13486 // Attach bottom side of surface to the anchor. 13487 corner = this.setBit(corner, constants_1.CornerBit.BOTTOM); 13488 } 13489 var isRtl = this.adapter.isRtl(); 13490 var isFlipRtl = this.hasBit(this.anchorCorner, constants_1.CornerBit.FLIP_RTL); 13491 var hasRightBit = this.hasBit(this.anchorCorner, constants_1.CornerBit.RIGHT) || this.hasBit(corner, constants_1.CornerBit.RIGHT); 13492 // Whether surface attached to right side of anchor element. 13493 var isAnchoredToRight = false; 13494 // Anchored to start 13495 if (isRtl && isFlipRtl) { 13496 isAnchoredToRight = !hasRightBit; 13497 } else { 13498 // Anchored to right 13499 isAnchoredToRight = hasRightBit; 13500 } 13501 var availableLeft; 13502 var availableRight; 13503 if (isAnchoredToRight) { 13504 availableLeft = viewportDistance.left + anchorSize.width + this.anchorMargin.right; 13505 availableRight = viewportDistance.right - this.anchorMargin.right; 13506 } else { 13507 availableLeft = viewportDistance.left + this.anchorMargin.left; 13508 availableRight = viewportDistance.right + anchorSize.width - this.anchorMargin.left; 13509 } 13510 var isAvailableLeft = availableLeft - surfaceSize.width > 0; 13511 var isAvailableRight = availableRight - surfaceSize.width > 0; 13512 var isOriginCornerAlignedToEnd = this.hasBit(corner, constants_1.CornerBit.FLIP_RTL) && this.hasBit(corner, constants_1.CornerBit.RIGHT); 13513 if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl || !isAvailableLeft && isOriginCornerAlignedToEnd) { 13514 // Attach left side of surface to the anchor. 13515 corner = this.unsetBit(corner, constants_1.CornerBit.RIGHT); 13516 } else if (isAvailableLeft && isAnchoredToRight && isRtl || isAvailableLeft && !isAnchoredToRight && hasRightBit || !isAvailableRight && availableLeft >= availableRight) { 13517 // Attach right side of surface to the anchor. 13518 corner = this.setBit(corner, constants_1.CornerBit.RIGHT); 13519 } 13520 return corner; 13521 }; 13522 /** 13523 * @param corner Origin corner of the menu surface. 13524 * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set. 13525 */ 13526 MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) { 13527 if (this.maxHeight > 0) { 13528 return this.maxHeight; 13529 } 13530 var viewportDistance = this.measurements.viewportDistance; 13531 var maxHeight = 0; 13532 var isBottomAligned = this.hasBit(corner, constants_1.CornerBit.BOTTOM); 13533 var isBottomAnchored = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM); 13534 var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE; 13535 // When maximum height is not specified, it is handled from CSS. 13536 if (isBottomAligned) { 13537 maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE; 13538 if (!isBottomAnchored) { 13539 maxHeight += this.measurements.anchorSize.height; 13540 } 13541 } else { 13542 maxHeight = viewportDistance.bottom - this.anchorMargin.bottom + this.measurements.anchorSize.height - MARGIN_TO_EDGE; 13543 if (isBottomAnchored) { 13544 maxHeight -= this.measurements.anchorSize.height; 13545 } 13546 } 13547 return maxHeight; 13548 }; 13549 /** 13550 * @param corner Origin corner of the menu surface. 13551 * @return Horizontal offset of menu surface origin corner from corresponding anchor corner. 13552 */ 13553 MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) { 13554 var anchorSize = this.measurements.anchorSize; 13555 // isRightAligned corresponds to using the 'right' property on the surface. 13556 var isRightAligned = this.hasBit(corner, constants_1.CornerBit.RIGHT); 13557 var avoidHorizontalOverlap = this.hasBit(this.anchorCorner, constants_1.CornerBit.RIGHT); 13558 if (isRightAligned) { 13559 var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.left : this.anchorMargin.right; 13560 // For hoisted or fixed elements, adjust the offset by the difference 13561 // between viewport width and body width so when we calculate the right 13562 // value (`adjustPositionForHoistedElement`) based on the element 13563 // position, the right property is correct. 13564 if (this.isHoistedElement || this.isFixedPosition) { 13565 return rightOffset - (this.measurements.viewportSize.width - this.measurements.bodySize.width); 13566 } 13567 return rightOffset; 13568 } 13569 return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right : this.anchorMargin.left; 13570 }; 13571 /** 13572 * @param corner Origin corner of the menu surface. 13573 * @return Vertical offset of menu surface origin corner from corresponding anchor corner. 13574 */ 13575 MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) { 13576 var anchorSize = this.measurements.anchorSize; 13577 var isBottomAligned = this.hasBit(corner, constants_1.CornerBit.BOTTOM); 13578 var avoidVerticalOverlap = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM); 13579 var y = 0; 13580 if (isBottomAligned) { 13581 y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top : -this.anchorMargin.bottom; 13582 } else { 13583 y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin.bottom : this.anchorMargin.top; 13584 } 13585 return y; 13586 }; 13587 /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */ 13588 MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) { 13589 var e_1, _a; 13590 var _b = this.measurements, 13591 windowScroll = _b.windowScroll, 13592 viewportDistance = _b.viewportDistance, 13593 surfaceSize = _b.surfaceSize, 13594 viewportSize = _b.viewportSize; 13595 var props = Object.keys(position); 13596 try { 13597 for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) { 13598 var prop = props_1_1.value; 13599 var value = position[prop] || 0; 13600 if (this.isHorizontallyCenteredOnViewport && (prop === 'left' || prop === 'right')) { 13601 position[prop] = (viewportSize.width - surfaceSize.width) / 2; 13602 continue; 13603 } 13604 // Hoisted surfaces need to have the anchor elements location on the page added to the 13605 // position properties for proper alignment on the body. 13606 value += viewportDistance[prop]; 13607 // Surfaces that are absolutely positioned need to have additional calculations for scroll 13608 // and bottom positioning. 13609 if (!this.isFixedPosition) { 13610 if (prop === 'top') { 13611 value += windowScroll.y; 13612 } else if (prop === 'bottom') { 13613 value -= windowScroll.y; 13614 } else if (prop === 'left') { 13615 value += windowScroll.x; 13616 } else { 13617 // prop === 'right' 13618 value -= windowScroll.x; 13619 } 13620 } 13621 position[prop] = value; 13622 } 13623 } catch (e_1_1) { 13624 e_1 = { error: e_1_1 }; 13625 } finally { 13626 try { 13627 if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1); 13628 } finally { 13629 if (e_1) throw e_1.error; 13630 } 13631 } 13632 }; 13633 /** 13634 * The last focused element when the menu surface was opened should regain focus, if the user is 13635 * focused on or within the menu surface when it is closed. 13636 */
13637 MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () { 13638 var isRootFocused = this.adapter.isFocused(); 13639 var childHasFocus = document.activeElement && this.adapter.isElementInContainer(document.activeElement); 13640 if (isRootFocused || childHasFocus) { 13641 this.adapter.restoreFocus(
vendor: 3,583 bytes, lines 13641-13722
13641); 13642 } 13643 }; 13644 MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) { 13645 return Boolean(corner & bit); // tslint:disable-line:no-bitwise 13646 }; 13647 MDCMenuSurfaceFoundation.prototype.setBit = function (corner, bit) { 13648 return corner | bit; // tslint:disable-line:no-bitwise 13649 }; 13650 MDCMenuSurfaceFoundation.prototype.unsetBit = function (corner, bit) { 13651 return corner ^ bit; 13652 }; 13653 /** 13654 * isFinite that doesn't force conversion to number type. 13655 * Equivalent to Number.isFinite in ES2015, which is not supported in IE. 13656 */ 13657 MDCMenuSurfaceFoundation.prototype.isFinite = function (num) { 13658 return typeof num === 'number' && isFinite(num); 13659 }; 13660 return MDCMenuSurfaceFoundation; 13661}(foundation_1.MDCFoundation); 13662exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation; 13663// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 13664exports.default = MDCMenuSurfaceFoundation; 13665 13666/***/ }), 13667 13668/***/ "./packages/mdc-menu-surface/index.ts": 13669/*!********************************************!*\ 13670 !*** ./packages/mdc-menu-surface/index.ts ***! 13671 \********************************************/ 13672/*! no static exports found */ 13673/***/ (function(module, exports, __webpack_require__) { 13674 13675"use strict"; 13676 13677/** 13678 * @license 13679 * Copyright 2019 Google Inc. 13680 * 13681 * Permission is hereby granted, free of charge, to any person obtaining a copy 13682 * of this software and associated documentation files (the "Software"), to deal 13683 * in the Software without restriction, including without limitation the rights 13684 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13685 * copies of the Software, and to permit persons to whom the Software is 13686 * furnished to do so, subject to the following conditions: 13687 * 13688 * The above copyright notice and this permission notice shall be included in 13689 * all copies or substantial portions of the Software. 13690 * 13691 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13692 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13693 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13694 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13695 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13696 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13697 * THE SOFTWARE. 13698 */ 13699 13700var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 13701 if (k2 === undefined) k2 = k; 13702 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 13703 return m[k]; 13704 } }); 13705} : function (o, m, k, k2) { 13706 if (k2 === undefined) k2 = k; 13707 o[k2] = m[k]; 13708}); 13709var __exportStar = this && this.__exportStar || function (m, exports) { 13710 for (var p in m) { 13711 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 13712 } 13713}; 13714Object.defineProperty(exports, "__esModule", { value: true }); 13715__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-menu-surface/adapter.ts"), exports); 13716__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-menu-surface/component.ts"), exports); 13717__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"), exports); 13718__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts"), exports); 13719__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-menu-surface/types.ts"), exports); 13720 13721/***/ }), 13722
vendor: 1,499 bytes, lines 13723-13758
13723/***/ "./packages/mdc-menu-surface/types.ts": 13724/*!********************************************!*\ 13725 !*** ./packages/mdc-menu-surface/types.ts ***! 13726 \********************************************/ 13727/*! no static exports found */ 13728/***/ (function(module, exports, __webpack_require__) { 13729 13730"use strict"; 13731 13732/** 13733 * @license 13734 * Copyright 2019 Google Inc. 13735 * 13736 * Permission is hereby granted, free of charge, to any person obtaining a copy 13737 * of this software and associated documentation files (the "Software"), to deal 13738 * in the Software without restriction, including without limitation the rights 13739 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13740 * copies of the Software, and to permit persons to whom the Software is 13741 * furnished to do so, subject to the following conditions: 13742 * 13743 * The above copyright notice and this permission notice shall be included in 13744 * all copies or substantial portions of the Software. 13745 * 13746 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13747 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13748 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13749 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13750 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13751 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13752 * THE SOFTWARE. 13753 */ 13754 13755Object.defineProperty(exports, "__esModule", { value: true }); 13756 13757/***/ }), 13758
vendor: 3,802 bytes, lines 13759-13848
13759/***/ "./packages/mdc-menu/adapter.ts": 13760/*!**************************************!*\ 13761 !*** ./packages/mdc-menu/adapter.ts ***! 13762 \**************************************/ 13763/*! no static exports found */ 13764/***/ (function(module, exports, __webpack_require__) { 13765 13766"use strict"; 13767 13768/** 13769 * @license 13770 * Copyright 2018 Google Inc. 13771 * 13772 * Permission is hereby granted, free of charge, to any person obtaining a copy 13773 * of this software and associated documentation files (the "Software"), to deal 13774 * in the Software without restriction, including without limitation the rights 13775 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13776 * copies of the Software, and to permit persons to whom the Software is 13777 * furnished to do so, subject to the following conditions: 13778 * 13779 * The above copyright notice and this permission notice shall be included in 13780 * all copies or substantial portions of the Software. 13781 * 13782 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13783 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13784 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13785 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13786 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13787 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13788 * THE SOFTWARE. 13789 */ 13790 13791Object.defineProperty(exports, "__esModule", { value: true }); 13792 13793/***/ }), 13794 13795/***/ "./packages/mdc-menu/component.ts": 13796/*!****************************************!*\ 13797 !*** ./packages/mdc-menu/component.ts ***! 13798 \****************************************/ 13799/*! no static exports found */ 13800/***/ (function(module, exports, __webpack_require__) { 13801 13802"use strict"; 13803 13804/** 13805 * @license 13806 * Copyright 2018 Google Inc. 13807 * 13808 * Permission is hereby granted, free of charge, to any person obtaining a copy 13809 * of this software and associated documentation files (the "Software"), to deal 13810 * in the Software without restriction, including without limitation the rights 13811 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13812 * copies of the Software, and to permit persons to whom the Software is 13813 * furnished to do so, subject to the following conditions: 13814 * 13815 * The above copyright notice and this permission notice shall be included in 13816 * all copies or substantial portions of the Software. 13817 * 13818 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13819 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13820 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13821 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 13822 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 13823 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13824 * THE SOFTWARE. 13825 */ 13826 13827var __extends = this && this.__extends || function () { 13828 var _extendStatics = function extendStatics(d, b) { 13829 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 13830 d.__proto__ = b; 13831 } || function (d, b) { 13832 for (var p in b) { 13833 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 13834 } 13835 }; 13836 return _extendStatics(d, b); 13837 }; 13838 return function (d, b) { 13839 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 13840 _extendStatics(d, b); 13841 function __() { 13842 this.constructor = d; 13843 } 13844 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13845 }; 13846}(); 13847Object.defineProperty(exports, "__esModule", { value: true }); 13848exports.MDCMenu = void 0;
vendor: 6,624 bytes, lines 13849-14003
13849// TODO(b/152410470): Remove trailing underscores from private properties 13850// tslint:disable:strip-private-property-underscore 13851var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 13852var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 13853var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts"); 13854var constants_1 = __webpack_require__(/*! @material/list/constants */ "./packages/mdc-list/constants.ts"); 13855var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts"); 13856var component_3 = __webpack_require__(/*! @material/menu-surface/component */ "./packages/mdc-menu-surface/component.ts"); 13857var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts"); 13858var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"); 13859var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts"); 13860var MDCMenu = /** @class */function (_super) { 13861 __extends(MDCMenu, _super); 13862 function MDCMenu() { 13863 return _super !== null && _super.apply(this, arguments) || this; 13864 } 13865 MDCMenu.attachTo = function (root) { 13866 return new MDCMenu(root); 13867 }; 13868 MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) { 13869 if (menuSurfaceFactory === void 0) { 13870 menuSurfaceFactory = function menuSurfaceFactory(el) { 13871 return new component_3.MDCMenuSurface(el); 13872 }; 13873 } 13874 if (listFactory === void 0) { 13875 listFactory = function listFactory(el) { 13876 return new component_2.MDCList(el); 13877 }; 13878 } 13879 this.menuSurfaceFactory_ = menuSurfaceFactory; 13880 this.listFactory_ = listFactory; 13881 }; 13882 MDCMenu.prototype.initialSyncWithDOM = function () { 13883 var _this = this; 13884 this.menuSurface_ = this.menuSurfaceFactory_(this.root); 13885 var list = this.root.querySelector(constants_2.strings.LIST_SELECTOR); 13886 if (list) { 13887 this.list_ = this.listFactory_(list); 13888 this.list_.wrapFocus = true; 13889 } else { 13890 this.list_ = null; 13891 } 13892 this.handleKeydown_ = function (evt) { 13893 return _this.foundation.handleKeydown(evt); 13894 }; 13895 this.handleItemAction_ = function (evt) { 13896 return _this.foundation.handleItemAction(_this.items[evt.detail.index]); 13897 }; 13898 this.handleMenuSurfaceOpened_ = function () { 13899 return _this.foundation.handleMenuSurfaceOpened(); 13900 }; 13901 this.menuSurface_.listen(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_); 13902 this.listen('keydown', this.handleKeydown_); 13903 this.listen(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_); 13904 }; 13905 MDCMenu.prototype.destroy = function () { 13906 if (this.list_) { 13907 this.list_.destroy(); 13908 } 13909 this.menuSurface_.destroy(); 13910 this.menuSurface_.unlisten(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_); 13911 this.unlisten('keydown', this.handleKeydown_); 13912 this.unlisten(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_); 13913 _super.prototype.destroy.call(this); 13914 }; 13915 Object.defineProperty(MDCMenu.prototype, "open", { 13916 get: function get() { 13917 return this.menuSurface_.isOpen(); 13918 }, 13919 set: function set(value) { 13920 if (value) { 13921 this.menuSurface_.open(); 13922 } else { 13923 this.menuSurface_.close(); 13924 } 13925 }, 13926 enumerable: false, 13927 configurable: true 13928 }); 13929 Object.defineProperty(MDCMenu.prototype, "wrapFocus", { 13930 get: function get() { 13931 return this.list_ ? this.list_.wrapFocus : false; 13932 }, 13933 set: function set(value) { 13934 if (this.list_) { 13935 this.list_.wrapFocus = value; 13936 } 13937 }, 13938 enumerable: false, 13939 configurable: true 13940 }); 13941 Object.defineProperty(MDCMenu.prototype, "hasTypeahead", { 13942 /** 13943 * Sets whether the menu has typeahead functionality. 13944 * @param value Whether typeahead is enabled. 13945 */ 13946 set: function set(value) { 13947 if (this.list_) { 13948 this.list_.hasTypeahead = value; 13949 } 13950 }, 13951 enumerable: false, 13952 configurable: true 13953 }); 13954 Object.defineProperty(MDCMenu.prototype, "typeaheadInProgress", { 13955 /** 13956 * @return Whether typeahead logic is currently matching some user prefix. 13957 */ 13958 get: function get() { 13959 return this.list_ ? this.list_.typeaheadInProgress : false; 13960 }, 13961 enumerable: false, 13962 configurable: true 13963 }); 13964 /** 13965 * Given the next desired character from the user, adds it to the typeahead 13966 * buffer. Then, attempts to find the next option matching the buffer. Wraps 13967 * around if at the end of options. 13968 * 13969 * @param nextChar The next character to add to the prefix buffer. 13970 * @param startingIndex The index from which to start matching. Only relevant 13971 * when starting a new match sequence. To start a new match sequence, 13972 * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer 13973 * to clear after a set interval defined in list foundation. Defaults to 13974 * the currently focused index. 13975 * @return The index of the matched item, or -1 if no match. 13976 */ 13977 MDCMenu.prototype.typeaheadMatchItem = function (nextChar, startingIndex) { 13978 if (this.list_) { 13979 return this.list_.typeaheadMatchItem(nextChar, startingIndex); 13980 } 13981 return -1; 13982 }; 13983 /** 13984 * Layout the underlying list element in the case of any dynamic updates 13985 * to its structure. 13986 */ 13987 MDCMenu.prototype.layout = function () { 13988 if (this.list_) { 13989 this.list_.layout(); 13990 } 13991 }; 13992 Object.defineProperty(MDCMenu.prototype, "items", { 13993 /** 13994 * Return the items within the menu. Note that this only contains the set of elements within 13995 * the items container that are proper list items, and not supplemental / presentational DOM 13996 * elements. 13997 */ 13998 get: function get() { 13999 return this.list_ ? this.list_.listElements : []; 14000 }, 14001 enumerable: false, 14002 configurable: true 14003 });
14004 Object.defineProperty(MDCMenu.prototype, "singleSelection", { 14005 /** 14006 * Turns on/off the underlying list's single selection mode. Used mainly 14007 * by select menu. 14008 * 14009 * @param singleSelection Whether to enable single selection mode. 14010 */ 14011 set: function set(singleSelection) { 14012 if (this.list_) { 14013 this.list_.singleSelection = singleSelection; 14014 } 14015 }, 14016 enumerable: false, 14017 configurable: true 14018 }); 14019 Object.defineProperty(MDCMenu.prototype, "selectedIndex", { 14020 /** 14021 * Retrieves the selected index. Only applicable to select menus. 14022 * @return The selected index, which is a number for single selection and 14023 * radio lists, and an array of numbers for checkbox lists. 14024 */ 14025 get: function get() { 14026 return this.list_ ? this.list_.selectedIndex : constants_1.numbers.UNSET_INDEX; 14027 }, 14028 /** 14029 * Sets the selected index of the list. Only applicable to select menus. 14030 * @param index The selected index, which is a number for single selection and 14031 * radio lists, and an array of numbers for checkbox lists. 14032 */ 14033 set: function set(index) { 14034 if (this.list_) { 14035 this.list_.selectedIndex = index; 14036 } 14037 }, 14038 enumerable: false, 14039 configurable: true 14040 }); 14041 Object.defineProperty(MDCMenu.prototype, "quickOpen", { 14042 set: function set(quickOpen) { 14043 this.menuSurface_.quickOpen = quickOpen; 14044 }, 14045 enumerable: false, 14046 configurable: true 14047 }); 14048 /** 14049 * Sets default focus state where the menu should focus every time when menu 14050 * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by 14051 * default. 14052 * @param focusState Default focus state. 14053 */ 14054 MDCMenu.prototype.setDefaultFocusState = function (focusState) { 14055 this.foundation.setDefaultFocusState(focusState); 14056 }; 14057 /** 14058 * @param corner Default anchor corner alignment of top-left menu corner. 14059 */ 14060 MDCMenu.prototype.setAnchorCorner = function (corner) {
vendor: 4,321 bytes, lines 14061-14162
14061 this.menuSurface_.setAnchorCorner(corner); 14062 }; 14063 MDCMenu.prototype.setAnchorMargin = function (margin) { 14064 this.menuSurface_.setAnchorMargin(margin); 14065 }; 14066 /** 14067 * Sets the list item as the selected row at the specified index. 14068 * @param index Index of list item within menu. 14069 */ 14070 MDCMenu.prototype.setSelectedIndex = function (index) { 14071 this.foundation.setSelectedIndex(index); 14072 }; 14073 /** 14074 * Sets the enabled state to isEnabled for the menu item at the given index. 14075 * @param index Index of the menu item 14076 * @param isEnabled The desired enabled state of the menu item. 14077 */ 14078 MDCMenu.prototype.setEnabled = function (index, isEnabled) { 14079 this.foundation.setEnabled(index, isEnabled); 14080 }; 14081 /** 14082 * @return The item within the menu at the index specified. 14083 */ 14084 MDCMenu.prototype.getOptionByIndex = function (index) { 14085 var items = this.items; 14086 if (index < items.length) { 14087 return this.items[index]; 14088 } else { 14089 return null; 14090 } 14091 }; 14092 /** 14093 * @param index A menu item's index. 14094 * @return The primary text within the menu at the index specified. 14095 */ 14096 MDCMenu.prototype.getPrimaryTextAtIndex = function (index) { 14097 var item = this.getOptionByIndex(index); 14098 if (item && this.list_) { 14099 return this.list_.getPrimaryText(item) || ''; 14100 } 14101 return ''; 14102 }; 14103 MDCMenu.prototype.setFixedPosition = function (isFixed) { 14104 this.menuSurface_.setFixedPosition(isFixed); 14105 }; 14106 MDCMenu.prototype.setIsHoisted = function (isHoisted) { 14107 this.menuSurface_.setIsHoisted(isHoisted); 14108 }; 14109 MDCMenu.prototype.setAbsolutePosition = function (x, y) { 14110 this.menuSurface_.setAbsolutePosition(x, y); 14111 }; 14112 /** 14113 * Sets the element that the menu-surface is anchored to. 14114 */ 14115 MDCMenu.prototype.setAnchorElement = function (element) { 14116 this.menuSurface_.anchorElement = element; 14117 }; 14118 MDCMenu.prototype.getDefaultFoundation = function () { 14119 var _this = this; 14120 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 14121 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 14122 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 14123 var adapter = { 14124 addClassToElementAtIndex: function addClassToElementAtIndex(index, className) { 14125 var list = _this.items; 14126 list[index].classList.add(className); 14127 }, 14128 removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) { 14129 var list = _this.items; 14130 list[index].classList.remove(className); 14131 }, 14132 addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) { 14133 var list = _this.items; 14134 list[index].setAttribute(attr, value); 14135 }, 14136 removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) { 14137 var list = _this.items; 14138 list[index].removeAttribute(attr); 14139 }, 14140 elementContainsClass: function elementContainsClass(element, className) { 14141 return element.classList.contains(className); 14142 }, 14143 closeSurface: function closeSurface(skipRestoreFocus) { 14144 return _this.menuSurface_.close(skipRestoreFocus); 14145 }, 14146 getElementIndex: function getElementIndex(element) { 14147 return _this.items.indexOf(element); 14148 }, 14149 notifySelected: function notifySelected(evtData) { 14150 return _this.emit(constants_2.strings.SELECTED_EVENT, { 14151 index: evtData.index, 14152 item: _this.items[evtData.index] 14153 }); 14154 }, 14155 getMenuItemCount: function getMenuItemCount() { 14156 return _this.items.length; 14157 }, 14158 focusItemAtIndex: function focusItemAtIndex(index) { 14159 return _this.items[index].focus(); 14160 }, 14161 focusListRoot: function focusListRoot() { 14162 return
vendor: 2,942 bytes, lines 14162-14227
14162 _this.root.querySelector(constants_2.strings.LIST_SELECTOR).focus(); 14163 }, 14164 isSelectableItemAtIndex: function isSelectableItemAtIndex(index) { 14165 return !!ponyfill_1.closest(_this.items[index], "." + constants_2.cssClasses.MENU_SELECTION_GROUP); 14166 }, 14167 getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex(index) { 14168 var selectionGroupEl = ponyfill_1.closest(_this.items[index], "." + constants_2.cssClasses.MENU_SELECTION_GROUP); 14169 var selectedItemEl = selectionGroupEl.querySelector("." + constants_2.cssClasses.MENU_SELECTED_LIST_ITEM); 14170 return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1; 14171 } 14172 }; 14173 // tslint:enable:object-literal-sort-keys 14174 return new foundation_3.MDCMenuFoundation(adapter); 14175 }; 14176 return MDCMenu; 14177}(component_1.MDCComponent); 14178exports.MDCMenu = MDCMenu; 14179 14180/***/ }), 14181 14182/***/ "./packages/mdc-menu/constants.ts": 14183/*!****************************************!*\ 14184 !*** ./packages/mdc-menu/constants.ts ***! 14185 \****************************************/ 14186/*! no static exports found */ 14187/***/ (function(module, exports, __webpack_require__) { 14188 14189"use strict"; 14190 14191/** 14192 * @license 14193 * Copyright 2018 Google Inc. 14194 * 14195 * Permission is hereby granted, free of charge, to any person obtaining a copy 14196 * of this software and associated documentation files (the "Software"), to deal 14197 * in the Software without restriction, including without limitation the rights 14198 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14199 * copies of the Software, and to permit persons to whom the Software is 14200 * furnished to do so, subject to the following conditions: 14201 * 14202 * The above copyright notice and this permission notice shall be included in 14203 * all copies or substantial portions of the Software. 14204 * 14205 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14206 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14207 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14208 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14209 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14210 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14211 * THE SOFTWARE. 14212 */ 14213 14214Object.defineProperty(exports, "__esModule", { value: true }); 14215exports.DefaultFocusState = exports.numbers = exports.strings = exports.cssClasses = void 0; 14216var cssClasses = { 14217 MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected', 14218 MENU_SELECTION_GROUP: 'mdc-menu__selection-group', 14219 ROOT: 'mdc-menu' 14220}; 14221exports.cssClasses = cssClasses; 14222var strings = { 14223 ARIA_CHECKED_ATTR: 'aria-checked', 14224 ARIA_DISABLED_ATTR: 'aria-disabled', 14225 CHECKBOX_SELECTOR: 'input[type="checkbox"]', 14226 LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list', 14227 SELECTED_EVENT: 'MDCMenu:selected'
14227 14228}; 14229exports.strings = strings; 14230var numbers = { 14231 FOCUS_ROOT_INDEX: -1 14232}; 14233exports.numbers = numbers; 14234var DefaultFocusState; 14235(function (DefaultFocusState) { 14236 DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE"; 14237 DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT"; 14238 DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM"; 14239 DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM"; 14240})(DefaultFocusState || (DefaultFocusState = {})); 14241exports.DefaultFocusState = DefaultFocusState; 14242 14243/***/ }), 14244
vendor: 10,094 bytes, lines 14245-14476
14245/***/ "./packages/mdc-menu/foundation.ts": 14246/*!*****************************************!*\ 14247 !*** ./packages/mdc-menu/foundation.ts ***! 14248 \*****************************************/ 14249/*! no static exports found */ 14250/***/ (function(module, exports, __webpack_require__) { 14251 14252"use strict"; 14253 14254/** 14255 * @license 14256 * Copyright 2018 Google Inc. 14257 * 14258 * Permission is hereby granted, free of charge, to any person obtaining a copy 14259 * of this software and associated documentation files (the "Software"), to deal 14260 * in the Software without restriction, including without limitation the rights 14261 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14262 * copies of the Software, and to permit persons to whom the Software is 14263 * furnished to do so, subject to the following conditions: 14264 * 14265 * The above copyright notice and this permission notice shall be included in 14266 * all copies or substantial portions of the Software. 14267 * 14268 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14269 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14270 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14271 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14272 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14273 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14274 * THE SOFTWARE. 14275 */ 14276 14277var __extends = this && this.__extends || function () { 14278 var _extendStatics = function extendStatics(d, b) { 14279 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 14280 d.__proto__ = b; 14281 } || function (d, b) { 14282 for (var p in b) { 14283 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 14284 } 14285 }; 14286 return _extendStatics(d, b); 14287 }; 14288 return function (d, b) { 14289 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 14290 _extendStatics(d, b); 14291 function __() { 14292 this.constructor = d; 14293 } 14294 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 14295 }; 14296}(); 14297var __assign = this && this.__assign || function () { 14298 __assign = Object.assign || function (t) { 14299 for (var s, i = 1, n = arguments.length; i < n; i++) { 14300 s = arguments[i]; 14301 for (var p in s) { 14302 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 14303 } 14304 } 14305 return t; 14306 }; 14307 return __assign.apply(this, arguments); 14308}; 14309Object.defineProperty(exports, "__esModule", { value: true }); 14310exports.MDCMenuFoundation = void 0; 14311var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 14312var constants_1 = __webpack_require__(/*! @material/list/constants */ "./packages/mdc-list/constants.ts"); 14313var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts"); 14314var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"); 14315var MDCMenuFoundation = /** @class */function (_super) { 14316 __extends(MDCMenuFoundation, _super); 14317 function MDCMenuFoundation(adapter) { 14318 var _this = _super.call(this, __assign(__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this; 14319 _this.closeAnimationEndTimerId_ = 0; 14320 _this.defaultFocusState_ = constants_2.DefaultFocusState.LIST_ROOT; 14321 return _this; 14322 } 14323 Object.defineProperty(MDCMenuFoundation, "cssClasses", { 14324 get: function get() { 14325 return constants_2.cssClasses; 14326 }, 14327 enumerable: false, 14328 configurable: true 14329 }); 14330 Object.defineProperty(MDCMenuFoundation, "strings", { 14331 get: function get() { 14332 return constants_2.strings; 14333 }, 14334 enumerable: false, 14335 configurable: true 14336 }); 14337 Object.defineProperty(MDCMenuFoundation, "numbers", { 14338 get: function get() { 14339 return constants_2.numbers; 14340 }, 14341 enumerable: false, 14342 configurable: true 14343 }); 14344 Object.defineProperty(MDCMenuFoundation, "defaultAdapter", { 14345 /** 14346 * @see {@link MDCMenuAdapter} for typing information on parameters and return types. 14347 */ 14348 get: function get() { 14349 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 14350 return { 14351 addClassToElementAtIndex: function addClassToElementAtIndex() { 14352 return undefined; 14353 }, 14354 removeClassFromElementAtIndex: function removeClassFromElementAtIndex() { 14355 return undefined; 14356 }, 14357 addAttributeToElementAtIndex: function addAttributeToElementAtIndex() { 14358 return undefined; 14359 }, 14360 removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() { 14361 return undefined; 14362 }, 14363 elementContainsClass: function elementContainsClass() { 14364 return false; 14365 }, 14366 closeSurface: function closeSurface() { 14367 return undefined; 14368 }, 14369 getElementIndex: function getElementIndex() { 14370 return -1; 14371 }, 14372 notifySelected: function notifySelected() { 14373 return undefined; 14374 }, 14375 getMenuItemCount: function getMenuItemCount() { 14376 return 0; 14377 }, 14378 focusItemAtIndex: function focusItemAtIndex() { 14379 return undefined; 14380 }, 14381 focusListRoot: function focusListRoot() { 14382 return undefined; 14383 }, 14384 getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex() { 14385 return -1; 14386 }, 14387 isSelectableItemAtIndex: function isSelectableItemAtIndex() { 14388 return false; 14389 } 14390 }; 14391 // tslint:enable:object-literal-sort-keys 14392 }, 14393 enumerable: false, 14394 configurable: true 14395 }); 14396 MDCMenuFoundation.prototype.destroy = function () { 14397 if (this.closeAnimationEndTimerId_) { 14398 clearTimeout(this.closeAnimationEndTimerId_); 14399 } 14400 this.adapter.closeSurface(); 14401 }; 14402 MDCMenuFoundation.prototype.handleKeydown = function (evt) { 14403 var key = evt.key, 14404 keyCode = evt.keyCode; 14405 var isTab = key === 'Tab' || keyCode === 9; 14406 if (isTab) { 14407 this.adapter.closeSurface( /** skipRestoreFocus */true); 14408 } 14409 }; 14410 MDCMenuFoundation.prototype.handleItemAction = function (listItem) { 14411 var _this = this; 14412 var index = this.adapter.getElementIndex(listItem); 14413 if (index < 0) { 14414 return; 14415 } 14416 this.adapter.notifySelected({ index: index }); 14417 this.adapter.closeSurface(); 14418 // Wait for the menu to close before adding/removing classes that affect styles. 14419 this.closeAnimationEndTimerId_ = setTimeout(function () { 14420 // Recompute the index in case the menu contents have changed. 14421 var recomputedIndex = _this.adapter.getElementIndex(listItem); 14422 if (recomputedIndex >= 0 && _this.adapter.isSelectableItemAtIndex(recomputedIndex)) { 14423 _this.setSelectedIndex(recomputedIndex); 14424 } 14425 }, foundation_2.MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION); 14426 }; 14427 MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () { 14428 switch (this.defaultFocusState_) { 14429 case constants_2.DefaultFocusState.FIRST_ITEM: 14430 this.adapter.focusItemAtIndex(0); 14431 break; 14432 case constants_2.DefaultFocusState.LAST_ITEM: 14433 this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1); 14434 break; 14435 case constants_2.DefaultFocusState.NONE: 14436 // Do nothing. 14437 break; 14438 default: 14439 this.adapter.focusListRoot(); 14440 break; 14441 } 14442 }; 14443 /** 14444 * Sets default focus state where the menu should focus every time when menu 14445 * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by 14446 * default. 14447 */ 14448 MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) { 14449 this.defaultFocusState_ = focusState; 14450 }; 14451 /** 14452 * Selects the list item at `index` within the menu. 14453 * @param index Index of list item within the menu. 14454 */ 14455 MDCMenuFoundation.prototype.setSelectedIndex = function (index) { 14456 this.validatedIndex_(index); 14457 if (!this.adapter.isSelectableItemAtIndex(index)) { 14458 throw new Error('MDCMenuFoundation: No selection group at specified index.'); 14459 } 14460 var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index); 14461 if (prevSelectedIndex >= 0) { 14462 this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, constants_2.strings.ARIA_CHECKED_ATTR); 14463 this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM); 14464 } 14465 this.adapter.addClassToElementAtIndex(index, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM); 14466 this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_CHECKED_ATTR, 'true'); 14467 }; 14468 /** 14469 * Sets the enabled state to isEnabled for the menu item at the given index. 14470 * @param index Index of the menu item 14471 * @param isEnabled The desired enabled state of the menu item. 14472 */ 14473 MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) { 14474 this.validatedIndex_(index); 14475 if (isEnabled) { 14476 this.adapter.removeClassFromElementAtIndex(index, constants_1.cssClasse
14476s.LIST_ITEM_DISABLED_CLASS); 14477 this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'false'); 14478 } else { 14479 this.adapter.addClassToElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); 14480 this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'true'); 14481 } 14482 }; 14483 MDCMenuFoundation.prototype.validatedIndex_
vendor: 3,347 bytes, lines 14483-14557
14483 = function (index) { 14484 var menuSize = this.adapter.getMenuItemCount(); 14485 var isIndexInRange = index >= 0 && index < menuSize; 14486 if (!isIndexInRange) { 14487 throw new Error('MDCMenuFoundation: No list item at specified index.'); 14488 } 14489 }; 14490 return MDCMenuFoundation; 14491}(foundation_1.MDCFoundation); 14492exports.MDCMenuFoundation = MDCMenuFoundation; 14493// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 14494exports.default = MDCMenuFoundation; 14495 14496/***/ }), 14497 14498/***/ "./packages/mdc-menu/index.ts": 14499/*!************************************!*\ 14500 !*** ./packages/mdc-menu/index.ts ***! 14501 \************************************/ 14502/*! no static exports found */ 14503/***/ (function(module, exports, __webpack_require__) { 14504 14505"use strict"; 14506 14507/** 14508 * @license 14509 * Copyright 2019 Google Inc. 14510 * 14511 * Permission is hereby granted, free of charge, to any person obtaining a copy 14512 * of this software and associated documentation files (the "Software"), to deal 14513 * in the Software without restriction, including without limitation the rights 14514 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14515 * copies of the Software, and to permit persons to whom the Software is 14516 * furnished to do so, subject to the following conditions: 14517 * 14518 * The above copyright notice and this permission notice shall be included in 14519 * all copies or substantial portions of the Software. 14520 * 14521 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14522 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14523 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14524 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14525 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14526 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14527 * THE SOFTWARE. 14528 */ 14529 14530var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 14531 if (k2 === undefined) k2 = k; 14532 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 14533 return m[k]; 14534 } }); 14535} : function (o, m, k, k2) { 14536 if (k2 === undefined) k2 = k; 14537 o[k2] = m[k]; 14538}); 14539var __exportStar = this && this.__exportStar || function (m, exports) { 14540 for (var p in m) { 14541 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 14542 } 14543}; 14544Object.defineProperty(exports, "__esModule", { value: true }); 14545exports.Corner = void 0; 14546var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"); // for backward compatibility 14547Object.defineProperty(exports, "Corner", { enumerable: true, get: function get() { 14548 return constants_1.Corner; 14549 } }); 14550__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-menu/adapter.ts"), exports); 14551__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-menu/component.ts"), exports); 14552__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"), exports); 14553__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts"), exports); 14554__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-menu/types.ts"), exports); 14555 14556/***/ }), 14557
vendor: 6,224 bytes, lines 14558-14697
14558/***/ "./packages/mdc-menu/types.ts": 14559/*!************************************!*\ 14560 !*** ./packages/mdc-menu/types.ts ***! 14561 \************************************/ 14562/*! no static exports found */ 14563/***/ (function(module, exports, __webpack_require__) { 14564 14565"use strict"; 14566 14567/** 14568 * @license 14569 * Copyright 2019 Google Inc. 14570 * 14571 * Permission is hereby granted, free of charge, to any person obtaining a copy 14572 * of this software and associated documentation files (the "Software"), to deal 14573 * in the Software without restriction, including without limitation the rights 14574 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14575 * copies of the Software, and to permit persons to whom the Software is 14576 * furnished to do so, subject to the following conditions: 14577 * 14578 * The above copyright notice and this permission notice shall be included in 14579 * all copies or substantial portions of the Software. 14580 * 14581 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14582 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14583 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14584 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14585 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14586 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14587 * THE SOFTWARE. 14588 */ 14589 14590Object.defineProperty(exports, "__esModule", { value: true }); 14591 14592/***/ }), 14593 14594/***/ "./packages/mdc-notched-outline/adapter.ts": 14595/*!*************************************************!*\ 14596 !*** ./packages/mdc-notched-outline/adapter.ts ***! 14597 \*************************************************/ 14598/*! no static exports found */ 14599/***/ (function(module, exports, __webpack_require__) { 14600 14601"use strict"; 14602 14603/** 14604 * @license 14605 * Copyright 2017 Google Inc. 14606 * 14607 * Permission is hereby granted, free of charge, to any person obtaining a copy 14608 * of this software and associated documentation files (the "Software"), to deal 14609 * in the Software without restriction, including without limitation the rights 14610 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14611 * copies of the Software, and to permit persons to whom the Software is 14612 * furnished to do so, subject to the following conditions: 14613 * 14614 * The above copyright notice and this permission notice shall be included in 14615 * all copies or substantial portions of the Software. 14616 * 14617 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14618 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14619 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14620 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14621 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14622 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14623 * THE SOFTWARE. 14624 */ 14625 14626Object.defineProperty(exports, "__esModule", { value: true }); 14627 14628/***/ }), 14629 14630/***/ "./packages/mdc-notched-outline/component.ts": 14631/*!***************************************************!*\ 14632 !*** ./packages/mdc-notched-outline/component.ts ***! 14633 \***************************************************/ 14634/*! no static exports found */ 14635/***/ (function(module, exports, __webpack_require__) { 14636 14637"use strict"; 14638 14639/** 14640 * @license 14641 * Copyright 2017 Google Inc. 14642 * 14643 * Permission is hereby granted, free of charge, to any person obtaining a copy 14644 * of this software and associated documentation files (the "Software"), to deal 14645 * in the Software without restriction, including without limitation the rights 14646 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14647 * copies of the Software, and to permit persons to whom the Software is 14648 * furnished to do so, subject to the following conditions: 14649 * 14650 * The above copyright notice and this permission notice shall be included in 14651 * all copies or substantial portions of the Software. 14652 * 14653 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14654 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14655 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14656 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14657 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14658 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14659 * THE SOFTWARE. 14660 */ 14661 14662var __extends = this && this.__extends || function () { 14663 var _extendStatics = function extendStatics(d, b) { 14664 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 14665 d.__proto__ = b; 14666 } || function (d, b) { 14667 for (var p in b) { 14668 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 14669 } 14670 }; 14671 return _extendStatics(d, b); 14672 }; 14673 return function (d, b) { 14674 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 14675 _extendStatics(d, b); 14676 function __() { 14677 this.constructor = d; 14678 } 14679 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 14680 }; 14681}(); 14682Object.defineProperty(exports, "__esModule", { value: true }); 14683exports.MDCNotchedOutline = void 0; 14684var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 14685var foundation_1 = __webpack_require__(/*! @material/floating-label/foundation */ "./packages/mdc-floating-label/foundation.ts"); 14686var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"); 14687var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts"); 14688var MDCNotchedOutline = /** @class */function (_super) { 14689 __extends(MDCNotchedOutline, _super); 14690 function MDCNotchedOutline() { 14691 return _super !== null && _super.apply(this, arguments) || this; 14692 } 14693 MDCNotchedOutline.attachTo = function (root) { 14694 return new MDCNotchedOutline(root); 14695 }; 14696 MDCNotchedOutline.prototype.initialSyncWithDOM = function () { 14697 this.notchElement
14697_ = this.root.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR); 14698 var label = this.root.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT); 14699 if (label) { 14700 label.style.transitionDuration = '0s'; 14701 this.root.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED); 14702 requestAnimationFrame(function () { 14703 label.style.transitionDuration = ''; 14704 }); 14705 } else { 14706 this.root.classList.add(constants_1.cssClasses.NO_LABEL); 14707 } 14708 }; 14709 /** 14710 * Updates classes and styles to open the notch to the specified width. 14711 * @param notchWidth The notch width in the outline. 14712 */ 14713 MDCNotchedOutline.prototype.notch = function (notchWidth) { 14714 this.foundation.notch(notchWidth); 14715 }; 14716 /** 14717 * Updates classes and styles to close the notch. 14718 */ 14719 MDCNotchedOutline.prototype.closeNotch = function () { 14720 this.foundation.closeNotch(); 14721 }; 14722 MDCNotchedOutline.prototype.getDefaultFoundation = function () { 14723 var _this = this; 14724 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 14725 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 14726 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 14727 var adapter = { 14728 addClass: function addClass(className) { 14729 return _this.root.classList.add(className); 14730 }, 14731 removeClass: function removeClass(className) { 14732 return _this.root.classList.remove(className); 14733 }, 14734 setNotchWidthProperty: function setNotchWidthProperty(width) { 14735 return _this.notchElement_.style.setProperty('width', width + 'px'); 14736 }, 14737 removeNotchWidthProperty: function removeNotchWidthProperty() { 14738 return _this.notchElement_
vendor: 15,924 bytes, lines 14738-15113
14738.style.removeProperty('width'); 14739 } 14740 }; 14741 // tslint:enable:object-literal-sort-keys 14742 return new foundation_2.MDCNotchedOutlineFoundation(adapter); 14743 }; 14744 return MDCNotchedOutline; 14745}(component_1.MDCComponent); 14746exports.MDCNotchedOutline = MDCNotchedOutline; 14747 14748/***/ }), 14749 14750/***/ "./packages/mdc-notched-outline/constants.ts": 14751/*!***************************************************!*\ 14752 !*** ./packages/mdc-notched-outline/constants.ts ***! 14753 \***************************************************/ 14754/*! no static exports found */ 14755/***/ (function(module, exports, __webpack_require__) { 14756 14757"use strict"; 14758 14759/** 14760 * @license 14761 * Copyright 2018 Google Inc. 14762 * 14763 * Permission is hereby granted, free of charge, to any person obtaining a copy 14764 * of this software and associated documentation files (the "Software"), to deal 14765 * in the Software without restriction, including without limitation the rights 14766 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14767 * copies of the Software, and to permit persons to whom the Software is 14768 * furnished to do so, subject to the following conditions: 14769 * 14770 * The above copyright notice and this permission notice shall be included in 14771 * all copies or substantial portions of the Software. 14772 * 14773 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14774 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14775 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14776 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14777 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14778 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14779 * THE SOFTWARE. 14780 */ 14781 14782Object.defineProperty(exports, "__esModule", { value: true }); 14783exports.strings = exports.numbers = exports.cssClasses = void 0; 14784var strings = { 14785 NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch' 14786}; 14787exports.strings = strings; 14788var numbers = { 14789 // This should stay in sync with $mdc-notched-outline-padding * 2. 14790 NOTCH_ELEMENT_PADDING: 8 14791}; 14792exports.numbers = numbers; 14793var cssClasses = { 14794 NO_LABEL: 'mdc-notched-outline--no-label', 14795 OUTLINE_NOTCHED: 'mdc-notched-outline--notched', 14796 OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded' 14797}; 14798exports.cssClasses = cssClasses; 14799 14800/***/ }), 14801 14802/***/ "./packages/mdc-notched-outline/foundation.ts": 14803/*!****************************************************!*\ 14804 !*** ./packages/mdc-notched-outline/foundation.ts ***! 14805 \****************************************************/ 14806/*! no static exports found */ 14807/***/ (function(module, exports, __webpack_require__) { 14808 14809"use strict"; 14810 14811/** 14812 * @license 14813 * Copyright 2017 Google Inc. 14814 * 14815 * Permission is hereby granted, free of charge, to any person obtaining a copy 14816 * of this software and associated documentation files (the "Software"), to deal 14817 * in the Software without restriction, including without limitation the rights 14818 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14819 * copies of the Software, and to permit persons to whom the Software is 14820 * furnished to do so, subject to the following conditions: 14821 * 14822 * The above copyright notice and this permission notice shall be included in 14823 * all copies or substantial portions of the Software. 14824 * 14825 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14826 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14827 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14828 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14829 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14830 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14831 * THE SOFTWARE. 14832 */ 14833 14834var __extends = this && this.__extends || function () { 14835 var _extendStatics = function extendStatics(d, b) { 14836 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 14837 d.__proto__ = b; 14838 } || function (d, b) { 14839 for (var p in b) { 14840 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 14841 } 14842 }; 14843 return _extendStatics(d, b); 14844 }; 14845 return function (d, b) { 14846 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 14847 _extendStatics(d, b); 14848 function __() { 14849 this.constructor = d; 14850 } 14851 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 14852 }; 14853}(); 14854var __assign = this && this.__assign || function () { 14855 __assign = Object.assign || function (t) { 14856 for (var s, i = 1, n = arguments.length; i < n; i++) { 14857 s = arguments[i]; 14858 for (var p in s) { 14859 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 14860 } 14861 } 14862 return t; 14863 }; 14864 return __assign.apply(this, arguments); 14865}; 14866Object.defineProperty(exports, "__esModule", { value: true }); 14867exports.MDCNotchedOutlineFoundation = void 0; 14868var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 14869var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"); 14870var MDCNotchedOutlineFoundation = /** @class */function (_super) { 14871 __extends(MDCNotchedOutlineFoundation, _super); 14872 function MDCNotchedOutlineFoundation(adapter) { 14873 return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this; 14874 } 14875 Object.defineProperty(MDCNotchedOutlineFoundation, "strings", { 14876 get: function get() { 14877 return constants_1.strings; 14878 }, 14879 enumerable: false, 14880 configurable: true 14881 }); 14882 Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", { 14883 get: function get() { 14884 return constants_1.cssClasses; 14885 }, 14886 enumerable: false, 14887 configurable: true 14888 }); 14889 Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", { 14890 get: function get() { 14891 return constants_1.numbers; 14892 }, 14893 enumerable: false, 14894 configurable: true 14895 }); 14896 Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", { 14897 /** 14898 * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types. 14899 */ 14900 get: function get() { 14901 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 14902 return { 14903 addClass: function addClass() { 14904 return undefined; 14905 }, 14906 removeClass: function removeClass() { 14907 return undefined; 14908 }, 14909 setNotchWidthProperty: function setNotchWidthProperty() { 14910 return undefined; 14911 }, 14912 removeNotchWidthProperty: function removeNotchWidthProperty() { 14913 return undefined; 14914 } 14915 }; 14916 // tslint:enable:object-literal-sort-keys 14917 }, 14918 enumerable: false, 14919 configurable: true 14920 }); 14921 /** 14922 * Adds the outline notched selector and updates the notch width calculated based off of notchWidth. 14923 */ 14924 MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) { 14925 var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; 14926 if (notchWidth > 0) { 14927 notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right. 14928 } 14929 this.adapter.setNotchWidthProperty(notchWidth); 14930 this.adapter.addClass(OUTLINE_NOTCHED); 14931 }; 14932 /** 14933 * Removes notched outline selector to close the notch in the outline. 14934 */ 14935 MDCNotchedOutlineFoundation.prototype.closeNotch = function () { 14936 var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; 14937 this.adapter.removeClass(OUTLINE_NOTCHED); 14938 this.adapter.removeNotchWidthProperty(); 14939 }; 14940 return MDCNotchedOutlineFoundation; 14941}(foundation_1.MDCFoundation); 14942exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation; 14943// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 14944exports.default = MDCNotchedOutlineFoundation; 14945 14946/***/ }), 14947 14948/***/ "./packages/mdc-notched-outline/index.ts": 14949/*!***********************************************!*\ 14950 !*** ./packages/mdc-notched-outline/index.ts ***! 14951 \***********************************************/ 14952/*! no static exports found */ 14953/***/ (function(module, exports, __webpack_require__) { 14954 14955"use strict"; 14956 14957/** 14958 * @license 14959 * Copyright 2019 Google Inc. 14960 * 14961 * Permission is hereby granted, free of charge, to any person obtaining a copy 14962 * of this software and associated documentation files (the "Software"), to deal 14963 * in the Software without restriction, including without limitation the rights 14964 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14965 * copies of the Software, and to permit persons to whom the Software is 14966 * furnished to do so, subject to the following conditions: 14967 * 14968 * The above copyright notice and this permission notice shall be included in 14969 * all copies or substantial portions of the Software. 14970 * 14971 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14972 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14973 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14974 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14975 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 14976 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 14977 * THE SOFTWARE. 14978 */ 14979 14980var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 14981 if (k2 === undefined) k2 = k; 14982 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 14983 return m[k]; 14984 } }); 14985} : function (o, m, k, k2) { 14986 if (k2 === undefined) k2 = k; 14987 o[k2] = m[k]; 14988}); 14989var __exportStar = this && this.__exportStar || function (m, exports) { 14990 for (var p in m) { 14991 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 14992 } 14993}; 14994Object.defineProperty(exports, "__esModule", { value: true }); 14995__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-notched-outline/adapter.ts"), exports); 14996__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-notched-outline/component.ts"), exports); 14997__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"), exports); 14998__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts"), exports); 14999 15000/***/ }), 15001 15002/***/ "./packages/mdc-radio/adapter.ts": 15003/*!***************************************!*\ 15004 !*** ./packages/mdc-radio/adapter.ts ***! 15005 \***************************************/ 15006/*! no static exports found */ 15007/***/ (function(module, exports, __webpack_require__) { 15008 15009"use strict"; 15010 15011/** 15012 * @license 15013 * Copyright 2016 Google Inc. 15014 * 15015 * Permission is hereby granted, free of charge, to any person obtaining a copy 15016 * of this software and associated documentation files (the "Software"), to deal 15017 * in the Software without restriction, including without limitation the rights 15018 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15019 * copies of the Software, and to permit persons to whom the Software is 15020 * furnished to do so, subject to the following conditions: 15021 * 15022 * The above copyright notice and this permission notice shall be included in 15023 * all copies or substantial portions of the Software. 15024 * 15025 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15026 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15027 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15028 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15029 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15030 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15031 * THE SOFTWARE. 15032 */ 15033 15034Object.defineProperty(exports, "__esModule", { value: true }); 15035 15036/***/ }), 15037 15038/***/ "./packages/mdc-radio/component.ts": 15039/*!*****************************************!*\ 15040 !*** ./packages/mdc-radio/component.ts ***! 15041 \*****************************************/ 15042/*! no static exports found */ 15043/***/ (function(module, exports, __webpack_require__) { 15044 15045"use strict"; 15046 15047/** 15048 * @license 15049 * Copyright 2016 Google Inc. 15050 * 15051 * Permission is hereby granted, free of charge, to any person obtaining a copy 15052 * of this software and associated documentation files (the "Software"), to deal 15053 * in the Software without restriction, including without limitation the rights 15054 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15055 * copies of the Software, and to permit persons to whom the Software is 15056 * furnished to do so, subject to the following conditions: 15057 * 15058 * The above copyright notice and this permission notice shall be included in 15059 * all copies or substantial portions of the Software. 15060 * 15061 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15062 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15063 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15064 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15065 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15066 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15067 * THE SOFTWARE. 15068 */ 15069 15070var __extends = this && this.__extends || function () { 15071 var _extendStatics = function extendStatics(d, b) { 15072 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 15073 d.__proto__ = b; 15074 } || function (d, b) { 15075 for (var p in b) { 15076 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 15077 } 15078 }; 15079 return _extendStatics(d, b); 15080 }; 15081 return function (d, b) { 15082 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 15083 _extendStatics(d, b); 15084 function __() { 15085 this.constructor = d; 15086 } 15087 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15088 }; 15089}(); 15090var __assign = this && this.__assign || function () { 15091 __assign = Object.assign || function (t) { 15092 for (var s, i = 1, n = arguments.length; i < n; i++) { 15093 s = arguments[i]; 15094 for (var p in s) { 15095 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 15096 } 15097 } 15098 return t; 15099 }; 15100 return __assign.apply(this, arguments); 15101}; 15102Object.defineProperty(exports, "__esModule", { value: true }); 15103exports.MDCRadio = void 0; 15104var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 15105var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 15106var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 15107var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 15108var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts"); 15109var MDCRadio = /** @class */function (_super) { 15110 __extends(MDCRadio, _super); 15111 function MDCRadio() { 15112 var _this = _super !== null && _super.apply(this, arguments) || this; 15113 _this.ripple
15113_ = _this.createRipple_(); 15114 return _this; 15115 } 15116 MDCRadio.attachTo = function (root) { 15117 return new MDCRadio(root); 15118 }; 15119 Object.defineProperty(MDCRadio.prototype, "checked", { 15120 get: function get() { 15121 return this.nativeControl_.checked; 15122 }, 15123 set: function set(checked) { 15124 this.nativeControl_.checked = checked; 15125 }, 15126 enumerable: false, 15127 configurable: true 15128 }); 15129 Object.defineProperty(MDCRadio.prototype, "disabled", { 15130 get: function get() { 15131 return this.nativeControl_.disabled; 15132 }, 15133 set: function set(disabled) { 15134 this.foundation.setDisabled(disabled); 15135 }, 15136 enumerable: false, 15137 configurable: true 15138 });
vendor: 2,938 bytes, lines 15139-15197
15139 Object.defineProperty(MDCRadio.prototype, "value", { 15140 get: function get() { 15141 return this.nativeControl_.value; 15142 }, 15143 set: function set(value) { 15144 this.nativeControl_.value = value; 15145 }, 15146 enumerable: false, 15147 configurable: true 15148 }); 15149 Object.defineProperty(MDCRadio.prototype, "ripple", { 15150 get: function get() { 15151 return this.ripple_; 15152 }, 15153 enumerable: false, 15154 configurable: true 15155 }); 15156 MDCRadio.prototype.destroy = function () { 15157 this.ripple_.destroy(); 15158 _super.prototype.destroy.call(this); 15159 }; 15160 MDCRadio.prototype.getDefaultFoundation = function () { 15161 var _this = this; 15162 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 15163 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 15164 var adapter = { 15165 addClass: function addClass(className) { 15166 return _this.root.classList.add(className); 15167 }, 15168 removeClass: function removeClass(className) { 15169 return _this.root.classList.remove(className); 15170 }, 15171 setNativeControlDisabled: function setNativeControlDisabled(disabled) { 15172 return _this.nativeControl_.disabled = disabled; 15173 } 15174 }; 15175 return new foundation_2.MDCRadioFoundation(adapter); 15176 }; 15177 MDCRadio.prototype.createRipple_ = function () { 15178 var _this = this; 15179 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 15180 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 15181 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 15182 var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 15183 return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive()); 15184 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 15185 return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive()); 15186 }, 15187 // Radio buttons technically go "active" whenever there is *any* keyboard interaction. 15188 // This is not the UI we desire. 15189 isSurfaceActive: function isSurfaceActive() { 15190 return false; 15191 }, isUnbounded: function isUnbounded() { 15192 return true; 15193 } }); 15194 // tslint:enable:object-literal-sort-keys 15195 return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter)); 15196 }; 15197 Object.defineProperty(MDCRadio.prototype, "nativeControl_
vendor: 9,499 bytes, lines 15197-15435
15197", { 15198 get: function get() { 15199 var NATIVE_CONTROL_SELECTOR = foundation_2.MDCRadioFoundation.strings.NATIVE_CONTROL_SELECTOR; 15200 var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR); 15201 if (!el) { 15202 throw new Error("Radio component requires a " + NATIVE_CONTROL_SELECTOR + " element"); 15203 } 15204 return el; 15205 }, 15206 enumerable: false, 15207 configurable: true 15208 }); 15209 return MDCRadio; 15210}(component_1.MDCComponent); 15211exports.MDCRadio = MDCRadio; 15212 15213/***/ }), 15214 15215/***/ "./packages/mdc-radio/constants.ts": 15216/*!*****************************************!*\ 15217 !*** ./packages/mdc-radio/constants.ts ***! 15218 \*****************************************/ 15219/*! no static exports found */ 15220/***/ (function(module, exports, __webpack_require__) { 15221 15222"use strict"; 15223 15224/** 15225 * @license 15226 * Copyright 2016 Google Inc. 15227 * 15228 * Permission is hereby granted, free of charge, to any person obtaining a copy 15229 * of this software and associated documentation files (the "Software"), to deal 15230 * in the Software without restriction, including without limitation the rights 15231 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15232 * copies of the Software, and to permit persons to whom the Software is 15233 * furnished to do so, subject to the following conditions: 15234 * 15235 * The above copyright notice and this permission notice shall be included in 15236 * all copies or substantial portions of the Software. 15237 * 15238 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15239 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15240 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15241 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15242 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15243 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15244 * THE SOFTWARE. 15245 */ 15246 15247Object.defineProperty(exports, "__esModule", { value: true }); 15248exports.cssClasses = exports.strings = void 0; 15249var strings = { 15250 NATIVE_CONTROL_SELECTOR: '.mdc-radio__native-control' 15251}; 15252exports.strings = strings; 15253var cssClasses = { 15254 DISABLED: 'mdc-radio--disabled', 15255 ROOT: 'mdc-radio' 15256}; 15257exports.cssClasses = cssClasses; 15258 15259/***/ }), 15260 15261/***/ "./packages/mdc-radio/foundation.ts": 15262/*!******************************************!*\ 15263 !*** ./packages/mdc-radio/foundation.ts ***! 15264 \******************************************/ 15265/*! no static exports found */ 15266/***/ (function(module, exports, __webpack_require__) { 15267 15268"use strict"; 15269 15270/** 15271 * @license 15272 * Copyright 2016 Google Inc. 15273 * 15274 * Permission is hereby granted, free of charge, to any person obtaining a copy 15275 * of this software and associated documentation files (the "Software"), to deal 15276 * in the Software without restriction, including without limitation the rights 15277 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15278 * copies of the Software, and to permit persons to whom the Software is 15279 * furnished to do so, subject to the following conditions: 15280 * 15281 * The above copyright notice and this permission notice shall be included in 15282 * all copies or substantial portions of the Software. 15283 * 15284 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15285 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15286 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15287 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15288 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15289 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15290 * THE SOFTWARE. 15291 */ 15292 15293var __extends = this && this.__extends || function () { 15294 var _extendStatics = function extendStatics(d, b) { 15295 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 15296 d.__proto__ = b; 15297 } || function (d, b) { 15298 for (var p in b) { 15299 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 15300 } 15301 }; 15302 return _extendStatics(d, b); 15303 }; 15304 return function (d, b) { 15305 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 15306 _extendStatics(d, b); 15307 function __() { 15308 this.constructor = d; 15309 } 15310 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15311 }; 15312}(); 15313var __assign = this && this.__assign || function () { 15314 __assign = Object.assign || function (t) { 15315 for (var s, i = 1, n = arguments.length; i < n; i++) { 15316 s = arguments[i]; 15317 for (var p in s) { 15318 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 15319 } 15320 } 15321 return t; 15322 }; 15323 return __assign.apply(this, arguments); 15324}; 15325Object.defineProperty(exports, "__esModule", { value: true }); 15326exports.MDCRadioFoundation = void 0; 15327var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 15328var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts"); 15329var MDCRadioFoundation = /** @class */function (_super) { 15330 __extends(MDCRadioFoundation, _super); 15331 function MDCRadioFoundation(adapter) { 15332 return _super.call(this, __assign(__assign({}, MDCRadioFoundation.defaultAdapter), adapter)) || this; 15333 } 15334 Object.defineProperty(MDCRadioFoundation, "cssClasses", { 15335 get: function get() { 15336 return constants_1.cssClasses; 15337 }, 15338 enumerable: false, 15339 configurable: true 15340 }); 15341 Object.defineProperty(MDCRadioFoundation, "strings", { 15342 get: function get() { 15343 return constants_1.strings; 15344 }, 15345 enumerable: false, 15346 configurable: true 15347 }); 15348 Object.defineProperty(MDCRadioFoundation, "defaultAdapter", { 15349 get: function get() { 15350 return { 15351 addClass: function addClass() { 15352 return undefined; 15353 }, 15354 removeClass: function removeClass() { 15355 return undefined; 15356 }, 15357 setNativeControlDisabled: function setNativeControlDisabled() { 15358 return undefined; 15359 } 15360 }; 15361 }, 15362 enumerable: false, 15363 configurable: true 15364 }); 15365 MDCRadioFoundation.prototype.setDisabled = function (disabled) { 15366 var DISABLED = MDCRadioFoundation.cssClasses.DISABLED; 15367 this.adapter.setNativeControlDisabled(disabled); 15368 if (disabled) { 15369 this.adapter.addClass(DISABLED); 15370 } else { 15371 this.adapter.removeClass(DISABLED); 15372 } 15373 }; 15374 return MDCRadioFoundation; 15375}(foundation_1.MDCFoundation); 15376exports.MDCRadioFoundation = MDCRadioFoundation; 15377// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 15378exports.default = MDCRadioFoundation; 15379 15380/***/ }), 15381 15382/***/ "./packages/mdc-radio/index.ts": 15383/*!*************************************!*\ 15384 !*** ./packages/mdc-radio/index.ts ***! 15385 \*************************************/ 15386/*! no static exports found */ 15387/***/ (function(module, exports, __webpack_require__) { 15388 15389"use strict"; 15390 15391/** 15392 * @license 15393 * Copyright 2019 Google Inc. 15394 * 15395 * Permission is hereby granted, free of charge, to any person obtaining a copy 15396 * of this software and associated documentation files (the "Software"), to deal 15397 * in the Software without restriction, including without limitation the rights 15398 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15399 * copies of the Software, and to permit persons to whom the Software is 15400 * furnished to do so, subject to the following conditions: 15401 * 15402 * The above copyright notice and this permission notice shall be included in 15403 * all copies or substantial portions of the Software. 15404 * 15405 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15406 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15407 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15408 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15409 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15410 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15411 * THE SOFTWARE. 15412 */ 15413 15414var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 15415 if (k2 === undefined) k2 = k; 15416 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 15417 return m[k]; 15418 } }); 15419} : function (o, m, k, k2) { 15420 if (k2 === undefined) k2 = k; 15421 o[k2] = m[k]; 15422}); 15423var __exportStar = this && this.__exportStar || function (m, exports) { 15424 for (var p in m) { 15425 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15426 } 15427}; 15428Object.defineProperty(exports, "__esModule", { value: true }); 15429__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-radio/adapter.ts"), exports); 15430__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-radio/component.ts"), exports); 15431__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts"), exports); 15432__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts"), exports); 15433 15434/***/ }), 15435
vendor: 5,551 bytes, lines 15436-15562
15436/***/ "./packages/mdc-ripple/adapter.ts": 15437/*!****************************************!*\ 15438 !*** ./packages/mdc-ripple/adapter.ts ***! 15439 \****************************************/ 15440/*! no static exports found */ 15441/***/ (function(module, exports, __webpack_require__) { 15442 15443"use strict"; 15444 15445/** 15446 * @license 15447 * Copyright 2016 Google Inc. 15448 * 15449 * Permission is hereby granted, free of charge, to any person obtaining a copy 15450 * of this software and associated documentation files (the "Software"), to deal 15451 * in the Software without restriction, including without limitation the rights 15452 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15453 * copies of the Software, and to permit persons to whom the Software is 15454 * furnished to do so, subject to the following conditions: 15455 * 15456 * The above copyright notice and this permission notice shall be included in 15457 * all copies or substantial portions of the Software. 15458 * 15459 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15460 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15461 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15462 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15463 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15464 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15465 * THE SOFTWARE. 15466 */ 15467 15468Object.defineProperty(exports, "__esModule", { value: true }); 15469 15470/***/ }), 15471 15472/***/ "./packages/mdc-ripple/component.ts": 15473/*!******************************************!*\ 15474 !*** ./packages/mdc-ripple/component.ts ***! 15475 \******************************************/ 15476/*! no static exports found */ 15477/***/ (function(module, exports, __webpack_require__) { 15478 15479"use strict"; 15480 15481/** 15482 * @license 15483 * Copyright 2016 Google Inc. 15484 * 15485 * Permission is hereby granted, free of charge, to any person obtaining a copy 15486 * of this software and associated documentation files (the "Software"), to deal 15487 * in the Software without restriction, including without limitation the rights 15488 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15489 * copies of the Software, and to permit persons to whom the Software is 15490 * furnished to do so, subject to the following conditions: 15491 * 15492 * The above copyright notice and this permission notice shall be included in 15493 * all copies or substantial portions of the Software. 15494 * 15495 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15496 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15497 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15498 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15499 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15500 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15501 * THE SOFTWARE. 15502 */ 15503 15504var __extends = this && this.__extends || function () { 15505 var _extendStatics = function extendStatics(d, b) { 15506 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 15507 d.__proto__ = b; 15508 } || function (d, b) { 15509 for (var p in b) { 15510 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 15511 } 15512 }; 15513 return _extendStatics(d, b); 15514 }; 15515 return function (d, b) { 15516 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 15517 _extendStatics(d, b); 15518 function __() { 15519 this.constructor = d; 15520 } 15521 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15522 }; 15523}(); 15524var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 15525 if (k2 === undefined) k2 = k; 15526 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 15527 return m[k]; 15528 } }); 15529} : function (o, m, k, k2) { 15530 if (k2 === undefined) k2 = k; 15531 o[k2] = m[k]; 15532}); 15533var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 15534 Object.defineProperty(o, "default", { enumerable: true, value: v }); 15535} : function (o, v) { 15536 o["default"] = v; 15537}); 15538var __importStar = this && this.__importStar || function (mod) { 15539 if (mod && mod.__esModule) return mod; 15540 var result = {}; 15541 if (mod != null) for (var k in mod) { 15542 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 15543 }__setModuleDefault(result, mod); 15544 return result; 15545}; 15546Object.defineProperty(exports, "__esModule", { value: true }); 15547exports.MDCRipple = void 0; 15548var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 15549var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 15550var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 15551var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"); 15552var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts")); 15553var MDCRipple = /** @class */function (_super) { 15554 __extends(MDCRipple, _super); 15555 function MDCRipple() { 15556 var _this = _super !== null && _super.apply(this, arguments) || this; 15557 _this.disabled = false; 15558 return _this; 15559 } 15560 MDCRipple.attachTo = function (root, opts) { 15561 if (opts === void 0) { 15562 opts = {
15562 isUnbounded: undefined }; 15563 } 15564 var ripple = new MDCRipple(root); 15565 // Only override unbounded behavior if option is explicitly specified 15566 if (opts.isUnbounded !== undefined) { 15567 ripple.unbounded = opts.isUnbounded; 15568 } 15569 return ripple; 15570 }; 15571 MDCRipple.createAdapter = function (instance) { 15572 return { 15573 addClass: function addClass(className) { 15574 return instance.root.classList.add(className); 15575 }, 15576 browserSupportsCssVars: function browserSupportsCssVars() { 15577 return util.supportsCssVariables(window); 15578 },
vendor: 3,725 bytes, lines 15579-15657
15579 computeBoundingRect: function computeBoundingRect() { 15580 return instance.root.getBoundingClientRect(); 15581 }, 15582 containsEventTarget: function containsEventTarget(target) { 15583 return instance.root.contains(target); 15584 }, 15585 deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { 15586 return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive()); 15587 }, 15588 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 15589 return instance.root.removeEventListener(evtType, handler, events_1.applyPassive()); 15590 }, 15591 deregisterResizeHandler: function deregisterResizeHandler(handler) { 15592 return window.removeEventListener('resize', handler); 15593 }, 15594 getWindowPageOffset: function getWindowPageOffset() { 15595 return { x: window.pageXOffset, y: window.pageYOffset }; 15596 }, 15597 isSurfaceActive: function isSurfaceActive() { 15598 return ponyfill_1.matches(instance.root, ':active'); 15599 }, 15600 isSurfaceDisabled: function isSurfaceDisabled() { 15601 return Boolean(instance.disabled); 15602 }, 15603 isUnbounded: function isUnbounded() { 15604 return Boolean(instance.unbounded); 15605 }, 15606 registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { 15607 return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive()); 15608 }, 15609 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 15610 return instance.root.addEventListener(evtType, handler, events_1.applyPassive()); 15611 }, 15612 registerResizeHandler: function registerResizeHandler(handler) { 15613 return window.addEventListener('resize', handler); 15614 }, 15615 removeClass: function removeClass(className) { 15616 return instance.root.classList.remove(className); 15617 }, 15618 updateCssVariable: function updateCssVariable(varName, value) { 15619 return instance.root.style.setProperty(varName, value); 15620 } 15621 }; 15622 }; 15623 Object.defineProperty(MDCRipple.prototype, "unbounded", { 15624 get: function get() { 15625 return Boolean(this.unbounded_); 15626 }, 15627 set: function set(unbounded) { 15628 this.unbounded_ = Boolean(unbounded); 15629 this.setUnbounded_(); 15630 }, 15631 enumerable: false, 15632 configurable: true 15633 }); 15634 MDCRipple.prototype.activate = function () { 15635 this.foundation.activate(); 15636 }; 15637 MDCRipple.prototype.deactivate = function () { 15638 this.foundation.deactivate(); 15639 }; 15640 MDCRipple.prototype.layout = function () { 15641 this.foundation.layout(); 15642 }; 15643 MDCRipple.prototype.getDefaultFoundation = function () { 15644 return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this)); 15645 }; 15646 MDCRipple.prototype.initialSyncWithDOM = function () { 15647 var root = this.root; 15648 this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; 15649 }; 15650 /** 15651 * Closure Compiler throws an access control error when directly accessing a 15652 * protected or private property inside a getter/setter, like unbounded above. 15653 * By accessing the protected property inside a method, we solve that problem. 15654 * That's why this function exists. 15655 */ 15656 MDCRipple.prototype.setUnbounded_ = function () { 15657 this.foundation.setUnbounded(Boolean(this.unbounded_
vendor: 5,300 bytes, lines 15657-15789
15657)); 15658 }; 15659 return MDCRipple; 15660}(component_1.MDCComponent); 15661exports.MDCRipple = MDCRipple; 15662 15663/***/ }), 15664 15665/***/ "./packages/mdc-ripple/constants.ts": 15666/*!******************************************!*\ 15667 !*** ./packages/mdc-ripple/constants.ts ***! 15668 \******************************************/ 15669/*! no static exports found */ 15670/***/ (function(module, exports, __webpack_require__) { 15671 15672"use strict"; 15673 15674/** 15675 * @license 15676 * Copyright 2016 Google Inc. 15677 * 15678 * Permission is hereby granted, free of charge, to any person obtaining a copy 15679 * of this software and associated documentation files (the "Software"), to deal 15680 * in the Software without restriction, including without limitation the rights 15681 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15682 * copies of the Software, and to permit persons to whom the Software is 15683 * furnished to do so, subject to the following conditions: 15684 * 15685 * The above copyright notice and this permission notice shall be included in 15686 * all copies or substantial portions of the Software. 15687 * 15688 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15689 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15690 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15691 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15692 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15693 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15694 * THE SOFTWARE. 15695 */ 15696 15697Object.defineProperty(exports, "__esModule", { value: true }); 15698exports.numbers = exports.strings = exports.cssClasses = void 0; 15699exports.cssClasses = { 15700 // Ripple is a special case where the "root" component is really a "mixin" of sorts, 15701 // given that it's an 'upgrade' to an existing component. That being said it is the root 15702 // CSS class that all other CSS classes derive from. 15703 BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', 15704 FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', 15705 FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', 15706 ROOT: 'mdc-ripple-upgraded', 15707 UNBOUNDED: 'mdc-ripple-upgraded--unbounded' 15708}; 15709exports.strings = { 15710 VAR_FG_SCALE: '--mdc-ripple-fg-scale', 15711 VAR_FG_SIZE: '--mdc-ripple-fg-size', 15712 VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', 15713 VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', 15714 VAR_LEFT: '--mdc-ripple-left', 15715 VAR_TOP: '--mdc-ripple-top' 15716}; 15717exports.numbers = { 15718 DEACTIVATION_TIMEOUT_MS: 225, 15719 FG_DEACTIVATION_MS: 150, 15720 INITIAL_ORIGIN_SCALE: 0.6, 15721 PADDING: 10, 15722 TAP_DELAY_MS: 300 }; 15723 15724/***/ }), 15725 15726/***/ "./packages/mdc-ripple/foundation.ts": 15727/*!*******************************************!*\ 15728 !*** ./packages/mdc-ripple/foundation.ts ***! 15729 \*******************************************/ 15730/*! no static exports found */ 15731/***/ (function(module, exports, __webpack_require__) { 15732 15733"use strict"; 15734 15735/** 15736 * @license 15737 * Copyright 2016 Google Inc. 15738 * 15739 * Permission is hereby granted, free of charge, to any person obtaining a copy 15740 * of this software and associated documentation files (the "Software"), to deal 15741 * in the Software without restriction, including without limitation the rights 15742 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15743 * copies of the Software, and to permit persons to whom the Software is 15744 * furnished to do so, subject to the following conditions: 15745 * 15746 * The above copyright notice and this permission notice shall be included in 15747 * all copies or substantial portions of the Software. 15748 * 15749 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15750 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15751 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15752 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15753 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15754 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 15755 * THE SOFTWARE. 15756 */ 15757 15758var __extends = this && this.__extends || function () { 15759 var _extendStatics = function extendStatics(d, b) { 15760 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 15761 d.__proto__ = b; 15762 } || function (d, b) { 15763 for (var p in b) { 15764 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 15765 } 15766 }; 15767 return _extendStatics(d, b); 15768 }; 15769 return function (d, b) { 15770 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 15771 _extendStatics(d, b); 15772 function __() { 15773 this.constructor = d; 15774 } 15775 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15776 }; 15777}(); 15778var __assign = this && this.__assign || function () { 15779 __assign = Object.assign || function (t) { 15780 for (var s, i = 1, n = arguments.length; i < n; i++) { 15781 s = arguments[i]; 15782 for (var p in s) { 15783 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 15784 } 15785 } 15786 return t; 15787 }; 15788 return __assign.apply(this, arguments); 15789};
vendor: 6,497 bytes, lines 15790-15942
15790Object.defineProperty(exports, "__esModule", { value: true }); 15791exports.MDCRippleFoundation = void 0; 15792var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 15793var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts"); 15794var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"); 15795// Activation events registered on the root element of each instance for activation 15796var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; 15797// Deactivation events registered on documentElement when a pointer-related down event occurs 15798var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; 15799// simultaneous nested activations 15800var activatedTargets = []; 15801var MDCRippleFoundation = /** @class */function (_super) { 15802 __extends(MDCRippleFoundation, _super); 15803 function MDCRippleFoundation(adapter) { 15804 var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this; 15805 _this.activationAnimationHasEnded_ = false; 15806 _this.activationTimer_ = 0; 15807 _this.fgDeactivationRemovalTimer_ = 0; 15808 _this.fgScale_ = '0'; 15809 _this.frame_ = { width: 0, height: 0 }; 15810 _this.initialSize_ = 0; 15811 _this.layoutFrame_ = 0; 15812 _this.maxRadius_ = 0; 15813 _this.unboundedCoords_ = { left: 0, top: 0 }; 15814 _this.activationState_ = _this.defaultActivationState_(); 15815 _this.activationTimerCallback_ = function () { 15816 _this.activationAnimationHasEnded_ = true; 15817 _this.runDeactivationUXLogicIfReady_(); 15818 }; 15819 _this.activateHandler_ = function (e) { 15820 return _this.activate_(e); 15821 }; 15822 _this.deactivateHandler_ = function () { 15823 return _this.deactivate_(); 15824 }; 15825 _this.focusHandler_ = function () { 15826 return _this.handleFocus(); 15827 }; 15828 _this.blurHandler_ = function () { 15829 return _this.handleBlur(); 15830 }; 15831 _this.resizeHandler_ = function () { 15832 return _this.layout(); 15833 }; 15834 return _this; 15835 } 15836 Object.defineProperty(MDCRippleFoundation, "cssClasses", { 15837 get: function get() { 15838 return constants_1.cssClasses; 15839 }, 15840 enumerable: false, 15841 configurable: true 15842 }); 15843 Object.defineProperty(MDCRippleFoundation, "strings", { 15844 get: function get() { 15845 return constants_1.strings; 15846 }, 15847 enumerable: false, 15848 configurable: true 15849 }); 15850 Object.defineProperty(MDCRippleFoundation, "numbers", { 15851 get: function get() { 15852 return constants_1.numbers; 15853 }, 15854 enumerable: false, 15855 configurable: true 15856 }); 15857 Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { 15858 get: function get() { 15859 return { 15860 addClass: function addClass() { 15861 return undefined; 15862 }, 15863 browserSupportsCssVars: function browserSupportsCssVars() { 15864 return true; 15865 }, 15866 computeBoundingRect: function computeBoundingRect() { 15867 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 15868 }, 15869 containsEventTarget: function containsEventTarget() { 15870 return true; 15871 }, 15872 deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { 15873 return undefined; 15874 }, 15875 deregisterInteractionHandler: function deregisterInteractionHandler() { 15876 return undefined; 15877 }, 15878 deregisterResizeHandler: function deregisterResizeHandler() { 15879 return undefined; 15880 }, 15881 getWindowPageOffset: function getWindowPageOffset() { 15882 return { x: 0, y: 0 }; 15883 }, 15884 isSurfaceActive: function isSurfaceActive() { 15885 return true; 15886 }, 15887 isSurfaceDisabled: function isSurfaceDisabled() { 15888 return true; 15889 }, 15890 isUnbounded: function isUnbounded() { 15891 return true; 15892 }, 15893 registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { 15894 return undefined; 15895 }, 15896 registerInteractionHandler: function registerInteractionHandler() { 15897 return undefined; 15898 }, 15899 registerResizeHandler: function registerResizeHandler() { 15900 return undefined; 15901 }, 15902 removeClass: function removeClass() { 15903 return undefined; 15904 }, 15905 updateCssVariable: function updateCssVariable() { 15906 return undefined; 15907 } 15908 }; 15909 }, 15910 enumerable: false, 15911 configurable: true 15912 }); 15913 MDCRippleFoundation.prototype.init = function () { 15914 var _this = this; 15915 var supportsPressRipple = this.supportsPressRipple_(); 15916 this.registerRootHandlers_(supportsPressRipple); 15917 if (supportsPressRipple) { 15918 var _a = MDCRippleFoundation.cssClasses, 15919 ROOT_1 = _a.ROOT, 15920 UNBOUNDED_1 = _a.UNBOUNDED; 15921 requestAnimationFrame(function () { 15922 _this.adapter.addClass(ROOT_1); 15923 if (_this.adapter.isUnbounded()) { 15924 _this.adapter.addClass(UNBOUNDED_1); 15925 // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple 15926 _this.layoutInternal_(); 15927 } 15928 }); 15929 } 15930 }; 15931 MDCRippleFoundation.prototype.destroy = function () { 15932 var _this = this; 15933 if (this.supportsPressRipple_()) { 15934 if (this.activationTimer_) { 15935 clearTimeout(this.activationTimer_); 15936 this.activationTimer_ = 0; 15937 this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); 15938 } 15939 if (this.fgDeactivationRemovalTimer_) { 15940 clearTimeout(this.fgDeactivationRemovalTimer_); 15941 this.fgDeactivationRemovalTimer_ = 0; 15942 this.adapter.removeClass(MDCRippleFoundation.cssClasse
vendor: 4,899 bytes, lines 15942-16059
15942s.FG_DEACTIVATION); 15943 } 15944 var _a = MDCRippleFoundation.cssClasses, 15945 ROOT_2 = _a.ROOT, 15946 UNBOUNDED_2 = _a.UNBOUNDED; 15947 requestAnimationFrame(function () { 15948 _this.adapter.removeClass(ROOT_2); 15949 _this.adapter.removeClass(UNBOUNDED_2); 15950 _this.removeCssVars_(); 15951 }); 15952 } 15953 this.deregisterRootHandlers_(); 15954 this.deregisterDeactivationHandlers_(); 15955 }; 15956 /** 15957 * @param evt Optional event containing position information. 15958 */ 15959 MDCRippleFoundation.prototype.activate = function (evt) { 15960 this.activate_(evt); 15961 }; 15962 MDCRippleFoundation.prototype.deactivate = function () { 15963 this.deactivate_(); 15964 }; 15965 MDCRippleFoundation.prototype.layout = function () { 15966 var _this = this; 15967 if (this.layoutFrame_) { 15968 cancelAnimationFrame(this.layoutFrame_); 15969 } 15970 this.layoutFrame_ = requestAnimationFrame(function () { 15971 _this.layoutInternal_(); 15972 _this.layoutFrame_ = 0; 15973 }); 15974 }; 15975 MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { 15976 var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; 15977 if (unbounded) { 15978 this.adapter.addClass(UNBOUNDED); 15979 } else { 15980 this.adapter.removeClass(UNBOUNDED); 15981 } 15982 }; 15983 MDCRippleFoundation.prototype.handleFocus = function () { 15984 var _this = this; 15985 requestAnimationFrame(function () { 15986 return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); 15987 }); 15988 }; 15989 MDCRippleFoundation.prototype.handleBlur = function () { 15990 var _this = this; 15991 requestAnimationFrame(function () { 15992 return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); 15993 }); 15994 }; 15995 /** 15996 * We compute this property so that we are not querying information about the client 15997 * until the point in time where the foundation requests it. This prevents scenarios where 15998 * client-side feature-detection may happen too early, such as when components are rendered on the server 15999 * and then initialized at mount time on the client. 16000 */ 16001 MDCRippleFoundation.prototype.supportsPressRipple_ = function () { 16002 return this.adapter.browserSupportsCssVars(); 16003 }; 16004 MDCRippleFoundation.prototype.defaultActivationState_ = function () { 16005 return { 16006 activationEvent: undefined, 16007 hasDeactivationUXRun: false, 16008 isActivated: false, 16009 isProgrammatic: false, 16010 wasActivatedByPointer: false, 16011 wasElementMadeActive: false 16012 }; 16013 }; 16014 /** 16015 * supportsPressRipple Passed from init to save a redundant function call 16016 */ 16017 MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { 16018 var _this = this; 16019 if (supportsPressRipple) { 16020 ACTIVATION_EVENT_TYPES.forEach(function (evtType) { 16021 _this.adapter.registerInteractionHandler(evtType, _this.activateHandler_); 16022 }); 16023 if (this.adapter.isUnbounded()) { 16024 this.adapter.registerResizeHandler(this.resizeHandler_); 16025 } 16026 } 16027 this.adapter.registerInteractionHandler('focus', this.focusHandler_); 16028 this.adapter.registerInteractionHandler('blur', this.blurHandler_); 16029 }; 16030 MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { 16031 var _this = this; 16032 if (evt.type === 'keydown') { 16033 this.adapter.registerInteractionHandler('keyup', this.deactivateHandler_); 16034 } else { 16035 POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { 16036 _this.adapter.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); 16037 }); 16038 } 16039 }; 16040 MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { 16041 var _this = this; 16042 ACTIVATION_EVENT_TYPES.forEach(function (evtType) { 16043 _this.adapter.deregisterInteractionHandler(evtType, _this.activateHandler_); 16044 }); 16045 this.adapter.deregisterInteractionHandler('focus', this.focusHandler_); 16046 this.adapter.deregisterInteractionHandler('blur', this.blurHandler_); 16047 if (this.adapter.isUnbounded()) { 16048 this.adapter.deregisterResizeHandler(this.resizeHandler_); 16049 } 16050 }; 16051 MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { 16052 var _this = this; 16053 this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler_); 16054 POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { 16055 _this.adapter.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); 16056 }); 16057 }; 16058 MDCRippleFoundation.prototype.removeCssVars_ = function () { 16059 var _this = this;
vendor: 11,984 bytes, lines 16060-16286
16060 var rippleStrings = MDCRippleFoundation.strings; 16061 var keys = Object.keys(rippleStrings); 16062 keys.forEach(function (key) { 16063 if (key.indexOf('VAR_') === 0) { 16064 _this.adapter.updateCssVariable(rippleStrings[key], null); 16065 } 16066 }); 16067 }; 16068 MDCRippleFoundation.prototype.activate_ = function (evt) { 16069 var _this = this; 16070 if (this.adapter.isSurfaceDisabled()) { 16071 return; 16072 } 16073 var activationState = this.activationState_; 16074 if (activationState.isActivated) { 16075 return; 16076 } 16077 // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction 16078 var previousActivationEvent = this.previousActivationEvent_; 16079 var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; 16080 if (isSameInteraction) { 16081 return; 16082 } 16083 activationState.isActivated = true; 16084 activationState.isProgrammatic = evt === undefined; 16085 activationState.activationEvent = evt; 16086 activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); 16087 var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { 16088 return _this.adapter.containsEventTarget(target); 16089 }); 16090 if (hasActivatedChild) { 16091 // Immediately reset activation state, while preserving logic that prevents touch follow-on events 16092 this.resetActivationState_(); 16093 return; 16094 } 16095 if (evt !== undefined) { 16096 activatedTargets.push(evt.target); 16097 this.registerDeactivationHandlers_(evt); 16098 } 16099 activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); 16100 if (activationState.wasElementMadeActive) { 16101 this.animateActivation_(); 16102 } 16103 requestAnimationFrame(function () { 16104 // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples 16105 activatedTargets = []; 16106 if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { 16107 // If space was pressed, try again within an rAF call to detect :active, because different UAs report 16108 // active states inconsistently when they're called within event handling code: 16109 // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 16110 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 16111 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS 16112 // variable is set within a rAF callback for a submit button interaction (#2241). 16113 activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); 16114 if (activationState.wasElementMadeActive) { 16115 _this.animateActivation_(); 16116 } 16117 } 16118 if (!activationState.wasElementMadeActive) { 16119 // Reset activation state immediately if element was not made active. 16120 _this.activationState_ = _this.defaultActivationState_(); 16121 } 16122 }); 16123 }; 16124 MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { 16125 return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true; 16126 }; 16127 MDCRippleFoundation.prototype.animateActivation_ = function () { 16128 var _this = this; 16129 var _a = MDCRippleFoundation.strings, 16130 VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, 16131 VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; 16132 var _b = MDCRippleFoundation.cssClasses, 16133 FG_DEACTIVATION = _b.FG_DEACTIVATION, 16134 FG_ACTIVATION = _b.FG_ACTIVATION; 16135 var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; 16136 this.layoutInternal_(); 16137 var translateStart = ''; 16138 var translateEnd = ''; 16139 if (!this.adapter.isUnbounded()) { 16140 var _c = this.getFgTranslationCoordinates_(), 16141 startPoint = _c.startPoint, 16142 endPoint = _c.endPoint; 16143 translateStart = startPoint.x + "px, " + startPoint.y + "px"; 16144 translateEnd = endPoint.x + "px, " + endPoint.y + "px"; 16145 } 16146 this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); 16147 this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); 16148 // Cancel any ongoing activation/deactivation animations 16149 clearTimeout(this.activationTimer_); 16150 clearTimeout(this.fgDeactivationRemovalTimer_); 16151 this.rmBoundedActivationClasses_(); 16152 this.adapter.removeClass(FG_DEACTIVATION); 16153 // Force layout in order to re-trigger the animation. 16154 this.adapter.computeBoundingRect(); 16155 this.adapter.addClass(FG_ACTIVATION); 16156 this.activationTimer_ = setTimeout(function () { 16157 return _this.activationTimerCallback_(); 16158 }, DEACTIVATION_TIMEOUT_MS); 16159 }; 16160 MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { 16161 var _a = this.activationState_, 16162 activationEvent = _a.activationEvent, 16163 wasActivatedByPointer = _a.wasActivatedByPointer; 16164 var startPoint; 16165 if (wasActivatedByPointer) { 16166 startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect()); 16167 } else { 16168 startPoint = { 16169 x: this.frame_.width / 2, 16170 y: this.frame_.height / 2 16171 }; 16172 } 16173 // Center the element around the start point. 16174 startPoint = { 16175 x: startPoint.x - this.initialSize_ / 2, 16176 y: startPoint.y - this.initialSize_ / 2 16177 }; 16178 var endPoint = { 16179 x: this.frame_.width / 2 - this.initialSize_ / 2, 16180 y: this.frame_.height / 2 - this.initialSize_ / 2 16181 }; 16182 return { startPoint: startPoint, endPoint: endPoint }; 16183 }; 16184 MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { 16185 var _this = this; 16186 // This method is called both when a pointing device is released, and when the activation animation ends. 16187 // The deactivation animation should only run after both of those occur. 16188 var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; 16189 var _a = this.activationState_, 16190 hasDeactivationUXRun = _a.hasDeactivationUXRun, 16191 isActivated = _a.isActivated; 16192 var activationHasEnded = hasDeactivationUXRun || !isActivated; 16193 if (activationHasEnded && this.activationAnimationHasEnded_) { 16194 this.rmBoundedActivationClasses_(); 16195 this.adapter.addClass(FG_DEACTIVATION); 16196 this.fgDeactivationRemovalTimer_ = setTimeout(function () { 16197 _this.adapter.removeClass(FG_DEACTIVATION); 16198 }, constants_1.numbers.FG_DEACTIVATION_MS); 16199 } 16200 }; 16201 MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { 16202 var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; 16203 this.adapter.removeClass(FG_ACTIVATION); 16204 this.activationAnimationHasEnded_ = false; 16205 this.adapter.computeBoundingRect(); 16206 }; 16207 MDCRippleFoundation.prototype.resetActivationState_ = function () { 16208 var _this = this; 16209 this.previousActivationEvent_ = this.activationState_.activationEvent; 16210 this.activationState_ = this.defaultActivationState_(); 16211 // Touch devices may fire additional events for the same interaction within a short time. 16212 // Store the previous event until it's safe to assume that subsequent events are for new interactions. 16213 setTimeout(function () { 16214 return _this.previousActivationEvent_ = undefined; 16215 }, MDCRippleFoundation.numbers.TAP_DELAY_MS); 16216 }; 16217 MDCRippleFoundation.prototype.deactivate_ = function () { 16218 var _this = this; 16219 var activationState = this.activationState_; 16220 // This can happen in scenarios such as when you have a keyup event that blurs the element. 16221 if (!activationState.isActivated) { 16222 return; 16223 } 16224 var state = __assign({}, activationState); 16225 if (activationState.isProgrammatic) { 16226 requestAnimationFrame(function () { 16227 return _this.animateDeactivation_(state); 16228 }); 16229 this.resetActivationState_(); 16230 } else { 16231 this.deregisterDeactivationHandlers_(); 16232 requestAnimationFrame(function () { 16233 _this.activationState_.hasDeactivationUXRun = true; 16234 _this.animateDeactivation_(state); 16235 _this.resetActivationState_(); 16236 }); 16237 } 16238 }; 16239 MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { 16240 var wasActivatedByPointer = _a.wasActivatedByPointer, 16241 wasElementMadeActive = _a.wasElementMadeActive; 16242 if (wasActivatedByPointer || wasElementMadeActive) { 16243 this.runDeactivationUXLogicIfReady_(); 16244 } 16245 }; 16246 MDCRippleFoundation.prototype.layoutInternal_ = function () { 16247 var _this = this; 16248 this.frame_ = this.adapter.computeBoundingRect(); 16249 var maxDim = Math.max(this.frame_.height, this.frame_.width); 16250 // Surface diameter is treated differently for unbounded vs. bounded ripples. 16251 // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately 16252 // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically 16253 // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter 16254 // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via 16255 // `overflow: hidden`. 16256 var getBoundedRadius = function getBoundedRadius() { 16257 var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); 16258 return hypotenuse + MDCRippleFoundation.numbers.PADDING; 16259 }; 16260 this.maxRadius_ = this.adapter.isUnbounded() ? maxDim : getBoundedRadius(); 16261 // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform 16262 var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); 16263 // Unbounded ripple size should always be even number to equally center align. 16264 if (this.adapter.isUnbounded() && initialSize % 2 !== 0) { 16265 this.initialSize_ = initialSize - 1; 16266 } else { 16267 this.initialSize_ = initialSize; 16268 } 16269 this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; 16270 this.updateLayoutCssVars_(); 16271 }; 16272 MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { 16273 var _a = MDCRippleFoundation.strings, 16274 VAR_FG_SIZE = _a.VAR_FG_SIZE, 16275 VAR_LEFT = _a.VAR_LEFT, 16276 VAR_TOP = _a.VAR_TOP, 16277 VAR_FG_SCALE = _a.VAR_FG_SCALE; 16278 this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); 16279 this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale_); 16280 if (this.adapter.isUnbounded()) { 16281 this.unboundedCoords_ = { 16282 left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), 16283 top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) 16284 }; 16285 this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); 16286 this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords_
vendor: 4,996 bytes, lines 16286-16403
16286.top + "px"); 16287 } 16288 }; 16289 return MDCRippleFoundation; 16290}(foundation_1.MDCFoundation); 16291exports.MDCRippleFoundation = MDCRippleFoundation; 16292// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 16293exports.default = MDCRippleFoundation; 16294 16295/***/ }), 16296 16297/***/ "./packages/mdc-ripple/index.ts": 16298/*!**************************************!*\ 16299 !*** ./packages/mdc-ripple/index.ts ***! 16300 \**************************************/ 16301/*! no static exports found */ 16302/***/ (function(module, exports, __webpack_require__) { 16303 16304"use strict"; 16305 16306/** 16307 * @license 16308 * Copyright 2019 Google Inc. 16309 * 16310 * Permission is hereby granted, free of charge, to any person obtaining a copy 16311 * of this software and associated documentation files (the "Software"), to deal 16312 * in the Software without restriction, including without limitation the rights 16313 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16314 * copies of the Software, and to permit persons to whom the Software is 16315 * furnished to do so, subject to the following conditions: 16316 * 16317 * The above copyright notice and this permission notice shall be included in 16318 * all copies or substantial portions of the Software. 16319 * 16320 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16321 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16322 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16323 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16324 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16325 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16326 * THE SOFTWARE. 16327 */ 16328 16329var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 16330 if (k2 === undefined) k2 = k; 16331 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 16332 return m[k]; 16333 } }); 16334} : function (o, m, k, k2) { 16335 if (k2 === undefined) k2 = k; 16336 o[k2] = m[k]; 16337}); 16338var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 16339 Object.defineProperty(o, "default", { enumerable: true, value: v }); 16340} : function (o, v) { 16341 o["default"] = v; 16342}); 16343var __importStar = this && this.__importStar || function (mod) { 16344 if (mod && mod.__esModule) return mod; 16345 var result = {}; 16346 if (mod != null) for (var k in mod) { 16347 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 16348 }__setModuleDefault(result, mod); 16349 return result; 16350}; 16351var __exportStar = this && this.__exportStar || function (m, exports) { 16352 for (var p in m) { 16353 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 16354 } 16355}; 16356Object.defineProperty(exports, "__esModule", { value: true }); 16357exports.util = void 0; 16358var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts")); 16359exports.util = util; 16360__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-ripple/adapter.ts"), exports); 16361__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-ripple/component.ts"), exports); 16362__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts"), exports); 16363__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"), exports); 16364__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-ripple/types.ts"), exports); 16365 16366/***/ }), 16367 16368/***/ "./packages/mdc-ripple/types.ts": 16369/*!**************************************!*\ 16370 !*** ./packages/mdc-ripple/types.ts ***! 16371 \**************************************/ 16372/*! no static exports found */ 16373/***/ (function(module, exports, __webpack_require__) { 16374 16375"use strict"; 16376 16377/** 16378 * @license 16379 * Copyright 2019 Google Inc. 16380 * 16381 * Permission is hereby granted, free of charge, to any person obtaining a copy 16382 * of this software and associated documentation files (the "Software"), to deal 16383 * in the Software without restriction, including without limitation the rights 16384 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16385 * copies of the Software, and to permit persons to whom the Software is 16386 * furnished to do so, subject to the following conditions: 16387 * 16388 * The above copyright notice and this permission notice shall be included in 16389 * all copies or substantial portions of the Software. 16390 * 16391 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16392 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16393 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16394 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16395 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16396 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16397 * THE SOFTWARE. 16398 */ 16399 16400Object.defineProperty(exports, "__esModule", { value: true }); 16401 16402/***/ }), 16403
vendor: 2,391 bytes, lines 16404-16470
16404/***/ "./packages/mdc-ripple/util.ts": 16405/*!*************************************!*\ 16406 !*** ./packages/mdc-ripple/util.ts ***! 16407 \*************************************/ 16408/*! no static exports found */ 16409/***/ (function(module, exports, __webpack_require__) { 16410 16411"use strict"; 16412 16413 16414Object.defineProperty(exports, "__esModule", { value: true }); 16415exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0; 16416/** 16417 * Stores result from supportsCssVariables to avoid redundant processing to 16418 * detect CSS custom variable support. 16419 */ 16420var supportsCssVariables_; 16421function supportsCssVariables(windowObj, forceRefresh) { 16422 if (forceRefresh === void 0) { 16423 forceRefresh = false; 16424 } 16425 var CSS = windowObj.CSS; 16426 var supportsCssVars = supportsCssVariables_; 16427 if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { 16428 return supportsCssVariables_; 16429 } 16430 var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; 16431 if (!supportsFunctionPresent) { 16432 return false; 16433 } 16434 var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); 16435 // See: https://bugs.webkit.org/show_bug.cgi?id=154669 16436 // See: README section on Safari 16437 var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); 16438 supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus; 16439 if (!forceRefresh) { 16440 supportsCssVariables_ = supportsCssVars; 16441 } 16442 return supportsCssVars; 16443} 16444exports.supportsCssVariables = supportsCssVariables; 16445function getNormalizedEventCoords(evt, pageOffset, clientRect) { 16446 if (!evt) { 16447 return { x: 0, y: 0 }; 16448 } 16449 var x = pageOffset.x, 16450 y = pageOffset.y; 16451 var documentX = x + clientRect.left; 16452 var documentY = y + clientRect.top; 16453 var normalizedX; 16454 var normalizedY; 16455 // Determine touch point relative to the ripple container. 16456 if (evt.type === 'touchstart') { 16457 var touchEvent = evt; 16458 normalizedX = touchEvent.changedTouches[0].pageX - documentX; 16459 normalizedY = touchEvent.changedTouches[0].pageY - documentY; 16460 } else { 16461 var mouseEvent = evt; 16462 normalizedX = mouseEvent.pageX - documentX; 16463 normalizedY = mouseEvent.pageY - documentY; 16464 } 16465 return { x: normalizedX, y: normalizedY }; 16466} 16467exports.getNormalizedEventCoords = getNormalizedEventCoords; 16468 16469/***/ }), 16470
vendor: 28,412 bytes, lines 16471-17152
16471/***/ "./packages/mdc-segmented-button/index.ts": 16472/*!************************************************!*\ 16473 !*** ./packages/mdc-segmented-button/index.ts ***! 16474 \************************************************/ 16475/*! no static exports found */ 16476/***/ (function(module, exports, __webpack_require__) { 16477 16478"use strict"; 16479 16480/** 16481 * @license 16482 * Copyright 2020 Google Inc. 16483 * 16484 * Permission is hereby granted, free of charge, to any person obtaining a copy 16485 * of this software and associated documentation files (the "Software"), to deal 16486 * in the Software without restriction, including without limitation the rights 16487 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16488 * copies of the Software, and to permit persons to whom the Software is 16489 * furnished to do so, subject to the following conditions: 16490 * 16491 * The above copyright notice and this permission notice shall be included in 16492 * all copies or substantial portions of the Software. 16493 * 16494 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16495 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16496 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16497 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16498 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16499 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16500 * THE SOFTWARE. 16501 */ 16502 16503var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 16504 if (k2 === undefined) k2 = k; 16505 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 16506 return m[k]; 16507 } }); 16508} : function (o, m, k, k2) { 16509 if (k2 === undefined) k2 = k; 16510 o[k2] = m[k]; 16511}); 16512var __exportStar = this && this.__exportStar || function (m, exports) { 16513 for (var p in m) { 16514 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 16515 } 16516}; 16517Object.defineProperty(exports, "__esModule", { value: true }); 16518__exportStar(__webpack_require__(/*! ./segmented-button/index */ "./packages/mdc-segmented-button/segmented-button/index.ts"), exports); 16519__exportStar(__webpack_require__(/*! ./segment/index */ "./packages/mdc-segmented-button/segment/index.ts"), exports); 16520__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-segmented-button/types.ts"), exports); 16521 16522/***/ }), 16523 16524/***/ "./packages/mdc-segmented-button/segment/adapter.ts": 16525/*!**********************************************************!*\ 16526 !*** ./packages/mdc-segmented-button/segment/adapter.ts ***! 16527 \**********************************************************/ 16528/*! no static exports found */ 16529/***/ (function(module, exports, __webpack_require__) { 16530 16531"use strict"; 16532 16533/** 16534 * @license 16535 * Copyright 2020 Google Inc. 16536 * 16537 * Permission is hereby granted, free of charge, to any person obtaining a copy 16538 * of this software and associated documentation files (the "Software"), to deal 16539 * in the Software without restriction, including without limitation the rights 16540 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16541 * copies of the Software, and to permit persons to whom the Software is 16542 * furnished to do so, subject to the following conditions: 16543 * 16544 * The above copyright notice and this permission notice shall be included in 16545 * all copies or substantial portions of the Software. 16546 * 16547 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16548 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16549 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16550 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16551 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16552 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16553 * THE SOFTWARE. 16554 */ 16555 16556Object.defineProperty(exports, "__esModule", { value: true }); 16557 16558/***/ }), 16559 16560/***/ "./packages/mdc-segmented-button/segment/component.ts": 16561/*!************************************************************!*\ 16562 !*** ./packages/mdc-segmented-button/segment/component.ts ***! 16563 \************************************************************/ 16564/*! no static exports found */ 16565/***/ (function(module, exports, __webpack_require__) { 16566 16567"use strict"; 16568 16569/** 16570 * @license 16571 * Copyright 2020 Google Inc. 16572 * 16573 * Permission is hereby granted, free of charge, to any person obtaining a copy 16574 * of this software and associated documentation files (the "Software"), to deal 16575 * in the Software without restriction, including without limitation the rights 16576 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16577 * copies of the Software, and to permit persons to whom the Software is 16578 * furnished to do so, subject to the following conditions: 16579 * 16580 * The above copyright notice and this permission notice shall be included in 16581 * all copies or substantial portions of the Software. 16582 * 16583 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16584 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16585 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16586 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16587 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16588 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16589 * THE SOFTWARE. 16590 */ 16591 16592var __extends = this && this.__extends || function () { 16593 var _extendStatics = function extendStatics(d, b) { 16594 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 16595 d.__proto__ = b; 16596 } || function (d, b) { 16597 for (var p in b) { 16598 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 16599 } 16600 }; 16601 return _extendStatics(d, b); 16602 }; 16603 return function (d, b) { 16604 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 16605 _extendStatics(d, b); 16606 function __() { 16607 this.constructor = d; 16608 } 16609 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 16610 }; 16611}(); 16612var __assign = this && this.__assign || function () { 16613 __assign = Object.assign || function (t) { 16614 for (var s, i = 1, n = arguments.length; i < n; i++) { 16615 s = arguments[i]; 16616 for (var p in s) { 16617 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 16618 } 16619 } 16620 return t; 16621 }; 16622 return __assign.apply(this, arguments); 16623}; 16624Object.defineProperty(exports, "__esModule", { value: true }); 16625exports.MDCSegmentedButtonSegment = void 0; 16626var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 16627var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 16628var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 16629var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-segmented-button/segment/constants.ts"); 16630var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-segmented-button/segment/foundation.ts"); 16631/** 16632 * Implementation of MDCSegmentedButtonSegmentFoundation 16633 */ 16634var MDCSegmentedButtonSegment = /** @class */function (_super) { 16635 __extends(MDCSegmentedButtonSegment, _super); 16636 function MDCSegmentedButtonSegment() { 16637 return _super !== null && _super.apply(this, arguments) || this; 16638 } 16639 Object.defineProperty(MDCSegmentedButtonSegment.prototype, "ripple", { 16640 get: function get() { 16641 return this.rippleComponent; 16642 }, 16643 enumerable: false, 16644 configurable: true 16645 }); 16646 MDCSegmentedButtonSegment.attachTo = function (root) { 16647 return new MDCSegmentedButtonSegment(root); 16648 }; 16649 MDCSegmentedButtonSegment.prototype.initialize = function (rippleFactory) { 16650 var _this = this; 16651 if (rippleFactory === void 0) { 16652 rippleFactory = function rippleFactory(el, foundation) { 16653 return new component_2.MDCRipple(el, foundation); 16654 }; 16655 } 16656 var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() { 16657 return _this.foundation.getDimensions(); 16658 } }); 16659 this.rippleComponent = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter)); 16660 }; 16661 MDCSegmentedButtonSegment.prototype.initialSyncWithDOM = function () { 16662 var _this = this; 16663 this.handleClick = function () { 16664 _this.foundation.handleClick(); 16665 }; 16666 this.listen(constants_1.events.CLICK, this.handleClick); 16667 }; 16668 MDCSegmentedButtonSegment.prototype.destroy = function () { 16669 this.ripple.destroy(); 16670 this.unlisten(constants_1.events.CLICK, this.handleClick); 16671 _super.prototype.destroy.call(this); 16672 }; 16673 MDCSegmentedButtonSegment.prototype.getDefaultFoundation = function () { 16674 var _this = this; 16675 // DO NOT INLINE this variable. For backward compatibility, foundations take 16676 // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any 16677 // methods, we need a separate, strongly typed adapter variable. 16678 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 16679 var adapter = { 16680 isSingleSelect: function isSingleSelect() { 16681 return _this.isSingleSelect; 16682 }, 16683 getAttr: function getAttr(attrName) { 16684 return _this.root.getAttribute(attrName); 16685 }, 16686 setAttr: function setAttr(attrName, value) { 16687 _this.root.setAttribute(attrName, value); 16688 }, 16689 addClass: function addClass(className) { 16690 _this.root.classList.add(className); 16691 }, 16692 removeClass: function removeClass(className) { 16693 _this.root.classList.remove(className); 16694 }, 16695 hasClass: function hasClass(className) { 16696 return _this.root.classList.contains(className); 16697 }, 16698 notifySelectedChange: function notifySelectedChange(selected) { 16699 _this.emit(constants_1.events.SELECTED, { 16700 index: _this.index, 16701 selected: selected, 16702 segmentId: _this.getSegmentId() 16703 }, true /* shouldBubble */); 16704 }, 16705 getRootBoundingClientRect: function getRootBoundingClientRect() { 16706 return _this.root.getBoundingClientRect(); 16707 } 16708 }; 16709 return new foundation_2.MDCSegmentedButtonSegmentFoundation(adapter); 16710 }; 16711 /** 16712 * Sets segment's index value 16713 * 16714 * @param index Segment's index within wrapping segmented button 16715 */ 16716 MDCSegmentedButtonSegment.prototype.setIndex = function (index) { 16717 this.index = index; 16718 }; 16719 /** 16720 * Sets segment's isSingleSelect value 16721 * 16722 * @param isSingleSelect True if wrapping segmented button is single select 16723 */ 16724 MDCSegmentedButtonSegment.prototype.setIsSingleSelect = function (isSingleSelect) { 16725 this.isSingleSelect = isSingleSelect; 16726 }; 16727 /** 16728 * @return Returns true if segment is currently selected, otherwise returns 16729 * false 16730 */ 16731 MDCSegmentedButtonSegment.prototype.isSelected = function () { 16732 return this.foundation.isSelected(); 16733 }; 16734 /** 16735 * Sets segment to be selected 16736 */ 16737 MDCSegmentedButtonSegment.prototype.setSelected = function () { 16738 this.foundation.setSelected(); 16739 }; 16740 /** 16741 * Sets segment to be not selected 16742 */ 16743 MDCSegmentedButtonSegment.prototype.setUnselected = function () { 16744 this.foundation.setUnselected(); 16745 }; 16746 /** 16747 * @return Returns segment's segmentId if it was set by client 16748 */ 16749 MDCSegmentedButtonSegment.prototype.getSegmentId = function () { 16750 return this.foundation.getSegmentId(); 16751 }; 16752 return MDCSegmentedButtonSegment; 16753}(component_1.MDCComponent); 16754exports.MDCSegmentedButtonSegment = MDCSegmentedButtonSegment; 16755 16756/***/ }), 16757 16758/***/ "./packages/mdc-segmented-button/segment/constants.ts": 16759/*!************************************************************!*\ 16760 !*** ./packages/mdc-segmented-button/segment/constants.ts ***! 16761 \************************************************************/ 16762/*! no static exports found */ 16763/***/ (function(module, exports, __webpack_require__) { 16764 16765"use strict"; 16766 16767/** 16768 * @license 16769 * Copyright 2020 Google Inc. 16770 * 16771 * Permission is hereby granted, free of charge, to any person obtaining a copy 16772 * of this software and associated documentation files (the "Software"), to deal 16773 * in the Software without restriction, including without limitation the rights 16774 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16775 * copies of the Software, and to permit persons to whom the Software is 16776 * furnished to do so, subject to the following conditions: 16777 * 16778 * The above copyright notice and this permission notice shall be included in 16779 * all copies or substantial portions of the Software. 16780 * 16781 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16782 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16783 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16784 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16785 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16786 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16787 * THE SOFTWARE. 16788 */ 16789 16790Object.defineProperty(exports, "__esModule", { value: true }); 16791exports.cssClasses = exports.events = exports.attributes = exports.booleans = void 0; 16792/** 16793 * Boolean strings for segment 16794 */ 16795exports.booleans = { 16796 TRUE: 'true', 16797 FALSE: 'false' 16798}; 16799/** 16800 * Attributes referenced by segment 16801 */ 16802exports.attributes = { 16803 ARIA_CHECKED: 'aria-checked', 16804 ARIA_PRESSED: 'aria-pressed', 16805 DATA_SEGMENT_ID: 'data-segment-id' 16806}; 16807/** 16808 * Events received or emitted by segment 16809 */ 16810exports.events = { 16811 CLICK: 'click', 16812 SELECTED: 'selected' 16813}; 16814/** 16815 * Style classes for segment 16816 */ 16817exports.cssClasses = { 16818 SELECTED: 'mdc-segmented-button__segment--selected' 16819}; 16820 16821/***/ }), 16822 16823/***/ "./packages/mdc-segmented-button/segment/foundation.ts": 16824/*!*************************************************************!*\ 16825 !*** ./packages/mdc-segmented-button/segment/foundation.ts ***! 16826 \*************************************************************/ 16827/*! no static exports found */ 16828/***/ (function(module, exports, __webpack_require__) { 16829 16830"use strict"; 16831 16832/** 16833 * @license 16834 * Copyright 2020 Google Inc. 16835 * 16836 * Permission is hereby granted, free of charge, to any person obtaining a copy 16837 * of this software and associated documentation files (the "Software"), to deal 16838 * in the Software without restriction, including without limitation the rights 16839 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16840 * copies of the Software, and to permit persons to whom the Software is 16841 * furnished to do so, subject to the following conditions: 16842 * 16843 * The above copyright notice and this permission notice shall be included in 16844 * all copies or substantial portions of the Software. 16845 * 16846 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16847 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16848 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16849 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16850 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16851 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16852 * THE SOFTWARE. 16853 */ 16854 16855var __extends = this && this.__extends || function () { 16856 var _extendStatics = function extendStatics(d, b) { 16857 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 16858 d.__proto__ = b; 16859 } || function (d, b) { 16860 for (var p in b) { 16861 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 16862 } 16863 }; 16864 return _extendStatics(d, b); 16865 }; 16866 return function (d, b) { 16867 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 16868 _extendStatics(d, b); 16869 function __() { 16870 this.constructor = d; 16871 } 16872 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 16873 }; 16874}(); 16875var __assign = this && this.__assign || function () { 16876 __assign = Object.assign || function (t) { 16877 for (var s, i = 1, n = arguments.length; i < n; i++) { 16878 s = arguments[i]; 16879 for (var p in s) { 16880 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 16881 } 16882 } 16883 return t; 16884 }; 16885 return __assign.apply(this, arguments); 16886}; 16887Object.defineProperty(exports, "__esModule", { value: true }); 16888exports.MDCSegmentedButtonSegmentFoundation = void 0; 16889var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 16890var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-segmented-button/segment/constants.ts"); 16891var emptyClientRect = { 16892 bottom: 0, 16893 height: 0, 16894 left: 0, 16895 right: 0, 16896 top: 0, 16897 width: 0 16898}; 16899var MDCSegmentedButtonSegmentFoundation = /** @class */function (_super) { 16900 __extends(MDCSegmentedButtonSegmentFoundation, _super); 16901 function MDCSegmentedButtonSegmentFoundation(adapter) { 16902 return _super.call(this, __assign(__assign({}, MDCSegmentedButtonSegmentFoundation.defaultAdapter), adapter)) || this; 16903 } 16904 Object.defineProperty(MDCSegmentedButtonSegmentFoundation, "defaultAdapter", { 16905 get: function get() { 16906 return { 16907 isSingleSelect: function isSingleSelect() { 16908 return false; 16909 }, getAttr: function getAttr() { 16910 return ''; 16911 }, setAttr: function setAttr() { 16912 return undefined; 16913 }, 16914 addClass: function addClass() { 16915 return undefined; 16916 }, removeClass: function removeClass() { 16917 return undefined; 16918 }, 16919 hasClass: function hasClass() { 16920 return false; 16921 }, 16922 notifySelectedChange: function notifySelectedChange() { 16923 return undefined; 16924 }, 16925 getRootBoundingClientRect: function getRootBoundingClientRect() { 16926 return emptyClientRect; 16927 } 16928 }; 16929 }, 16930 enumerable: false, 16931 configurable: true 16932 }); 16933 /** 16934 * @return Returns true if segment is currently selected, otherwise returns 16935 * false 16936 */ 16937 MDCSegmentedButtonSegmentFoundation.prototype.isSelected = function () { 16938 return this.adapter.hasClass(constants_1.cssClasses.SELECTED); 16939 }; 16940 /** 16941 * Sets segment to be selected 16942 */ 16943 MDCSegmentedButtonSegmentFoundation.prototype.setSelected = function () { 16944 this.adapter.addClass(constants_1.cssClasses.SELECTED); 16945 this.setAriaAttr(constants_1.booleans.TRUE); 16946 }; 16947 /** 16948 * Sets segment to be not selected 16949 */ 16950 MDCSegmentedButtonSegmentFoundation.prototype.setUnselected = function () { 16951 this.adapter.removeClass(constants_1.cssClasses.SELECTED); 16952 this.setAriaAttr(constants_1.booleans.FALSE); 16953 }; 16954 /** 16955 * @return Returns segment's segmentId if it was set by client 16956 */ 16957 MDCSegmentedButtonSegmentFoundation.prototype.getSegmentId = function () { 16958 var _a; 16959 return (_a = this.adapter.getAttr(constants_1.attributes.DATA_SEGMENT_ID)) !== null && _a !== void 0 ? _a : undefined; 16960 }; 16961 /** 16962 * Called when segment is clicked. If the wrapping segmented button is single 16963 * select, doesn't allow segment to be set to not selected. Otherwise, toggles 16964 * segment's selected status. Finally, emits event to wrapping segmented 16965 * button. 16966 * 16967 * @event selected With detail - SegmentDetail 16968 */ 16969 MDCSegmentedButtonSegmentFoundation.prototype.handleClick = function () { 16970 if (this.adapter.isSingleSelect()) { 16971 this.setSelected(); 16972 } else { 16973 this.toggleSelection(); 16974 } 16975 this.adapter.notifySelectedChange(this.isSelected()); 16976 }; 16977 /** 16978 * @return Returns bounding rectangle for ripple effect 16979 */ 16980 MDCSegmentedButtonSegmentFoundation.prototype.getDimensions = function () { 16981 return this.adapter.getRootBoundingClientRect(); 16982 }; 16983 /** 16984 * Sets segment from not selected to selected, or selected to not selected 16985 */ 16986 MDCSegmentedButtonSegmentFoundation.prototype.toggleSelection = function () { 16987 if (this.isSelected()) { 16988 this.setUnselected(); 16989 } else { 16990 this.setSelected(); 16991 } 16992 }; 16993 /** 16994 * Sets appropriate aria attribute, based on wrapping segmented button's 16995 * single selected value, to new value 16996 * 16997 * @param value Value that represents selected status 16998 */ 16999 MDCSegmentedButtonSegmentFoundation.prototype.setAriaAttr = function (value) { 17000 if (this.adapter.isSingleSelect()) { 17001 this.adapter.setAttr(constants_1.attributes.ARIA_CHECKED, value); 17002 } else { 17003 this.adapter.setAttr(constants_1.attributes.ARIA_PRESSED, value); 17004 } 17005 }; 17006 return MDCSegmentedButtonSegmentFoundation; 17007}(foundation_1.MDCFoundation); 17008exports.MDCSegmentedButtonSegmentFoundation = MDCSegmentedButtonSegmentFoundation; 17009 17010/***/ }), 17011 17012/***/ "./packages/mdc-segmented-button/segment/index.ts": 17013/*!********************************************************!*\ 17014 !*** ./packages/mdc-segmented-button/segment/index.ts ***! 17015 \********************************************************/ 17016/*! no static exports found */ 17017/***/ (function(module, exports, __webpack_require__) { 17018 17019"use strict"; 17020 17021/** 17022 * @license 17023 * Copyright 2020 Google Inc. 17024 * 17025 * Permission is hereby granted, free of charge, to any person obtaining a copy 17026 * of this software and associated documentation files (the "Software"), to deal 17027 * in the Software without restriction, including without limitation the rights 17028 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17029 * copies of the Software, and to permit persons to whom the Software is 17030 * furnished to do so, subject to the following conditions: 17031 * 17032 * The above copyright notice and this permission notice shall be included in 17033 * all copies or substantial portions of the Software. 17034 * 17035 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17036 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17037 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17038 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17039 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17040 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17041 * THE SOFTWARE. 17042 */ 17043 17044var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 17045 if (k2 === undefined) k2 = k; 17046 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 17047 return m[k]; 17048 } }); 17049} : function (o, m, k, k2) { 17050 if (k2 === undefined) k2 = k; 17051 o[k2] = m[k]; 17052}); 17053var __exportStar = this && this.__exportStar || function (m, exports) { 17054 for (var p in m) { 17055 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 17056 } 17057}; 17058Object.defineProperty(exports, "__esModule", { value: true }); 17059__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-segmented-button/segment/adapter.ts"), exports); 17060__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-segmented-button/segment/foundation.ts"), exports); 17061__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-segmented-button/segment/component.ts"), exports); 17062 17063/***/ }), 17064 17065/***/ "./packages/mdc-segmented-button/segmented-button/adapter.ts": 17066/*!*******************************************************************!*\ 17067 !*** ./packages/mdc-segmented-button/segmented-button/adapter.ts ***! 17068 \*******************************************************************/ 17069/*! no static exports found */ 17070/***/ (function(module, exports, __webpack_require__) { 17071 17072"use strict"; 17073 17074/** 17075 * @license 17076 * Copyright 2020 Google Inc. 17077 * 17078 * Permission is hereby granted, free of charge, to any person obtaining a copy 17079 * of this software and associated documentation files (the "Software"), to deal 17080 * in the Software without restriction, including without limitation the rights 17081 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17082 * copies of the Software, and to permit persons to whom the Software is 17083 * furnished to do so, subject to the following conditions: 17084 * 17085 * The above copyright notice and this permission notice shall be included in 17086 * all copies or substantial portions of the Software. 17087 * 17088 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17089 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17090 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17091 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17092 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17093 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17094 * THE SOFTWARE. 17095 */ 17096 17097Object.defineProperty(exports, "__esModule", { value: true }); 17098 17099/***/ }), 17100 17101/***/ "./packages/mdc-segmented-button/segmented-button/component.ts": 17102/*!*********************************************************************!*\ 17103 !*** ./packages/mdc-segmented-button/segmented-button/component.ts ***! 17104 \*********************************************************************/ 17105/*! no static exports found */ 17106/***/ (function(module, exports, __webpack_require__) { 17107 17108"use strict"; 17109 17110/** 17111 * @license 17112 * Copyright 2020 Google Inc. 17113 * 17114 * Permission is hereby granted, free of charge, to any person obtaining a copy 17115 * of this software and associated documentation files (the "Software"), to deal 17116 * in the Software without restriction, including without limitation the rights 17117 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17118 * copies of the Software, and to permit persons to whom the Software is 17119 * furnished to do so, subject to the following conditions: 17120 * 17121 * The above copyright notice and this permission notice shall be included in 17122 * all copies or substantial portions of the Software. 17123 * 17124 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17125 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17126 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17127 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17128 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17129 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17130 * THE SOFTWARE. 17131 */ 17132 17133var __extends = this && this.__extends || function () { 17134 var _extendStatics = function extendStatics(d, b) { 17135 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 17136 d.__proto__ = b; 17137 } || function (d, b) { 17138 for (var p in b) { 17139 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 17140 } 17141 }; 17142 return _extendStatics(d, b); 17143 }; 17144 return function (d, b) { 17145 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 17146 _extendStatics(d, b); 17147 function __() { 17148 this.constructor = d; 17149 } 17150 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 17151 }; 17152}();
vendor: 4,704 bytes, lines 17153-17248
17153Object.defineProperty(exports, "__esModule", { value: true }); 17154exports.MDCSegmentedButton = void 0; 17155var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 17156var component_2 = __webpack_require__(/*! ../segment/component */ "./packages/mdc-segmented-button/segment/component.ts"); 17157var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-segmented-button/segmented-button/constants.ts"); 17158var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-segmented-button/segmented-button/foundation.ts"); 17159// TODO(b/152410470): Remove trailing underscores from private properties 17160// tslint:disable:strip-private-property-underscore 17161var MDCSegmentedButton = /** @class */function (_super) { 17162 __extends(MDCSegmentedButton, _super); 17163 function MDCSegmentedButton() { 17164 return _super !== null && _super.apply(this, arguments) || this; 17165 } 17166 MDCSegmentedButton.attachTo = function (root) { 17167 return new MDCSegmentedButton(root); 17168 }; 17169 Object.defineProperty(MDCSegmentedButton.prototype, "segments", { 17170 get: function get() { 17171 return this.segments_.slice(); 17172 }, 17173 enumerable: false, 17174 configurable: true 17175 }); 17176 // initialSyncWithDOM 17177 MDCSegmentedButton.prototype.initialize = function (segmentFactory) { 17178 if (segmentFactory === void 0) { 17179 segmentFactory = function segmentFactory(el) { 17180 return new component_2.MDCSegmentedButtonSegment(el); 17181 }; 17182 } 17183 this.segmentFactory = segmentFactory; 17184 this.segments_ = this.instantiateSegments(this.segmentFactory); 17185 }; 17186 /** 17187 * @param segmentFactory Factory to create new child segments 17188 * @return Returns list of child segments found in DOM 17189 */ 17190 MDCSegmentedButton.prototype.instantiateSegments = function (segmentFactory) { 17191 var segmentElements = [].slice.call(this.root.querySelectorAll(constants_1.selectors.SEGMENT)); 17192 return segmentElements.map(function (el) { 17193 return segmentFactory(el); 17194 }); 17195 }; 17196 MDCSegmentedButton.prototype.initialSyncWithDOM = function () { 17197 var _this = this; 17198 this.handleSelected = function (event) { 17199 _this.foundation.handleSelected(event.detail); 17200 }; 17201 this.listen(constants_1.events.SELECTED, this.handleSelected); 17202 var isSingleSelect = this.foundation.isSingleSelect(); 17203 this.segments_.forEach(function (segment, index) { 17204 segment.setIndex(index); 17205 segment.setIsSingleSelect(isSingleSelect); 17206 }); 17207 var selectedSegments = this.segments_.filter(function (segment) { 17208 return segment.isSelected(); 17209 }); 17210 if (isSingleSelect && selectedSegments.length == 0 && this.segments_.length > 0) { 17211 throw new Error('No segment selected in singleSelect mdc-segmented-button'); 17212 } else if (isSingleSelect && selectedSegments.length > 1) { 17213 throw new Error('Multiple segments selected in singleSelect mdc-segmented-button'); 17214 } 17215 }; 17216 MDCSegmentedButton.prototype.destroy = function () { 17217 this.segments_.forEach(function (segment) { 17218 segment.destroy(); 17219 }); 17220 this.unlisten(constants_1.events.SELECTED, this.handleSelected); 17221 _super.prototype.destroy.call(this); 17222 }; 17223 MDCSegmentedButton.prototype.getDefaultFoundation = function () { 17224 var _this = this; 17225 var adapter = { 17226 hasClass: function hasClass(className) { 17227 return _this.root.classList.contains(className); 17228 }, 17229 getSegments: function getSegments() { 17230 return _this.mappedSegments(); 17231 }, 17232 selectSegment: function selectSegment(indexOrSegmentId) { 17233 var segmentDetail = _this.mappedSegments().find(function (_segmentDetail) { 17234 return _segmentDetail.index === indexOrSegmentId || _segmentDetail.segmentId === indexOrSegmentId; 17235 }); 17236 if (segmentDetail) { 17237 _this.segments_[segmentDetail.index].setSelected(); 17238 } 17239 }, 17240 unselectSegment: function unselectSegment(indexOrSegmentId) { 17241 var segmentDetail = _this.mappedSegments().find(function (_segmentDetail) { 17242 return _segmentDetail.index === indexOrSegmentId || _segmentDetail.segmentId === indexOrSegmentId; 17243 }); 17244 if (segmentDetail) { 17245 _this.segments_[segmentDetail.index].setUnselected(); 17246 } 17247 }, 17248 notifySelectedChange: function notifySelectedChange(detail) {
17249 _this.emit(constants_1.events.CHANGE, detail, true /* shouldBubble */); 17250 } 17251 }; 17252 return new foundation_1.MDCSegmentedButtonFoundation(adapter); 17253 }; 17254 /** 17255 * @return Returns readonly list of selected child segments as SegmentDetails 17256 */ 17257 MDCSegmentedButton.prototype.getSelectedSegments = function () { 17258 return this.foundation.getSelectedSegments(); 17259 }; 17260 /** 17261 * Sets identified segment to be selected 17262 * 17263 * @param indexOrSegmentId Number index or string segmentId that identifies 17264 * child segment 17265 */ 17266 MDCSegmentedButton.prototype.selectSegment = function (indexOrSegmentId) { 17267 this.foundation.selectSegment(indexOrSegmentId); 17268 }; 17269 /** 17270 * Sets identified segment to be not selected 17271 * 17272 * @param indexOrSegmentId Number index or string segmentId that identifies 17273 * child segment 17274 */ 17275 MDCSegmentedButton.prototype.unselectSegment = function (indexOrSegmentId) { 17276 this.foundation.unselectSegment(indexOrSegmentId); 17277 }; 17278 /** 17279 * @param indexOrSegmentId Number index or string segmentId that identifies 17280 * child segment 17281 * @return Returns true if identified child segment is currently selected, 17282 * otherwise returns false 17283 */ 17284 MDCSegmentedButton.prototype.isSegmentSelected = function (indexOrSegmentId) { 17285 return this.foundation.isSegmentSelected(indexOrSegmentId); 17286 }; 17287 /** 17288 * @return Returns child segments mapped to readonly SegmentDetail list 17289 */ 17290 MDCSegmentedButton.prototype.mappedSegments = function () { 17291 return this.segments_
vendor: 62,245 bytes, lines 17291-18763
17291.map(function (segment, index) { 17292 return { 17293 index: index, 17294 selected: segment.isSelected(), 17295 segmentId: segment.getSegmentId() 17296 }; 17297 }); 17298 }; 17299 return MDCSegmentedButton; 17300}(component_1.MDCComponent); 17301exports.MDCSegmentedButton = MDCSegmentedButton; 17302 17303/***/ }), 17304 17305/***/ "./packages/mdc-segmented-button/segmented-button/constants.ts": 17306/*!*********************************************************************!*\ 17307 !*** ./packages/mdc-segmented-button/segmented-button/constants.ts ***! 17308 \*********************************************************************/ 17309/*! no static exports found */ 17310/***/ (function(module, exports, __webpack_require__) { 17311 17312"use strict"; 17313 17314/** 17315 * @license 17316 * Copyright 2020 Google Inc. 17317 * 17318 * Permission is hereby granted, free of charge, to any person obtaining a copy 17319 * of this software and associated documentation files (the "Software"), to deal 17320 * in the Software without restriction, including without limitation the rights 17321 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17322 * copies of the Software, and to permit persons to whom the Software is 17323 * furnished to do so, subject to the following conditions: 17324 * 17325 * The above copyright notice and this permission notice shall be included in 17326 * all copies or substantial portions of the Software. 17327 * 17328 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17329 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17330 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17331 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17332 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17333 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17334 * THE SOFTWARE. 17335 */ 17336 17337Object.defineProperty(exports, "__esModule", { value: true }); 17338exports.cssClasses = exports.events = exports.selectors = void 0; 17339/** 17340 * Selectors used by segmented-button 17341 */ 17342exports.selectors = { 17343 SEGMENT: '.mdc-segmented-button__segment' 17344}; 17345/** 17346 * Events received or emitted by segmented-button 17347 */ 17348exports.events = { 17349 SELECTED: 'selected', 17350 CHANGE: 'change' 17351}; 17352/** 17353 * Style classes for segmented-button 17354 */ 17355exports.cssClasses = { 17356 SINGLE_SELECT: 'mdc-segmented-button--single-select' 17357}; 17358 17359/***/ }), 17360 17361/***/ "./packages/mdc-segmented-button/segmented-button/foundation.ts": 17362/*!**********************************************************************!*\ 17363 !*** ./packages/mdc-segmented-button/segmented-button/foundation.ts ***! 17364 \**********************************************************************/ 17365/*! no static exports found */ 17366/***/ (function(module, exports, __webpack_require__) { 17367 17368"use strict"; 17369 17370/** 17371 * @license 17372 * Copyright 2020 Google Inc. 17373 * 17374 * Permission is hereby granted, free of charge, to any person obtaining a copy 17375 * of this software and associated documentation files (the "Software"), to deal 17376 * in the Software without restriction, including without limitation the rights 17377 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17378 * copies of the Software, and to permit persons to whom the Software is 17379 * furnished to do so, subject to the following conditions: 17380 * 17381 * The above copyright notice and this permission notice shall be included in 17382 * all copies or substantial portions of the Software. 17383 * 17384 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17385 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17386 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17387 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17388 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17389 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17390 * THE SOFTWARE. 17391 */ 17392 17393var __extends = this && this.__extends || function () { 17394 var _extendStatics = function extendStatics(d, b) { 17395 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 17396 d.__proto__ = b; 17397 } || function (d, b) { 17398 for (var p in b) { 17399 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 17400 } 17401 }; 17402 return _extendStatics(d, b); 17403 }; 17404 return function (d, b) { 17405 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 17406 _extendStatics(d, b); 17407 function __() { 17408 this.constructor = d; 17409 } 17410 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 17411 }; 17412}(); 17413var __assign = this && this.__assign || function () { 17414 __assign = Object.assign || function (t) { 17415 for (var s, i = 1, n = arguments.length; i < n; i++) { 17416 s = arguments[i]; 17417 for (var p in s) { 17418 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 17419 } 17420 } 17421 return t; 17422 }; 17423 return __assign.apply(this, arguments); 17424}; 17425var __values = this && this.__values || function (o) { 17426 var s = typeof Symbol === "function" && Symbol.iterator, 17427 m = s && o[s], 17428 i = 0; 17429 if (m) return m.call(o); 17430 if (o && typeof o.length === "number") return { 17431 next: function next() { 17432 if (o && i >= o.length) o = void 0; 17433 return { value: o && o[i++], done: !o }; 17434 } 17435 }; 17436 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 17437}; 17438Object.defineProperty(exports, "__esModule", { value: true }); 17439exports.MDCSegmentedButtonFoundation = void 0; 17440var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 17441var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-segmented-button/segmented-button/constants.ts"); 17442var MDCSegmentedButtonFoundation = /** @class */function (_super) { 17443 __extends(MDCSegmentedButtonFoundation, _super); 17444 function MDCSegmentedButtonFoundation(adapter) { 17445 return _super.call(this, __assign(__assign({}, MDCSegmentedButtonFoundation.defaultAdapter), adapter)) || this; 17446 } 17447 Object.defineProperty(MDCSegmentedButtonFoundation, "defaultAdapter", { 17448 get: function get() { 17449 return { 17450 hasClass: function hasClass() { 17451 return false; 17452 }, getSegments: function getSegments() { 17453 return []; 17454 }, 17455 selectSegment: function selectSegment() { 17456 return undefined; 17457 }, 17458 unselectSegment: function unselectSegment() { 17459 return undefined; 17460 }, 17461 notifySelectedChange: function notifySelectedChange() { 17462 return undefined; 17463 } 17464 }; 17465 }, 17466 enumerable: false, 17467 configurable: true 17468 }); 17469 /** 17470 * Sets identified child segment to be selected 17471 * 17472 * @param indexOrSegmentId Number index or string segmentId that identifies 17473 * child segment 17474 */ 17475 MDCSegmentedButtonFoundation.prototype.selectSegment = function (indexOrSegmentId) { 17476 this.adapter.selectSegment(indexOrSegmentId); 17477 }; 17478 /** 17479 * Sets identified child segment to be not selected 17480 * 17481 * @param indexOrSegmentId Number index or string segmentId that identifies 17482 * child segment 17483 */ 17484 MDCSegmentedButtonFoundation.prototype.unselectSegment = function (indexOrSegmentId) { 17485 this.adapter.unselectSegment(indexOrSegmentId); 17486 }; 17487 /** 17488 * @return Returns currently selected child segments as readonly list of 17489 * SegmentDetails 17490 */ 17491 MDCSegmentedButtonFoundation.prototype.getSelectedSegments = function () { 17492 return this.adapter.getSegments().filter(function (segmentDetail) { 17493 return segmentDetail.selected; 17494 }); 17495 }; 17496 /** 17497 * @param indexOrSegmentId Number index or string segmentId that identifies 17498 * child segment 17499 * @return Returns true if identified child segment is currently selected, 17500 * otherwise returns false 17501 */ 17502 MDCSegmentedButtonFoundation.prototype.isSegmentSelected = function (indexOrSegmentId) { 17503 return this.adapter.getSegments().some(function (segmentDetail) { 17504 return (segmentDetail.index === indexOrSegmentId || segmentDetail.segmentId === indexOrSegmentId) && segmentDetail.selected; 17505 }); 17506 }; 17507 /** 17508 * @return Returns true if segmented button is single select, otherwise 17509 * returns false 17510 */ 17511 MDCSegmentedButtonFoundation.prototype.isSingleSelect = function () { 17512 return this.adapter.hasClass(constants_1.cssClasses.SINGLE_SELECT); 17513 }; 17514 /** 17515 * Called when child segment's selected status may have changed. If segmented 17516 * button is single select, unselects all child segments other than identified 17517 * child segment. Finally, emits event to client. 17518 * 17519 * @param detail Child segment affected represented as SegmentDetail 17520 * @event change With detail - SegmentDetail 17521 */ 17522 MDCSegmentedButtonFoundation.prototype.handleSelected = function (detail) { 17523 if (this.isSingleSelect()) { 17524 this.unselectPrevSelected(detail.index); 17525 } 17526 this.adapter.notifySelectedChange(detail); 17527 }; 17528 /** 17529 * Sets all child segments to be not selected except for child segment 17530 * identified by index 17531 * 17532 * @param index Index of child segment to not unselect 17533 */ 17534 MDCSegmentedButtonFoundation.prototype.unselectPrevSelected = function (index) { 17535 var e_1, _a; 17536 try { 17537 for (var _b = __values(this.getSelectedSegments()), _c = _b.next(); !_c.done; _c = _b.next()) { 17538 var selectedSegment = _c.value; 17539 if (selectedSegment.index !== index) { 17540 this.unselectSegment(selectedSegment.index); 17541 } 17542 } 17543 } catch (e_1_1) { 17544 e_1 = { error: e_1_1 }; 17545 } finally { 17546 try { 17547 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 17548 } finally { 17549 if (e_1) throw e_1.error; 17550 } 17551 } 17552 }; 17553 return MDCSegmentedButtonFoundation; 17554}(foundation_1.MDCFoundation); 17555exports.MDCSegmentedButtonFoundation = MDCSegmentedButtonFoundation; 17556 17557/***/ }), 17558 17559/***/ "./packages/mdc-segmented-button/segmented-button/index.ts": 17560/*!*****************************************************************!*\ 17561 !*** ./packages/mdc-segmented-button/segmented-button/index.ts ***! 17562 \*****************************************************************/ 17563/*! no static exports found */ 17564/***/ (function(module, exports, __webpack_require__) { 17565 17566"use strict"; 17567 17568/** 17569 * @license 17570 * Copyright 2020 Google Inc. 17571 * 17572 * Permission is hereby granted, free of charge, to any person obtaining a copy 17573 * of this software and associated documentation files (the "Software"), to deal 17574 * in the Software without restriction, including without limitation the rights 17575 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17576 * copies of the Software, and to permit persons to whom the Software is 17577 * furnished to do so, subject to the following conditions: 17578 * 17579 * The above copyright notice and this permission notice shall be included in 17580 * all copies or substantial portions of the Software. 17581 * 17582 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17583 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17584 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17585 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17586 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17587 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17588 * THE SOFTWARE. 17589 */ 17590 17591var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 17592 if (k2 === undefined) k2 = k; 17593 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 17594 return m[k]; 17595 } }); 17596} : function (o, m, k, k2) { 17597 if (k2 === undefined) k2 = k; 17598 o[k2] = m[k]; 17599}); 17600var __exportStar = this && this.__exportStar || function (m, exports) { 17601 for (var p in m) { 17602 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 17603 } 17604}; 17605Object.defineProperty(exports, "__esModule", { value: true }); 17606__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-segmented-button/segmented-button/adapter.ts"), exports); 17607__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-segmented-button/segmented-button/foundation.ts"), exports); 17608__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-segmented-button/segmented-button/component.ts"), exports); 17609 17610/***/ }), 17611 17612/***/ "./packages/mdc-segmented-button/types.ts": 17613/*!************************************************!*\ 17614 !*** ./packages/mdc-segmented-button/types.ts ***! 17615 \************************************************/ 17616/*! no static exports found */ 17617/***/ (function(module, exports, __webpack_require__) { 17618 17619"use strict"; 17620 17621/** 17622 * @license 17623 * Copyright 2020 Google Inc. 17624 * 17625 * Permission is hereby granted, free of charge, to any person obtaining a copy 17626 * of this software and associated documentation files (the "Software"), to deal 17627 * in the Software without restriction, including without limitation the rights 17628 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17629 * copies of the Software, and to permit persons to whom the Software is 17630 * furnished to do so, subject to the following conditions: 17631 * 17632 * The above copyright notice and this permission notice shall be included in 17633 * all copies or substantial portions of the Software. 17634 * 17635 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17636 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17637 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17638 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17639 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17640 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17641 * THE SOFTWARE. 17642 */ 17643 17644Object.defineProperty(exports, "__esModule", { value: true }); 17645 17646/***/ }), 17647 17648/***/ "./packages/mdc-select/adapter.ts": 17649/*!****************************************!*\ 17650 !*** ./packages/mdc-select/adapter.ts ***! 17651 \****************************************/ 17652/*! no static exports found */ 17653/***/ (function(module, exports, __webpack_require__) { 17654 17655"use strict"; 17656 17657/** 17658 * @license 17659 * Copyright 2018 Google Inc. 17660 * 17661 * Permission is hereby granted, free of charge, to any person obtaining a copy 17662 * of this software and associated documentation files (the "Software"), to deal 17663 * in the Software without restriction, including without limitation the rights 17664 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17665 * copies of the Software, and to permit persons to whom the Software is 17666 * furnished to do so, subject to the following conditions: 17667 * 17668 * The above copyright notice and this permission notice shall be included in 17669 * all copies or substantial portions of the Software. 17670 * 17671 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17672 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17673 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17674 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17675 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17676 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17677 * THE SOFTWARE. 17678 */ 17679 17680Object.defineProperty(exports, "__esModule", { value: true }); 17681 17682/***/ }), 17683 17684/***/ "./packages/mdc-select/component.ts": 17685/*!******************************************!*\ 17686 !*** ./packages/mdc-select/component.ts ***! 17687 \******************************************/ 17688/*! no static exports found */ 17689/***/ (function(module, exports, __webpack_require__) { 17690 17691"use strict"; 17692 17693/** 17694 * @license 17695 * Copyright 2016 Google Inc. 17696 * 17697 * Permission is hereby granted, free of charge, to any person obtaining a copy 17698 * of this software and associated documentation files (the "Software"), to deal 17699 * in the Software without restriction, including without limitation the rights 17700 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17701 * copies of the Software, and to permit persons to whom the Software is 17702 * furnished to do so, subject to the following conditions: 17703 * 17704 * The above copyright notice and this permission notice shall be included in 17705 * all copies or substantial portions of the Software. 17706 * 17707 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17708 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17709 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17710 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17711 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17712 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17713 * THE SOFTWARE. 17714 */ 17715 17716var __extends = this && this.__extends || function () { 17717 var _extendStatics = function extendStatics(d, b) { 17718 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 17719 d.__proto__ = b; 17720 } || function (d, b) { 17721 for (var p in b) { 17722 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 17723 } 17724 }; 17725 return _extendStatics(d, b); 17726 }; 17727 return function (d, b) { 17728 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 17729 _extendStatics(d, b); 17730 function __() { 17731 this.constructor = d; 17732 } 17733 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 17734 }; 17735}(); 17736var __assign = this && this.__assign || function () { 17737 __assign = Object.assign || function (t) { 17738 for (var s, i = 1, n = arguments.length; i < n; i++) { 17739 s = arguments[i]; 17740 for (var p in s) { 17741 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 17742 } 17743 } 17744 return t; 17745 }; 17746 return __assign.apply(this, arguments); 17747}; 17748var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 17749 if (k2 === undefined) k2 = k; 17750 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 17751 return m[k]; 17752 } }); 17753} : function (o, m, k, k2) { 17754 if (k2 === undefined) k2 = k; 17755 o[k2] = m[k]; 17756}); 17757var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 17758 Object.defineProperty(o, "default", { enumerable: true, value: v }); 17759} : function (o, v) { 17760 o["default"] = v; 17761}); 17762var __importStar = this && this.__importStar || function (mod) { 17763 if (mod && mod.__esModule) return mod; 17764 var result = {}; 17765 if (mod != null) for (var k in mod) { 17766 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 17767 }__setModuleDefault(result, mod); 17768 return result; 17769}; 17770Object.defineProperty(exports, "__esModule", { value: true }); 17771exports.MDCSelect = void 0; 17772var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 17773var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts"); 17774var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts"); 17775var menuSurfaceConstants = __importStar(__webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts")); 17776var component_4 = __webpack_require__(/*! @material/menu/component */ "./packages/mdc-menu/component.ts"); 17777var menuConstants = __importStar(__webpack_require__(/*! @material/menu/constants */ "./packages/mdc-menu/constants.ts")); 17778var component_5 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts"); 17779var component_6 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 17780var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 17781var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"); 17782var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts"); 17783var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-select/helper-text/component.ts"); 17784var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-select/icon/component.ts"); 17785var MDCSelect = /** @class */function (_super) { 17786 __extends(MDCSelect, _super); 17787 function MDCSelect() { 17788 return _super !== null && _super.apply(this, arguments) || this; 17789 } 17790 MDCSelect.attachTo = function (root) { 17791 return new MDCSelect(root); 17792 }; 17793 MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) { 17794 if (labelFactory === void 0) { 17795 labelFactory = function labelFactory(el) { 17796 return new component_2.MDCFloatingLabel(el); 17797 }; 17798 } 17799 if (lineRippleFactory === void 0) { 17800 lineRippleFactory = function lineRippleFactory(el) { 17801 return new component_3.MDCLineRipple(el); 17802 }; 17803 } 17804 if (outlineFactory === void 0) { 17805 outlineFactory = function outlineFactory(el) { 17806 return new component_5.MDCNotchedOutline(el); 17807 }; 17808 } 17809 if (menuFactory === void 0) { 17810 menuFactory = function menuFactory(el) { 17811 return new component_4.MDCMenu(el); 17812 }; 17813 } 17814 if (iconFactory === void 0) { 17815 iconFactory = function iconFactory(el) { 17816 return new component_8.MDCSelectIcon(el); 17817 }; 17818 } 17819 if (helperTextFactory === void 0) { 17820 helperTextFactory = function helperTextFactory(el) { 17821 return new component_7.MDCSelectHelperText(el); 17822 }; 17823 } 17824 this.selectAnchor = this.root.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR); 17825 this.selectedText = this.root.querySelector(constants_1.strings.SELECTED_TEXT_SELECTOR); 17826 this.hiddenInput = this.root.querySelector(constants_1.strings.HIDDEN_INPUT_SELECTOR); 17827 if (!this.selectedText) { 17828 throw new Error('MDCSelect: Missing required element: The following selector must be present: ' + ("'" + constants_1.strings.SELECTED_TEXT_SELECTOR + "'")); 17829 } 17830 if (this.selectAnchor.hasAttribute(constants_1.strings.ARIA_CONTROLS)) { 17831 var helperTextElement = document.getElementById(this.selectAnchor.getAttribute(constants_1.strings.ARIA_CONTROLS)); 17832 if (helperTextElement) { 17833 this.helperText = helperTextFactory(helperTextElement); 17834 } 17835 } 17836 this.menuSetup(menuFactory); 17837 var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR); 17838 this.label = labelElement ? labelFactory(labelElement) : null; 17839 var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR); 17840 this.lineRipple = lineRippleElement ? lineRippleFactory(lineRippleElement) : null; 17841 var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR); 17842 this.outline = outlineElement ? outlineFactory(outlineElement) : null; 17843 var leadingIcon = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR); 17844 if (leadingIcon) { 17845 this.leadingIcon = iconFactory(leadingIcon); 17846 } 17847 if (!this.root.classList.contains(constants_1.cssClasses.OUTLINED)) { 17848 this.ripple = this.createRipple(); 17849 } 17850 }; 17851 /** 17852 * Initializes the select's event listeners and internal state based 17853 * on the environment's state. 17854 */ 17855 MDCSelect.prototype.initialSyncWithDOM = function () { 17856 var _this = this; 17857 this.handleFocus = function () { 17858 _this.foundation.handleFocus(); 17859 }; 17860 this.handleBlur = function () { 17861 _this.foundation.handleBlur(); 17862 }; 17863 this.handleClick = function (evt) { 17864 _this.selectAnchor.focus(); 17865 _this.foundation.handleClick(_this.getNormalizedXCoordinate(evt)); 17866 }; 17867 this.handleKeydown = function (evt) { 17868 _this.foundation.handleKeydown(evt); 17869 }; 17870 this.handleMenuItemAction = function (evt) { 17871 _this.foundation.handleMenuItemAction(evt.detail.index); 17872 }; 17873 this.handleMenuOpened = function () { 17874 _this.foundation.handleMenuOpened(); 17875 }; 17876 this.handleMenuClosed = function () { 17877 _this.foundation.handleMenuClosed(); 17878 }; 17879 this.handleMenuClosing = function () { 17880 _this.foundation.handleMenuClosing(); 17881 }; 17882 this.selectAnchor.addEventListener('focus', this.handleFocus); 17883 this.selectAnchor.addEventListener('blur', this.handleBlur); 17884 this.selectAnchor.addEventListener('click', this.handleClick); 17885 this.selectAnchor.addEventListener('keydown', this.handleKeydown); 17886 this.menu.listen(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed); 17887 this.menu.listen(menuSurfaceConstants.strings.CLOSING_EVENT, this.handleMenuClosing); 17888 this.menu.listen(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened); 17889 this.menu.listen(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction); 17890 if (this.hiddenInput) { 17891 if (this.hiddenInput.value) { 17892 // If the hidden input already has a value, use it to restore the 17893 // select's value. This can happen e.g. if the user goes back or (in 17894 // some browsers) refreshes the page. 17895 this.foundation.setValue(this.hiddenInput.value, /** skipNotify */true); 17896 this.foundation.layout(); 17897 return; 17898 } 17899 this.hiddenInput.value = this.value; 17900 } 17901 }; 17902 MDCSelect.prototype.destroy = function () { 17903 this.selectAnchor.removeEventListener('focus', this.handleFocus); 17904 this.selectAnchor.removeEventListener('blur', this.handleBlur); 17905 this.selectAnchor.removeEventListener('keydown', this.handleKeydown); 17906 this.selectAnchor.removeEventListener('click', this.handleClick); 17907 this.menu.unlisten(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed); 17908 this.menu.unlisten(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened); 17909 this.menu.unlisten(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction); 17910 this.menu.destroy(); 17911 if (this.ripple) { 17912 this.ripple.destroy(); 17913 } 17914 if (this.outline) { 17915 this.outline.destroy(); 17916 } 17917 if (this.leadingIcon) { 17918 this.leadingIcon.destroy(); 17919 } 17920 if (this.helperText) { 17921 this.helperText.destroy(); 17922 } 17923 _super.prototype.destroy.call(this); 17924 }; 17925 Object.defineProperty(MDCSelect.prototype, "value", { 17926 get: function get() { 17927 return this.foundation.getValue(); 17928 }, 17929 set: function set(value) { 17930 this.foundation.setValue(value); 17931 }, 17932 enumerable: false, 17933 configurable: true 17934 }); 17935 MDCSelect.prototype.setValue = function (value, skipNotify) { 17936 if (skipNotify === void 0) { 17937 skipNotify = false; 17938 } 17939 this.foundation.setValue(value, skipNotify); 17940 }; 17941 Object.defineProperty(MDCSelect.prototype, "selectedIndex", { 17942 get: function get() { 17943 return this.foundation.getSelectedIndex(); 17944 }, 17945 set: function set(selectedIndex) { 17946 this.foundation.setSelectedIndex(selectedIndex, /* closeMenu */true); 17947 }, 17948 enumerable: false, 17949 configurable: true 17950 }); 17951 MDCSelect.prototype.setSelectedIndex = function (selectedIndex, skipNotify) { 17952 if (skipNotify === void 0) { 17953 skipNotify = false; 17954 } 17955 this.foundation.setSelectedIndex(selectedIndex, /* closeMenu */true, skipNotify); 17956 }; 17957 Object.defineProperty(MDCSelect.prototype, "disabled", { 17958 get: function get() { 17959 return this.foundation.getDisabled(); 17960 }, 17961 set: function set(disabled) { 17962 this.foundation.setDisabled(disabled); 17963 if (this.hiddenInput) { 17964 this.hiddenInput.disabled = disabled; 17965 } 17966 }, 17967 enumerable: false, 17968 configurable: true 17969 }); 17970 Object.defineProperty(MDCSelect.prototype, "leadingIconAriaLabel", { 17971 set: function set(label) { 17972 this.foundation.setLeadingIconAriaLabel(label); 17973 }, 17974 enumerable: false, 17975 configurable: true 17976 }); 17977 Object.defineProperty(MDCSelect.prototype, "leadingIconContent", { 17978 /** 17979 * Sets the text content of the leading icon. 17980 */ 17981 set: function set(content) { 17982 this.foundation.setLeadingIconContent(content); 17983 }, 17984 enumerable: false, 17985 configurable: true 17986 }); 17987 Object.defineProperty(MDCSelect.prototype, "helperTextContent", { 17988 /** 17989 * Sets the text content of the helper text. 17990 */ 17991 set: function set(content) { 17992 this.foundation.setHelperTextContent(content); 17993 }, 17994 enumerable: false, 17995 configurable: true 17996 }); 17997 Object.defineProperty(MDCSelect.prototype, "useDefaultValidation", { 17998 /** 17999 * Enables or disables the default validation scheme where a required select 18000 * must be non-empty. Set to false for custom validation. 18001 * @param useDefaultValidation Set this to false to ignore default 18002 * validation scheme. 18003 */ 18004 set: function set(useDefaultValidation) { 18005 this.foundation.setUseDefaultValidation(useDefaultValidation); 18006 }, 18007 enumerable: false, 18008 configurable: true 18009 }); 18010 Object.defineProperty(MDCSelect.prototype, "valid", { 18011 /** 18012 * Checks if the select is in a valid state. 18013 */ 18014 get: function get() { 18015 return this.foundation.isValid(); 18016 }, 18017 /** 18018 * Sets the current invalid state of the select. 18019 */ 18020 set: function set(isValid) { 18021 this.foundation.setValid(isValid); 18022 }, 18023 enumerable: false, 18024 configurable: true 18025 }); 18026 Object.defineProperty(MDCSelect.prototype, "required", { 18027 /** 18028 * Returns whether the select is required. 18029 */ 18030 get: function get() { 18031 return this.foundation.getRequired(); 18032 }, 18033 /** 18034 * Sets the control to the required state. 18035 */ 18036 set: function set(isRequired) { 18037 this.foundation.setRequired(isRequired); 18038 }, 18039 enumerable: false, 18040 configurable: true 18041 }); 18042 /** 18043 * Re-calculates if the notched outline should be notched and if the label 18044 * should float. 18045 */ 18046 MDCSelect.prototype.layout = function () { 18047 this.foundation.layout(); 18048 }; 18049 /** 18050 * Synchronizes the list of options with the state of the foundation. Call 18051 * this whenever menu options are dynamically updated. 18052 */ 18053 MDCSelect.prototype.layoutOptions = function () { 18054 this.foundation.layoutOptions(); 18055 this.menu.layout(); 18056 // Update cached menuItemValues for adapter. 18057 this.menuItemValues = this.menu.items.map(function (el) { 18058 return el.getAttribute(constants_1.strings.VALUE_ATTR) || ''; 18059 }); 18060 if (this.hiddenInput) { 18061 this.hiddenInput.value = this.value; 18062 } 18063 }; 18064 MDCSelect.prototype.getDefaultFoundation = function () { 18065 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 18066 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 18067 var adapter = __assign(__assign(__assign(__assign({}, this.getSelectAdapterMethods()), this.getCommonAdapterMethods()), this.getOutlineAdapterMethods()), this.getLabelAdapterMethods()); 18068 return new foundation_2.MDCSelectFoundation(adapter, this.getFoundationMap()); 18069 }; 18070 /** 18071 * Handles setup for the menu. 18072 */ 18073 MDCSelect.prototype.menuSetup = function (menuFactory) { 18074 this.menuElement = this.root.querySelector(constants_1.strings.MENU_SELECTOR); 18075 this.menu = menuFactory(this.menuElement); 18076 this.menu.hasTypeahead = true; 18077 this.menu.singleSelection = true; 18078 this.menuItemValues = this.menu.items.map(function (el) { 18079 return el.getAttribute(constants_1.strings.VALUE_ATTR) || ''; 18080 }); 18081 }; 18082 MDCSelect.prototype.createRipple = function () { 18083 var _this = this; 18084 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 18085 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 18086 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 18087 var adapter = __assign(__assign({}, component_6.MDCRipple.createAdapter({ root: this.selectAnchor })), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 18088 _this.selectAnchor.addEventListener(evtType, handler); 18089 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 18090 _this.selectAnchor.removeEventListener(evtType, handler); 18091 } }); 18092 // tslint:enable:object-literal-sort-keys 18093 return new component_6.MDCRipple(this.selectAnchor, new foundation_1.MDCRippleFoundation(adapter)); 18094 }; 18095 MDCSelect.prototype.getSelectAdapterMethods = function () { 18096 var _this = this; 18097 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 18098 return { 18099 getMenuItemAttr: function getMenuItemAttr(menuItem, attr) { 18100 return menuItem.getAttribute(attr); 18101 }, 18102 setSelectedText: function setSelectedText(text) { 18103 _this.selectedText.textContent = text; 18104 }, 18105 isSelectAnchorFocused: function isSelectAnchorFocused() { 18106 return document.activeElement === _this.selectAnchor; 18107 }, 18108 getSelectAnchorAttr: function getSelectAnchorAttr(attr) { 18109 return _this.selectAnchor.getAttribute(attr); 18110 }, 18111 setSelectAnchorAttr: function setSelectAnchorAttr(attr, value) { 18112 _this.selectAnchor.setAttribute(attr, value); 18113 }, 18114 removeSelectAnchorAttr: function removeSelectAnchorAttr(attr) { 18115 _this.selectAnchor.removeAttribute(attr); 18116 }, 18117 addMenuClass: function addMenuClass(className) { 18118 _this.menuElement.classList.add(className); 18119 }, 18120 removeMenuClass: function removeMenuClass(className) { 18121 _this.menuElement.classList.remove(className); 18122 }, 18123 openMenu: function openMenu() { 18124 _this.menu.open = true; 18125 }, 18126 closeMenu: function closeMenu() { 18127 _this.menu.open = false; 18128 }, 18129 getAnchorElement: function getAnchorElement() { 18130 return _this.root.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR); 18131 }, 18132 setMenuAnchorElement: function setMenuAnchorElement(anchorEl) { 18133 _this.menu.setAnchorElement(anchorEl); 18134 }, 18135 setMenuAnchorCorner: function setMenuAnchorCorner(anchorCorner) { 18136 _this.menu.setAnchorCorner(anchorCorner); 18137 }, 18138 setMenuWrapFocus: function setMenuWrapFocus(wrapFocus) { 18139 _this.menu.wrapFocus = wrapFocus; 18140 }, 18141 getSelectedIndex: function getSelectedIndex() { 18142 var index = _this.menu.selectedIndex; 18143 return index instanceof Array ? index[0] : index; 18144 }, 18145 setSelectedIndex: function setSelectedIndex(index) { 18146 _this.menu.selectedIndex = index; 18147 }, 18148 focusMenuItemAtIndex: function focusMenuItemAtIndex(index) { 18149 _this.menu.items[index].focus(); 18150 }, 18151 getMenuItemCount: function getMenuItemCount() { 18152 return _this.menu.items.length; 18153 }, 18154 // Cache menu item values. layoutOptions() updates this cache. 18155 getMenuItemValues: function getMenuItemValues() { 18156 return _this.menuItemValues; 18157 }, 18158 getMenuItemTextAtIndex: function getMenuItemTextAtIndex(index) { 18159 return _this.menu.getPrimaryTextAtIndex(index); 18160 }, 18161 isTypeaheadInProgress: function isTypeaheadInProgress() { 18162 return _this.menu.typeaheadInProgress; 18163 }, 18164 typeaheadMatchItem: function typeaheadMatchItem(nextChar, startingIndex) { 18165 return _this.menu.typeaheadMatchItem(nextChar, startingIndex); 18166 } 18167 }; 18168 // tslint:enable:object-literal-sort-keys 18169 }; 18170 MDCSelect.prototype.getCommonAdapterMethods = function () { 18171 var _this = this; 18172 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 18173 return { 18174 addClass: function addClass(className) { 18175 _this.root.classList.add(className); 18176 }, 18177 removeClass: function removeClass(className) { 18178 _this.root.classList.remove(className); 18179 }, 18180 hasClass: function hasClass(className) { 18181 return _this.root.classList.contains(className); 18182 }, 18183 setRippleCenter: function setRippleCenter(normalizedX) { 18184 _this.lineRipple && _this.lineRipple.setRippleCenter(normalizedX); 18185 }, 18186 activateBottomLine: function activateBottomLine() { 18187 _this.lineRipple && _this.lineRipple.activate(); 18188 }, 18189 deactivateBottomLine: function deactivateBottomLine() { 18190 _this.lineRipple && _this.lineRipple.deactivate(); 18191 }, 18192 notifyChange: function notifyChange(value) { 18193 if (_this.hiddenInput) { 18194 _this.hiddenInput.value = value; 18195 } 18196 var index = _this.selectedIndex; 18197 _this.emit(constants_1.strings.CHANGE_EVENT, { value: value, index: index }, true /* shouldBubble */); 18198 } 18199 }; 18200 // tslint:enable:object-literal-sort-keys 18201 }; 18202 MDCSelect.prototype.getOutlineAdapterMethods = function () { 18203 var _this = this; 18204 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 18205 return { 18206 hasOutline: function hasOutline() { 18207 return Boolean(_this.outline); 18208 }, 18209 notchOutline: function notchOutline(labelWidth) { 18210 _this.outline && _this.outline.notch(labelWidth); 18211 }, 18212 closeOutline: function closeOutline() { 18213 _this.outline && _this.outline.closeNotch(); 18214 } 18215 }; 18216 // tslint:enable:object-literal-sort-keys 18217 }; 18218 MDCSelect.prototype.getLabelAdapterMethods = function () { 18219 var _this = this; 18220 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 18221 return { 18222 hasLabel: function hasLabel() { 18223 return !!_this.label; 18224 }, 18225 floatLabel: function floatLabel(shouldFloat) { 18226 _this.label && _this.label.float(shouldFloat); 18227 }, 18228 getLabelWidth: function getLabelWidth() { 18229 return _this.label ? _this.label.getWidth() : 0; 18230 }, 18231 setLabelRequired: function setLabelRequired(isRequired) { 18232 _this.label && _this.label.setRequired(isRequired); 18233 } 18234 }; 18235 // tslint:enable:object-literal-sort-keys 18236 }; 18237 /** 18238 * Calculates where the line ripple should start based on the x coordinate within the component. 18239 */ 18240 MDCSelect.prototype.getNormalizedXCoordinate = function (evt) { 18241 var targetClientRect = evt.target.getBoundingClientRect(); 18242 var xCoordinate = this.isTouchEvent(evt) ? evt.touches[0].clientX : evt.clientX; 18243 return xCoordinate - targetClientRect.left; 18244 }; 18245 MDCSelect.prototype.isTouchEvent = function (evt) { 18246 return Boolean(evt.touches); 18247 }; 18248 /** 18249 * Returns a map of all subcomponents to subfoundations. 18250 */ 18251 MDCSelect.prototype.getFoundationMap = function () { 18252 return { 18253 helperText: this.helperText ? this.helperText.foundationForSelect : undefined, 18254 leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForSelect : undefined 18255 }; 18256 }; 18257 return MDCSelect; 18258}(component_1.MDCComponent); 18259exports.MDCSelect = MDCSelect; 18260 18261/***/ }), 18262 18263/***/ "./packages/mdc-select/constants.ts": 18264/*!******************************************!*\ 18265 !*** ./packages/mdc-select/constants.ts ***! 18266 \******************************************/ 18267/*! no static exports found */ 18268/***/ (function(module, exports, __webpack_require__) { 18269 18270"use strict"; 18271 18272/** 18273 * @license 18274 * Copyright 2016 Google Inc. 18275 * 18276 * Permission is hereby granted, free of charge, to any person obtaining a copy 18277 * of this software and associated documentation files (the "Software"), to deal 18278 * in the Software without restriction, including without limitation the rights 18279 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18280 * copies of the Software, and to permit persons to whom the Software is 18281 * furnished to do so, subject to the following conditions: 18282 * 18283 * The above copyright notice and this permission notice shall be included in 18284 * all copies or substantial portions of the Software. 18285 * 18286 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18287 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18288 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18289 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18290 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18291 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18292 * THE SOFTWARE. 18293 */ 18294 18295Object.defineProperty(exports, "__esModule", { value: true }); 18296exports.numbers = exports.strings = exports.cssClasses = void 0; 18297var cssClasses = { 18298 ACTIVATED: 'mdc-select--activated', 18299 DISABLED: 'mdc-select--disabled', 18300 FOCUSED: 'mdc-select--focused', 18301 INVALID: 'mdc-select--invalid', 18302 MENU_INVALID: 'mdc-select__menu--invalid', 18303 OUTLINED: 'mdc-select--outlined', 18304 REQUIRED: 'mdc-select--required', 18305 ROOT: 'mdc-select', 18306 WITH_LEADING_ICON: 'mdc-select--with-leading-icon' 18307}; 18308exports.cssClasses = cssClasses; 18309var strings = { 18310 ARIA_CONTROLS: 'aria-controls', 18311 ARIA_DESCRIBEDBY: 'aria-describedby', 18312 ARIA_SELECTED_ATTR: 'aria-selected', 18313 CHANGE_EVENT: 'MDCSelect:change', 18314 HIDDEN_INPUT_SELECTOR: 'input[type="hidden"]', 18315 LABEL_SELECTOR: '.mdc-floating-label', 18316 LEADING_ICON_SELECTOR: '.mdc-select__icon', 18317 LINE_RIPPLE_SELECTOR: '.mdc-line-ripple', 18318 MENU_SELECTOR: '.mdc-select__menu', 18319 OUTLINE_SELECTOR: '.mdc-notched-outline', 18320 SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text', 18321 SELECT_ANCHOR_SELECTOR: '.mdc-select__anchor', 18322 VALUE_ATTR: 'data-value' 18323}; 18324exports.strings = strings; 18325var numbers = { 18326 LABEL_SCALE: 0.75, 18327 UNSET_INDEX: -1, 18328 CLICK_DEBOUNCE_TIMEOUT_MS: 330 18329}; 18330exports.numbers = numbers; 18331 18332/***/ }), 18333 18334/***/ "./packages/mdc-select/foundation.ts": 18335/*!*******************************************!*\ 18336 !*** ./packages/mdc-select/foundation.ts ***! 18337 \*******************************************/ 18338/*! no static exports found */ 18339/***/ (function(module, exports, __webpack_require__) { 18340 18341"use strict"; 18342 18343/** 18344 * @license 18345 * Copyright 2016 Google Inc. 18346 * 18347 * Permission is hereby granted, free of charge, to any person obtaining a copy 18348 * of this software and associated documentation files (the "Software"), to deal 18349 * in the Software without restriction, including without limitation the rights 18350 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18351 * copies of the Software, and to permit persons to whom the Software is 18352 * furnished to do so, subject to the following conditions: 18353 * 18354 * The above copyright notice and this permission notice shall be included in 18355 * all copies or substantial portions of the Software. 18356 * 18357 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18358 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18359 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18360 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18361 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18362 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18363 * THE SOFTWARE. 18364 */ 18365 18366var __extends = this && this.__extends || function () { 18367 var _extendStatics = function extendStatics(d, b) { 18368 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 18369 d.__proto__ = b; 18370 } || function (d, b) { 18371 for (var p in b) { 18372 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 18373 } 18374 }; 18375 return _extendStatics(d, b); 18376 }; 18377 return function (d, b) { 18378 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 18379 _extendStatics(d, b); 18380 function __() { 18381 this.constructor = d; 18382 } 18383 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 18384 }; 18385}(); 18386var __assign = this && this.__assign || function () { 18387 __assign = Object.assign || function (t) { 18388 for (var s, i = 1, n = arguments.length; i < n; i++) { 18389 s = arguments[i]; 18390 for (var p in s) { 18391 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 18392 } 18393 } 18394 return t; 18395 }; 18396 return __assign.apply(this, arguments); 18397}; 18398Object.defineProperty(exports, "__esModule", { value: true }); 18399exports.MDCSelectFoundation = void 0; 18400var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 18401var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 18402var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"); 18403var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"); 18404var MDCSelectFoundation = /** @class */function (_super) { 18405 __extends(MDCSelectFoundation, _super); 18406 /* istanbul ignore next: optional argument is not a branch statement */ 18407 /** 18408 * @param adapter 18409 * @param foundationMap Map from subcomponent names to their subfoundations. 18410 */ 18411 function MDCSelectFoundation(adapter, foundationMap) { 18412 if (foundationMap === void 0) { 18413 foundationMap = {}; 18414 } 18415 var _this = _super.call(this, __assign(__assign({}, MDCSelectFoundation.defaultAdapter), adapter)) || this; 18416 // Disabled state 18417 _this.disabled = false; 18418 // isMenuOpen is used to track the state of the menu by listening to the 18419 // MDCMenuSurface:closed event For reference, menu.open will return false if 18420 // the menu is still closing, but isMenuOpen returns false only after the menu 18421 // has closed 18422 _this.isMenuOpen = false; 18423 // By default, select is invalid if it is required but no value is selected. 18424 _this.useDefaultValidation = true; 18425 _this.customValidity = true; 18426 _this.lastSelectedIndex = constants_2.numbers.UNSET_INDEX; 18427 _this.clickDebounceTimeout = 0; 18428 _this.recentlyClicked = false; 18429 _this.leadingIcon = foundationMap.leadingIcon; 18430 _this.helperText = foundationMap.helperText; 18431 return _this; 18432 } 18433 Object.defineProperty(MDCSelectFoundation, "cssClasses", { 18434 get: function get() { 18435 return constants_2.cssClasses; 18436 }, 18437 enumerable: false, 18438 configurable: true 18439 }); 18440 Object.defineProperty(MDCSelectFoundation, "numbers", { 18441 get: function get() { 18442 return constants_2.numbers; 18443 }, 18444 enumerable: false, 18445 configurable: true 18446 }); 18447 Object.defineProperty(MDCSelectFoundation, "strings", { 18448 get: function get() { 18449 return constants_2.strings; 18450 }, 18451 enumerable: false, 18452 configurable: true 18453 }); 18454 Object.defineProperty(MDCSelectFoundation, "defaultAdapter", { 18455 /** 18456 * See {@link MDCSelectAdapter} for typing information on parameters and return types. 18457 */ 18458 get: function get() { 18459 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 18460 return { 18461 addClass: function addClass() { 18462 return undefined; 18463 }, 18464 removeClass: function removeClass() { 18465 return undefined; 18466 }, 18467 hasClass: function hasClass() { 18468 return false; 18469 }, 18470 activateBottomLine: function activateBottomLine() { 18471 return undefined; 18472 }, 18473 deactivateBottomLine: function deactivateBottomLine() { 18474 return undefined; 18475 }, 18476 getSelectedIndex: function getSelectedIndex() { 18477 return -1; 18478 }, 18479 setSelectedIndex: function setSelectedIndex() { 18480 return undefined; 18481 }, 18482 hasLabel: function hasLabel() { 18483 return false; 18484 }, 18485 floatLabel: function floatLabel() { 18486 return undefined; 18487 }, 18488 getLabelWidth: function getLabelWidth() { 18489 return 0; 18490 }, 18491 setLabelRequired: function setLabelRequired() { 18492 return undefined; 18493 }, 18494 hasOutline: function hasOutline() { 18495 return false; 18496 }, 18497 notchOutline: function notchOutline() { 18498 return undefined; 18499 }, 18500 closeOutline: function closeOutline() { 18501 return undefined; 18502 }, 18503 setRippleCenter: function setRippleCenter() { 18504 return undefined; 18505 }, 18506 notifyChange: function notifyChange() { 18507 return undefined; 18508 }, 18509 setSelectedText: function setSelectedText() { 18510 return undefined; 18511 }, 18512 isSelectAnchorFocused: function isSelectAnchorFocused() { 18513 return false; 18514 }, 18515 getSelectAnchorAttr: function getSelectAnchorAttr() { 18516 return ''; 18517 }, 18518 setSelectAnchorAttr: function setSelectAnchorAttr() { 18519 return undefined; 18520 }, 18521 removeSelectAnchorAttr: function removeSelectAnchorAttr() { 18522 return undefined; 18523 }, 18524 addMenuClass: function addMenuClass() { 18525 return undefined; 18526 }, 18527 removeMenuClass: function removeMenuClass() { 18528 return undefined; 18529 }, 18530 openMenu: function openMenu() { 18531 return undefined; 18532 }, 18533 closeMenu: function closeMenu() { 18534 return undefined; 18535 }, 18536 getAnchorElement: function getAnchorElement() { 18537 return null; 18538 }, 18539 setMenuAnchorElement: function setMenuAnchorElement() { 18540 return undefined; 18541 }, 18542 setMenuAnchorCorner: function setMenuAnchorCorner() { 18543 return undefined; 18544 }, 18545 setMenuWrapFocus: function setMenuWrapFocus() { 18546 return undefined; 18547 }, 18548 focusMenuItemAtIndex: function focusMenuItemAtIndex() { 18549 return undefined; 18550 }, 18551 getMenuItemCount: function getMenuItemCount() { 18552 return 0; 18553 }, 18554 getMenuItemValues: function getMenuItemValues() { 18555 return []; 18556 }, 18557 getMenuItemTextAtIndex: function getMenuItemTextAtIndex() { 18558 return ''; 18559 }, 18560 isTypeaheadInProgress: function isTypeaheadInProgress() { 18561 return false; 18562 }, 18563 typeaheadMatchItem: function typeaheadMatchItem() { 18564 return -1; 18565 } 18566 }; 18567 // tslint:enable:object-literal-sort-keys 18568 }, 18569 enumerable: false, 18570 configurable: true 18571 }); 18572 /** Returns the index of the currently selected menu item, or -1 if none. */ 18573 MDCSelectFoundation.prototype.getSelectedIndex = function () { 18574 return this.adapter.getSelectedIndex(); 18575 }; 18576 MDCSelectFoundation.prototype.setSelectedIndex = function (index, closeMenu, skipNotify) { 18577 if (closeMenu === void 0) { 18578 closeMenu = false; 18579 } 18580 if (skipNotify === void 0) { 18581 skipNotify = false; 18582 } 18583 if (index >= this.adapter.getMenuItemCount()) { 18584 return; 18585 } 18586 if (index === constants_2.numbers.UNSET_INDEX) { 18587 this.adapter.setSelectedText(''); 18588 } else { 18589 this.adapter.setSelectedText(this.adapter.getMenuItemTextAtIndex(index).trim()); 18590 } 18591 this.adapter.setSelectedIndex(index); 18592 if (closeMenu) { 18593 this.adapter.closeMenu(); 18594 } 18595 if (!skipNotify && this.lastSelectedIndex !== index) { 18596 this.handleChange(); 18597 } 18598 this.lastSelectedIndex = index; 18599 }; 18600 MDCSelectFoundation.prototype.setValue = function (value, skipNotify) { 18601 if (skipNotify === void 0) { 18602 skipNotify = false; 18603 } 18604 var index = this.adapter.getMenuItemValues().indexOf(value); 18605 this.setSelectedIndex(index, /** closeMenu */false, skipNotify); 18606 }; 18607 MDCSelectFoundation.prototype.getValue = function () { 18608 var index = this.adapter.getSelectedIndex(); 18609 var menuItemValues = this.adapter.getMenuItemValues(); 18610 return index !== constants_2.numbers.UNSET_INDEX ? menuItemValues[index] : ''; 18611 }; 18612 MDCSelectFoundation.prototype.getDisabled = function () { 18613 return this.disabled; 18614 }; 18615 MDCSelectFoundation.prototype.setDisabled = function (isDisabled) { 18616 this.disabled = isDisabled; 18617 if (this.disabled) { 18618 this.adapter.addClass(constants_2.cssClasses.DISABLED); 18619 this.adapter.closeMenu(); 18620 } else { 18621 this.adapter.removeClass(constants_2.cssClasses.DISABLED); 18622 } 18623 if (this.leadingIcon) { 18624 this.leadingIcon.setDisabled(this.disabled); 18625 } 18626 if (this.disabled) { 18627 // Prevent click events from focusing select. Simply pointer-events: none 18628 // is not enough since screenreader clicks may bypass this. 18629 this.adapter.removeSelectAnchorAttr('tabindex'); 18630 } else { 18631 this.adapter.setSelectAnchorAttr('tabindex', '0'); 18632 } 18633 this.adapter.setSelectAnchorAttr('aria-disabled', this.disabled.toString()); 18634 }; 18635 /** Opens the menu. */ 18636 MDCSelectFoundation.prototype.openMenu = function () { 18637 this.adapter.addClass(constants_2.cssClasses.ACTIVATED); 18638 this.adapter.openMenu(); 18639 this.isMenuOpen = true; 18640 this.adapter.setSelectAnchorAttr('aria-expanded', 'true'); 18641 }; 18642 /** 18643 * @param content Sets the content of the helper text. 18644 */ 18645 MDCSelectFoundation.prototype.setHelperTextContent = function (content) { 18646 if (this.helperText) { 18647 this.helperText.setContent(content); 18648 } 18649 }; 18650 /** 18651 * Re-calculates if the notched outline should be notched and if the label 18652 * should float. 18653 */ 18654 MDCSelectFoundation.prototype.layout = function () { 18655 if (this.adapter.hasLabel()) { 18656 var optionHasValue = this.getValue().length > 0; 18657 var isFocused = this.adapter.hasClass(constants_2.cssClasses.FOCUSED); 18658 var shouldFloatAndNotch = optionHasValue || isFocused; 18659 var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED); 18660 this.notchOutline(shouldFloatAndNotch); 18661 this.adapter.floatLabel(shouldFloatAndNotch); 18662 this.adapter.setLabelRequired(isRequired); 18663 } 18664 }; 18665 /** 18666 * Synchronizes the list of options with the state of the foundation. Call 18667 * this whenever menu options are dynamically updated. 18668 */ 18669 MDCSelectFoundation.prototype.layoutOptions = function () { 18670 var menuItemValues = this.adapter.getMenuItemValues(); 18671 var selectedIndex = menuItemValues.indexOf(this.getValue()); 18672 this.setSelectedIndex(selectedIndex, /** closeMenu */false, /** skipNotify */true); 18673 }; 18674 MDCSelectFoundation.prototype.handleMenuOpened = function () { 18675 if (this.adapter.getMenuItemValues().length === 0) { 18676 return; 18677 } 18678 // Menu should open to the last selected element, should open to first menu item otherwise. 18679 var selectedIndex = this.getSelectedIndex(); 18680 var focusItemIndex = selectedIndex >= 0 ? selectedIndex : 0; 18681 this.adapter.focusMenuItemAtIndex(focusItemIndex); 18682 }; 18683 MDCSelectFoundation.prototype.handleMenuClosing = function () { 18684 this.adapter.setSelectAnchorAttr('aria-expanded', 'false'); 18685 }; 18686 MDCSelectFoundation.prototype.handleMenuClosed = function () { 18687 this.adapter.removeClass(constants_2.cssClasses.ACTIVATED); 18688 this.isMenuOpen = false; 18689 // Unfocus the select if menu is closed without a selection 18690 if (!this.adapter.isSelectAnchorFocused()) { 18691 this.blur(); 18692 } 18693 }; 18694 /** 18695 * Handles value changes, via change event or programmatic updates. 18696 */ 18697 MDCSelectFoundation.prototype.handleChange = function () { 18698 this.layout(); 18699 this.adapter.notifyChange(this.getValue()); 18700 var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED); 18701 if (isRequired && this.useDefaultValidation) { 18702 this.setValid(this.isValid()); 18703 } 18704 }; 18705 MDCSelectFoundation.prototype.handleMenuItemAction = function (index) { 18706 this.setSelectedIndex(index, /** closeMenu */true); 18707 }; 18708 /** 18709 * Handles focus events from select element. 18710 */ 18711 MDCSelectFoundation.prototype.handleFocus = function () { 18712 this.adapter.addClass(constants_2.cssClasses.FOCUSED); 18713 this.layout(); 18714 this.adapter.activateBottomLine(); 18715 }; 18716 /** 18717 * Handles blur events from select element. 18718 */ 18719 MDCSelectFoundation.prototype.handleBlur = function () { 18720 if (this.isMenuOpen) { 18721 return; 18722 } 18723 this.blur(); 18724 }; 18725 MDCSelectFoundation.prototype.handleClick = function (normalizedX) { 18726 if (this.disabled || this.recentlyClicked) { 18727 return; 18728 } 18729 this.setClickDebounceTimeout(); 18730 if (this.isMenuOpen) { 18731 this.adapter.closeMenu(); 18732 return; 18733 } 18734 this.adapter.setRippleCenter(normalizedX); 18735 this.openMenu(); 18736 }; 18737 /** 18738 * Handles keydown events on select element. Depending on the type of 18739 * character typed, does typeahead matching or opens menu. 18740 */ 18741 MDCSelectFoundation.prototype.handleKeydown = function (event) { 18742 if (this.isMenuOpen || !this.adapter.hasClass(constants_2.cssClasses.FOCUSED)) { 18743 return; 18744 } 18745 var isEnter = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ENTER; 18746 var isSpace = keyboard_1.normalizeKey(event) === keyboard_1.KEY.SPACEBAR; 18747 var arrowUp = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ARROW_UP; 18748 var arrowDown = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ARROW_DOWN; 18749 var isModifier = event.ctrlKey || event.metaKey; 18750 // Typeahead 18751 if (!isModifier && (!isSpace && event.key && event.key.length === 1 || isSpace && this.adapter.isTypeaheadInProgress())) { 18752 var key = isSpace ? ' ' : event.key; 18753 var typeaheadNextIndex = this.adapter.typeaheadMatchItem(key, this.getSelectedIndex()); 18754 if (typeaheadNextIndex >= 0) { 18755 this.setSelectedIndex(typeaheadNextIndex); 18756 } 18757 event.preventDefault(); 18758 return; 18759 } 18760 if (!isEnter && !isSpace && !arrowUp && !arrowDown) { 18761 return; 18762 } 18763
18763// Increment/decrement index as necessary and open menu. 18764 if (arrowUp && this.getSelectedIndex() > 0) { 18765 this.setSelectedIndex(this.getSelectedIndex() - 1); 18766 } else if (arrowDown && this.getSelectedIndex() < this.adapter.getMenuItemCount() - 1) { 18767 this.setSelectedIndex(this.getSelectedIndex() + 1); 18768 } 18769 this.openMenu(); 18770 event.preventDefault(); 18771 }; 18772 /** 18773 * Opens/closes the notched outline. 18774 */ 18775 MDCSelectFoundation.prototype.notchOutline = function (openNotch) { 18776 if (!this.adapter.hasOutline()) { 18777 return; 18778 } 18779 var isFocused = this.adapter.hasClass(constants_2.cssClasses.FOCUSED); 18780 if (openNotch) { 18781 var labelScale = constants_2.numbers.LABEL_SCALE; 18782 var labelWidth = this.adapter.getLabelWidth() * labelScale; 18783 this.adapter.notchOutline(labelWidth); 18784 } else if (!isFocused) { 18785 this.adapter.closeOutline(); 18786 } 18787 }; 18788 /** 18789 * Sets the aria label of the leading icon. 18790 */ 18791 MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) { 18792 if (this.leadingIcon) { 18793 this.leadingIcon.setAriaLabel(label); 18794 } 18795 }; 18796 /** 18797 * Sets the text content of the leading icon. 18798 */ 18799 MDCSelectFoundation.prototype.setLeadingIconContent = function (content) { 18800 if (this.leadingIcon) { 18801 this.leadingIcon.setContent(content); 18802 }
vendor: 35,152 bytes, lines 18802-19615
18802 18803 }; 18804 MDCSelectFoundation.prototype.setUseDefaultValidation = function (useDefaultValidation) { 18805 this.useDefaultValidation = useDefaultValidation; 18806 }; 18807 MDCSelectFoundation.prototype.setValid = function (isValid) { 18808 if (!this.useDefaultValidation) { 18809 this.customValidity = isValid; 18810 } 18811 this.adapter.setSelectAnchorAttr('aria-invalid', (!isValid).toString()); 18812 if (isValid) { 18813 this.adapter.removeClass(constants_2.cssClasses.INVALID); 18814 this.adapter.removeMenuClass(constants_2.cssClasses.MENU_INVALID); 18815 } else { 18816 this.adapter.addClass(constants_2.cssClasses.INVALID); 18817 this.adapter.addMenuClass(constants_2.cssClasses.MENU_INVALID); 18818 } 18819 this.syncHelperTextValidity(isValid); 18820 }; 18821 MDCSelectFoundation.prototype.isValid = function () { 18822 if (this.useDefaultValidation && this.adapter.hasClass(constants_2.cssClasses.REQUIRED) && !this.adapter.hasClass(constants_2.cssClasses.DISABLED)) { 18823 // See notes for required attribute under https://www.w3.org/TR/html52/sec-forms.html#the-select-element 18824 // TL;DR: Invalid if no index is selected, or if the first index is selected and has an empty value. 18825 return this.getSelectedIndex() !== constants_2.numbers.UNSET_INDEX && (this.getSelectedIndex() !== 0 || Boolean(this.getValue())); 18826 } 18827 return this.customValidity; 18828 }; 18829 MDCSelectFoundation.prototype.setRequired = function (isRequired) { 18830 if (isRequired) { 18831 this.adapter.addClass(constants_2.cssClasses.REQUIRED); 18832 } else { 18833 this.adapter.removeClass(constants_2.cssClasses.REQUIRED); 18834 } 18835 this.adapter.setSelectAnchorAttr('aria-required', isRequired.toString()); 18836 this.adapter.setLabelRequired(isRequired); 18837 }; 18838 MDCSelectFoundation.prototype.getRequired = function () { 18839 return this.adapter.getSelectAnchorAttr('aria-required') === 'true'; 18840 }; 18841 MDCSelectFoundation.prototype.init = function () { 18842 var anchorEl = this.adapter.getAnchorElement(); 18843 if (anchorEl) { 18844 this.adapter.setMenuAnchorElement(anchorEl); 18845 this.adapter.setMenuAnchorCorner(constants_1.Corner.BOTTOM_START); 18846 } 18847 this.adapter.setMenuWrapFocus(false); 18848 this.setDisabled(this.adapter.hasClass(constants_2.cssClasses.DISABLED)); 18849 this.syncHelperTextValidity(!this.adapter.hasClass(constants_2.cssClasses.INVALID)); 18850 this.layout(); 18851 this.layoutOptions(); 18852 }; 18853 /** 18854 * Unfocuses the select component. 18855 */ 18856 MDCSelectFoundation.prototype.blur = function () { 18857 this.adapter.removeClass(constants_2.cssClasses.FOCUSED); 18858 this.layout(); 18859 this.adapter.deactivateBottomLine(); 18860 var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED); 18861 if (isRequired && this.useDefaultValidation) { 18862 this.setValid(this.isValid()); 18863 } 18864 }; 18865 MDCSelectFoundation.prototype.syncHelperTextValidity = function (isValid) { 18866 if (!this.helperText) { 18867 return; 18868 } 18869 this.helperText.setValidity(isValid); 18870 var helperTextVisible = this.helperText.isVisible(); 18871 var helperTextId = this.helperText.getId(); 18872 if (helperTextVisible && helperTextId) { 18873 this.adapter.setSelectAnchorAttr(constants_2.strings.ARIA_DESCRIBEDBY, helperTextId); 18874 } else { 18875 // Needed because screenreaders will read labels pointed to by 18876 // `aria-describedby` even if they are `aria-hidden`. 18877 this.adapter.removeSelectAnchorAttr(constants_2.strings.ARIA_DESCRIBEDBY); 18878 } 18879 }; 18880 MDCSelectFoundation.prototype.setClickDebounceTimeout = function () { 18881 var _this = this; 18882 clearTimeout(this.clickDebounceTimeout); 18883 this.clickDebounceTimeout = setTimeout(function () { 18884 _this.recentlyClicked = false; 18885 }, constants_2.numbers.CLICK_DEBOUNCE_TIMEOUT_MS); 18886 this.recentlyClicked = true; 18887 }; 18888 return MDCSelectFoundation; 18889}(foundation_1.MDCFoundation); 18890exports.MDCSelectFoundation = MDCSelectFoundation; 18891// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 18892exports.default = MDCSelectFoundation; 18893 18894/***/ }), 18895 18896/***/ "./packages/mdc-select/helper-text/adapter.ts": 18897/*!****************************************************!*\ 18898 !*** ./packages/mdc-select/helper-text/adapter.ts ***! 18899 \****************************************************/ 18900/*! no static exports found */ 18901/***/ (function(module, exports, __webpack_require__) { 18902 18903"use strict"; 18904 18905/** 18906 * @license 18907 * Copyright 2018 Google Inc. 18908 * 18909 * Permission is hereby granted, free of charge, to any person obtaining a copy 18910 * of this software and associated documentation files (the "Software"), to deal 18911 * in the Software without restriction, including without limitation the rights 18912 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18913 * copies of the Software, and to permit persons to whom the Software is 18914 * furnished to do so, subject to the following conditions: 18915 * 18916 * The above copyright notice and this permission notice shall be included in 18917 * all copies or substantial portions of the Software. 18918 * 18919 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18920 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18921 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18922 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18923 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18924 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18925 * THE SOFTWARE. 18926 */ 18927 18928Object.defineProperty(exports, "__esModule", { value: true }); 18929 18930/***/ }), 18931 18932/***/ "./packages/mdc-select/helper-text/component.ts": 18933/*!******************************************************!*\ 18934 !*** ./packages/mdc-select/helper-text/component.ts ***! 18935 \******************************************************/ 18936/*! no static exports found */ 18937/***/ (function(module, exports, __webpack_require__) { 18938 18939"use strict"; 18940 18941/** 18942 * @license 18943 * Copyright 2018 Google Inc. 18944 * 18945 * Permission is hereby granted, free of charge, to any person obtaining a copy 18946 * of this software and associated documentation files (the "Software"), to deal 18947 * in the Software without restriction, including without limitation the rights 18948 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18949 * copies of the Software, and to permit persons to whom the Software is 18950 * furnished to do so, subject to the following conditions: 18951 * 18952 * The above copyright notice and this permission notice shall be included in 18953 * all copies or substantial portions of the Software. 18954 * 18955 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18956 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18957 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18958 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18959 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18960 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18961 * THE SOFTWARE. 18962 */ 18963 18964var __extends = this && this.__extends || function () { 18965 var _extendStatics = function extendStatics(d, b) { 18966 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 18967 d.__proto__ = b; 18968 } || function (d, b) { 18969 for (var p in b) { 18970 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 18971 } 18972 }; 18973 return _extendStatics(d, b); 18974 }; 18975 return function (d, b) { 18976 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 18977 _extendStatics(d, b); 18978 function __() { 18979 this.constructor = d; 18980 } 18981 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 18982 }; 18983}(); 18984Object.defineProperty(exports, "__esModule", { value: true }); 18985exports.MDCSelectHelperText = void 0; 18986var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 18987var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts"); 18988var MDCSelectHelperText = /** @class */function (_super) { 18989 __extends(MDCSelectHelperText, _super); 18990 function MDCSelectHelperText() { 18991 return _super !== null && _super.apply(this, arguments) || this; 18992 } 18993 MDCSelectHelperText.attachTo = function (root) { 18994 return new MDCSelectHelperText(root); 18995 }; 18996 Object.defineProperty(MDCSelectHelperText.prototype, "foundationForSelect", { 18997 // Provided for access by MDCSelect component 18998 get: function get() { 18999 return this.foundation; 19000 }, 19001 enumerable: false, 19002 configurable: true 19003 }); 19004 MDCSelectHelperText.prototype.getDefaultFoundation = function () { 19005 var _this = this; 19006 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 19007 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 19008 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 19009 var adapter = { 19010 addClass: function addClass(className) { 19011 return _this.root.classList.add(className); 19012 }, 19013 removeClass: function removeClass(className) { 19014 return _this.root.classList.remove(className); 19015 }, 19016 hasClass: function hasClass(className) { 19017 return _this.root.classList.contains(className); 19018 }, 19019 getAttr: function getAttr(attr) { 19020 return _this.root.getAttribute(attr); 19021 }, 19022 setAttr: function setAttr(attr, value) { 19023 return _this.root.setAttribute(attr, value); 19024 }, 19025 removeAttr: function removeAttr(attr) { 19026 return _this.root.removeAttribute(attr); 19027 }, 19028 setContent: function setContent(content) { 19029 _this.root.textContent = content; 19030 } 19031 }; 19032 // tslint:enable:object-literal-sort-keys 19033 return new foundation_1.MDCSelectHelperTextFoundation(adapter); 19034 }; 19035 return MDCSelectHelperText; 19036}(component_1.MDCComponent); 19037exports.MDCSelectHelperText = MDCSelectHelperText; 19038 19039/***/ }), 19040 19041/***/ "./packages/mdc-select/helper-text/constants.ts": 19042/*!******************************************************!*\ 19043 !*** ./packages/mdc-select/helper-text/constants.ts ***! 19044 \******************************************************/ 19045/*! no static exports found */ 19046/***/ (function(module, exports, __webpack_require__) { 19047 19048"use strict"; 19049 19050/** 19051 * @license 19052 * Copyright 2018 Google Inc. 19053 * 19054 * Permission is hereby granted, free of charge, to any person obtaining a copy 19055 * of this software and associated documentation files (the "Software"), to deal 19056 * in the Software without restriction, including without limitation the rights 19057 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19058 * copies of the Software, and to permit persons to whom the Software is 19059 * furnished to do so, subject to the following conditions: 19060 * 19061 * The above copyright notice and this permission notice shall be included in 19062 * all copies or substantial portions of the Software. 19063 * 19064 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19065 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19066 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19067 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19068 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19069 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19070 * THE SOFTWARE. 19071 */ 19072 19073Object.defineProperty(exports, "__esModule", { value: true }); 19074exports.cssClasses = exports.strings = void 0; 19075var strings = { 19076 ARIA_HIDDEN: 'aria-hidden', 19077 ROLE: 'role' 19078}; 19079exports.strings = strings; 19080var cssClasses = { 19081 HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg', 19082 HELPER_TEXT_VALIDATION_MSG_PERSISTENT: 'mdc-select-helper-text--validation-msg-persistent' 19083}; 19084exports.cssClasses = cssClasses; 19085 19086/***/ }), 19087 19088/***/ "./packages/mdc-select/helper-text/foundation.ts": 19089/*!*******************************************************!*\ 19090 !*** ./packages/mdc-select/helper-text/foundation.ts ***! 19091 \*******************************************************/ 19092/*! no static exports found */ 19093/***/ (function(module, exports, __webpack_require__) { 19094 19095"use strict"; 19096 19097/** 19098 * @license 19099 * Copyright 2018 Google Inc. 19100 * 19101 * Permission is hereby granted, free of charge, to any person obtaining a copy 19102 * of this software and associated documentation files (the "Software"), to deal 19103 * in the Software without restriction, including without limitation the rights 19104 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19105 * copies of the Software, and to permit persons to whom the Software is 19106 * furnished to do so, subject to the following conditions: 19107 * 19108 * The above copyright notice and this permission notice shall be included in 19109 * all copies or substantial portions of the Software. 19110 * 19111 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19112 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19113 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19114 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19115 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19116 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19117 * THE SOFTWARE. 19118 */ 19119 19120var __extends = this && this.__extends || function () { 19121 var _extendStatics = function extendStatics(d, b) { 19122 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 19123 d.__proto__ = b; 19124 } || function (d, b) { 19125 for (var p in b) { 19126 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 19127 } 19128 }; 19129 return _extendStatics(d, b); 19130 }; 19131 return function (d, b) { 19132 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 19133 _extendStatics(d, b); 19134 function __() { 19135 this.constructor = d; 19136 } 19137 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 19138 }; 19139}(); 19140var __assign = this && this.__assign || function () { 19141 __assign = Object.assign || function (t) { 19142 for (var s, i = 1, n = arguments.length; i < n; i++) { 19143 s = arguments[i]; 19144 for (var p in s) { 19145 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 19146 } 19147 } 19148 return t; 19149 }; 19150 return __assign.apply(this, arguments); 19151}; 19152Object.defineProperty(exports, "__esModule", { value: true }); 19153exports.MDCSelectHelperTextFoundation = void 0; 19154var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 19155var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts"); 19156var MDCSelectHelperTextFoundation = /** @class */function (_super) { 19157 __extends(MDCSelectHelperTextFoundation, _super); 19158 function MDCSelectHelperTextFoundation(adapter) { 19159 return _super.call(this, __assign(__assign({}, MDCSelectHelperTextFoundation.defaultAdapter), adapter)) || this; 19160 } 19161 Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", { 19162 get: function get() { 19163 return constants_1.cssClasses; 19164 }, 19165 enumerable: false, 19166 configurable: true 19167 }); 19168 Object.defineProperty(MDCSelectHelperTextFoundation, "strings", { 19169 get: function get() { 19170 return constants_1.strings; 19171 }, 19172 enumerable: false, 19173 configurable: true 19174 }); 19175 Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", { 19176 /** 19177 * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types. 19178 */ 19179 get: function get() { 19180 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 19181 return { 19182 addClass: function addClass() { 19183 return undefined; 19184 }, 19185 removeClass: function removeClass() { 19186 return undefined; 19187 }, 19188 hasClass: function hasClass() { 19189 return false; 19190 }, 19191 setAttr: function setAttr() { 19192 return undefined; 19193 }, 19194 getAttr: function getAttr() { 19195 return null; 19196 }, 19197 removeAttr: function removeAttr() { 19198 return undefined; 19199 }, 19200 setContent: function setContent() { 19201 return undefined; 19202 } 19203 }; 19204 // tslint:enable:object-literal-sort-keys 19205 }, 19206 enumerable: false, 19207 configurable: true 19208 }); 19209 /** 19210 * @return The ID of the helper text, or null if none is set. 19211 */ 19212 MDCSelectHelperTextFoundation.prototype.getId = function () { 19213 return this.adapter.getAttr('id'); 19214 }; 19215 /** 19216 * @return Whether the helper text is currently visible. 19217 */ 19218 MDCSelectHelperTextFoundation.prototype.isVisible = function () { 19219 return this.adapter.getAttr(constants_1.strings.ARIA_HIDDEN) !== 'true'; 19220 }; 19221 /** 19222 * Sets the content of the helper text field. 19223 */ 19224 MDCSelectHelperTextFoundation.prototype.setContent = function (content) { 19225 this.adapter.setContent(content); 19226 }; 19227 /** 19228 * Sets the helper text to act as a validation message. 19229 * By default, validation messages are hidden when the select is valid and 19230 * visible when the select is invalid. 19231 * 19232 * @param isValidation True to make the helper text act as an error validation 19233 * message. 19234 */ 19235 MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) { 19236 if (isValidation) { 19237 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 19238 } else { 19239 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 19240 } 19241 }; 19242 /** 19243 * Sets the persistency of the validation helper text. 19244 * This keeps the validation message visible even if the select is valid, 19245 * though it will be displayed in the normal (grey) color. 19246 */ 19247 MDCSelectHelperTextFoundation.prototype.setValidationMsgPersistent = function (isPersistent) { 19248 if (isPersistent) { 19249 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT); 19250 } else { 19251 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT); 19252 } 19253 }; 19254 /** 19255 * When acting as a validation message, shows/hides the helper text and 19256 * triggers alerts as necessary based on the select's validity. 19257 */ 19258 MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) { 19259 var isValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 19260 if (!isValidationMsg) { 19261 // Non-validating helper-text is always displayed and does not participate 19262 // in validation logic. 19263 return; 19264 } 19265 var isPersistentValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT); 19266 // Validating helper text is displayed if select is invalid, unless it is 19267 // set as persistent, in which case it always displays. 19268 var msgShouldDisplay = !selectIsValid || isPersistentValidationMsg; 19269 if (msgShouldDisplay) { 19270 this.showToScreenReader(); 19271 // In addition to displaying, also trigger an alert if the select 19272 // has become invalid. 19273 if (!selectIsValid) { 19274 this.adapter.setAttr(constants_1.strings.ROLE, 'alert'); 19275 } else { 19276 this.adapter.removeAttr(constants_1.strings.ROLE); 19277 } 19278 return; 19279 } 19280 // Hide everything. 19281 this.adapter.removeAttr(constants_1.strings.ROLE); 19282 this.hide(); 19283 }; 19284 /** 19285 * Makes the helper text visible to screen readers. 19286 */ 19287 MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () { 19288 this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN); 19289 }; 19290 /** 19291 * Hides the help text from screen readers. 19292 */ 19293 MDCSelectHelperTextFoundation.prototype.hide = function () { 19294 this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true'); 19295 }; 19296 return MDCSelectHelperTextFoundation; 19297}(foundation_1.MDCFoundation); 19298exports.MDCSelectHelperTextFoundation = MDCSelectHelperTextFoundation; 19299// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 19300exports.default = MDCSelectHelperTextFoundation; 19301 19302/***/ }), 19303 19304/***/ "./packages/mdc-select/helper-text/index.ts": 19305/*!**************************************************!*\ 19306 !*** ./packages/mdc-select/helper-text/index.ts ***! 19307 \**************************************************/ 19308/*! no static exports found */ 19309/***/ (function(module, exports, __webpack_require__) { 19310 19311"use strict"; 19312 19313/** 19314 * @license 19315 * Copyright 2019 Google Inc. 19316 * 19317 * Permission is hereby granted, free of charge, to any person obtaining a copy 19318 * of this software and associated documentation files (the "Software"), to deal 19319 * in the Software without restriction, including without limitation the rights 19320 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19321 * copies of the Software, and to permit persons to whom the Software is 19322 * furnished to do so, subject to the following conditions: 19323 * 19324 * The above copyright notice and this permission notice shall be included in 19325 * all copies or substantial portions of the Software. 19326 * 19327 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19328 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19329 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19330 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19331 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19332 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19333 * THE SOFTWARE. 19334 */ 19335 19336var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 19337 if (k2 === undefined) k2 = k; 19338 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 19339 return m[k]; 19340 } }); 19341} : function (o, m, k, k2) { 19342 if (k2 === undefined) k2 = k; 19343 o[k2] = m[k]; 19344}); 19345var __exportStar = this && this.__exportStar || function (m, exports) { 19346 for (var p in m) { 19347 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 19348 } 19349}; 19350Object.defineProperty(exports, "__esModule", { value: true }); 19351exports.helperTextStrings = exports.helperTextCssClasses = void 0; 19352__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-select/helper-text/adapter.ts"), exports); 19353__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-select/helper-text/component.ts"), exports); 19354__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts"), exports); 19355var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts"); 19356Object.defineProperty(exports, "helperTextCssClasses", { enumerable: true, get: function get() { 19357 return constants_1.cssClasses; 19358 } }); 19359Object.defineProperty(exports, "helperTextStrings", { enumerable: true, get: function get() { 19360 return constants_1.strings; 19361 } }); 19362 19363/***/ }), 19364 19365/***/ "./packages/mdc-select/icon/adapter.ts": 19366/*!*********************************************!*\ 19367 !*** ./packages/mdc-select/icon/adapter.ts ***! 19368 \*********************************************/ 19369/*! no static exports found */ 19370/***/ (function(module, exports, __webpack_require__) { 19371 19372"use strict"; 19373 19374/** 19375 * @license 19376 * Copyright 2018 Google Inc. 19377 * 19378 * Permission is hereby granted, free of charge, to any person obtaining a copy 19379 * of this software and associated documentation files (the "Software"), to deal 19380 * in the Software without restriction, including without limitation the rights 19381 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19382 * copies of the Software, and to permit persons to whom the Software is 19383 * furnished to do so, subject to the following conditions: 19384 * 19385 * The above copyright notice and this permission notice shall be included in 19386 * all copies or substantial portions of the Software. 19387 * 19388 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19389 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19390 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19391 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19392 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19393 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19394 * THE SOFTWARE. 19395 */ 19396 19397Object.defineProperty(exports, "__esModule", { value: true }); 19398 19399/***/ }), 19400 19401/***/ "./packages/mdc-select/icon/component.ts": 19402/*!***********************************************!*\ 19403 !*** ./packages/mdc-select/icon/component.ts ***! 19404 \***********************************************/ 19405/*! no static exports found */ 19406/***/ (function(module, exports, __webpack_require__) { 19407 19408"use strict"; 19409 19410/** 19411 * @license 19412 * Copyright 2018 Google Inc. 19413 * 19414 * Permission is hereby granted, free of charge, to any person obtaining a copy 19415 * of this software and associated documentation files (the "Software"), to deal 19416 * in the Software without restriction, including without limitation the rights 19417 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19418 * copies of the Software, and to permit persons to whom the Software is 19419 * furnished to do so, subject to the following conditions: 19420 * 19421 * The above copyright notice and this permission notice shall be included in 19422 * all copies or substantial portions of the Software. 19423 * 19424 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19425 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19426 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19427 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19428 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19429 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19430 * THE SOFTWARE. 19431 */ 19432 19433var __extends = this && this.__extends || function () { 19434 var _extendStatics = function extendStatics(d, b) { 19435 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 19436 d.__proto__ = b; 19437 } || function (d, b) { 19438 for (var p in b) { 19439 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 19440 } 19441 }; 19442 return _extendStatics(d, b); 19443 }; 19444 return function (d, b) { 19445 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 19446 _extendStatics(d, b); 19447 function __() { 19448 this.constructor = d; 19449 } 19450 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 19451 }; 19452}(); 19453Object.defineProperty(exports, "__esModule", { value: true }); 19454exports.MDCSelectIcon = void 0; 19455var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 19456var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts"); 19457var MDCSelectIcon = /** @class */function (_super) { 19458 __extends(MDCSelectIcon, _super); 19459 function MDCSelectIcon() { 19460 return _super !== null && _super.apply(this, arguments) || this; 19461 } 19462 MDCSelectIcon.attachTo = function (root) { 19463 return new MDCSelectIcon(root); 19464 }; 19465 Object.defineProperty(MDCSelectIcon.prototype, "foundationForSelect", { 19466 // Provided for access by MDCSelect component 19467 get: function get() { 19468 return this.foundation; 19469 }, 19470 enumerable: false, 19471 configurable: true 19472 }); 19473 MDCSelectIcon.prototype.getDefaultFoundation = function () { 19474 var _this = this; 19475 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 19476 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 19477 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 19478 var adapter = { 19479 getAttr: function getAttr(attr) { 19480 return _this.root.getAttribute(attr); 19481 }, 19482 setAttr: function setAttr(attr, value) { 19483 return _this.root.setAttribute(attr, value); 19484 }, 19485 removeAttr: function removeAttr(attr) { 19486 return _this.root.removeAttribute(attr); 19487 }, 19488 setContent: function setContent(content) { 19489 _this.root.textContent = content; 19490 }, 19491 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 19492 return _this.listen(evtType, handler); 19493 }, 19494 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 19495 return _this.unlisten(evtType, handler); 19496 }, 19497 notifyIconAction: function notifyIconAction() { 19498 return _this.emit(foundation_1.MDCSelectIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */); 19499 } 19500 }; 19501 // tslint:enable:object-literal-sort-keys 19502 return new foundation_1.MDCSelectIconFoundation(adapter); 19503 }; 19504 return MDCSelectIcon; 19505}(component_1.MDCComponent); 19506exports.MDCSelectIcon = MDCSelectIcon; 19507 19508/***/ }), 19509 19510/***/ "./packages/mdc-select/icon/constants.ts": 19511/*!***********************************************!*\ 19512 !*** ./packages/mdc-select/icon/constants.ts ***! 19513 \***********************************************/ 19514/*! no static exports found */ 19515/***/ (function(module, exports, __webpack_require__) { 19516 19517"use strict"; 19518 19519/** 19520 * @license 19521 * Copyright 2018 Google Inc. 19522 * 19523 * Permission is hereby granted, free of charge, to any person obtaining a copy 19524 * of this software and associated documentation files (the "Software"), to deal 19525 * in the Software without restriction, including without limitation the rights 19526 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19527 * copies of the Software, and to permit persons to whom the Software is 19528 * furnished to do so, subject to the following conditions: 19529 * 19530 * The above copyright notice and this permission notice shall be included in 19531 * all copies or substantial portions of the Software. 19532 * 19533 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19534 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19535 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19536 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19537 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19538 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19539 * THE SOFTWARE. 19540 */ 19541 19542Object.defineProperty(exports, "__esModule", { value: true }); 19543exports.strings = void 0; 19544var strings = { 19545 ICON_EVENT: 'MDCSelect:icon', 19546 ICON_ROLE: 'button' 19547}; 19548exports.strings = strings; 19549 19550/***/ }), 19551 19552/***/ "./packages/mdc-select/icon/foundation.ts": 19553/*!************************************************!*\ 19554 !*** ./packages/mdc-select/icon/foundation.ts ***! 19555 \************************************************/ 19556/*! no static exports found */ 19557/***/ (function(module, exports, __webpack_require__) { 19558 19559"use strict"; 19560 19561/** 19562 * @license 19563 * Copyright 2018 Google Inc. 19564 * 19565 * Permission is hereby granted, free of charge, to any person obtaining a copy 19566 * of this software and associated documentation files (the "Software"), to deal 19567 * in the Software without restriction, including without limitation the rights 19568 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19569 * copies of the Software, and to permit persons to whom the Software is 19570 * furnished to do so, subject to the following conditions: 19571 * 19572 * The above copyright notice and this permission notice shall be included in 19573 * all copies or substantial portions of the Software. 19574 * 19575 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19576 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19577 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19578 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19579 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19580 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19581 * THE SOFTWARE. 19582 */ 19583 19584var __extends = this && this.__extends || function () { 19585 var _extendStatics = function extendStatics(d, b) { 19586 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 19587 d.__proto__ = b; 19588 } || function (d, b) { 19589 for (var p in b) { 19590 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 19591 } 19592 }; 19593 return _extendStatics(d, b); 19594 }; 19595 return function (d, b) { 19596 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 19597 _extendStatics(d, b); 19598 function __() { 19599 this.constructor = d; 19600 } 19601 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 19602 }; 19603}(); 19604var __assign = this && this.__assign || function () { 19605 __assign = Object.assign || function (t) { 19606 for (var s, i = 1, n = arguments.length; i < n; i++) { 19607 s = arguments[i]; 19608 for (var p in s) { 19609 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 19610 } 19611 } 19612 return t; 19613 }; 19614 return __assign.apply(this, arguments); 19615};
vendor: 2,505 bytes, lines 19616-19674
19616Object.defineProperty(exports, "__esModule", { value: true }); 19617exports.MDCSelectIconFoundation = void 0; 19618var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 19619var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts"); 19620var INTERACTION_EVENTS = ['click', 'keydown']; 19621var MDCSelectIconFoundation = /** @class */function (_super) { 19622 __extends(MDCSelectIconFoundation, _super); 19623 function MDCSelectIconFoundation(adapter) { 19624 var _this = _super.call(this, __assign(__assign({}, MDCSelectIconFoundation.defaultAdapter), adapter)) || this; 19625 _this.savedTabIndex_ = null; 19626 _this.interactionHandler_ = function (evt) { 19627 return _this.handleInteraction(evt); 19628 }; 19629 return _this; 19630 } 19631 Object.defineProperty(MDCSelectIconFoundation, "strings", { 19632 get: function get() { 19633 return constants_1.strings; 19634 }, 19635 enumerable: false, 19636 configurable: true 19637 }); 19638 Object.defineProperty(MDCSelectIconFoundation, "defaultAdapter", { 19639 /** 19640 * See {@link MDCSelectIconAdapter} for typing information on parameters and return types. 19641 */ 19642 get: function get() { 19643 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 19644 return { 19645 getAttr: function getAttr() { 19646 return null; 19647 }, 19648 setAttr: function setAttr() { 19649 return undefined; 19650 }, 19651 removeAttr: function removeAttr() { 19652 return undefined; 19653 }, 19654 setContent: function setContent() { 19655 return undefined; 19656 }, 19657 registerInteractionHandler: function registerInteractionHandler() { 19658 return undefined; 19659 }, 19660 deregisterInteractionHandler: function deregisterInteractionHandler() { 19661 return undefined; 19662 }, 19663 notifyIconAction: function notifyIconAction() { 19664 return undefined; 19665 } 19666 }; 19667 // tslint:enable:object-literal-sort-keys 19668 }, 19669 enumerable: false, 19670 configurable: true 19671 }); 19672 MDCSelectIconFoundation.prototype.init = function () { 19673 var _this = this; 19674 this.savedTabIndex_ = this.adapter.getAttr('tabindex');
19675 INTERACTION_EVENTS.forEach(function (evtType) { 19676 _this.adapter.registerInteractionHandler(evtType, _this.interactionHandler_); 19677 }); 19678 }; 19679 MDCSelectIconFoundation.prototype.destroy = function () { 19680 var _this = this; 19681 INTERACTION_EVENTS.forEach(function (evtType) { 19682 _this.adapter.deregisterInteractionHandler(evtType, _this.interactionHandler_); 19683 }); 19684 }; 19685 MDCSelectIconFoundation.prototype.setDisabled = function (disabled) { 19686 if (!this.savedTabIndex_) { 19687 return; 19688 } 19689 if (disabled) { 19690 this.adapter.setAttr('tabindex', '-1'); 19691 this.adapter.removeAttr('role'); 19692 } else { 19693 this.adapter.setAttr('tabindex', this.savedTabIndex_
vendor: 7,729 bytes, lines 19693-19867
19693); 19694 this.adapter.setAttr('role', constants_1.strings.ICON_ROLE); 19695 } 19696 }; 19697 MDCSelectIconFoundation.prototype.setAriaLabel = function (label) { 19698 this.adapter.setAttr('aria-label', label); 19699 }; 19700 MDCSelectIconFoundation.prototype.setContent = function (content) { 19701 this.adapter.setContent(content); 19702 }; 19703 MDCSelectIconFoundation.prototype.handleInteraction = function (evt) { 19704 var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13; 19705 if (evt.type === 'click' || isEnterKey) { 19706 this.adapter.notifyIconAction(); 19707 } 19708 }; 19709 return MDCSelectIconFoundation; 19710}(foundation_1.MDCFoundation); 19711exports.MDCSelectIconFoundation = MDCSelectIconFoundation; 19712// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 19713exports.default = MDCSelectIconFoundation; 19714 19715/***/ }), 19716 19717/***/ "./packages/mdc-select/icon/index.ts": 19718/*!*******************************************!*\ 19719 !*** ./packages/mdc-select/icon/index.ts ***! 19720 \*******************************************/ 19721/*! no static exports found */ 19722/***/ (function(module, exports, __webpack_require__) { 19723 19724"use strict"; 19725 19726/** 19727 * @license 19728 * Copyright 2019 Google Inc. 19729 * 19730 * Permission is hereby granted, free of charge, to any person obtaining a copy 19731 * of this software and associated documentation files (the "Software"), to deal 19732 * in the Software without restriction, including without limitation the rights 19733 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19734 * copies of the Software, and to permit persons to whom the Software is 19735 * furnished to do so, subject to the following conditions: 19736 * 19737 * The above copyright notice and this permission notice shall be included in 19738 * all copies or substantial portions of the Software. 19739 * 19740 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19741 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19742 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19743 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19744 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19745 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19746 * THE SOFTWARE. 19747 */ 19748 19749var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 19750 if (k2 === undefined) k2 = k; 19751 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 19752 return m[k]; 19753 } }); 19754} : function (o, m, k, k2) { 19755 if (k2 === undefined) k2 = k; 19756 o[k2] = m[k]; 19757}); 19758var __exportStar = this && this.__exportStar || function (m, exports) { 19759 for (var p in m) { 19760 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 19761 } 19762}; 19763Object.defineProperty(exports, "__esModule", { value: true }); 19764exports.iconStrings = void 0; 19765__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-select/icon/adapter.ts"), exports); 19766__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-select/icon/component.ts"), exports); 19767__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts"), exports); 19768var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts"); 19769Object.defineProperty(exports, "iconStrings", { enumerable: true, get: function get() { 19770 return constants_1.strings; 19771 } }); 19772 19773/***/ }), 19774 19775/***/ "./packages/mdc-select/index.ts": 19776/*!**************************************!*\ 19777 !*** ./packages/mdc-select/index.ts ***! 19778 \**************************************/ 19779/*! no static exports found */ 19780/***/ (function(module, exports, __webpack_require__) { 19781 19782"use strict"; 19783 19784/** 19785 * @license 19786 * Copyright 2019 Google Inc. 19787 * 19788 * Permission is hereby granted, free of charge, to any person obtaining a copy 19789 * of this software and associated documentation files (the "Software"), to deal 19790 * in the Software without restriction, including without limitation the rights 19791 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19792 * copies of the Software, and to permit persons to whom the Software is 19793 * furnished to do so, subject to the following conditions: 19794 * 19795 * The above copyright notice and this permission notice shall be included in 19796 * all copies or substantial portions of the Software. 19797 * 19798 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19799 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19800 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19801 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19802 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19803 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19804 * THE SOFTWARE. 19805 */ 19806 19807var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 19808 if (k2 === undefined) k2 = k; 19809 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 19810 return m[k]; 19811 } }); 19812} : function (o, m, k, k2) { 19813 if (k2 === undefined) k2 = k; 19814 o[k2] = m[k]; 19815}); 19816var __exportStar = this && this.__exportStar || function (m, exports) { 19817 for (var p in m) { 19818 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 19819 } 19820}; 19821Object.defineProperty(exports, "__esModule", { value: true }); 19822__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-select/adapter.ts"), exports); 19823__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-select/component.ts"), exports); 19824__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"), exports); 19825__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts"), exports); 19826__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-select/types.ts"), exports); 19827__exportStar(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-select/helper-text/index.ts"), exports); 19828__exportStar(__webpack_require__(/*! ./icon/index */ "./packages/mdc-select/icon/index.ts"), exports); 19829 19830/***/ }), 19831 19832/***/ "./packages/mdc-select/types.ts": 19833/*!**************************************!*\ 19834 !*** ./packages/mdc-select/types.ts ***! 19835 \**************************************/ 19836/*! no static exports found */ 19837/***/ (function(module, exports, __webpack_require__) { 19838 19839"use strict"; 19840 19841/** 19842 * @license 19843 * Copyright 2019 Google Inc. 19844 * 19845 * Permission is hereby granted, free of charge, to any person obtaining a copy 19846 * of this software and associated documentation files (the "Software"), to deal 19847 * in the Software without restriction, including without limitation the rights 19848 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19849 * copies of the Software, and to permit persons to whom the Software is 19850 * furnished to do so, subject to the following conditions: 19851 * 19852 * The above copyright notice and this permission notice shall be included in 19853 * all copies or substantial portions of the Software. 19854 * 19855 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19856 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19857 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19858 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19859 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19860 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19861 * THE SOFTWARE. 19862 */ 19863 19864Object.defineProperty(exports, "__esModule", { value: true }); 19865 19866/***/ }), 19867
vendor: 7,794 bytes, lines 19868-20039
19868/***/ "./packages/mdc-slider/adapter.ts": 19869/*!****************************************!*\ 19870 !*** ./packages/mdc-slider/adapter.ts ***! 19871 \****************************************/ 19872/*! no static exports found */ 19873/***/ (function(module, exports, __webpack_require__) { 19874 19875"use strict"; 19876 19877/** 19878 * @license 19879 * Copyright 2020 Google Inc. 19880 * 19881 * Permission is hereby granted, free of charge, to any person obtaining a copy 19882 * of this software and associated documentation files (the "Software"), to deal 19883 * in the Software without restriction, including without limitation the rights 19884 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19885 * copies of the Software, and to permit persons to whom the Software is 19886 * furnished to do so, subject to the following conditions: 19887 * 19888 * The above copyright notice and this permission notice shall be included in 19889 * all copies or substantial portions of the Software. 19890 * 19891 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19892 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19893 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19894 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19895 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19896 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19897 * THE SOFTWARE. 19898 */ 19899 19900Object.defineProperty(exports, "__esModule", { value: true }); 19901 19902/***/ }), 19903 19904/***/ "./packages/mdc-slider/component.ts": 19905/*!******************************************!*\ 19906 !*** ./packages/mdc-slider/component.ts ***! 19907 \******************************************/ 19908/*! no static exports found */ 19909/***/ (function(module, exports, __webpack_require__) { 19910 19911"use strict"; 19912 19913/** 19914 * @license 19915 * Copyright 2020 Google Inc. 19916 * 19917 * Permission is hereby granted, free of charge, to any person obtaining a copy 19918 * of this software and associated documentation files (the "Software"), to deal 19919 * in the Software without restriction, including without limitation the rights 19920 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19921 * copies of the Software, and to permit persons to whom the Software is 19922 * furnished to do so, subject to the following conditions: 19923 * 19924 * The above copyright notice and this permission notice shall be included in 19925 * all copies or substantial portions of the Software. 19926 * 19927 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19928 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19929 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19930 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19931 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19932 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19933 * THE SOFTWARE. 19934 */ 19935 19936var __extends = this && this.__extends || function () { 19937 var _extendStatics = function extendStatics(d, b) { 19938 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 19939 d.__proto__ = b; 19940 } || function (d, b) { 19941 for (var p in b) { 19942 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 19943 } 19944 }; 19945 return _extendStatics(d, b); 19946 }; 19947 return function (d, b) { 19948 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 19949 _extendStatics(d, b); 19950 function __() { 19951 this.constructor = d; 19952 } 19953 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 19954 }; 19955}(); 19956var __assign = this && this.__assign || function () { 19957 __assign = Object.assign || function (t) { 19958 for (var s, i = 1, n = arguments.length; i < n; i++) { 19959 s = arguments[i]; 19960 for (var p in s) { 19961 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 19962 } 19963 } 19964 return t; 19965 }; 19966 return __assign.apply(this, arguments); 19967}; 19968Object.defineProperty(exports, "__esModule", { value: true }); 19969exports.MDCSlider = void 0; 19970var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 19971var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 19972var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 19973var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 19974var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 19975var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"); 19976var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts"); 19977var types_1 = __webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts"); 19978/** Vanilla JS implementation of slider component. */ 19979var MDCSlider = /** @class */function (_super) { 19980 __extends(MDCSlider, _super); 19981 function MDCSlider() { 19982 var _this = _super !== null && _super.apply(this, arguments) || this; 19983 _this.skipInitialUIUpdate = false; 19984 // Function that maps a slider value to the value of the `aria-valuetext` 19985 // attribute on the thumb element. 19986 _this.valueToAriaValueTextFn = null; 19987 return _this; 19988 } 19989 MDCSlider.attachTo = function (root, options) { 19990 if (options === void 0) { 19991 options = {}; 19992 } 19993 return new MDCSlider(root, undefined, options); 19994 }; 19995 MDCSlider.prototype.getDefaultFoundation = function () { 19996 var _this = this; 19997 // tslint:disable:object-literal-sort-keys Methods should be in the same 19998 // order as the adapter interface. 19999 var adapter = { 20000 hasClass: function hasClass(className) { 20001 return _this.root.classList.contains(className); 20002 }, 20003 addClass: function addClass(className) { 20004 _this.root.classList.add(className); 20005 }, 20006 removeClass: function removeClass(className) { 20007 _this.root.classList.remove(className); 20008 }, 20009 addThumbClass: function addThumbClass(className, thumb) { 20010 _this.getThumbEl(thumb).classList.add(className); 20011 }, 20012 removeThumbClass: function removeThumbClass(className, thumb) { 20013 _this.getThumbEl(thumb).classList.remove(className); 20014 }, 20015 getAttribute: function getAttribute(attribute) { 20016 return _this.root.getAttribute(attribute); 20017 }, 20018 getInputValue: function getInputValue(thumb) { 20019 return _this.getInput(thumb).value; 20020 }, 20021 setInputValue: function setInputValue(value, thumb) { 20022 _this.getInput(thumb).value = value; 20023 }, 20024 getInputAttribute: function getInputAttribute(attribute, thumb) { 20025 return _this.getInput(thumb).getAttribute(attribute); 20026 }, 20027 setInputAttribute: function setInputAttribute(attribute, value, thumb) { 20028 _this.getInput(thumb).setAttribute(attribute, value); 20029 }, 20030 removeInputAttribute: function removeInputAttribute(attribute, thumb) { 20031 _this.getInput(thumb).removeAttribute(attribute); 20032 }, 20033 focusInput: function focusInput(thumb) { 20034 _this.getInput(thumb).focus(); 20035 }, 20036 isInputFocused: function isInputFocused(thumb) { 20037 return _this.getInput(thumb) === document.activeElement; 20038 }, 20039
20039getThumbKnobWidth: function getThumbKnobWidth(thumb) { 20040 return _this.getThumbEl(thumb).querySelector("." + constants_1.cssClasse
vendor: 1,440 bytes, lines 20040-20064
20040s.THUMB_KNOB).getBoundingClientRect().width; 20041 }, 20042 getThumbBoundingClientRect: function getThumbBoundingClientRect(thumb) { 20043 return _this.getThumbEl(thumb).getBoundingClientRect(); 20044 }, 20045 getBoundingClientRect: function getBoundingClientRect() { 20046 return _this.root.getBoundingClientRect(); 20047 }, 20048 isRTL: function isRTL() { 20049 return getComputedStyle(_this.root).direction === 'rtl'; 20050 }, 20051 setThumbStyleProperty: function setThumbStyleProperty(propertyName, value, thumb) { 20052 _this.getThumbEl(thumb).style.setProperty(propertyName, value); 20053 }, 20054 removeThumbStyleProperty: function removeThumbStyleProperty(propertyName, thumb) { 20055 _this.getThumbEl(thumb).style.removeProperty(propertyName); 20056 }, 20057 setTrackActiveStyleProperty: function setTrackActiveStyleProperty(propertyName, value) { 20058 _this.trackActive.style.setProperty(propertyName, value); 20059 }, 20060 removeTrackActiveStyleProperty: function removeTrackActiveStyleProperty(propertyName) { 20061 _this.trackActive.style.removeProperty(propertyName); 20062 }, 20063 setValueIndicatorText: function setValueIndicatorText(value, thumb) { 20064 var valueIndicatorEl = _this.getThumbEl(thumb).querySelector("." + constants_1.cssClasse
20064s.VALUE_INDICATOR_TEXT); 20065 valueIndicatorEl.textContent = String(value); 20066 }, 20067 getValueToAriaValueTextFn: function getValueToAriaValueTextFn() { 20068 return _this.valueToAriaValueTextFn; 20069 }, 20070 updateTickMarks: function updateTickMarks(tickMarks) { 20071 var tickMarksContainer = _this.root.querySelector("." + constants_1.cssClasses.TICK_MARKS_CONTAINER); 20072 if (!tickMarksContainer) { 20073 tickMarksContainer = document.createElement('div'); 20074 tickMarksContainer.classList.add(constants_1.cssClasses.TICK_MARKS_CONTAINER); 20075 var track = _this.root.querySelector("." + constants_1.cssClasses.TRACK); 20076 track.appendChild(tickMarksContainer); 20077 } 20078 if (tickMarks.length !== tickMarksContainer.children.length) { 20079 tickMarksContainer.innerHTML = '';
vendor: 10,833 bytes, lines 20079-20296
20079 20080 _this.addTickMarks(tickMarksContainer, tickMarks); 20081 } else { 20082 _this.updateTickMarks(tickMarksContainer, tickMarks); 20083 } 20084 }, 20085 setPointerCapture: function setPointerCapture(pointerId) { 20086 _this.root.setPointerCapture(pointerId); 20087 }, 20088 emitChangeEvent: function emitChangeEvent(value, thumb) { 20089 _this.emit(constants_1.events.CHANGE, { value: value, thumb: thumb }); 20090 }, 20091 emitInputEvent: function emitInputEvent(value, thumb) { 20092 _this.emit(constants_1.events.INPUT, { value: value, thumb: thumb }); 20093 }, 20094 emitDragStartEvent: function emitDragStartEvent(_, thumb) { 20095 // Emitting event is not yet implemented. See issue: 20096 // https://github.com/material-components/material-components-web/issues/6448 20097 _this.getRipple(thumb).activate(); 20098 }, 20099 emitDragEndEvent: function emitDragEndEvent(_, thumb) { 20100 // Emitting event is not yet implemented. See issue: 20101 // https://github.com/material-components/material-components-web/issues/6448 20102 _this.getRipple(thumb).deactivate(); 20103 }, 20104 registerEventHandler: function registerEventHandler(evtType, handler) { 20105 _this.listen(evtType, handler); 20106 }, 20107 deregisterEventHandler: function deregisterEventHandler(evtType, handler) { 20108 _this.unlisten(evtType, handler); 20109 }, 20110 registerThumbEventHandler: function registerThumbEventHandler(thumb, evtType, handler) { 20111 _this.getThumbEl(thumb).addEventListener(evtType, handler); 20112 }, 20113 deregisterThumbEventHandler: function deregisterThumbEventHandler(thumb, evtType, handler) { 20114 _this.getThumbEl(thumb).removeEventListener(evtType, handler); 20115 }, 20116 registerInputEventHandler: function registerInputEventHandler(thumb, evtType, handler) { 20117 _this.getInput(thumb).addEventListener(evtType, handler); 20118 }, 20119 deregisterInputEventHandler: function deregisterInputEventHandler(thumb, evtType, handler) { 20120 _this.getInput(thumb).removeEventListener(evtType, handler); 20121 }, 20122 registerBodyEventHandler: function registerBodyEventHandler(evtType, handler) { 20123 document.body.addEventListener(evtType, handler); 20124 }, 20125 deregisterBodyEventHandler: function deregisterBodyEventHandler(evtType, handler) { 20126 document.body.removeEventListener(evtType, handler); 20127 }, 20128 registerWindowEventHandler: function registerWindowEventHandler(evtType, handler) { 20129 window.addEventListener(evtType, handler); 20130 }, 20131 deregisterWindowEventHandler: function deregisterWindowEventHandler(evtType, handler) { 20132 window.removeEventListener(evtType, handler); 20133 } 20134 }; 20135 return new foundation_2.MDCSliderFoundation(adapter); 20136 }; 20137 /** 20138 * Initializes component, with the following options: 20139 * - `skipInitialUIUpdate`: Whether to skip updating the UI when initially 20140 * syncing with the DOM. This should be enabled when the slider position 20141 * is set before component initialization. 20142 */ 20143 MDCSlider.prototype.initialize = function (_a) { 20144 var _b = _a === void 0 ? {} : _a, 20145 skipInitialUIUpdate = _b.skipInitialUIUpdate; 20146 this.inputs = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.INPUT)); 20147 this.thumbs = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.THUMB)); 20148 this.trackActive = this.root.querySelector("." + constants_1.cssClasses.TRACK_ACTIVE); 20149 this.ripples = this.createRipples(); 20150 if (skipInitialUIUpdate) { 20151 this.skipInitialUIUpdate = true; 20152 } 20153 }; 20154 MDCSlider.prototype.initialSyncWithDOM = function () { 20155 this.foundation.layout({ skipUpdateUI: this.skipInitialUIUpdate }); 20156 }; 20157 /** Redraws UI based on DOM (e.g. element dimensions, RTL). */ 20158 MDCSlider.prototype.layout = function () { 20159 this.foundation.layout(); 20160 }; 20161 MDCSlider.prototype.getValueStart = function () { 20162 return this.foundation.getValueStart(); 20163 }; 20164 MDCSlider.prototype.setValueStart = function (valueStart) { 20165 this.foundation.setValueStart(valueStart); 20166 }; 20167 MDCSlider.prototype.getValue = function () { 20168 return this.foundation.getValue(); 20169 }; 20170 MDCSlider.prototype.setValue = function (value) { 20171 this.foundation.setValue(value); 20172 }; 20173 /** @return Slider disabled state. */ 20174 MDCSlider.prototype.getDisabled = function () { 20175 return this.foundation.getDisabled(); 20176 }; 20177 /** Sets slider disabled state. */ 20178 MDCSlider.prototype.setDisabled = function (disabled) { 20179 this.foundation.setDisabled(disabled); 20180 }; 20181 /** 20182 * Sets a function that maps the slider value to the value of the 20183 * `aria-valuetext` attribute on the thumb element. 20184 */ 20185 MDCSlider.prototype.setValueToAriaValueTextFn = function (mapFn) { 20186 this.valueToAriaValueTextFn = mapFn; 20187 }; 20188 MDCSlider.prototype.getThumbEl = function (thumb) { 20189 return thumb === types_1.Thumb.END ? this.thumbs[this.thumbs.length - 1] : this.thumbs[0]; 20190 }; 20191 MDCSlider.prototype.getInput = function (thumb) { 20192 return thumb === types_1.Thumb.END ? this.inputs[this.inputs.length - 1] : this.inputs[0]; 20193 }; 20194 MDCSlider.prototype.getRipple = function (thumb) { 20195 return thumb === types_1.Thumb.END ? this.ripples[this.ripples.length - 1] : this.ripples[0]; 20196 }; 20197 /** Adds tick mark elements to the given container. */ 20198 MDCSlider.prototype.addTickMarks = function (tickMarkContainer, tickMarks) { 20199 var fragment = document.createDocumentFragment(); 20200 for (var i = 0; i < tickMarks.length; i++) { 20201 var div = document.createElement('div'); 20202 var tickMarkClass = tickMarks[i] === types_1.TickMark.ACTIVE ? constants_1.cssClasses.TICK_MARK_ACTIVE : constants_1.cssClasses.TICK_MARK_INACTIVE; 20203 div.classList.add(tickMarkClass); 20204 fragment.appendChild(div); 20205 } 20206 tickMarkContainer.appendChild(fragment); 20207 }; 20208 /** Updates tick mark elements' classes in the given container. */ 20209 MDCSlider.prototype.updateTickMarks = function (tickMarkContainer, tickMarks) { 20210 var tickMarkEls = Array.from(tickMarkContainer.children); 20211 for (var i = 0; i < tickMarkEls.length; i++) { 20212 if (tickMarks[i] === types_1.TickMark.ACTIVE) { 20213 tickMarkEls[i].classList.add(constants_1.cssClasses.TICK_MARK_ACTIVE); 20214 tickMarkEls[i].classList.remove(constants_1.cssClasses.TICK_MARK_INACTIVE); 20215 } else { 20216 tickMarkEls[i].classList.add(constants_1.cssClasses.TICK_MARK_INACTIVE); 20217 tickMarkEls[i].classList.remove(constants_1.cssClasses.TICK_MARK_ACTIVE); 20218 } 20219 } 20220 }; 20221 /** Initializes thumb ripples. */ 20222 MDCSlider.prototype.createRipples = function () { 20223 var ripples = []; 20224 var rippleSurfaces = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.THUMB)); 20225 var _loop_1 = function _loop_1(i) { 20226 var rippleSurface = rippleSurfaces[i]; 20227 // Use the corresponding input as the focus source for the ripple (i.e. 20228 // when the input is focused, the ripple is in the focused state). 20229 var input = this_1.inputs[i]; 20230 var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this_1)), { addClass: function addClass(className) { 20231 rippleSurface.classList.add(className); 20232 }, computeBoundingRect: function computeBoundingRect() { 20233 return rippleSurface.getBoundingClientRect(); 20234 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 20235 input.removeEventListener(evtType, handler); 20236 }, isSurfaceActive: function isSurfaceActive() { 20237 return ponyfill_1.matches(input, ':active'); 20238 }, isUnbounded: function isUnbounded() { 20239 return true; 20240 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 20241 input.addEventListener(evtType, handler, events_1.applyPassive()); 20242 }, removeClass: function removeClass(className) { 20243 rippleSurface.classList.remove(className); 20244 }, updateCssVariable: function updateCssVariable(varName, value) { 20245 rippleSurface.style.setProperty(varName, value); 20246 } }); 20247 var ripple = new component_2.MDCRipple(rippleSurface, new foundation_1.MDCRippleFoundation(adapter)); 20248 ripple.unbounded = true; 20249 ripples.push(ripple); 20250 }; 20251 var this_1 = this; 20252 for (var i = 0; i < rippleSurfaces.length; i++) { 20253 _loop_1(i); 20254 } 20255 return ripples; 20256 }; 20257 return MDCSlider; 20258}(component_1.MDCComponent); 20259exports.MDCSlider = MDCSlider; 20260 20261/***/ }), 20262 20263/***/ "./packages/mdc-slider/constants.ts": 20264/*!******************************************!*\ 20265 !*** ./packages/mdc-slider/constants.ts ***! 20266 \******************************************/ 20267/*! no static exports found */ 20268/***/ (function(module, exports, __webpack_require__) { 20269 20270"use strict"; 20271 20272/** 20273 * @license 20274 * Copyright 2020 Google Inc. 20275 * 20276 * Permission is hereby granted, free of charge, to any person obtaining a copy 20277 * of this software and associated documentation files (the "Software"), to deal 20278 * in the Software without restriction, including without limitation the rights 20279 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20280 * copies of the Software, and to permit persons to whom the Software is 20281 * furnished to do so, subject to the following conditions: 20282 * 20283 * The above copyright notice and this permission notice shall be included in 20284 * all copies or substantial portions of the Software. 20285 * 20286 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20287 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20288 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20289 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20290 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20291 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20292 * THE SOFTWARE. 20293 */ 20294 20295Object.defineProperty(exports, "__esModule", { value: true }); 20296exports.
20296events = exports.attributes = exports.numbers = exports.cssClasses = void 0; 20297/** Slider element classes. */ 20298exports.cssClasses = { 20299 DISABLED: 'mdc-slider--disabled', 20300 DISCRETE: 'mdc-slider--discrete', 20301 INPUT: 'mdc-slider__input', 20302 RANGE: 'mdc-slider--range', 20303 THUMB: 'mdc-slider__thumb', 20304 // Applied when thumb is in the focused state. 20305 THUMB_FOCUSED: 'mdc-slider__thumb--focused', 20306 THUMB_KNOB: 'mdc-slider__thumb-knob', 20307 // Class added to the top thumb (for overlapping thumbs in range slider). 20308 THUMB_TOP: 'mdc-slider__thumb--top', 20309 THUMB_WITH_INDICATOR: 'mdc-slider__thumb--with-indicator', 20310 TICK_MARKS: 'mdc-slider--tick-marks', 20311 TICK_MARKS_CONTAINER: 'mdc-slider__tick-marks', 20312 TICK_MARK_ACTIVE: 'mdc-slider__tick-mark--active', 20313 TICK_MARK_INACTIVE: 'mdc-slider__tick-mark--inactive', 20314 TRACK: 'mdc-slider__track', 20315 // The active track fill element that will be scaled as the value changes. 20316 TRACK_ACTIVE: 'mdc-slider__track--active_fill', 20317 VALUE_INDICATOR_TEXT: 'mdc-slider__value-indicator-text' 20318}; 20319/** Slider numbers. */ 20320exports.numbers = { 20321 // Default step size. 20322 STEP_SIZE: 1, 20323 // Minimum absolute difference between clientX of move event / down event 20324 // for which to update thumb, in the case of overlapping thumbs. 20325 // This is needed to reduce chances of choosing the thumb based on 20326 // pointer jitter. 20327 THUMB_UPDATE_MIN_PX: 5 20328}; 20329/** Slider attributes. */ 20330exports.attributes = { 20331 ARIA_VALUETEXT: 'aria-valuetext', 20332 INPUT_DISABLED: 'disabled', 20333 INPUT_MIN: 'min', 20334 INPUT_MAX: 'max', 20335 INPUT_VALUE: 'value', 20336 INPUT_STEP: 'step' 20337}; 20338/** Slider events. */ 20339exports.events = { 20340 CHANGE: 'MDCSlider:change', 20341 INPUT: 'MDCSlider:input
vendor: 4,355 bytes, lines 20341-20439
20341' 20342}; 20343 20344/***/ }), 20345 20346/***/ "./packages/mdc-slider/foundation.ts": 20347/*!*******************************************!*\ 20348 !*** ./packages/mdc-slider/foundation.ts ***! 20349 \*******************************************/ 20350/*! no static exports found */ 20351/***/ (function(module, exports, __webpack_require__) { 20352 20353"use strict"; 20354 20355/** 20356 * @license 20357 * Copyright 2020 Google Inc. 20358 * 20359 * Permission is hereby granted, free of charge, to any person obtaining a copy 20360 * of this software and associated documentation files (the "Software"), to deal 20361 * in the Software without restriction, including without limitation the rights 20362 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20363 * copies of the Software, and to permit persons to whom the Software is 20364 * furnished to do so, subject to the following conditions: 20365 * 20366 * The above copyright notice and this permission notice shall be included in 20367 * all copies or substantial portions of the Software. 20368 * 20369 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20370 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20371 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20372 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20373 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20374 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20375 * THE SOFTWARE. 20376 */ 20377 20378var __extends = this && this.__extends || function () { 20379 var _extendStatics = function extendStatics(d, b) { 20380 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 20381 d.__proto__ = b; 20382 } || function (d, b) { 20383 for (var p in b) { 20384 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 20385 } 20386 }; 20387 return _extendStatics(d, b); 20388 }; 20389 return function (d, b) { 20390 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 20391 _extendStatics(d, b); 20392 function __() { 20393 this.constructor = d; 20394 } 20395 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 20396 }; 20397}(); 20398var __assign = this && this.__assign || function () { 20399 __assign = Object.assign || function (t) { 20400 for (var s, i = 1, n = arguments.length; i < n; i++) { 20401 s = arguments[i]; 20402 for (var p in s) { 20403 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 20404 } 20405 } 20406 return t; 20407 }; 20408 return __assign.apply(this, arguments); 20409}; 20410Object.defineProperty(exports, "__esModule", { value: true }); 20411exports.MDCSliderFoundation = void 0; 20412var animationframe_1 = __webpack_require__(/*! @material/animation/animationframe */ "./packages/mdc-animation/animationframe.ts"); 20413var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 20414var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 20415var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"); 20416var types_1 = __webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts"); 20417var AnimationKeys; 20418(function (AnimationKeys) { 20419 AnimationKeys["SLIDER_UPDATE"] = "slider_update"; 20420})(AnimationKeys || (AnimationKeys = {})); 20421// Accessing `window` without a `typeof` check will throw on Node environments. 20422var HAS_WINDOW = typeof window !== 'undefined'; 20423/** 20424 * Foundation class for slider. Responsibilities include: 20425 * - Updating slider values (internal state and DOM updates) based on client 20426 * 'x' position. 20427 * - Updating DOM after slider property updates (e.g. min, max). 20428 */ 20429var MDCSliderFoundation = /** @class */function (_super) { 20430 __extends(MDCSliderFoundation, _super); 20431 function MDCSliderFoundation(adapter) { 20432 var _this = _super.call(this, __assign(__assign({}, MDCSliderFoundation.defaultAdapter), adapter)) || this; 20433 // Whether the initial styles (to position the thumb, before component 20434 // initialization) have been removed. 20435 _this.initialStylesRemoved = false; 20436 _this.isDisabled = false; 20437 _this.isDiscrete = false; 20438 _this.step = constants_1.numbers.STEP_SIZE; 20439 _this.
vendor: 38,446 bytes, lines 20439-21210
20439hasTickMarks = false; 20440 // The following properties are only set for range sliders. 20441 _this.isRange = false; 20442 // Tracks the thumb being moved across a slider pointer interaction (down, 20443 // move event). 20444 _this.thumb = null; 20445 // `clientX` from the most recent down event. Used in subsequent move 20446 // events to determine which thumb to move (in the case of 20447 // overlapping thumbs). 20448 _this.downEventClientX = null; 20449 // Width of the start thumb knob. 20450 _this.startThumbKnobWidth = 0; 20451 // Width of the end thumb knob. 20452 _this.endThumbKnobWidth = 0; 20453 _this.animFrame = new animationframe_1.AnimationFrame(); 20454 return _this; 20455 } 20456 Object.defineProperty(MDCSliderFoundation, "defaultAdapter", { 20457 get: function get() { 20458 // tslint:disable:object-literal-sort-keys Methods should be in the same 20459 // order as the adapter interface. 20460 return { 20461 hasClass: function hasClass() { 20462 return false; 20463 }, 20464 addClass: function addClass() { 20465 return undefined; 20466 }, 20467 removeClass: function removeClass() { 20468 return undefined; 20469 }, 20470 addThumbClass: function addThumbClass() { 20471 return undefined; 20472 }, 20473 removeThumbClass: function removeThumbClass() { 20474 return undefined; 20475 }, 20476 getAttribute: function getAttribute() { 20477 return null; 20478 }, 20479 getInputValue: function getInputValue() { 20480 return ''; 20481 }, 20482 setInputValue: function setInputValue() { 20483 return undefined; 20484 }, 20485 getInputAttribute: function getInputAttribute() { 20486 return null; 20487 }, 20488 setInputAttribute: function setInputAttribute() { 20489 return null; 20490 }, 20491 removeInputAttribute: function removeInputAttribute() { 20492 return null; 20493 }, 20494 focusInput: function focusInput() { 20495 return undefined; 20496 }, 20497 isInputFocused: function isInputFocused() { 20498 return false; 20499 }, 20500 getThumbKnobWidth: function getThumbKnobWidth() { 20501 return 0; 20502 }, 20503 getThumbBoundingClientRect: function getThumbBoundingClientRect() { 20504 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 20505 }, 20506 getBoundingClientRect: function getBoundingClientRect() { 20507 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 20508 }, 20509 isRTL: function isRTL() { 20510 return false; 20511 }, 20512 setThumbStyleProperty: function setThumbStyleProperty() { 20513 return undefined; 20514 }, 20515 removeThumbStyleProperty: function removeThumbStyleProperty() { 20516 return undefined; 20517 }, 20518 setTrackActiveStyleProperty: function setTrackActiveStyleProperty() { 20519 return undefined; 20520 }, 20521 removeTrackActiveStyleProperty: function removeTrackActiveStyleProperty() { 20522 return undefined; 20523 }, 20524 setValueIndicatorText: function setValueIndicatorText() { 20525 return undefined; 20526 }, 20527 getValueToAriaValueTextFn: function getValueToAriaValueTextFn() { 20528 return null; 20529 }, 20530 updateTickMarks: function updateTickMarks() { 20531 return undefined; 20532 }, 20533 setPointerCapture: function setPointerCapture() { 20534 return undefined; 20535 }, 20536 emitChangeEvent: function emitChangeEvent() { 20537 return undefined; 20538 }, 20539 emitInputEvent: function emitInputEvent() { 20540 return undefined; 20541 }, 20542 emitDragStartEvent: function emitDragStartEvent() { 20543 return undefined; 20544 }, 20545 emitDragEndEvent: function emitDragEndEvent() { 20546 return undefined; 20547 }, 20548 registerEventHandler: function registerEventHandler() { 20549 return undefined; 20550 }, 20551 deregisterEventHandler: function deregisterEventHandler() { 20552 return undefined; 20553 }, 20554 registerThumbEventHandler: function registerThumbEventHandler() { 20555 return undefined; 20556 }, 20557 deregisterThumbEventHandler: function deregisterThumbEventHandler() { 20558 return undefined; 20559 }, 20560 registerInputEventHandler: function registerInputEventHandler() { 20561 return undefined; 20562 }, 20563 deregisterInputEventHandler: function deregisterInputEventHandler() { 20564 return undefined; 20565 }, 20566 registerBodyEventHandler: function registerBodyEventHandler() { 20567 return undefined; 20568 }, 20569 deregisterBodyEventHandler: function deregisterBodyEventHandler() { 20570 return undefined; 20571 }, 20572 registerWindowEventHandler: function registerWindowEventHandler() { 20573 return undefined; 20574 }, 20575 deregisterWindowEventHandler: function deregisterWindowEventHandler() { 20576 return undefined; 20577 } 20578 }; 20579 // tslint:enable:object-literal-sort-keys 20580 }, 20581 enumerable: false, 20582 configurable: true 20583 }); 20584 MDCSliderFoundation.prototype.init = function () { 20585 var _this = this; 20586 this.isDisabled = this.adapter.hasClass(constants_1.cssClasses.DISABLED); 20587 this.isDiscrete = this.adapter.hasClass(constants_1.cssClasses.DISCRETE); 20588 this.hasTickMarks = this.adapter.hasClass(constants_1.cssClasses.TICK_MARKS); 20589 this.isRange = this.adapter.hasClass(constants_1.cssClasses.RANGE); 20590 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); 20591 var max = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_MAX, types_1.Thumb.END), constants_1.attributes.INPUT_MAX); 20592 var value = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_VALUE, types_1.Thumb.END), constants_1.attributes.INPUT_VALUE); 20593 var valueStart = this.isRange ? this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_VALUE, types_1.Thumb.START), constants_1.attributes.INPUT_VALUE) : min; 20594 var stepAttr = this.adapter.getInputAttribute(constants_1.attributes.INPUT_STEP, types_1.Thumb.END); 20595 var step = stepAttr ? this.convertAttributeValueToNumber(stepAttr, constants_1.attributes.INPUT_STEP) : this.step; 20596 this.validateProperties({ min: min, max: max, value: value, valueStart: valueStart, step: step }); 20597 this.min = min; 20598 this.max = max; 20599 this.value = value; 20600 this.valueStart = valueStart; 20601 this.step = step; 20602 this.numDecimalPlaces = getNumDecimalPlaces(this.step); 20603 this.valueBeforeDownEvent = value; 20604 this.valueStartBeforeDownEvent = valueStart; 20605 this.mousedownOrTouchstartListener = this.handleMousedownOrTouchstart.bind(this); 20606 this.moveListener = this.handleMove.bind(this); 20607 this.pointerdownListener = this.handlePointerdown.bind(this); 20608 this.pointerupListener = this.handlePointerup.bind(this); 20609 this.thumbMouseenterListener = this.handleThumbMouseenter.bind(this); 20610 this.thumbMouseleaveListener = this.handleThumbMouseleave.bind(this); 20611 this.inputStartChangeListener = function () { 20612 _this.handleInputChange(types_1.Thumb.START); 20613 }; 20614 this.inputEndChangeListener = function () { 20615 _this.handleInputChange(types_1.Thumb.END); 20616 }; 20617 this.inputStartFocusListener = function () { 20618 _this.handleInputFocus(types_1.Thumb.START); 20619 }; 20620 this.inputEndFocusListener = function () { 20621 _this.handleInputFocus(types_1.Thumb.END); 20622 }; 20623 this.inputStartBlurListener = function () { 20624 _this.handleInputBlur(types_1.Thumb.START); 20625 }; 20626 this.inputEndBlurListener = function () { 20627 _this.handleInputBlur(types_1.Thumb.END); 20628 }; 20629 this.resizeListener = this.handleResize.bind(this); 20630 this.registerEventHandlers(); 20631 }; 20632 MDCSliderFoundation.prototype.destroy = function () { 20633 this.deregisterEventHandlers(); 20634 }; 20635 MDCSliderFoundation.prototype.getMin = function () { 20636 return this.min; 20637 }; 20638 MDCSliderFoundation.prototype.getMax = function () { 20639 return this.max; 20640 }; 20641 /** 20642 * - For single point sliders, returns the thumb value. 20643 * - For range (two-thumb) sliders, returns the end thumb's value. 20644 */ 20645 MDCSliderFoundation.prototype.getValue = function () { 20646 return this.value; 20647 }; 20648 /** 20649 * - For single point sliders, sets the thumb value. 20650 * - For range (two-thumb) sliders, sets the end thumb's value. 20651 */ 20652 MDCSliderFoundation.prototype.setValue = function (value) { 20653 if (this.isRange && value < this.valueStart) { 20654 throw new Error("end thumb value (" + value + ") must be >= start thumb " + ("value (" + this.valueStart + ")")); 20655 } 20656 this.updateValue(value, types_1.Thumb.END); 20657 }; 20658 /** 20659 * Only applicable for range sliders. 20660 * @return The start thumb's value. 20661 */ 20662 MDCSliderFoundation.prototype.getValueStart = function () { 20663 if (!this.isRange) { 20664 throw new Error('`valueStart` is only applicable for range sliders.'); 20665 } 20666 return this.valueStart; 20667 }; 20668 /** 20669 * Only applicable for range sliders. Sets the start thumb's value. 20670 */ 20671 MDCSliderFoundation.prototype.setValueStart = function (valueStart) { 20672 if (!this.isRange) { 20673 throw new Error('`valueStart` is only applicable for range sliders.'); 20674 } 20675 if (this.isRange && valueStart > this.value) { 20676 throw new Error("start thumb value (" + valueStart + ") must be <= end thumb " + ("value (" + this.value + ")")); 20677 } 20678 this.updateValue(valueStart, types_1.Thumb.START); 20679 }; 20680 MDCSliderFoundation.prototype.getStep = function () { 20681 return this.step; 20682 }; 20683 MDCSliderFoundation.prototype.getDisabled = function () { 20684 return this.isDisabled; 20685 }; 20686 /** 20687 * Sets disabled state, including updating styles and thumb tabindex. 20688 */ 20689 MDCSliderFoundation.prototype.setDisabled = function (disabled) { 20690 this.isDisabled = disabled; 20691 if (disabled) { 20692 this.adapter.addClass(constants_1.cssClasses.DISABLED); 20693 if (this.isRange) { 20694 this.adapter.setInputAttribute(constants_1.attributes.INPUT_DISABLED, '', types_1.Thumb.START); 20695 } 20696 this.adapter.setInputAttribute(constants_1.attributes.INPUT_DISABLED, '', types_1.Thumb.END); 20697 } else { 20698 this.adapter.removeClass(constants_1.cssClasses.DISABLED); 20699 if (this.isRange) { 20700 this.adapter.removeInputAttribute(constants_1.attributes.INPUT_DISABLED, types_1.Thumb.START); 20701 } 20702 this.adapter.removeInputAttribute(constants_1.attributes.INPUT_DISABLED, types_1.Thumb.END); 20703 } 20704 }; 20705 /** @return Whether the slider is a range slider. */ 20706 MDCSliderFoundation.prototype.getIsRange = function () { 20707 return this.isRange; 20708 }; 20709 /** 20710 * - Syncs slider boundingClientRect with the current DOM. 20711 * - Updates UI based on internal state. 20712 */ 20713 MDCSliderFoundation.prototype.layout = function (_a) { 20714 var _b = _a === void 0 ? {} : _a, 20715 skipUpdateUI = _b.skipUpdateUI; 20716 this.rect = this.adapter.getBoundingClientRect(); 20717 if (this.isRange) { 20718 this.startThumbKnobWidth = this.adapter.getThumbKnobWidth(types_1.Thumb.START); 20719 this.endThumbKnobWidth = this.adapter.getThumbKnobWidth(types_1.Thumb.END); 20720 } 20721 if (!skipUpdateUI) { 20722 this.updateUI(); 20723 } 20724 }; 20725 /** Handles resize events on the window. */ 20726 MDCSliderFoundation.prototype.handleResize = function () { 20727 this.layout(); 20728 }; 20729 /** 20730 * Handles pointer down events on the slider root element. 20731 */ 20732 MDCSliderFoundation.prototype.handleDown = function (event) { 20733 if (this.isDisabled) return; 20734 this.valueStartBeforeDownEvent = this.valueStart; 20735 this.valueBeforeDownEvent = this.value; 20736 var clientX = event.clientX != null ? event.clientX : event.targetTouches[0].clientX; 20737 this.downEventClientX = clientX; 20738 var value = this.mapClientXOnSliderScale(clientX); 20739 this.thumb = this.getThumbFromDownEvent(clientX, value); 20740 if (this.thumb === null) return; 20741 this.handleDragStart(event, value, this.thumb); 20742 this.updateValue(value, this.thumb, { emitInputEvent: true }); 20743 }; 20744 /** 20745 * Handles pointer move events on the slider root element. 20746 */ 20747 MDCSliderFoundation.prototype.handleMove = function (event) { 20748 if (this.isDisabled) return; 20749 // Prevent scrolling. 20750 event.preventDefault(); 20751 var clientX = event.clientX != null ? event.clientX : event.targetTouches[0].clientX; 20752 var dragAlreadyStarted = this.thumb != null; 20753 this.thumb = this.getThumbFromMoveEvent(clientX); 20754 if (this.thumb === null) return; 20755 var value = this.mapClientXOnSliderScale(clientX); 20756 if (!dragAlreadyStarted) { 20757 this.handleDragStart(event, value, this.thumb); 20758 this.adapter.emitDragStartEvent(value, this.thumb); 20759 } 20760 this.updateValue(value, this.thumb, { emitInputEvent: true }); 20761 }; 20762 /** 20763 * Handles pointer up events on the slider root element. 20764 */ 20765 MDCSliderFoundation.prototype.handleUp = function () { 20766 if (this.isDisabled || this.thumb === null) return; 20767 var oldValue = this.thumb === types_1.Thumb.START ? this.valueStartBeforeDownEvent : this.valueBeforeDownEvent; 20768 var newValue = this.thumb === types_1.Thumb.START ? this.valueStart : this.value; 20769 if (oldValue !== newValue) { 20770 this.adapter.emitChangeEvent(newValue, this.thumb); 20771 } 20772 this.adapter.emitDragEndEvent(newValue, this.thumb); 20773 this.thumb = null; 20774 }; 20775 /** 20776 * For range, discrete slider, shows the value indicator on both thumbs. 20777 */ 20778 MDCSliderFoundation.prototype.handleThumbMouseenter = function () { 20779 if (!this.isDiscrete || !this.isRange) return; 20780 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.START); 20781 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.END); 20782 }; 20783 /** 20784 * For range, discrete slider, hides the value indicator on both thumbs. 20785 */ 20786 MDCSliderFoundation.prototype.handleThumbMouseleave = function () { 20787 if (!this.isDiscrete || !this.isRange) return; 20788 if (this.adapter.isInputFocused(types_1.Thumb.START) || this.adapter.isInputFocused(types_1.Thumb.END)) { 20789 // Leave value indicator shown if either input is focused. 20790 return; 20791 } 20792 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.START); 20793 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.END); 20794 }; 20795 MDCSliderFoundation.prototype.handleMousedownOrTouchstart = function (event) { 20796 var _this = this; 20797 var moveEventType = event.type === 'mousedown' ? 'mousemove' : 'touchmove'; 20798 // After a down event on the slider root, listen for move events on 20799 // body (so the slider value is updated for events outside of the 20800 // slider root). 20801 this.adapter.registerBodyEventHandler(moveEventType, this.moveListener); 20802 var upHandler = function upHandler() { 20803 _this.handleUp(); 20804 // Once the drag is finished (up event on body), remove the move 20805 // handler. 20806 _this.adapter.deregisterBodyEventHandler(moveEventType, _this.moveListener); 20807 // Also stop listening for subsequent up events. 20808 _this.adapter.deregisterEventHandler('mouseup', upHandler); 20809 _this.adapter.deregisterEventHandler('touchend', upHandler); 20810 }; 20811 this.adapter.registerBodyEventHandler('mouseup', upHandler); 20812 this.adapter.registerBodyEventHandler('touchend', upHandler); 20813 this.handleDown(event); 20814 }; 20815 MDCSliderFoundation.prototype.handlePointerdown = function (event) { 20816 this.adapter.setPointerCapture(event.pointerId); 20817 this.adapter.registerEventHandler('pointermove', this.moveListener); 20818 this.handleDown(event); 20819 }; 20820 /** 20821 * Handles input `change` event by setting internal slider value to match 20822 * input's new value. 20823 */ 20824 MDCSliderFoundation.prototype.handleInputChange = function (thumb) { 20825 var value = Number(this.adapter.getInputValue(thumb)); 20826 if (thumb === types_1.Thumb.START) { 20827 this.setValueStart(value); 20828 } else { 20829 this.setValue(value); 20830 } 20831 this.adapter.emitChangeEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb); 20832 this.adapter.emitInputEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb); 20833 }; 20834 /** Shows activated state and value indicator on thumb(s). */ 20835 MDCSliderFoundation.prototype.handleInputFocus = function (thumb) { 20836 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_FOCUSED, thumb); 20837 if (!this.isDiscrete) return; 20838 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, thumb); 20839 if (this.isRange) { 20840 var otherThumb = thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START; 20841 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, otherThumb); 20842 } 20843 }; 20844 /** Removes activated state and value indicator from thumb(s). */ 20845 MDCSliderFoundation.prototype.handleInputBlur = function (thumb) { 20846 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_FOCUSED, thumb); 20847 if (!this.isDiscrete) return; 20848 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, thumb); 20849 if (this.isRange) { 20850 var otherThumb = thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START; 20851 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, otherThumb); 20852 } 20853 }; 20854 /** 20855 * Emits custom dragStart event, along with focusing the underlying input. 20856 */ 20857 MDCSliderFoundation.prototype.handleDragStart = function (event, value, thumb) { 20858 this.adapter.focusInput(thumb); 20859 // Prevent the input (that we just focused) from losing focus. 20860 event.preventDefault(); 20861 this.adapter.emitDragStartEvent(value, thumb); 20862 }; 20863 /** 20864 * @return The thumb to be moved based on initial down event. 20865 */ 20866 MDCSliderFoundation.prototype.getThumbFromDownEvent = function (clientX, value) { 20867 // For single point slider, thumb to be moved is always the END (only) 20868 // thumb. 20869 if (!this.isRange) return types_1.Thumb.END; 20870 // Check if event press point is in the bounds of any thumb. 20871 var thumbStartRect = this.adapter.getThumbBoundingClientRect(types_1.Thumb.START); 20872 var thumbEndRect = this.adapter.getThumbBoundingClientRect(types_1.Thumb.END); 20873 var inThumbStartBounds = clientX >= thumbStartRect.left && clientX <= thumbStartRect.right; 20874 var inThumbEndBounds = clientX >= thumbEndRect.left && clientX <= thumbEndRect.right; 20875 if (inThumbStartBounds && inThumbEndBounds) { 20876 // Thumbs overlapping. Thumb to be moved cannot be determined yet. 20877 return null; 20878 } 20879 // If press is in bounds for either thumb on down event, that's the thumb 20880 // to be moved. 20881 if (inThumbStartBounds) { 20882 return types_1.Thumb.START; 20883 } 20884 if (inThumbEndBounds) { 20885 return types_1.Thumb.END; 20886 } 20887 // For presses outside the range, return whichever thumb is closer. 20888 if (value < this.valueStart) { 20889 return types_1.Thumb.START; 20890 } 20891 if (value > this.value) { 20892 return types_1.Thumb.END; 20893 } 20894 // For presses inside the range, return whichever thumb is closer. 20895 return value - this.valueStart <= this.value - value ? types_1.Thumb.START : types_1.Thumb.END; 20896 }; 20897 /** 20898 * @return The thumb to be moved based on move event (based on drag 20899 * direction from original down event). Only applicable if thumbs 20900 * were overlapping in the down event. 20901 */ 20902 MDCSliderFoundation.prototype.getThumbFromMoveEvent = function (clientX) { 20903 // Thumb has already been chosen. 20904 if (this.thumb !== null) return this.thumb; 20905 if (this.downEventClientX === null) { 20906 throw new Error('`downEventClientX` is null after move event.'); 20907 } 20908 var moveDistanceUnderThreshold = Math.abs(this.downEventClientX - clientX) < constants_1.numbers.THUMB_UPDATE_MIN_PX; 20909 if (moveDistanceUnderThreshold) return this.thumb; 20910 var draggedThumbToLeft = clientX < this.downEventClientX; 20911 if (draggedThumbToLeft) { 20912 return this.adapter.isRTL() ? types_1.Thumb.END : types_1.Thumb.START; 20913 } else { 20914 return this.adapter.isRTL() ? types_1.Thumb.START : types_1.Thumb.END; 20915 } 20916 }; 20917 /** 20918 * Updates UI based on internal state. 20919 * @param thumb Thumb whose value is being updated. If undefined, UI is 20920 * updated for both thumbs based on current internal state. 20921 */ 20922 MDCSliderFoundation.prototype.updateUI = function (thumb) { 20923 this.updateThumbAndInputAttributes(thumb); 20924 this.updateThumbAndTrackUI(thumb); 20925 this.updateValueIndicatorUI(thumb); 20926 this.updateTickMarksUI(); 20927 }; 20928 /** 20929 * Updates thumb and input attributes based on current value. 20930 * @param thumb Thumb whose aria attributes to update. 20931 */ 20932 MDCSliderFoundation.prototype.updateThumbAndInputAttributes = function (thumb) { 20933 if (!thumb) return; 20934 var value = this.isRange && thumb === types_1.Thumb.START ? this.valueStart : this.value; 20935 var valueStr = String(value); 20936 this.adapter.setInputAttribute(constants_1.attributes.INPUT_VALUE, valueStr, thumb); 20937 if (this.isRange && thumb === types_1.Thumb.START) { 20938 this.adapter.setInputAttribute(constants_1.attributes.INPUT_MIN, valueStr, types_1.Thumb.END); 20939 } else if (this.isRange && thumb === types_1.Thumb.END) { 20940 this.adapter.setInputAttribute(constants_1.attributes.INPUT_MAX, valueStr, types_1.Thumb.START); 20941 } 20942 // Sync attribute with property. 20943 if (this.adapter.getInputValue(thumb) !== valueStr) { 20944 this.adapter.setInputValue(valueStr, thumb); 20945 } 20946 var valueToAriaValueTextFn = this.adapter.getValueToAriaValueTextFn(); 20947 if (valueToAriaValueTextFn) { 20948 this.adapter.setInputAttribute(constants_1.attributes.ARIA_VALUETEXT, valueToAriaValueTextFn(value), thumb); 20949 } 20950 }; 20951 /** 20952 * Updates value indicator UI based on current value. 20953 * @param thumb Thumb whose value indicator to update. If undefined, all 20954 * thumbs' value indicators are updated. 20955 */ 20956 MDCSliderFoundation.prototype.updateValueIndicatorUI = function (thumb) { 20957 if (!this.isDiscrete) return; 20958 var value = this.isRange && thumb === types_1.Thumb.START ? this.valueStart : this.value; 20959 this.adapter.setValueIndicatorText(value, thumb === types_1.Thumb.START ? types_1.Thumb.START : types_1.Thumb.END); 20960 if (!thumb && this.isRange) { 20961 this.adapter.setValueIndicatorText(this.valueStart, types_1.Thumb.START); 20962 } 20963 }; 20964 /** 20965 * Updates tick marks UI within slider, based on current min, max, and step. 20966 */ 20967 MDCSliderFoundation.prototype.updateTickMarksUI = function () { 20968 if (!this.isDiscrete || !this.hasTickMarks) return; 20969 var numTickMarksInactiveStart = (this.valueStart - this.min) / this.step; 20970 var numTickMarksActive = (this.value - this.valueStart) / this.step + 1; 20971 var numTickMarksInactiveEnd = (this.max - this.value) / this.step; 20972 var tickMarksInactiveStart = Array.from({ length: numTickMarksInactiveStart }).fill(types_1.TickMark.INACTIVE); 20973 var tickMarksActive = Array.from({ length: numTickMarksActive }).fill(types_1.TickMark.ACTIVE); 20974 var tickMarksInactiveEnd = Array.from({ length: numTickMarksInactiveEnd }).fill(types_1.TickMark.INACTIVE); 20975 this.adapter.updateTickMarks(tickMarksInactiveStart.concat(tickMarksActive).concat(tickMarksInactiveEnd)); 20976 }; 20977 /** Maps clientX to a value on the slider scale. */ 20978 MDCSliderFoundation.prototype.mapClientXOnSliderScale = function (clientX) { 20979 var xPos = clientX - this.rect.left; 20980 var pctComplete = xPos / this.rect.width; 20981 if (this.adapter.isRTL()) { 20982 pctComplete = 1 - pctComplete; 20983 } 20984 // Fit the percentage complete between the range [min,max] 20985 // by remapping from [0, 1] to [min, min+(max-min)]. 20986 var value = this.min + pctComplete * (this.max - this.min); 20987 if (value === this.max || value === this.min) { 20988 return value; 20989 } 20990 return Number(this.quantize(value).toFixed(this.numDecimalPlaces)); 20991 }; 20992 /** Calculates the quantized value based on step value. */ 20993 MDCSliderFoundation.prototype.quantize = function (value) { 20994 var numSteps = Math.round((value - this.min) / this.step); 20995 return this.min + numSteps * this.step; 20996 }; 20997 /** 20998 * Updates slider value (internal state and UI) based on the given value. 20999 */ 21000 MDCSliderFoundation.prototype.updateValue = function (value, thumb, _a) { 21001 var _b = _a === void 0 ? {} : _a, 21002 emitInputEvent = _b.emitInputEvent; 21003 value = this.clampValue(value, thumb); 21004 if (this.isRange && thumb === types_1.Thumb.START) { 21005 // Exit early if current value is the same as the new value. 21006 if (this.valueStart === value) return; 21007 this.valueStart = value; 21008 } else { 21009 // Exit early if current value is the same as the new value. 21010 if (this.value === value) return; 21011 this.value = value; 21012 } 21013 this.updateUI(thumb); 21014 if (emitInputEvent) { 21015 this.adapter.emitInputEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb); 21016 } 21017 }; 21018 /** 21019 * Clamps the given value for the given thumb based on slider properties: 21020 * - Restricts value within [min, max]. 21021 * - If range slider, clamp start value <= end value, and 21022 * end value >= start value. 21023 */ 21024 MDCSliderFoundation.prototype.clampValue = function (value, thumb) { 21025 // Clamp value to [min, max] range. 21026 value = Math.min(Math.max(value, this.min), this.max); 21027 var thumbStartMovedPastThumbEnd = this.isRange && thumb === types_1.Thumb.START && value > this.value; 21028 if (thumbStartMovedPastThumbEnd) { 21029 return this.value; 21030 } 21031 var thumbEndMovedPastThumbStart = this.isRange && thumb === types_1.Thumb.END && value < this.valueStart; 21032 if (thumbEndMovedPastThumbStart) { 21033 return this.valueStart; 21034 } 21035 return value; 21036 }; 21037 /** 21038 * Updates the active track and thumb style properties to reflect current 21039 * value. 21040 */ 21041 MDCSliderFoundation.prototype.updateThumbAndTrackUI = function (thumb) { 21042 var _this = this; 21043 var _a = this, 21044 max = _a.max, 21045 min = _a.min; 21046 var pctComplete = (this.value - this.valueStart) / (max - min); 21047 var rangePx = pctComplete * this.rect.width; 21048 var isRtl = this.adapter.isRTL(); 21049 var transformProp = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; 21050 if (this.isRange) { 21051 var thumbLeftPos_1 = this.adapter.isRTL() ? (max - this.value) / (max - min) * this.rect.width : (this.valueStart - min) / (max - min) * this.rect.width; 21052 var thumbRightPos_1 = thumbLeftPos_1 + rangePx; 21053 this.animFrame.request(AnimationKeys.SLIDER_UPDATE, function () { 21054 // Set active track styles, accounting for animation direction by 21055 // setting `transform-origin`. 21056 var trackAnimatesFromRight = !isRtl && thumb === types_1.Thumb.START || isRtl && thumb !== types_1.Thumb.START; 21057 if (trackAnimatesFromRight) { 21058 _this.adapter.setTrackActiveStyleProperty('transform-origin', 'right'); 21059 _this.adapter.setTrackActiveStyleProperty('left', 'unset'); 21060 _this.adapter.setTrackActiveStyleProperty('right', _this.rect.width - thumbRightPos_1 + "px"); 21061 } else { 21062 _this.adapter.setTrackActiveStyleProperty('transform-origin', 'left'); 21063 _this.adapter.setTrackActiveStyleProperty('right', 'unset'); 21064 _this.adapter.setTrackActiveStyleProperty('left', thumbLeftPos_1 + "px"); 21065 } 21066 _this.adapter.setTrackActiveStyleProperty(transformProp, "scaleX(" + pctComplete + ")"); 21067 // Set thumb styles. 21068 var thumbStartPos = isRtl ? thumbRightPos_1 : thumbLeftPos_1; 21069 var thumbEndPos = _this.adapter.isRTL() ? thumbLeftPos_1 : thumbRightPos_1; 21070 if (thumb === types_1.Thumb.START || !thumb || !_this.initialStylesRemoved) { 21071 _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbStartPos + "px)", types_1.Thumb.START); 21072 } 21073 if (thumb === types_1.Thumb.END || !thumb || !_this.initialStylesRemoved) { 21074 _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbEndPos + "px)", types_1.Thumb.END); 21075 } 21076 _this.removeInitialStyles(isRtl); 21077 _this.updateOverlappingThumbsUI(thumbStartPos, thumbEndPos, thumb); 21078 }); 21079 } else { 21080 this.animFrame.request(AnimationKeys.SLIDER_UPDATE, function () { 21081 var thumbStartPos = isRtl ? _this.rect.width - rangePx : rangePx; 21082 _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbStartPos + "px)", types_1.Thumb.END); 21083 _this.adapter.setTrackActiveStyleProperty(transformProp, "scaleX(" + pctComplete + ")"); 21084 _this.removeInitialStyles(isRtl); 21085 }); 21086 } 21087 }; 21088 /** 21089 * Removes initial inline styles if not already removed. `left:<...>%` 21090 * inline styles can be added to position the thumb correctly before JS 21091 * initialization. However, they need to be removed before the JS starts 21092 * positioning the thumb. This is because the JS uses 21093 * `transform:translateX(<...>)px` (for performance reasons) to position 21094 * the thumb (which is not possible for initial styles since we need the 21095 * bounding rect measurements). 21096 */ 21097 MDCSliderFoundation.prototype.removeInitialStyles = function (isRtl) { 21098 if (this.initialStylesRemoved) return; 21099 // Remove thumb position properties that were added for initial render. 21100 var position = isRtl ? 'right' : 'left'; 21101 this.adapter.removeThumbStyleProperty(position, types_1.Thumb.END); 21102 if (this.isRange) { 21103 this.adapter.removeThumbStyleProperty(position, types_1.Thumb.START); 21104 } 21105 this.initialStylesRemoved = true; 21106 this.resetTrackAndThumbAnimation(); 21107 }; 21108 /** 21109 * Resets track/thumb animation to prevent animation when adding 21110 * `transform` styles to thumb initially. 21111 */ 21112 MDCSliderFoundation.prototype.resetTrackAndThumbAnimation = function () { 21113 var _this = this; 21114 if (!this.isDiscrete) return; 21115 // Set transition properties to default (no animation), so that the 21116 // newly added `transform` styles do not animate thumb/track from 21117 // their default positions. 21118 var transitionProp = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transition') : 'transition'; 21119 var transitionDefault = 'all 0s ease 0s'; 21120 this.adapter.setThumbStyleProperty(transitionProp, transitionDefault, types_1.Thumb.END); 21121 if (this.isRange) { 21122 this.adapter.setThumbStyleProperty(transitionProp, transitionDefault, types_1.Thumb.START); 21123 } 21124 this.adapter.setTrackActiveStyleProperty(transitionProp, transitionDefault); 21125 // In the next frame, remove the transition inline styles we just 21126 // added, such that any animations added in the CSS can now take effect. 21127 requestAnimationFrame(function () { 21128 _this.adapter.removeThumbStyleProperty(transitionProp, types_1.Thumb.END); 21129 _this.adapter.removeTrackActiveStyleProperty(transitionProp); 21130 if (_this.isRange) { 21131 _this.adapter.removeThumbStyleProperty(transitionProp, types_1.Thumb.START); 21132 } 21133 }); 21134 }; 21135 /** 21136 * Adds THUMB_TOP class to active thumb if thumb knobs overlap; otherwise 21137 * removes THUMB_TOP class from both thumbs. 21138 * @param thumb Thumb that is active (being moved). 21139 */ 21140 MDCSliderFoundation.prototype.updateOverlappingThumbsUI = function (thumbStartPos, thumbEndPos, thumb) { 21141 var thumbsOverlap = false; 21142 if (this.adapter.isRTL()) { 21143 var startThumbLeftEdge = thumbStartPos - this.startThumbKnobWidth / 2; 21144 var endThumbRightEdge = thumbEndPos + this.endThumbKnobWidth / 2; 21145 thumbsOverlap = endThumbRightEdge >= startThumbLeftEdge; 21146 } else { 21147 var startThumbRightEdge = thumbStartPos + this.startThumbKnobWidth / 2; 21148 var endThumbLeftEdge = thumbEndPos - this.endThumbKnobWidth / 2; 21149 thumbsOverlap = startThumbRightEdge >= endThumbLeftEdge; 21150 } 21151 if (thumbsOverlap) { 21152 this.adapter.addThumbClass(constants_1.cssClasses.THUMB_TOP, 21153 // If no thumb was dragged (in the case of initial layout), end 21154 // thumb is on top by default. 21155 thumb || types_1.Thumb.END); 21156 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START); 21157 } else { 21158 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, types_1.Thumb.START); 21159 this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, types_1.Thumb.END); 21160 } 21161 }; 21162 /** 21163 * Converts attribute value to a number, e.g. '100' => 100. Throws errors 21164 * for invalid values. 21165 * @param attributeValue Attribute value, e.g. 100. 21166 * @param attributeName Attribute name, e.g. `aria-valuemax`. 21167 */ 21168 MDCSliderFoundation.prototype.convertAttributeValueToNumber = function (attributeValue, attributeName) { 21169 if (attributeValue === null) { 21170 throw new Error("MDCSliderFoundation: `" + attributeName + "` must be non-null."); 21171 } 21172 var value = Number(attributeValue); 21173 if (isNaN(value)) { 21174 throw new Error("MDCSliderFoundation: `" + attributeName + "` value is " + ("`" + attributeValue + "`, but must be a number.")); 21175 } 21176 return value; 21177 }; 21178 /** Checks that the given properties are valid slider values. */ 21179 MDCSliderFoundation.prototype.validateProperties = function (_a) { 21180 var min = _a.min, 21181 max = _a.max, 21182 value = _a.value, 21183 valueStart = _a.valueStart, 21184 step = _a.step; 21185 if (min >= max) { 21186 throw new Error("MDCSliderFoundation: min must be strictly less than max. " + ("Current: [min: " + min + ", max: " + max + "]")); 21187 } 21188 if (step <= 0) { 21189 throw new Error("MDCSliderFoundation: step must be a positive number. " + ("Current step: " + this.step)); 21190 } 21191 if (this.isRange) { 21192 if (value < min || value > max || valueStart < min || valueStart > max) { 21193 throw new Error("MDCSliderFoundation: values must be in [min, max] range. " + ("Current values: [start value: " + valueStart + ", end value: " + value + "]")); 21194 } 21195 if (valueStart > value) { 21196 throw new Error("MDCSliderFoundation: start value must be <= end value. " + ("Current values: [start value: " + valueStart + ", end value: " + value + "]")); 21197 } 21198 var numStepsValueStartFromMin = (valueStart - min) / step; 21199 var numStepsValueFromMin = (value - min) / step; 21200 if (numStepsValueStartFromMin % 1 !== 0 || numStepsValueFromMin % 1 !== 0) { 21201 throw new Error("MDCSliderFoundation: Slider values must be valid based on the " + ("step value. Current values: [start value: " + valueStart + ", ") + ("end value: " + value + "]")); 21202 } 21203 } else { 21204 // Single point slider. 21205 if (value < min || value > max) { 21206 throw new Error("MDCSliderFoundation: value must be in [min, max] range. " + ("Current value: " + value)); 21207 } 21208 var numStepsValueFromMin = (value - min) / step; 21209 if (numStepsValueFromMin % 1 !== 0) { 21210 throw new Error("MDCSliderFoundation: Slider value must be valid based on the " + ("step value
vendor: 8,171 bytes, lines 21210-21357
21210. Current value: " + value)); 21211 } 21212 } 21213 }; 21214 MDCSliderFoundation.prototype.registerEventHandlers = function () { 21215 this.adapter.registerWindowEventHandler('resize', this.resizeListener); 21216 if (MDCSliderFoundation.SUPPORTS_POINTER_EVENTS) { 21217 // If supported, use pointer events API with #setPointerCapture. 21218 this.adapter.registerEventHandler('pointerdown', this.pointerdownListener); 21219 this.adapter.registerEventHandler('pointerup', this.pointerupListener); 21220 } else { 21221 // Otherwise, fall back to mousedown/touchstart events. 21222 this.adapter.registerEventHandler('mousedown', this.mousedownOrTouchstartListener); 21223 this.adapter.registerEventHandler('touchstart', this.mousedownOrTouchstartListener); 21224 } 21225 if (this.isRange) { 21226 this.adapter.registerThumbEventHandler(types_1.Thumb.START, 'mouseenter', this.thumbMouseenterListener); 21227 this.adapter.registerThumbEventHandler(types_1.Thumb.START, 'mouseleave', this.thumbMouseleaveListener); 21228 this.adapter.registerInputEventHandler(types_1.Thumb.START, 'change', this.inputStartChangeListener); 21229 this.adapter.registerInputEventHandler(types_1.Thumb.START, 'focus', this.inputStartFocusListener); 21230 this.adapter.registerInputEventHandler(types_1.Thumb.START, 'blur', this.inputStartBlurListener); 21231 } 21232 this.adapter.registerThumbEventHandler(types_1.Thumb.END, 'mouseenter', this.thumbMouseenterListener); 21233 this.adapter.registerThumbEventHandler(types_1.Thumb.END, 'mouseleave', this.thumbMouseleaveListener); 21234 this.adapter.registerInputEventHandler(types_1.Thumb.END, 'change', this.inputEndChangeListener); 21235 this.adapter.registerInputEventHandler(types_1.Thumb.END, 'focus', this.inputEndFocusListener); 21236 this.adapter.registerInputEventHandler(types_1.Thumb.END, 'blur', this.inputEndBlurListener); 21237 }; 21238 MDCSliderFoundation.prototype.deregisterEventHandlers = function () { 21239 this.adapter.deregisterWindowEventHandler('resize', this.resizeListener); 21240 if (MDCSliderFoundation.SUPPORTS_POINTER_EVENTS) { 21241 this.adapter.deregisterEventHandler('pointerdown', this.pointerdownListener); 21242 this.adapter.deregisterEventHandler('pointerup', this.pointerupListener); 21243 } else { 21244 this.adapter.deregisterEventHandler('mousedown', this.mousedownOrTouchstartListener); 21245 this.adapter.deregisterEventHandler('touchstart', this.mousedownOrTouchstartListener); 21246 } 21247 if (this.isRange) { 21248 this.adapter.deregisterThumbEventHandler(types_1.Thumb.START, 'mouseenter', this.thumbMouseenterListener); 21249 this.adapter.deregisterThumbEventHandler(types_1.Thumb.START, 'mouseleave', this.thumbMouseleaveListener); 21250 this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'change', this.inputStartChangeListener); 21251 this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'focus', this.inputStartFocusListener); 21252 this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'blur', this.inputStartBlurListener); 21253 } 21254 this.adapter.deregisterThumbEventHandler(types_1.Thumb.END, 'mouseenter', this.thumbMouseenterListener); 21255 this.adapter.deregisterThumbEventHandler(types_1.Thumb.END, 'mouseleave', this.thumbMouseleaveListener); 21256 this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'change', this.inputEndChangeListener); 21257 this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'focus', this.inputEndFocusListener); 21258 this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'blur', this.inputEndBlurListener); 21259 }; 21260 MDCSliderFoundation.prototype.handlePointerup = function () { 21261 this.handleUp(); 21262 this.adapter.deregisterEventHandler('pointermove', this.moveListener); 21263 }; 21264 MDCSliderFoundation.SUPPORTS_POINTER_EVENTS = HAS_WINDOW && Boolean(window.PointerEvent) && 21265 // #setPointerCapture is buggy on iOS, so we can't use pointer events 21266 // until the following bug is fixed: 21267 // https://bugs.webkit.org/show_bug.cgi?id=220196 21268 !isIOS(); 21269 return MDCSliderFoundation; 21270}(foundation_1.MDCFoundation); 21271exports.MDCSliderFoundation = MDCSliderFoundation; 21272function isIOS() { 21273 // Source: 21274 // https://stackoverflow.com/questions/9038625/detect-if-device-is-ios 21275 return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) 21276 // iPad on iOS 13 detection 21277 || navigator.userAgent.includes('Mac') && 'ontouchend' in document; 21278} 21279/** 21280 * Given a number, returns the number of digits that appear after the 21281 * decimal point. 21282 * See 21283 * https://stackoverflow.com/questions/9539513/is-there-a-reliable-way-in-javascript-to-obtain-the-number-of-decimal-places-of 21284 */ 21285function getNumDecimalPlaces(n) { 21286 // Pull out the fraction and the exponent. 21287 var match = /(?:\.(\d+))?(?:[eE]([+\-]?\d+))?$/.exec(String(n)); 21288 // NaN or Infinity or integer. 21289 // We arbitrarily decide that Infinity is integral. 21290 if (!match) return 0; 21291 var fraction = match[1] || ''; // E.g. 1.234e-2 => 234 21292 var exponent = match[2] || 0; // E.g. 1.234e-2 => -2 21293 // Count the number of digits in the fraction and subtract the 21294 // exponent to simulate moving the decimal point left by exponent places. 21295 // 1.234e+2 has 1 fraction digit and '234'.length - 2 == 1 21296 // 1.234e-2 has 5 fraction digit and '234'.length - -2 == 5 21297 return Math.max(0, // lower limit 21298 (fraction === '0' ? 0 : fraction.length) - Number(exponent)); 21299} 21300 21301/***/ }), 21302 21303/***/ "./packages/mdc-slider/index.ts": 21304/*!**************************************!*\ 21305 !*** ./packages/mdc-slider/index.ts ***! 21306 \**************************************/ 21307/*! no static exports found */ 21308/***/ (function(module, exports, __webpack_require__) { 21309 21310"use strict"; 21311 21312/** 21313 * @license 21314 * Copyright 2020 Google Inc. 21315 * 21316 * Permission is hereby granted, free of charge, to any person obtaining a copy 21317 * of this software and associated documentation files (the "Software"), to deal 21318 * in the Software without restriction, including without limitation the rights 21319 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21320 * copies of the Software, and to permit persons to whom the Software is 21321 * furnished to do so, subject to the following conditions: 21322 * 21323 * The above copyright notice and this permission notice shall be included in 21324 * all copies or substantial portions of the Software. 21325 * 21326 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21327 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21328 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21329 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21330 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21331 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21332 * THE SOFTWARE. 21333 */ 21334 21335var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 21336 if (k2 === undefined) k2 = k; 21337 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 21338 return m[k]; 21339 } }); 21340} : function (o, m, k, k2) { 21341 if (k2 === undefined) k2 = k; 21342 o[k2] = m[k]; 21343}); 21344var __exportStar = this && this.__exportStar || function (m, exports) { 21345 for (var p in m) { 21346 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 21347 } 21348}; 21349Object.defineProperty(exports, "__esModule", { value: true }); 21350__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-slider/adapter.ts"), exports); 21351__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-slider/component.ts"), exports); 21352__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"), exports); 21353__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts"), exports); 21354__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts"), exports); 21355 21356/***/ }), 21357
vendor: 8,457 bytes, lines 21358-21552
21358/***/ "./packages/mdc-slider/types.ts": 21359/*!**************************************!*\ 21360 !*** ./packages/mdc-slider/types.ts ***! 21361 \**************************************/ 21362/*! no static exports found */ 21363/***/ (function(module, exports, __webpack_require__) { 21364 21365"use strict"; 21366 21367/** 21368 * @license 21369 * Copyright 2020 Google Inc. 21370 * 21371 * Permission is hereby granted, free of charge, to any person obtaining a copy 21372 * of this software and associated documentation files (the "Software"), to deal 21373 * in the Software without restriction, including without limitation the rights 21374 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21375 * copies of the Software, and to permit persons to whom the Software is 21376 * furnished to do so, subject to the following conditions: 21377 * 21378 * The above copyright notice and this permission notice shall be included in 21379 * all copies or substantial portions of the Software. 21380 * 21381 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21382 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21383 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21384 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21385 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21386 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21387 * THE SOFTWARE. 21388 */ 21389 21390Object.defineProperty(exports, "__esModule", { value: true }); 21391exports.Thumb = exports.TickMark = void 0; 21392/** Tick mark enum, for discrete sliders. */ 21393var TickMark; 21394(function (TickMark) { 21395 TickMark[TickMark["ACTIVE"] = 0] = "ACTIVE"; 21396 TickMark[TickMark["INACTIVE"] = 1] = "INACTIVE"; 21397})(TickMark = exports.TickMark || (exports.TickMark = {})); 21398/** 21399 * Thumb types: range slider has two thumbs (START, END) whereas single point 21400 * slider only has one thumb (END). 21401 */ 21402var Thumb; 21403(function (Thumb) { 21404 // Thumb at start of slider (e.g. in LTR mode, left thumb on range slider). 21405 Thumb[Thumb["START"] = 1] = "START"; 21406 // Thumb at end of slider (e.g. in LTR mode, right thumb on range slider, 21407 // or only thumb on single point slider). 21408 Thumb[Thumb["END"] = 2] = "END"; 21409})(Thumb = exports.Thumb || (exports.Thumb = {})); 21410 21411/***/ }), 21412 21413/***/ "./packages/mdc-snackbar/adapter.ts": 21414/*!******************************************!*\ 21415 !*** ./packages/mdc-snackbar/adapter.ts ***! 21416 \******************************************/ 21417/*! no static exports found */ 21418/***/ (function(module, exports, __webpack_require__) { 21419 21420"use strict"; 21421 21422/** 21423 * @license 21424 * Copyright 2018 Google Inc. 21425 * 21426 * Permission is hereby granted, free of charge, to any person obtaining a copy 21427 * of this software and associated documentation files (the "Software"), to deal 21428 * in the Software without restriction, including without limitation the rights 21429 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21430 * copies of the Software, and to permit persons to whom the Software is 21431 * furnished to do so, subject to the following conditions: 21432 * 21433 * The above copyright notice and this permission notice shall be included in 21434 * all copies or substantial portions of the Software. 21435 * 21436 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21437 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21438 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21439 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21440 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21441 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21442 * THE SOFTWARE. 21443 */ 21444 21445Object.defineProperty(exports, "__esModule", { value: true }); 21446 21447/***/ }), 21448 21449/***/ "./packages/mdc-snackbar/component.ts": 21450/*!********************************************!*\ 21451 !*** ./packages/mdc-snackbar/component.ts ***! 21452 \********************************************/ 21453/*! no static exports found */ 21454/***/ (function(module, exports, __webpack_require__) { 21455 21456"use strict"; 21457 21458/** 21459 * @license 21460 * Copyright 2018 Google Inc. 21461 * 21462 * Permission is hereby granted, free of charge, to any person obtaining a copy 21463 * of this software and associated documentation files (the "Software"), to deal 21464 * in the Software without restriction, including without limitation the rights 21465 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21466 * copies of the Software, and to permit persons to whom the Software is 21467 * furnished to do so, subject to the following conditions: 21468 * 21469 * The above copyright notice and this permission notice shall be included in 21470 * all copies or substantial portions of the Software. 21471 * 21472 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21473 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21474 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21475 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21476 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21477 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21478 * THE SOFTWARE. 21479 */ 21480 21481var __extends = this && this.__extends || function () { 21482 var _extendStatics = function extendStatics(d, b) { 21483 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 21484 d.__proto__ = b; 21485 } || function (d, b) { 21486 for (var p in b) { 21487 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 21488 } 21489 }; 21490 return _extendStatics(d, b); 21491 }; 21492 return function (d, b) { 21493 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 21494 _extendStatics(d, b); 21495 function __() { 21496 this.constructor = d; 21497 } 21498 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 21499 }; 21500}(); 21501var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 21502 if (k2 === undefined) k2 = k; 21503 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 21504 return m[k]; 21505 } }); 21506} : function (o, m, k, k2) { 21507 if (k2 === undefined) k2 = k; 21508 o[k2] = m[k]; 21509}); 21510var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 21511 Object.defineProperty(o, "default", { enumerable: true, value: v }); 21512} : function (o, v) { 21513 o["default"] = v; 21514}); 21515var __importStar = this && this.__importStar || function (mod) { 21516 if (mod && mod.__esModule) return mod; 21517 var result = {}; 21518 if (mod != null) for (var k in mod) { 21519 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 21520 }__setModuleDefault(result, mod); 21521 return result; 21522}; 21523Object.defineProperty(exports, "__esModule", { value: true }); 21524exports.MDCSnackbar = void 0; 21525var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 21526var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 21527var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"); 21528var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts"); 21529var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts")); 21530var SURFACE_SELECTOR = constants_1.strings.SURFACE_SELECTOR, 21531 LABEL_SELECTOR = constants_1.strings.LABEL_SELECTOR, 21532 ACTION_SELECTOR = constants_1.strings.ACTION_SELECTOR, 21533 DISMISS_SELECTOR = constants_1.strings.DISMISS_SELECTOR, 21534 OPENING_EVENT = constants_1.strings.OPENING_EVENT, 21535 OPENED_EVENT = constants_1.strings.OPENED_EVENT, 21536 CLOSING_EVENT = constants_1.strings.CLOSING_EVENT, 21537 CLOSED_EVENT = constants_1.strings.CLOSED_EVENT; 21538var MDCSnackbar = /** @class */function (_super) { 21539 __extends(MDCSnackbar, _super); 21540 function MDCSnackbar() { 21541 return _super !== null && _super.apply(this, arguments) || this; 21542 } 21543 MDCSnackbar.attachTo = function (root) { 21544 return new MDCSnackbar(root); 21545 }; 21546 MDCSnackbar.prototype.initialize = function (announcerFactory) { 21547 if (announcerFactory === void 0) { 21548 announcerFactory = function announcerFactory() { 21549 return util.announce; 21550 }; 21551 } 21552 this.announce
21552_ = announcerFactory(); 21553 }; 21554 MDCSnackbar.prototype.initialSyncWithDOM = function () { 21555 var _this = this; 21556 this.surfaceEl_ = this.root.querySelector(SURFACE_SELECTOR); 21557 this.labelEl_ = this.root.querySelector(LABEL_SELECTOR); 21558 this.actionEl_ = this.root.querySelector(ACTION_SELECTOR); 21559 this.handleKeyDown_ = function (evt) { 21560 return _this.foundation.handleKeyDown(evt); 21561 }; 21562 this.handleSurfaceClick_ = function (evt) { 21563 var target = evt.target; 21564 if (_this.isActionButton_(target)) { 21565 _this.foundation.handleActionButtonClick(evt); 21566 } else if (_this.isActionIcon_(target)) {
vendor: 4,166 bytes, lines 21567-21672
21567 _this.foundation.handleActionIconClick(evt); 21568 } 21569 }; 21570 this.registerKeyDownHandler_(this.handleKeyDown_); 21571 this.registerSurfaceClickHandler_(this.handleSurfaceClick_); 21572 }; 21573 MDCSnackbar.prototype.destroy = function () { 21574 _super.prototype.destroy.call(this); 21575 this.deregisterKeyDownHandler_(this.handleKeyDown_); 21576 this.deregisterSurfaceClickHandler_(this.handleSurfaceClick_); 21577 }; 21578 MDCSnackbar.prototype.open = function () { 21579 this.foundation.open(); 21580 }; 21581 /** 21582 * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the 21583 * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom 21584 * client-specific values may also be used if desired. 21585 */ 21586 MDCSnackbar.prototype.close = function (reason) { 21587 if (reason === void 0) { 21588 reason = ''; 21589 } 21590 this.foundation.close(reason); 21591 }; 21592 MDCSnackbar.prototype.getDefaultFoundation = function () { 21593 var _this = this; 21594 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 21595 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 21596 var adapter = { 21597 addClass: function addClass(className) { 21598 return _this.root.classList.add(className); 21599 }, 21600 announce: function announce() { 21601 return _this.announce_(_this.labelEl_); 21602 }, 21603 notifyClosed: function notifyClosed(reason) { 21604 return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {}); 21605 }, 21606 notifyClosing: function notifyClosing(reason) { 21607 return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {}); 21608 }, 21609 notifyOpened: function notifyOpened() { 21610 return _this.emit(OPENED_EVENT, {}); 21611 }, 21612 notifyOpening: function notifyOpening() { 21613 return _this.emit(OPENING_EVENT, {}); 21614 }, 21615 removeClass: function removeClass(className) { 21616 return _this.root.classList.remove(className); 21617 } 21618 }; 21619 return new foundation_1.MDCSnackbarFoundation(adapter); 21620 }; 21621 Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", { 21622 get: function get() { 21623 return this.foundation.getTimeoutMs(); 21624 }, 21625 set: function set(timeoutMs) { 21626 this.foundation.setTimeoutMs(timeoutMs); 21627 }, 21628 enumerable: false, 21629 configurable: true 21630 }); 21631 Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", { 21632 get: function get() { 21633 return this.foundation.getCloseOnEscape(); 21634 }, 21635 set: function set(closeOnEscape) { 21636 this.foundation.setCloseOnEscape(closeOnEscape); 21637 }, 21638 enumerable: false, 21639 configurable: true 21640 }); 21641 Object.defineProperty(MDCSnackbar.prototype, "isOpen", { 21642 get: function get() { 21643 return this.foundation.isOpen(); 21644 }, 21645 enumerable: false, 21646 configurable: true 21647 }); 21648 Object.defineProperty(MDCSnackbar.prototype, "labelText", { 21649 get: function get() { 21650 // This property only returns null if the node is a document, DOCTYPE, or notation. 21651 // On Element nodes, it always returns a string. 21652 return this.labelEl_.textContent; 21653 }, 21654 set: function set(labelText) { 21655 this.labelEl_.textContent = labelText; 21656 }, 21657 enumerable: false, 21658 configurable: true 21659 }); 21660 Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", { 21661 get: function get() { 21662 return this.actionEl_.textContent; 21663 }, 21664 set: function set(actionButtonText) { 21665 this.actionEl_.textContent = actionButtonText; 21666 }, 21667 enumerable: false, 21668 configurable: true 21669 }); 21670 MDCSnackbar.prototype.registerKeyDownHandler_ = function (handler) { 21671 this.listen('keydown', handler); 21672 };
21673 MDCSnackbar.prototype.deregisterKeyDownHandler_ = function (handler) { 21674 this.unlisten('keydown', handler); 21675 }; 21676 MDCSnackbar.prototype.registerSurfaceClickHandler_ = function (handler) { 21677 this.surfaceEl_.addEventListener('click', handler); 21678 }; 21679 MDCSnackbar.prototype.deregisterSurfaceClickHandler_ = function (handler) { 21680 this.surfaceEl_.removeEventListener('click', handler); 21681 }; 21682 MDCSnackbar.prototype.isActionButton_ = function (target) { 21683 return Boolean(ponyfill_1.closest(target, ACTION_SELECTOR)); 21684 }; 21685 MDCSnackbar.prototype.isActionIcon_
vendor: 6,585 bytes, lines 21685-21844
21685 = function (target) { 21686 return Boolean(ponyfill_1.closest(target, DISMISS_SELECTOR)); 21687 }; 21688 return MDCSnackbar; 21689}(component_1.MDCComponent); 21690exports.MDCSnackbar = MDCSnackbar; 21691 21692/***/ }), 21693 21694/***/ "./packages/mdc-snackbar/constants.ts": 21695/*!********************************************!*\ 21696 !*** ./packages/mdc-snackbar/constants.ts ***! 21697 \********************************************/ 21698/*! no static exports found */ 21699/***/ (function(module, exports, __webpack_require__) { 21700 21701"use strict"; 21702 21703/** 21704 * @license 21705 * Copyright 2018 Google Inc. 21706 * 21707 * Permission is hereby granted, free of charge, to any person obtaining a copy 21708 * of this software and associated documentation files (the "Software"), to deal 21709 * in the Software without restriction, including without limitation the rights 21710 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21711 * copies of the Software, and to permit persons to whom the Software is 21712 * furnished to do so, subject to the following conditions: 21713 * 21714 * The above copyright notice and this permission notice shall be included in 21715 * all copies or substantial portions of the Software. 21716 * 21717 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21718 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21719 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21720 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21721 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21722 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21723 * THE SOFTWARE. 21724 */ 21725 21726Object.defineProperty(exports, "__esModule", { value: true }); 21727exports.numbers = exports.strings = exports.cssClasses = void 0; 21728var cssClasses = { 21729 CLOSING: 'mdc-snackbar--closing', 21730 OPEN: 'mdc-snackbar--open', 21731 OPENING: 'mdc-snackbar--opening' 21732}; 21733exports.cssClasses = cssClasses; 21734var strings = { 21735 ACTION_SELECTOR: '.mdc-snackbar__action', 21736 ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text', 21737 CLOSED_EVENT: 'MDCSnackbar:closed', 21738 CLOSING_EVENT: 'MDCSnackbar:closing', 21739 DISMISS_SELECTOR: '.mdc-snackbar__dismiss', 21740 LABEL_SELECTOR: '.mdc-snackbar__label', 21741 OPENED_EVENT: 'MDCSnackbar:opened', 21742 OPENING_EVENT: 'MDCSnackbar:opening', 21743 REASON_ACTION: 'action', 21744 REASON_DISMISS: 'dismiss', 21745 SURFACE_SELECTOR: '.mdc-snackbar__surface' 21746}; 21747exports.strings = strings; 21748var numbers = { 21749 DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000, 21750 INDETERMINATE: -1, 21751 MAX_AUTO_DISMISS_TIMEOUT_MS: 10000, 21752 MIN_AUTO_DISMISS_TIMEOUT_MS: 4000, 21753 // These variables need to be kept in sync with the values in _variables.scss. 21754 SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75, 21755 SNACKBAR_ANIMATION_OPEN_TIME_MS: 150, 21756 /** 21757 * Number of milliseconds to wait between temporarily clearing the label text 21758 * in the DOM and subsequently restoring it. This is necessary to force IE 11 21759 * to pick up the `aria-live` content change and announce it to the user. 21760 */ 21761 ARIA_LIVE_DELAY_MS: 1000 21762}; 21763exports.numbers = numbers; 21764 21765/***/ }), 21766 21767/***/ "./packages/mdc-snackbar/foundation.ts": 21768/*!*********************************************!*\ 21769 !*** ./packages/mdc-snackbar/foundation.ts ***! 21770 \*********************************************/ 21771/*! no static exports found */ 21772/***/ (function(module, exports, __webpack_require__) { 21773 21774"use strict"; 21775 21776/** 21777 * @license 21778 * Copyright 2018 Google Inc. 21779 * 21780 * Permission is hereby granted, free of charge, to any person obtaining a copy 21781 * of this software and associated documentation files (the "Software"), to deal 21782 * in the Software without restriction, including without limitation the rights 21783 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21784 * copies of the Software, and to permit persons to whom the Software is 21785 * furnished to do so, subject to the following conditions: 21786 * 21787 * The above copyright notice and this permission notice shall be included in 21788 * all copies or substantial portions of the Software. 21789 * 21790 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21791 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21792 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21793 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21794 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21795 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21796 * THE SOFTWARE. 21797 */ 21798 21799var __extends = this && this.__extends || function () { 21800 var _extendStatics = function extendStatics(d, b) { 21801 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 21802 d.__proto__ = b; 21803 } || function (d, b) { 21804 for (var p in b) { 21805 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 21806 } 21807 }; 21808 return _extendStatics(d, b); 21809 }; 21810 return function (d, b) { 21811 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 21812 _extendStatics(d, b); 21813 function __() { 21814 this.constructor = d; 21815 } 21816 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 21817 }; 21818}(); 21819var __assign = this && this.__assign || function () { 21820 __assign = Object.assign || function (t) { 21821 for (var s, i = 1, n = arguments.length; i < n; i++) { 21822 s = arguments[i]; 21823 for (var p in s) { 21824 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 21825 } 21826 } 21827 return t; 21828 }; 21829 return __assign.apply(this, arguments); 21830}; 21831Object.defineProperty(exports, "__esModule", { value: true }); 21832exports.MDCSnackbarFoundation = void 0; 21833var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 21834var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"); 21835var OPENING = constants_1.cssClasses.OPENING, 21836 OPEN = constants_1.cssClasses.OPEN, 21837 CLOSING = constants_1.cssClasses.CLOSING; 21838var REASON_ACTION = constants_1.strings.REASON_ACTION, 21839 REASON_DISMISS = constants_1.strings.REASON_DISMISS; 21840var MDCSnackbarFoundation = /** @class */function (_super) { 21841 __extends(MDCSnackbarFoundation, _super); 21842 function MDCSnackbarFoundation(adapter) { 21843 var _this = _super.call(this, __assign(__assign({}, MDCSnackbarFoundation.defaultAdapter), adapter)) || this; 21844 _this.
vendor: 6,593 bytes, lines 21844-22003
21844isOpen_ = false; 21845 _this.animationFrame_ = 0; 21846 _this.animationTimer_ = 0; 21847 _this.autoDismissTimer_ = 0; 21848 _this.autoDismissTimeoutMs_ = constants_1.numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS; 21849 _this.closeOnEscape_ = true; 21850 return _this; 21851 } 21852 Object.defineProperty(MDCSnackbarFoundation, "cssClasses", { 21853 get: function get() { 21854 return constants_1.cssClasses; 21855 }, 21856 enumerable: false, 21857 configurable: true 21858 }); 21859 Object.defineProperty(MDCSnackbarFoundation, "strings", { 21860 get: function get() { 21861 return constants_1.strings; 21862 }, 21863 enumerable: false, 21864 configurable: true 21865 }); 21866 Object.defineProperty(MDCSnackbarFoundation, "numbers", { 21867 get: function get() { 21868 return constants_1.numbers; 21869 }, 21870 enumerable: false, 21871 configurable: true 21872 }); 21873 Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", { 21874 get: function get() { 21875 return { 21876 addClass: function addClass() { 21877 return undefined; 21878 }, 21879 announce: function announce() { 21880 return undefined; 21881 }, 21882 notifyClosed: function notifyClosed() { 21883 return undefined; 21884 }, 21885 notifyClosing: function notifyClosing() { 21886 return undefined; 21887 }, 21888 notifyOpened: function notifyOpened() { 21889 return undefined; 21890 }, 21891 notifyOpening: function notifyOpening() { 21892 return undefined; 21893 }, 21894 removeClass: function removeClass() { 21895 return undefined; 21896 } 21897 }; 21898 }, 21899 enumerable: false, 21900 configurable: true 21901 }); 21902 MDCSnackbarFoundation.prototype.destroy = function () { 21903 this.clearAutoDismissTimer_(); 21904 cancelAnimationFrame(this.animationFrame_); 21905 this.animationFrame_ = 0; 21906 clearTimeout(this.animationTimer_); 21907 this.animationTimer_ = 0; 21908 this.adapter.removeClass(OPENING); 21909 this.adapter.removeClass(OPEN); 21910 this.adapter.removeClass(CLOSING); 21911 }; 21912 MDCSnackbarFoundation.prototype.open = function () { 21913 var _this = this; 21914 this.clearAutoDismissTimer_(); 21915 this.isOpen_ = true; 21916 this.adapter.notifyOpening(); 21917 this.adapter.removeClass(CLOSING); 21918 this.adapter.addClass(OPENING); 21919 this.adapter.announce(); 21920 // Wait a frame once display is no longer "none", to establish basis for animation 21921 this.runNextAnimationFrame_(function () { 21922 _this.adapter.addClass(OPEN); 21923 _this.animationTimer_ = setTimeout(function () { 21924 var timeoutMs = _this.getTimeoutMs(); 21925 _this.handleAnimationTimerEnd_(); 21926 _this.adapter.notifyOpened(); 21927 if (timeoutMs !== constants_1.numbers.INDETERMINATE) { 21928 _this.autoDismissTimer_ = setTimeout(function () { 21929 _this.close(REASON_DISMISS); 21930 }, timeoutMs); 21931 } 21932 }, constants_1.numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS); 21933 }); 21934 }; 21935 /** 21936 * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the 21937 * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom 21938 * client-specific values may also be used if desired. 21939 */ 21940 MDCSnackbarFoundation.prototype.close = function (reason) { 21941 var _this = this; 21942 if (reason === void 0) { 21943 reason = ''; 21944 } 21945 if (!this.isOpen_) { 21946 // Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed 21947 return; 21948 } 21949 cancelAnimationFrame(this.animationFrame_); 21950 this.animationFrame_ = 0; 21951 this.clearAutoDismissTimer_(); 21952 this.isOpen_ = false; 21953 this.adapter.notifyClosing(reason); 21954 this.adapter.addClass(constants_1.cssClasses.CLOSING); 21955 this.adapter.removeClass(constants_1.cssClasses.OPEN); 21956 this.adapter.removeClass(constants_1.cssClasses.OPENING); 21957 clearTimeout(this.animationTimer_); 21958 this.animationTimer_ = setTimeout(function () { 21959 _this.handleAnimationTimerEnd_(); 21960 _this.adapter.notifyClosed(reason); 21961 }, constants_1.numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS); 21962 }; 21963 MDCSnackbarFoundation.prototype.isOpen = function () { 21964 return this.isOpen_; 21965 }; 21966 MDCSnackbarFoundation.prototype.getTimeoutMs = function () { 21967 return this.autoDismissTimeoutMs_; 21968 }; 21969 MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) { 21970 // Use shorter variable names to make the code more readable 21971 var minValue = constants_1.numbers.MIN_AUTO_DISMISS_TIMEOUT_MS; 21972 var maxValue = constants_1.numbers.MAX_AUTO_DISMISS_TIMEOUT_MS; 21973 var indeterminateValue = constants_1.numbers.INDETERMINATE; 21974 if (timeoutMs === constants_1.numbers.INDETERMINATE || timeoutMs <= maxValue && timeoutMs >= minValue) { 21975 this.autoDismissTimeoutMs_ = timeoutMs; 21976 } else { 21977 throw new Error("\n timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + "\n (or " + indeterminateValue + " to disable), but got '" + timeoutMs + "'"); 21978 } 21979 }; 21980 MDCSnackbarFoundation.prototype.getCloseOnEscape = function () { 21981 return this.closeOnEscape_; 21982 }; 21983 MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) { 21984 this.closeOnEscape_ = closeOnEscape; 21985 }; 21986 MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) { 21987 var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27; 21988 if (isEscapeKey && this.getCloseOnEscape()) { 21989 this.close(REASON_DISMISS); 21990 } 21991 }; 21992 MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) { 21993 this.close(REASON_ACTION); 21994 }; 21995 MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) { 21996 this.close(REASON_DISMISS); 21997 }; 21998 MDCSnackbarFoundation.prototype.clearAutoDismissTimer_ = function () { 21999 clearTimeout(this.autoDismissTimer_); 22000 this.autoDismissTimer_ = 0; 22001 }; 22002 MDCSnackbarFoundation.prototype.handleAnimationTimerEnd_ = function () { 22003 this.animationTimer_ = 0;
22004 this.adapter.removeClass(constants_1.cssClasses.OPENING); 22005 this.adapter.removeClass(constants_1.cssClasses.CLOSING); 22006 }; 22007 /** 22008 * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. 22009 */ 22010 MDCSnackbarFoundation.prototype.runNextAnimationFrame_ = function (callback) { 22011 var _this = this; 22012 cancelAnimationFrame(this.animationFrame_); 22013 this.animationFrame_ = requestAnimationFrame(function () { 22014 _this.animationFrame_ = 0; 22015 clearTimeout(_this.animationTimer_); 22016 _this.animationTimer_
vendor: 8,744 bytes, lines 22016-22212
22016 = setTimeout(callback, 0); 22017 }); 22018 }; 22019 return MDCSnackbarFoundation; 22020}(foundation_1.MDCFoundation); 22021exports.MDCSnackbarFoundation = MDCSnackbarFoundation; 22022// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 22023exports.default = MDCSnackbarFoundation; 22024 22025/***/ }), 22026 22027/***/ "./packages/mdc-snackbar/index.ts": 22028/*!****************************************!*\ 22029 !*** ./packages/mdc-snackbar/index.ts ***! 22030 \****************************************/ 22031/*! no static exports found */ 22032/***/ (function(module, exports, __webpack_require__) { 22033 22034"use strict"; 22035 22036/** 22037 * @license 22038 * Copyright 2019 Google Inc. 22039 * 22040 * Permission is hereby granted, free of charge, to any person obtaining a copy 22041 * of this software and associated documentation files (the "Software"), to deal 22042 * in the Software without restriction, including without limitation the rights 22043 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22044 * copies of the Software, and to permit persons to whom the Software is 22045 * furnished to do so, subject to the following conditions: 22046 * 22047 * The above copyright notice and this permission notice shall be included in 22048 * all copies or substantial portions of the Software. 22049 * 22050 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22051 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22052 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22053 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22054 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22055 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22056 * THE SOFTWARE. 22057 */ 22058 22059var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 22060 if (k2 === undefined) k2 = k; 22061 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 22062 return m[k]; 22063 } }); 22064} : function (o, m, k, k2) { 22065 if (k2 === undefined) k2 = k; 22066 o[k2] = m[k]; 22067}); 22068var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 22069 Object.defineProperty(o, "default", { enumerable: true, value: v }); 22070} : function (o, v) { 22071 o["default"] = v; 22072}); 22073var __importStar = this && this.__importStar || function (mod) { 22074 if (mod && mod.__esModule) return mod; 22075 var result = {}; 22076 if (mod != null) for (var k in mod) { 22077 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 22078 }__setModuleDefault(result, mod); 22079 return result; 22080}; 22081var __exportStar = this && this.__exportStar || function (m, exports) { 22082 for (var p in m) { 22083 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 22084 } 22085}; 22086Object.defineProperty(exports, "__esModule", { value: true }); 22087exports.util = void 0; 22088var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts")); 22089exports.util = util; 22090__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-snackbar/adapter.ts"), exports); 22091__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-snackbar/component.ts"), exports); 22092__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"), exports); 22093__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts"), exports); 22094__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-snackbar/types.ts"), exports); 22095 22096/***/ }), 22097 22098/***/ "./packages/mdc-snackbar/types.ts": 22099/*!****************************************!*\ 22100 !*** ./packages/mdc-snackbar/types.ts ***! 22101 \****************************************/ 22102/*! no static exports found */ 22103/***/ (function(module, exports, __webpack_require__) { 22104 22105"use strict"; 22106 22107/** 22108 * @license 22109 * Copyright 2019 Google Inc. 22110 * 22111 * Permission is hereby granted, free of charge, to any person obtaining a copy 22112 * of this software and associated documentation files (the "Software"), to deal 22113 * in the Software without restriction, including without limitation the rights 22114 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22115 * copies of the Software, and to permit persons to whom the Software is 22116 * furnished to do so, subject to the following conditions: 22117 * 22118 * The above copyright notice and this permission notice shall be included in 22119 * all copies or substantial portions of the Software. 22120 * 22121 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22122 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22123 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22124 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22125 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22126 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22127 * THE SOFTWARE. 22128 */ 22129 22130Object.defineProperty(exports, "__esModule", { value: true }); 22131 22132/***/ }), 22133 22134/***/ "./packages/mdc-snackbar/util.ts": 22135/*!***************************************!*\ 22136 !*** ./packages/mdc-snackbar/util.ts ***! 22137 \***************************************/ 22138/*! no static exports found */ 22139/***/ (function(module, exports, __webpack_require__) { 22140 22141"use strict"; 22142 22143/** 22144 * @license 22145 * Copyright 2018 Google Inc. 22146 * 22147 * Permission is hereby granted, free of charge, to any person obtaining a copy 22148 * of this software and associated documentation files (the "Software"), to deal 22149 * in the Software without restriction, including without limitation the rights 22150 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22151 * copies of the Software, and to permit persons to whom the Software is 22152 * furnished to do so, subject to the following conditions: 22153 * 22154 * The above copyright notice and this permission notice shall be included in 22155 * all copies or substantial portions of the Software. 22156 * 22157 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22158 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22159 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22160 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22161 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22162 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22163 * THE SOFTWARE. 22164 */ 22165 22166Object.defineProperty(exports, "__esModule", { value: true }); 22167exports.announce = void 0; 22168var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"); 22169var ARIA_LIVE_DELAY_MS = constants_1.numbers.ARIA_LIVE_DELAY_MS; 22170var ARIA_LIVE_LABEL_TEXT_ATTR = constants_1.strings.ARIA_LIVE_LABEL_TEXT_ATTR; 22171function announce(ariaEl, labelEl) { 22172 if (labelEl === void 0) { 22173 labelEl = ariaEl; 22174 } 22175 var priority = ariaEl.getAttribute('aria-live'); 22176 // Trim text to ignore ` ` (see below). 22177 // textContent is only null if the node is a document, DOCTYPE, or notation. 22178 var labelText = labelEl.textContent.trim(); 22179 if (!labelText || !priority) { 22180 return; 22181 } 22182 // Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice. 22183 ariaEl.setAttribute('aria-live', 'off'); 22184 // Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers. 22185 // `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars 22186 // sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first. 22187 // Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event, 22188 // so screen readers won't announce the second message unless we first clear `textContent`. 22189 // 22190 // We have to clear the label text two different ways to make it work in all browsers and screen readers: 22191 // 22192 // 1. `textContent = ''` is required for IE11 + JAWS 22193 // 2. `innerHTML = ' '` is required for Chrome + JAWS and NVDA 22194 // 22195 // All other browser/screen reader combinations support both methods. 22196 // 22197 // The wrapper `<span>` visually hides the space character so that it doesn't cause jank when added/removed. 22198 // N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change. 22199 // 22200 // This technique has been tested in: 22201 // 22202 // * JAWS 2019: 22203 // - Chrome 70 22204 // - Firefox 60 (ESR) 22205 // - IE 11 22206 // * NVDA 2018: 22207 // - Chrome 70 22208 // - Firefox 60 (ESR) 22209 // - IE 11 22210 // * ChromeVox 53 22211 labelEl.textContent = ''; 22212
22212labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;"> </span>'; 22213 // Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element. 22214 // CSS generated content is normally announced by screen readers 22215 // (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/); 22216 // however, `aria-live` is turned off, so this DOM update will be ignored by screen readers. 22217 labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText); 22218 setTimeout(function () { 22219 // Allow screen readers to announce changes to the DOM again. 22220 ariaEl.setAttribute('aria-live', priority); 22221 // Remove the message from the ::before pseudo-element. 22222 labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR); 22223 // Restore the original label text, which will be announced by screen readers. 22224 labelEl.textContent = labelText; 22225 }, ARIA_LIVE_DELAY_MS); 22226} 22227exports.announce = announce; 22228 22229/***/ }), 22230
22231/***/ "./packages/mdc-switch/adapter.ts": 22232/*!****************************************!*\ 22233 !*** ./packages/mdc-switch/adapter.ts ***! 22234 \****************************************/ 22235/*! no static exports found */ 22236/***/ (function(module, exports, __webpack_require__) { 22237 22238"use strict"; 22239 22240/** 22241 * @license 22242 * Copyright 2018 Google Inc. 22243 * 22244 * Permission is hereby granted, free of charge, to any person obtaining a copy 22245 * of this software and associated documentation files (the "Software"), to deal 22246 * in the Software without restriction, including without limitation the rights 22247 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22248 * copies of the Software, and to permit persons to whom the Software is 22249 * furnished to do so, subject to the following conditions: 22250 * 22251 * The above copyright notice and this permission notice shall be included in 22252 * all copies or substantial portions of the Software. 22253 * 22254 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22255 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22256 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22257 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22258 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22259 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22260 * THE SOFTWARE. 22261 */ 22262 22263Object.defineProperty(exports, "__esModule", { value: true }); 22264 22265/***/ }), 22266
vendor: 9,682 bytes, lines 22267-22485
22267/***/ "./packages/mdc-switch/component.ts": 22268/*!******************************************!*\ 22269 !*** ./packages/mdc-switch/component.ts ***! 22270 \******************************************/ 22271/*! no static exports found */ 22272/***/ (function(module, exports, __webpack_require__) { 22273 22274"use strict"; 22275 22276/** 22277 * @license 22278 * Copyright 2018 Google Inc. 22279 * 22280 * Permission is hereby granted, free of charge, to any person obtaining a copy 22281 * of this software and associated documentation files (the "Software"), to deal 22282 * in the Software without restriction, including without limitation the rights 22283 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22284 * copies of the Software, and to permit persons to whom the Software is 22285 * furnished to do so, subject to the following conditions: 22286 * 22287 * The above copyright notice and this permission notice shall be included in 22288 * all copies or substantial portions of the Software. 22289 * 22290 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22291 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22292 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22293 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22294 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22295 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22296 * THE SOFTWARE. 22297 */ 22298 22299var __extends = this && this.__extends || function () { 22300 var _extendStatics = function extendStatics(d, b) { 22301 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 22302 d.__proto__ = b; 22303 } || function (d, b) { 22304 for (var p in b) { 22305 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 22306 } 22307 }; 22308 return _extendStatics(d, b); 22309 }; 22310 return function (d, b) { 22311 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 22312 _extendStatics(d, b); 22313 function __() { 22314 this.constructor = d; 22315 } 22316 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 22317 }; 22318}(); 22319var __assign = this && this.__assign || function () { 22320 __assign = Object.assign || function (t) { 22321 for (var s, i = 1, n = arguments.length; i < n; i++) { 22322 s = arguments[i]; 22323 for (var p in s) { 22324 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 22325 } 22326 } 22327 return t; 22328 }; 22329 return __assign.apply(this, arguments); 22330}; 22331var __read = this && this.__read || function (o, n) { 22332 var m = typeof Symbol === "function" && o[Symbol.iterator]; 22333 if (!m) return o; 22334 var i = m.call(o), 22335 r, 22336 ar = [], 22337 e; 22338 try { 22339 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { 22340 ar.push(r.value); 22341 } 22342 } catch (error) { 22343 e = { error: error }; 22344 } finally { 22345 try { 22346 if (r && !r.done && (m = i["return"])) m.call(i); 22347 } finally { 22348 if (e) throw e.error; 22349 } 22350 } 22351 return ar; 22352}; 22353var __spreadArray = this && this.__spreadArray || function (to, from) { 22354 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) { 22355 to[j] = from[i]; 22356 }return to; 22357}; 22358Object.defineProperty(exports, "__esModule", { value: true }); 22359exports.MDCSwitch = void 0; 22360var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 22361var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 22362var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 22363var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 22364var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 22365var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts"); 22366var MDCSwitch = /** @class */function (_super) { 22367 __extends(MDCSwitch, _super); 22368 function MDCSwitch() { 22369 var _this = _super !== null && _super.apply(this, arguments) || this; 22370 _this.ripple_ = _this.createRipple_(); 22371 return _this; 22372 } 22373 MDCSwitch.attachTo = function (root) { 22374 return new MDCSwitch(root); 22375 }; 22376 MDCSwitch.prototype.destroy = function () { 22377 _super.prototype.destroy.call(this); 22378 this.ripple_.destroy(); 22379 this.nativeControl_.removeEventListener('change', this.changeHandler_); 22380 }; 22381 MDCSwitch.prototype.initialSyncWithDOM = function () { 22382 var _this = this; 22383 this.changeHandler_ = function () { 22384 var _a; 22385 var args = []; 22386 for (var _i = 0; _i < arguments.length; _i++) { 22387 args[_i] = arguments[_i]; 22388 } 22389 return (_a = _this.foundation).handleChange.apply(_a, __spreadArray([], __read(args))); 22390 }; 22391 this.nativeControl_.addEventListener('change', this.changeHandler_); 22392 // Sometimes the checked state of the input element is saved in the history. 22393 // The switch styling should match the checked state of the input element. 22394 // Do an initial sync between the native control and the foundation. 22395 this.checked = this.checked; 22396 }; 22397 MDCSwitch.prototype.getDefaultFoundation = function () { 22398 var _this = this; 22399 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 22400 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 22401 var adapter = { 22402 addClass: function addClass(className) { 22403 return _this.root.classList.add(className); 22404 }, 22405 removeClass: function removeClass(className) { 22406 return _this.root.classList.remove(className); 22407 }, 22408 setNativeControlChecked: function setNativeControlChecked(checked) { 22409 return _this.nativeControl_.checked = checked; 22410 }, 22411 setNativeControlDisabled: function setNativeControlDisabled(disabled) { 22412 return _this.nativeControl_.disabled = disabled; 22413 }, 22414 setNativeControlAttr: function setNativeControlAttr(attr, value) { 22415 return _this.nativeControl_.setAttribute(attr, value); 22416 } 22417 }; 22418 return new foundation_2.MDCSwitchFoundation(adapter); 22419 }; 22420 Object.defineProperty(MDCSwitch.prototype, "ripple", { 22421 get: function get() { 22422 return this.ripple_; 22423 }, 22424 enumerable: false, 22425 configurable: true 22426 }); 22427 Object.defineProperty(MDCSwitch.prototype, "checked", { 22428 get: function get() { 22429 return this.nativeControl_.checked; 22430 }, 22431 set: function set(checked) { 22432 this.foundation.setChecked(checked); 22433 }, 22434 enumerable: false, 22435 configurable: true 22436 }); 22437 Object.defineProperty(MDCSwitch.prototype, "disabled", { 22438 get: function get() { 22439 return this.nativeControl_.disabled; 22440 }, 22441 set: function set(disabled) { 22442 this.foundation.setDisabled(disabled); 22443 }, 22444 enumerable: false, 22445 configurable: true 22446 }); 22447 MDCSwitch.prototype.createRipple_ = function () { 22448 var _this = this; 22449 var RIPPLE_SURFACE_SELECTOR = foundation_2.MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR; 22450 var rippleSurface = this.root.querySelector(RIPPLE_SURFACE_SELECTOR); 22451 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 22452 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 22453 var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { addClass: function addClass(className) { 22454 return rippleSurface.classList.add(className); 22455 }, computeBoundingRect: function computeBoundingRect() { 22456 return rippleSurface.getBoundingClientRect(); 22457 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 22458 _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive()); 22459 }, isSurfaceActive: function isSurfaceActive() { 22460 return ponyfill_1.matches(_this.nativeControl_, ':active'); 22461 }, isUnbounded: function isUnbounded() { 22462 return true; 22463 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 22464 _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive()); 22465 }, removeClass: function removeClass(className) { 22466 rippleSurface.classList.remove(className); 22467 }, updateCssVariable: function updateCssVariable(varName, value) { 22468 rippleSurface.style.setProperty(varName, value); 22469 } }); 22470 return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter)); 22471 }; 22472 Object.defineProperty(MDCSwitch.prototype, "nativeControl_", { 22473 get: function get() { 22474 var NATIVE_CONTROL_SELECTOR = foundation_2.MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR; 22475 return this.root.querySelector(NATIVE_CONTROL_SELECTOR); 22476 }, 22477 enumerable: false, 22478 configurable: true 22479 }); 22480 return MDCSwitch; 22481}(component_1.MDCComponent); 22482exports.MDCSwitch = MDCSwitch; 22483 22484/***/ }), 22485
22486/***/ "./packages/mdc-switch/constants.ts": 22487/*!******************************************!*\ 22488 !*** ./packages/mdc-switch/constants.ts ***! 22489 \
vendor: 2,200 bytes, lines 22489-22541
22489******************************************/ 22490/*! no static exports found */ 22491/***/ (function(module, exports, __webpack_require__) { 22492 22493"use strict"; 22494 22495/** 22496 * @license 22497 * Copyright 2018 Google Inc. 22498 * 22499 * Permission is hereby granted, free of charge, to any person obtaining a copy 22500 * of this software and associated documentation files (the "Software"), to deal 22501 * in the Software without restriction, including without limitation the rights 22502 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22503 * copies of the Software, and to permit persons to whom the Software is 22504 * furnished to do so, subject to the following conditions: 22505 * 22506 * The above copyright notice and this permission notice shall be included in 22507 * all copies or substantial portions of the Software. 22508 * 22509 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22510 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22511 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22512 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22513 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22514 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22515 * THE SOFTWARE. 22516 */ 22517 22518Object.defineProperty(exports, "__esModule", { value: true }); 22519exports.strings = exports.cssClasses = void 0; 22520/** CSS classes used by the switch. */ 22521var cssClasses = { 22522 /** Class used for a switch that is in the "checked" (on) position. */ 22523 CHECKED: 'mdc-switch--checked', 22524 /** Class used for a switch that is disabled. */ 22525 DISABLED: 'mdc-switch--disabled' 22526}; 22527exports.cssClasses = cssClasses; 22528/** String constants used by the switch. */ 22529var strings = { 22530 /** Aria attribute for checked or unchecked state of switch */ 22531 ARIA_CHECKED_ATTR: 'aria-checked', 22532 /** A CSS selector used to locate the native HTML control for the switch. */ 22533 NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control', 22534 /** A CSS selector used to locate the ripple surface element for the switch. */ 22535 RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay' 22536}; 22537exports.strings = strings; 22538 22539/***/ }), 22540 22541/***/ "./packages/mdc-switch/
vendor: 3,593 bytes, lines 22541-22624
22541foundation.ts": 22542/*!*******************************************!*\ 22543 !*** ./packages/mdc-switch/foundation.ts ***! 22544 \*******************************************/ 22545/*! no static exports found */ 22546/***/ (function(module, exports, __webpack_require__) { 22547 22548"use strict"; 22549 22550/** 22551 * @license 22552 * Copyright 2018 Google Inc. 22553 * 22554 * Permission is hereby granted, free of charge, to any person obtaining a copy 22555 * of this software and associated documentation files (the "Software"), to deal 22556 * in the Software without restriction, including without limitation the rights 22557 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22558 * copies of the Software, and to permit persons to whom the Software is 22559 * furnished to do so, subject to the following conditions: 22560 * 22561 * The above copyright notice and this permission notice shall be included in 22562 * all copies or substantial portions of the Software. 22563 * 22564 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22565 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22566 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22567 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22568 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22569 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22570 * THE SOFTWARE. 22571 */ 22572 22573var __extends = this && this.__extends || function () { 22574 var _extendStatics = function extendStatics(d, b) { 22575 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 22576 d.__proto__ = b; 22577 } || function (d, b) { 22578 for (var p in b) { 22579 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 22580 } 22581 }; 22582 return _extendStatics(d, b); 22583 }; 22584 return function (d, b) { 22585 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 22586 _extendStatics(d, b); 22587 function __() { 22588 this.constructor = d; 22589 } 22590 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 22591 }; 22592}(); 22593var __assign = this && this.__assign || function () { 22594 __assign = Object.assign || function (t) { 22595 for (var s, i = 1, n = arguments.length; i < n; i++) { 22596 s = arguments[i]; 22597 for (var p in s) { 22598 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 22599 } 22600 } 22601 return t; 22602 }; 22603 return __assign.apply(this, arguments); 22604}; 22605Object.defineProperty(exports, "__esModule", { value: true }); 22606exports.MDCSwitchFoundation = void 0; 22607var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 22608var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts"); 22609var MDCSwitchFoundation = /** @class */function (_super) { 22610 __extends(MDCSwitchFoundation, _super); 22611 function MDCSwitchFoundation(adapter) { 22612 return _super.call(this, __assign(__assign({}, MDCSwitchFoundation.defaultAdapter), adapter)) || this; 22613 } 22614 Object.defineProperty(MDCSwitchFoundation, "strings", { 22615 /** The string constants used by the switch. */ 22616 get: function get() { 22617 return constants_1.strings; 22618 }, 22619 enumerable: false, 22620 configurable: true 22621 }); 22622 Object.defineProperty(MDCSwitchFoundation, "cssClasses", { 22623 /** The CSS classes used by the switch. */ 22624 get: function get() {
22625 return constants_1.cssClasses; 22626 }, 22627 enumerable: false, 22628 configurable: true 22629 }); 22630 Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", { 22631 /** The default Adapter for the switch. */ 22632 get: function get() { 22633 return { 22634 addClass: function addClass() { 22635 return undefined; 22636 }, 22637 removeClass: function removeClass() { 22638 return undefined; 22639 }, 22640 setNativeControlChecked: function setNativeControlChecked() { 22641 return undefined; 22642 }, 22643 setNativeControlDisabled: function setNativeControlDisabled() { 22644 return undefined; 22645 }, 22646 setNativeControlAttr: function setNativeControlAttr() { 22647 return undefined; 22648 } 22649 }; 22650 }, 22651 enumerable: false, 22652 configurable: true 22653 }); 22654 /** Sets the checked state of the switch. */ 22655 MDCSwitchFoundation.prototype.setChecked = function (checked) { 22656 this.adapter.setNativeControlChecked(checked); 22657 this.updateAriaChecked_(checked); 22658 this.updateCheckedStyling_(checked); 22659 }; 22660 /** Sets the disabled state of the switch. */ 22661 MDCSwitchFoundation.prototype.setDisabled = function (disabled) { 22662 this.adapter.setNativeControlDisabled(disabled); 22663 if (disabled) {
22664 this.adapter.addClass(constants_1.cssClasses.DISABLED); 22665 } else { 22666 this.adapter.removeClass(constants_1.cssClasses.DISABLED); 22667 } 22668 }; 22669 /** Handles the change event for the switch native control. */ 22670 MDCSwitchFoundation.prototype.handleChange = function (evt) { 22671 var nativeControl = evt.target; 22672 this.updateAriaChecked_(nativeControl.checked); 22673 this.updateCheckedStyling_(nativeControl.checked); 22674 }; 22675 /** Updates the styling of the switch based on its checked state. */ 22676 MDCSwitchFoundation.prototype.updateCheckedStyling_ = function (checked) { 22677 if (checked) { 22678 this.adapter.addClass(constants_1.cssClasses.CHECKED); 22679 } else { 22680 this.adapter.removeClass(constants_1.cssClasses.CHECKED); 22681 } 22682 }; 22683 MDCSwitchFoundation.prototype.updateAriaChecked_ = function (checked) { 22684 this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, "" + !!checked); 22685 }; 22686 return MDCSwitchFoundation; 22687}(foundation_1.MDCFoundation); 22688exports.MDCSwitchFoundation = MDCSwitchFoundation; 22689// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 22690exports.default = MDCSwitchFoundation; 22691 22692/***/ }), 22693
vendor: 2,008 bytes, lines 22694-22740
22694/***/ "./packages/mdc-switch/index.ts": 22695/*!**************************************!*\ 22696 !*** ./packages/mdc-switch/index.ts ***! 22697 \**************************************/ 22698/*! no static exports found */ 22699/***/ (function(module, exports, __webpack_require__) { 22700 22701"use strict"; 22702 22703/** 22704 * @license 22705 * Copyright 2019 Google Inc. 22706 * 22707 * Permission is hereby granted, free of charge, to any person obtaining a copy 22708 * of this software and associated documentation files (the "Software"), to deal 22709 * in the Software without restriction, including without limitation the rights 22710 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22711 * copies of the Software, and to permit persons to whom the Software is 22712 * furnished to do so, subject to the following conditions: 22713 * 22714 * The above copyright notice and this permission notice shall be included in 22715 * all copies or substantial portions of the Software. 22716 * 22717 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22718 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22719 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22720 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22721 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22722 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22723 * THE SOFTWARE. 22724 */ 22725 22726var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 22727 if (k2 === undefined) k2 = k; 22728 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 22729 return m[k]; 22730 } }); 22731} : function (o, m, k, k2) { 22732 if (k2 === undefined) k2 = k; 22733 o[k2] = m[k]; 22734}); 22735var __exportStar = this && this.__exportStar || function (m, exports) { 22736 for (var p in m) { 22737 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 22738 } 22739}; 22740Object.defineProperty(exports, "__esModule", { value: true })
vendor: 4,153 bytes, lines 22740-22835
22740; 22741__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-switch/adapter.ts"), exports); 22742__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-switch/component.ts"), exports); 22743__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts"), exports); 22744__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts"), exports); 22745 22746/***/ }), 22747 22748/***/ "./packages/mdc-tab-bar/adapter.ts": 22749/*!*****************************************!*\ 22750 !*** ./packages/mdc-tab-bar/adapter.ts ***! 22751 \*****************************************/ 22752/*! no static exports found */ 22753/***/ (function(module, exports, __webpack_require__) { 22754 22755"use strict"; 22756 22757/** 22758 * @license 22759 * Copyright 2018 Google Inc. 22760 * 22761 * Permission is hereby granted, free of charge, to any person obtaining a copy 22762 * of this software and associated documentation files (the "Software"), to deal 22763 * in the Software without restriction, including without limitation the rights 22764 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22765 * copies of the Software, and to permit persons to whom the Software is 22766 * furnished to do so, subject to the following conditions: 22767 * 22768 * The above copyright notice and this permission notice shall be included in 22769 * all copies or substantial portions of the Software. 22770 * 22771 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22772 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22773 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22774 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22775 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22776 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22777 * THE SOFTWARE. 22778 */ 22779 22780Object.defineProperty(exports, "__esModule", { value: true }); 22781 22782/***/ }), 22783 22784/***/ "./packages/mdc-tab-bar/component.ts": 22785/*!*******************************************!*\ 22786 !*** ./packages/mdc-tab-bar/component.ts ***! 22787 \*******************************************/ 22788/*! no static exports found */ 22789/***/ (function(module, exports, __webpack_require__) { 22790 22791"use strict"; 22792 22793/** 22794 * @license 22795 * Copyright 2018 Google Inc. 22796 * 22797 * Permission is hereby granted, free of charge, to any person obtaining a copy 22798 * of this software and associated documentation files (the "Software"), to deal 22799 * in the Software without restriction, including without limitation the rights 22800 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22801 * copies of the Software, and to permit persons to whom the Software is 22802 * furnished to do so, subject to the following conditions: 22803 * 22804 * The above copyright notice and this permission notice shall be included in 22805 * all copies or substantial portions of the Software. 22806 * 22807 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22808 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22809 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22810 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22811 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22812 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22813 * THE SOFTWARE. 22814 */ 22815 22816var __extends = this && this.__extends || function () { 22817 var _extendStatics = function extendStatics(d, b) { 22818 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 22819 d.__proto__ = b; 22820 } || function (d, b) { 22821 for (var p in b) { 22822 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 22823 } 22824 }; 22825 return _extendStatics(d, b); 22826 }; 22827 return function (d, b) { 22828 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 22829 _extendStatics(d, b); 22830 function __() { 22831 this.constructor = d; 22832 } 22833 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 22834 }; 22835}();
vendor: 7,905 bytes, lines 22836-23016
22836Object.defineProperty(exports, "__esModule", { value: true }); 22837exports.MDCTabBar = void 0; 22838var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 22839var component_2 = __webpack_require__(/*! @material/tab-scroller/component */ "./packages/mdc-tab-scroller/component.ts"); 22840var component_3 = __webpack_require__(/*! @material/tab/component */ "./packages/mdc-tab/component.ts"); 22841var foundation_1 = __webpack_require__(/*! @material/tab/foundation */ "./packages/mdc-tab/foundation.ts"); 22842var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts"); 22843var strings = foundation_2.MDCTabBarFoundation.strings; 22844var tabIdCounter = 0; 22845var MDCTabBar = /** @class */function (_super) { 22846 __extends(MDCTabBar, _super); 22847 function MDCTabBar() { 22848 return _super !== null && _super.apply(this, arguments) || this; 22849 } 22850 MDCTabBar.attachTo = function (root) { 22851 return new MDCTabBar(root); 22852 }; 22853 Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", { 22854 set: function set(focusOnActivate) { 22855 this.tabList_.forEach(function (tab) { 22856 return tab.focusOnActivate = focusOnActivate; 22857 }); 22858 }, 22859 enumerable: false, 22860 configurable: true 22861 }); 22862 Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", { 22863 set: function set(useAutomaticActivation) { 22864 this.foundation.setUseAutomaticActivation(useAutomaticActivation); 22865 }, 22866 enumerable: false, 22867 configurable: true 22868 }); 22869 MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) { 22870 if (tabFactory === void 0) { 22871 tabFactory = function tabFactory(el) { 22872 return new component_3.MDCTab(el); 22873 }; 22874 } 22875 if (tabScrollerFactory === void 0) { 22876 tabScrollerFactory = function tabScrollerFactory(el) { 22877 return new component_2.MDCTabScroller(el); 22878 }; 22879 } 22880 this.tabList_ = this.instantiateTabs_(tabFactory); 22881 this.tabScroller_ = this.instantiateTabScroller_(tabScrollerFactory); 22882 }; 22883 MDCTabBar.prototype.initialSyncWithDOM = function () { 22884 var _this = this; 22885 this.handleTabInteraction_ = function (evt) { 22886 return _this.foundation.handleTabInteraction(evt); 22887 }; 22888 this.handleKeyDown_ = function (evt) { 22889 return _this.foundation.handleKeyDown(evt); 22890 }; 22891 this.listen(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_); 22892 this.listen('keydown', this.handleKeyDown_); 22893 for (var i = 0; i < this.tabList_.length; i++) { 22894 if (this.tabList_[i].active) { 22895 this.scrollIntoView(i); 22896 break; 22897 } 22898 } 22899 }; 22900 MDCTabBar.prototype.destroy = function () { 22901 _super.prototype.destroy.call(this); 22902 this.unlisten(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_); 22903 this.unlisten('keydown', this.handleKeyDown_); 22904 this.tabList_.forEach(function (tab) { 22905 return tab.destroy(); 22906 }); 22907 if (this.tabScroller_) { 22908 this.tabScroller_.destroy(); 22909 } 22910 }; 22911 MDCTabBar.prototype.getDefaultFoundation = function () { 22912 var _this = this; 22913 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 22914 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 22915 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 22916 var adapter = { 22917 scrollTo: function scrollTo(scrollX) { 22918 return _this.tabScroller_.scrollTo(scrollX); 22919 }, 22920 incrementScroll: function incrementScroll(scrollXIncrement) { 22921 return _this.tabScroller_.incrementScroll(scrollXIncrement); 22922 }, 22923 getScrollPosition: function getScrollPosition() { 22924 return _this.tabScroller_.getScrollPosition(); 22925 }, 22926 getScrollContentWidth: function getScrollContentWidth() { 22927 return _this.tabScroller_.getScrollContentWidth(); 22928 }, 22929 getOffsetWidth: function getOffsetWidth() { 22930 return _this.root.offsetWidth; 22931 }, 22932 isRTL: function isRTL() { 22933 return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; 22934 }, 22935 setActiveTab: function setActiveTab(index) { 22936 return _this.foundation.activateTab(index); 22937 }, 22938 activateTabAtIndex: function activateTabAtIndex(index, clientRect) { 22939 return _this.tabList_[index].activate(clientRect); 22940 }, 22941 deactivateTabAtIndex: function deactivateTabAtIndex(index) { 22942 return _this.tabList_[index].deactivate(); 22943 }, 22944 focusTabAtIndex: function focusTabAtIndex(index) { 22945 return _this.tabList_[index].focus(); 22946 }, 22947 getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex(index) { 22948 return _this.tabList_[index].computeIndicatorClientRect(); 22949 }, 22950 getTabDimensionsAtIndex: function getTabDimensionsAtIndex(index) { 22951 return _this.tabList_[index].computeDimensions(); 22952 }, 22953 getPreviousActiveTabIndex: function getPreviousActiveTabIndex() { 22954 for (var i = 0; i < _this.tabList_.length; i++) { 22955 if (_this.tabList_[i].active) { 22956 return i; 22957 } 22958 } 22959 return -1; 22960 }, 22961 getFocusedTabIndex: function getFocusedTabIndex() { 22962 var tabElements = _this.getTabElements_(); 22963 var activeElement = document.activeElement; 22964 return tabElements.indexOf(activeElement); 22965 }, 22966 getIndexOfTabById: function getIndexOfTabById(id) { 22967 for (var i = 0; i < _this.tabList_.length; i++) { 22968 if (_this.tabList_[i].id === id) { 22969 return i; 22970 } 22971 } 22972 return -1; 22973 }, 22974 getTabListLength: function getTabListLength() { 22975 return _this.tabList_.length; 22976 }, 22977 notifyTabActivated: function notifyTabActivated(index) { 22978 return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true); 22979 } 22980 }; 22981 // tslint:enable:object-literal-sort-keys 22982 return new foundation_2.MDCTabBarFoundation(adapter); 22983 }; 22984 /** 22985 * Activates the tab at the given index 22986 * @param index The index of the tab 22987 */ 22988 MDCTabBar.prototype.activateTab = function (index) { 22989 this.foundation.activateTab(index); 22990 }; 22991 /** 22992 * Scrolls the tab at the given index into view 22993 * @param index THe index of the tab 22994 */ 22995 MDCTabBar.prototype.scrollIntoView = function (index) { 22996 this.foundation.scrollIntoView(index); 22997 }; 22998 /** 22999 * Returns all the tab elements in a nice clean array 23000 */ 23001 MDCTabBar.prototype.getTabElements_ = function () { 23002 return [].slice.call(this.root.querySelectorAll(strings.TAB_SELECTOR)); 23003 }; 23004 /** 23005 * Instantiates tab components on all child tab elements 23006 */ 23007 MDCTabBar.prototype.instantiateTabs_ = function (tabFactory) { 23008 return this.getTabElements_().map(function (el) { 23009 el.id = el.id || "mdc-tab-" + ++tabIdCounter; 23010 return tabFactory(el); 23011 }); 23012 }; 23013 /** 23014 * Instantiates tab scroller component on the child tab scroller element 23015 */ 23016 MDCTabBar.prototype.instantiateTabScroller_
vendor: 6,766 bytes, lines 23016-23176
23016 = function (tabScrollerFactory) { 23017 var tabScrollerElement = this.root.querySelector(strings.TAB_SCROLLER_SELECTOR); 23018 if (tabScrollerElement) { 23019 return tabScrollerFactory(tabScrollerElement); 23020 } 23021 return null; 23022 }; 23023 return MDCTabBar; 23024}(component_1.MDCComponent); 23025exports.MDCTabBar = MDCTabBar; 23026 23027/***/ }), 23028 23029/***/ "./packages/mdc-tab-bar/constants.ts": 23030/*!*******************************************!*\ 23031 !*** ./packages/mdc-tab-bar/constants.ts ***! 23032 \*******************************************/ 23033/*! no static exports found */ 23034/***/ (function(module, exports, __webpack_require__) { 23035 23036"use strict"; 23037 23038/** 23039 * @license 23040 * Copyright 2018 Google Inc. 23041 * 23042 * Permission is hereby granted, free of charge, to any person obtaining a copy 23043 * of this software and associated documentation files (the "Software"), to deal 23044 * in the Software without restriction, including without limitation the rights 23045 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23046 * copies of the Software, and to permit persons to whom the Software is 23047 * furnished to do so, subject to the following conditions: 23048 * 23049 * The above copyright notice and this permission notice shall be included in 23050 * all copies or substantial portions of the Software. 23051 * 23052 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23053 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23054 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23055 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23056 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23057 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23058 * THE SOFTWARE. 23059 */ 23060 23061Object.defineProperty(exports, "__esModule", { value: true }); 23062exports.strings = exports.numbers = void 0; 23063var strings = { 23064 ARROW_LEFT_KEY: 'ArrowLeft', 23065 ARROW_RIGHT_KEY: 'ArrowRight', 23066 END_KEY: 'End', 23067 ENTER_KEY: 'Enter', 23068 HOME_KEY: 'Home', 23069 SPACE_KEY: 'Space', 23070 TAB_ACTIVATED_EVENT: 'MDCTabBar:activated', 23071 TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller', 23072 TAB_SELECTOR: '.mdc-tab' 23073}; 23074exports.strings = strings; 23075var numbers = { 23076 ARROW_LEFT_KEYCODE: 37, 23077 ARROW_RIGHT_KEYCODE: 39, 23078 END_KEYCODE: 35, 23079 ENTER_KEYCODE: 13, 23080 EXTRA_SCROLL_AMOUNT: 20, 23081 HOME_KEYCODE: 36, 23082 SPACE_KEYCODE: 32 23083}; 23084exports.numbers = numbers; 23085 23086/***/ }), 23087 23088/***/ "./packages/mdc-tab-bar/foundation.ts": 23089/*!********************************************!*\ 23090 !*** ./packages/mdc-tab-bar/foundation.ts ***! 23091 \********************************************/ 23092/*! no static exports found */ 23093/***/ (function(module, exports, __webpack_require__) { 23094 23095"use strict"; 23096 23097/** 23098 * @license 23099 * Copyright 2018 Google Inc. 23100 * 23101 * Permission is hereby granted, free of charge, to any person obtaining a copy 23102 * of this software and associated documentation files (the "Software"), to deal 23103 * in the Software without restriction, including without limitation the rights 23104 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23105 * copies of the Software, and to permit persons to whom the Software is 23106 * furnished to do so, subject to the following conditions: 23107 * 23108 * The above copyright notice and this permission notice shall be included in 23109 * all copies or substantial portions of the Software. 23110 * 23111 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23112 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23113 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23114 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23115 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23116 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23117 * THE SOFTWARE. 23118 */ 23119 23120var __extends = this && this.__extends || function () { 23121 var _extendStatics = function extendStatics(d, b) { 23122 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 23123 d.__proto__ = b; 23124 } || function (d, b) { 23125 for (var p in b) { 23126 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 23127 } 23128 }; 23129 return _extendStatics(d, b); 23130 }; 23131 return function (d, b) { 23132 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 23133 _extendStatics(d, b); 23134 function __() { 23135 this.constructor = d; 23136 } 23137 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 23138 }; 23139}(); 23140var __assign = this && this.__assign || function () { 23141 __assign = Object.assign || function (t) { 23142 for (var s, i = 1, n = arguments.length; i < n; i++) { 23143 s = arguments[i]; 23144 for (var p in s) { 23145 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 23146 } 23147 } 23148 return t; 23149 }; 23150 return __assign.apply(this, arguments); 23151}; 23152Object.defineProperty(exports, "__esModule", { value: true }); 23153exports.MDCTabBarFoundation = void 0; 23154var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 23155var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts"); 23156var ACCEPTABLE_KEYS = new Set(); 23157// IE11 has no support for new Set with iterable so we need to initialize this by hand 23158ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_LEFT_KEY); 23159ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_RIGHT_KEY); 23160ACCEPTABLE_KEYS.add(constants_1.strings.END_KEY); 23161ACCEPTABLE_KEYS.add(constants_1.strings.HOME_KEY); 23162ACCEPTABLE_KEYS.add(constants_1.strings.ENTER_KEY); 23163ACCEPTABLE_KEYS.add(constants_1.strings.SPACE_KEY); 23164var KEYCODE_MAP = new Map(); 23165// IE11 has no support for new Map with iterable so we need to initialize this by hand 23166KEYCODE_MAP.set(constants_1.numbers.ARROW_LEFT_KEYCODE, constants_1.strings.ARROW_LEFT_KEY); 23167KEYCODE_MAP.set(constants_1.numbers.ARROW_RIGHT_KEYCODE, constants_1.strings.ARROW_RIGHT_KEY); 23168KEYCODE_MAP.set(constants_1.numbers.END_KEYCODE, constants_1.strings.END_KEY); 23169KEYCODE_MAP.set(constants_1.numbers.HOME_KEYCODE, constants_1.strings.HOME_KEY); 23170KEYCODE_MAP.set(constants_1.numbers.ENTER_KEYCODE, constants_1.strings.ENTER_KEY); 23171KEYCODE_MAP.set(constants_1.numbers.SPACE_KEYCODE, constants_1.strings.SPACE_KEY); 23172var MDCTabBarFoundation = /** @class */function (_super) { 23173 __extends(MDCTabBarFoundation, _super); 23174 function MDCTabBarFoundation(adapter) { 23175 var _this = _super.call(this, __assign(__assign({}, MDCTabBarFoundation.defaultAdapter), adapter)) || this; 23176 _this.useAutomaticActivation
23176_
vendor: 3,257 bytes, lines 23176-23259
23176 = false; 23177 return _this; 23178 } 23179 Object.defineProperty(MDCTabBarFoundation, "strings", { 23180 get: function get() { 23181 return constants_1.strings; 23182 }, 23183 enumerable: false, 23184 configurable: true 23185 }); 23186 Object.defineProperty(MDCTabBarFoundation, "numbers", { 23187 get: function get() { 23188 return constants_1.numbers; 23189 }, 23190 enumerable: false, 23191 configurable: true 23192 }); 23193 Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", { 23194 get: function get() { 23195 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 23196 return { 23197 scrollTo: function scrollTo() { 23198 return undefined; 23199 }, 23200 incrementScroll: function incrementScroll() { 23201 return undefined; 23202 }, 23203 getScrollPosition: function getScrollPosition() { 23204 return 0; 23205 }, 23206 getScrollContentWidth: function getScrollContentWidth() { 23207 return 0; 23208 }, 23209 getOffsetWidth: function getOffsetWidth() { 23210 return 0; 23211 }, 23212 isRTL: function isRTL() { 23213 return false; 23214 }, 23215 setActiveTab: function setActiveTab() { 23216 return undefined; 23217 }, 23218 activateTabAtIndex: function activateTabAtIndex() { 23219 return undefined; 23220 }, 23221 deactivateTabAtIndex: function deactivateTabAtIndex() { 23222 return undefined; 23223 }, 23224 focusTabAtIndex: function focusTabAtIndex() { 23225 return undefined; 23226 }, 23227 getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex() { 23228 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 23229 }, 23230 getTabDimensionsAtIndex: function getTabDimensionsAtIndex() { 23231 return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 }; 23232 }, 23233 getPreviousActiveTabIndex: function getPreviousActiveTabIndex() { 23234 return -1; 23235 }, 23236 getFocusedTabIndex: function getFocusedTabIndex() { 23237 return -1; 23238 }, 23239 getIndexOfTabById: function getIndexOfTabById() { 23240 return -1; 23241 }, 23242 getTabListLength: function getTabListLength() { 23243 return 0; 23244 }, 23245 notifyTabActivated: function notifyTabActivated() { 23246 return undefined; 23247 } 23248 }; 23249 // tslint:enable:object-literal-sort-keys 23250 }, 23251 enumerable: false, 23252 configurable: true 23253 }); 23254 /** 23255 * Switches between automatic and manual activation modes. 23256 * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples. 23257 */ 23258 MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) { 23259 this.useAutomaticActivation
vendor: 2,897 bytes, lines 23259-23326
23259_ = useAutomaticActivation; 23260 }; 23261 MDCTabBarFoundation.prototype.activateTab = function (index) { 23262 var previousActiveIndex = this.adapter.getPreviousActiveTabIndex(); 23263 if (!this.indexIsInRange_(index) || index === previousActiveIndex) { 23264 return; 23265 } 23266 var previousClientRect; 23267 if (previousActiveIndex !== -1) { 23268 this.adapter.deactivateTabAtIndex(previousActiveIndex); 23269 previousClientRect = this.adapter.getTabIndicatorClientRectAtIndex(previousActiveIndex); 23270 } 23271 this.adapter.activateTabAtIndex(index, previousClientRect); 23272 this.scrollIntoView(index); 23273 this.adapter.notifyTabActivated(index); 23274 }; 23275 MDCTabBarFoundation.prototype.handleKeyDown = function (evt) { 23276 // Get the key from the event 23277 var key = this.getKeyFromEvent_(evt); 23278 // Early exit if the event key isn't one of the keyboard navigation keys 23279 if (key === undefined) { 23280 return; 23281 } 23282 // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple 23283 if (!this.isActivationKey_(key)) { 23284 evt.preventDefault(); 23285 } 23286 if (this.useAutomaticActivation_) { 23287 if (this.isActivationKey_(key)) { 23288 return; 23289 } 23290 var index = this.determineTargetFromKey_(this.adapter.getPreviousActiveTabIndex(), key); 23291 this.adapter.setActiveTab(index); 23292 this.scrollIntoView(index); 23293 } else { 23294 var focusedTabIndex = this.adapter.getFocusedTabIndex(); 23295 if (this.isActivationKey_(key)) { 23296 this.adapter.setActiveTab(focusedTabIndex); 23297 } else { 23298 var index = this.determineTargetFromKey_(focusedTabIndex, key); 23299 this.adapter.focusTabAtIndex(index); 23300 this.scrollIntoView(index); 23301 } 23302 } 23303 }; 23304 /** 23305 * Handles the MDCTab:interacted event 23306 */ 23307 MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) { 23308 this.adapter.setActiveTab(this.adapter.getIndexOfTabById(evt.detail.tabId)); 23309 }; 23310 /** 23311 * Scrolls the tab at the given index into view 23312 * @param index The tab index to make visible 23313 */ 23314 MDCTabBarFoundation.prototype.scrollIntoView = function (index) { 23315 // Early exit if the index is out of range 23316 if (!this.indexIsInRange_(index)) { 23317 return; 23318 } 23319 // Always scroll to 0 if scrolling to the 0th index 23320 if (index === 0) { 23321 return this.adapter.scrollTo(0); 23322 } 23323 // Always scroll to the max value if scrolling to the Nth index 23324 // MDCTabScroller.scrollTo() will never scroll past the max possible value 23325 if (index === this.adapter.getTabListLength() - 1) { 23326 return this.adapter.scrollTo(this.adapter.getScrollC
vendor: 9,141 bytes, lines 23326-23519
23326ontentWidth()); 23327 } 23328 if (this.isRTL_()) { 23329 return this.scrollIntoViewRTL_(index); 23330 } 23331 this.scrollIntoView_(index); 23332 }; 23333 /** 23334 * Private method for determining the index of the destination tab based on what key was pressed 23335 * @param origin The original index from which to determine the destination 23336 * @param key The name of the key 23337 */ 23338 MDCTabBarFoundation.prototype.determineTargetFromKey_ = function (origin, key) { 23339 var isRTL = this.isRTL_(); 23340 var maxIndex = this.adapter.getTabListLength() - 1; 23341 var shouldGoToEnd = key === constants_1.strings.END_KEY; 23342 var shouldDecrement = key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL; 23343 var shouldIncrement = key === constants_1.strings.ARROW_RIGHT_KEY && !isRTL || key === constants_1.strings.ARROW_LEFT_KEY && isRTL; 23344 var index = origin; 23345 if (shouldGoToEnd) { 23346 index = maxIndex; 23347 } else if (shouldDecrement) { 23348 index -= 1; 23349 } else if (shouldIncrement) { 23350 index += 1; 23351 } else { 23352 index = 0; 23353 } 23354 if (index < 0) { 23355 index = maxIndex; 23356 } else if (index > maxIndex) { 23357 index = 0; 23358 } 23359 return index; 23360 }; 23361 /** 23362 * Calculates the scroll increment that will make the tab at the given index visible 23363 * @param index The index of the tab 23364 * @param nextIndex The index of the next tab 23365 * @param scrollPosition The current scroll position 23366 * @param barWidth The width of the Tab Bar 23367 */ 23368 MDCTabBarFoundation.prototype.calculateScrollIncrement_ = function (index, nextIndex, scrollPosition, barWidth) { 23369 var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex); 23370 var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth; 23371 var relativeContentRight = nextTabDimensions.contentRight - scrollPosition; 23372 var leftIncrement = relativeContentRight - constants_1.numbers.EXTRA_SCROLL_AMOUNT; 23373 var rightIncrement = relativeContentLeft + constants_1.numbers.EXTRA_SCROLL_AMOUNT; 23374 if (nextIndex < index) { 23375 return Math.min(leftIncrement, 0); 23376 } 23377 return Math.max(rightIncrement, 0); 23378 }; 23379 /** 23380 * Calculates the scroll increment that will make the tab at the given index visible in RTL 23381 * @param index The index of the tab 23382 * @param nextIndex The index of the next tab 23383 * @param scrollPosition The current scroll position 23384 * @param barWidth The width of the Tab Bar 23385 * @param scrollContentWidth The width of the scroll content 23386 */ 23387 MDCTabBarFoundation.prototype.calculateScrollIncrementRTL_ = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) { 23388 var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex); 23389 var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition; 23390 var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth; 23391 var leftIncrement = relativeContentRight + constants_1.numbers.EXTRA_SCROLL_AMOUNT; 23392 var rightIncrement = relativeContentLeft - constants_1.numbers.EXTRA_SCROLL_AMOUNT; 23393 if (nextIndex > index) { 23394 return Math.max(leftIncrement, 0); 23395 } 23396 return Math.min(rightIncrement, 0); 23397 }; 23398 /** 23399 * Determines the index of the adjacent tab closest to either edge of the Tab Bar 23400 * @param index The index of the tab 23401 * @param tabDimensions The dimensions of the tab 23402 * @param scrollPosition The current scroll position 23403 * @param barWidth The width of the tab bar 23404 */ 23405 MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge_ = function (index, tabDimensions, scrollPosition, barWidth) { 23406 /** 23407 * Tabs are laid out in the Tab Scroller like this: 23408 * 23409 * Scroll Position 23410 * +---+ 23411 * | | Bar Width 23412 * | +-----------------------------------+ 23413 * | | | 23414 * | V V 23415 * | +-----------------------------------+ 23416 * V | Tab Scroller | 23417 * +------------+--------------+-------------------+ 23418 * | Tab | Tab | Tab | 23419 * +------------+--------------+-------------------+ 23420 * | | 23421 * +-----------------------------------+ 23422 * 23423 * To determine the next adjacent index, we look at the Tab root left and 23424 * Tab root right, both relative to the scroll position. If the Tab root 23425 * left is less than 0, then we know it's out of view to the left. If the 23426 * Tab root right minus the bar width is greater than 0, we know the Tab is 23427 * out of view to the right. From there, we either increment or decrement 23428 * the index. 23429 */ 23430 var relativeRootLeft = tabDimensions.rootLeft - scrollPosition; 23431 var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth; 23432 var relativeRootDelta = relativeRootLeft + relativeRootRight; 23433 var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0; 23434 var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0; 23435 if (leftEdgeIsCloser) { 23436 return index - 1; 23437 } 23438 if (rightEdgeIsCloser) { 23439 return index + 1; 23440 } 23441 return -1; 23442 }; 23443 /** 23444 * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL 23445 * @param index The index of the tab 23446 * @param tabDimensions The dimensions of the tab 23447 * @param scrollPosition The current scroll position 23448 * @param barWidth The width of the tab bar 23449 * @param scrollContentWidth The width of the scroller content 23450 */ 23451 MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL_ = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) { 23452 var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition; 23453 var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition; 23454 var rootDelta = rootLeft + rootRight; 23455 var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0; 23456 var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0; 23457 if (leftEdgeIsCloser) { 23458 return index + 1; 23459 } 23460 if (rightEdgeIsCloser) { 23461 return index - 1; 23462 } 23463 return -1; 23464 }; 23465 /** 23466 * Returns the key associated with a keydown event 23467 * @param evt The keydown event 23468 */ 23469 MDCTabBarFoundation.prototype.getKeyFromEvent_ = function (evt) { 23470 if (ACCEPTABLE_KEYS.has(evt.key)) { 23471 return evt.key; 23472 } 23473 return KEYCODE_MAP.get(evt.keyCode); 23474 }; 23475 MDCTabBarFoundation.prototype.isActivationKey_ = function (key) { 23476 return key === constants_1.strings.SPACE_KEY || key === constants_1.strings.ENTER_KEY; 23477 }; 23478 /** 23479 * Returns whether a given index is inclusively between the ends 23480 * @param index The index to test 23481 */ 23482 MDCTabBarFoundation.prototype.indexIsInRange_ = function (index) { 23483 return index >= 0 && index < this.adapter.getTabListLength(); 23484 }; 23485 /** 23486 * Returns the view's RTL property 23487 */ 23488 MDCTabBarFoundation.prototype.isRTL_ = function () { 23489 return this.adapter.isRTL(); 23490 }; 23491 /** 23492 * Scrolls the tab at the given index into view for left-to-right user agents. 23493 * @param index The index of the tab to scroll into view 23494 */ 23495 MDCTabBarFoundation.prototype.scrollIntoView_ = function (index) { 23496 var scrollPosition = this.adapter.getScrollPosition(); 23497 var barWidth = this.adapter.getOffsetWidth(); 23498 var tabDimensions = this.adapter.getTabDimensionsAtIndex(index); 23499 var nextIndex = this.findAdjacentTabIndexClosestToEdge_(index, tabDimensions, scrollPosition, barWidth); 23500 if (!this.indexIsInRange_(nextIndex)) { 23501 return; 23502 } 23503 var scrollIncrement = this.calculateScrollIncrement_(index, nextIndex, scrollPosition, barWidth); 23504 this.adapter.incrementScroll(scrollIncrement); 23505 }; 23506 /** 23507 * Scrolls the tab at the given index into view in RTL 23508 * @param index The tab index to make visible 23509 */ 23510 MDCTabBarFoundation.prototype.scrollIntoViewRTL_ = function (index) { 23511 var scrollPosition = this.adapter.getScrollPosition(); 23512 var barWidth = this.adapter.getOffsetWidth(); 23513 var tabDimensions = this.adapter.getTabDimensionsAtIndex(index); 23514 var scrollWidth = this.adapter.getScrollContentWidth(); 23515 var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL_(index, tabDimensions, scrollPosition, barWidth, scrollWidth); 23516 if (!this.indexIsInRange_(nextIndex)) { 23517 return; 23518 } 23519 var scrollIncrement = this.calculateScrollIncrementRTL_
vendor: 4,405 bytes, lines 23519-23620
23519(index, nextIndex, scrollPosition, barWidth, scrollWidth); 23520 this.adapter.incrementScroll(scrollIncrement); 23521 }; 23522 return MDCTabBarFoundation; 23523}(foundation_1.MDCFoundation); 23524exports.MDCTabBarFoundation = MDCTabBarFoundation; 23525// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 23526exports.default = MDCTabBarFoundation; 23527 23528/***/ }), 23529 23530/***/ "./packages/mdc-tab-bar/index.ts": 23531/*!***************************************!*\ 23532 !*** ./packages/mdc-tab-bar/index.ts ***! 23533 \***************************************/ 23534/*! no static exports found */ 23535/***/ (function(module, exports, __webpack_require__) { 23536 23537"use strict"; 23538 23539/** 23540 * @license 23541 * Copyright 2019 Google Inc. 23542 * 23543 * Permission is hereby granted, free of charge, to any person obtaining a copy 23544 * of this software and associated documentation files (the "Software"), to deal 23545 * in the Software without restriction, including without limitation the rights 23546 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23547 * copies of the Software, and to permit persons to whom the Software is 23548 * furnished to do so, subject to the following conditions: 23549 * 23550 * The above copyright notice and this permission notice shall be included in 23551 * all copies or substantial portions of the Software. 23552 * 23553 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23554 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23555 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23556 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23557 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23558 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23559 * THE SOFTWARE. 23560 */ 23561 23562var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 23563 if (k2 === undefined) k2 = k; 23564 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 23565 return m[k]; 23566 } }); 23567} : function (o, m, k, k2) { 23568 if (k2 === undefined) k2 = k; 23569 o[k2] = m[k]; 23570}); 23571var __exportStar = this && this.__exportStar || function (m, exports) { 23572 for (var p in m) { 23573 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 23574 } 23575}; 23576Object.defineProperty(exports, "__esModule", { value: true }); 23577__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-tab-bar/adapter.ts"), exports); 23578__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-tab-bar/component.ts"), exports); 23579__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts"), exports); 23580__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts"), exports); 23581__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-tab-bar/types.ts"), exports); 23582 23583/***/ }), 23584 23585/***/ "./packages/mdc-tab-bar/types.ts": 23586/*!***************************************!*\ 23587 !*** ./packages/mdc-tab-bar/types.ts ***! 23588 \***************************************/ 23589/*! no static exports found */ 23590/***/ (function(module, exports, __webpack_require__) { 23591 23592"use strict"; 23593 23594/** 23595 * @license 23596 * Copyright 2019 Google Inc. 23597 * 23598 * Permission is hereby granted, free of charge, to any person obtaining a copy 23599 * of this software and associated documentation files (the "Software"), to deal 23600 * in the Software without restriction, including without limitation the rights 23601 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23602 * copies of the Software, and to permit persons to whom the Software is 23603 * furnished to do so, subject to the following conditions: 23604 * 23605 * The above copyright notice and this permission notice shall be included in 23606 * all copies or substantial portions of the Software. 23607 * 23608 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23609 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23610 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23611 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23612 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23613 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23614 * THE SOFTWARE. 23615 */ 23616 23617Object.defineProperty(exports, "__esModule", { value: true }); 23618 23619/***/ }), 23620
vendor: 4,734 bytes, lines 23621-23724
23621/***/ "./packages/mdc-tab-indicator/adapter.ts": 23622/*!***********************************************!*\ 23623 !*** ./packages/mdc-tab-indicator/adapter.ts ***! 23624 \***********************************************/ 23625/*! no static exports found */ 23626/***/ (function(module, exports, __webpack_require__) { 23627 23628"use strict"; 23629 23630/** 23631 * @license 23632 * Copyright 2018 Google Inc. 23633 * 23634 * Permission is hereby granted, free of charge, to any person obtaining a copy 23635 * of this software and associated documentation files (the "Software"), to deal 23636 * in the Software without restriction, including without limitation the rights 23637 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23638 * copies of the Software, and to permit persons to whom the Software is 23639 * furnished to do so, subject to the following conditions: 23640 * 23641 * The above copyright notice and this permission notice shall be included in 23642 * all copies or substantial portions of the Software. 23643 * 23644 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23645 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23646 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23647 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23648 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23649 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23650 * THE SOFTWARE. 23651 */ 23652 23653Object.defineProperty(exports, "__esModule", { value: true }); 23654 23655/***/ }), 23656 23657/***/ "./packages/mdc-tab-indicator/component.ts": 23658/*!*************************************************!*\ 23659 !*** ./packages/mdc-tab-indicator/component.ts ***! 23660 \*************************************************/ 23661/*! no static exports found */ 23662/***/ (function(module, exports, __webpack_require__) { 23663 23664"use strict"; 23665 23666/** 23667 * @license 23668 * Copyright 2018 Google Inc. 23669 * 23670 * Permission is hereby granted, free of charge, to any person obtaining a copy 23671 * of this software and associated documentation files (the "Software"), to deal 23672 * in the Software without restriction, including without limitation the rights 23673 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23674 * copies of the Software, and to permit persons to whom the Software is 23675 * furnished to do so, subject to the following conditions: 23676 * 23677 * The above copyright notice and this permission notice shall be included in 23678 * all copies or substantial portions of the Software. 23679 * 23680 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23681 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23682 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23683 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23684 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23685 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23686 * THE SOFTWARE. 23687 */ 23688 23689var __extends = this && this.__extends || function () { 23690 var _extendStatics = function extendStatics(d, b) { 23691 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 23692 d.__proto__ = b; 23693 } || function (d, b) { 23694 for (var p in b) { 23695 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 23696 } 23697 }; 23698 return _extendStatics(d, b); 23699 }; 23700 return function (d, b) { 23701 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 23702 _extendStatics(d, b); 23703 function __() { 23704 this.constructor = d; 23705 } 23706 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 23707 }; 23708}(); 23709Object.defineProperty(exports, "__esModule", { value: true }); 23710exports.MDCTabIndicator = void 0; 23711var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 23712var fading_foundation_1 = __webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts"); 23713var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"); 23714var sliding_foundation_1 = __webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts"); 23715var MDCTabIndicator = /** @class */function (_super) { 23716 __extends(MDCTabIndicator, _super); 23717 function MDCTabIndicator() { 23718 return _super !== null && _super.apply(this, arguments) || this; 23719 } 23720 MDCTabIndicator.attachTo = function (root) { 23721 return new MDCTabIndicator(root); 23722 }; 23723 MDCTabIndicator.prototype.initialize = function () { 23724 this.content
23724_ = this.root.querySelector(foundation_1.MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR); 23725 }; 23726 MDCTabIndicator.prototype.computeContentClientRect = function () { 23727 return this.foundation.computeContentClientRect(); 23728 }; 23729 MDCTabIndicator.prototype.getDefaultFoundation = function () { 23730 var _this = this; 23731 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 23732 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 23733 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 23734 var adapter = { 23735 addClass: function addClass(className) { 23736 return _this.root.classList.add(className); 23737 }, 23738 removeClass: function removeClass(className) { 23739 return _this.root.classList.remove(className); 23740 }, 23741 computeContentClientRect: function computeContentClientRect() { 23742 return _this.content_.getBoundingClientRect(); 23743 }, 23744 setContentStyleProperty: function setContentStyleProperty(prop, value) { 23745 return _this.content_
vendor: 18,167 bytes, lines 23745-24143
23745.style.setProperty(prop, value); 23746 } 23747 }; 23748 // tslint:enable:object-literal-sort-keys 23749 if (this.root.classList.contains(foundation_1.MDCTabIndicatorFoundation.cssClasses.FADE)) { 23750 return new fading_foundation_1.MDCFadingTabIndicatorFoundation(adapter); 23751 } 23752 // Default to the sliding indicator 23753 return new sliding_foundation_1.MDCSlidingTabIndicatorFoundation(adapter); 23754 }; 23755 MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) { 23756 this.foundation.activate(previousIndicatorClientRect); 23757 }; 23758 MDCTabIndicator.prototype.deactivate = function () { 23759 this.foundation.deactivate(); 23760 }; 23761 return MDCTabIndicator; 23762}(component_1.MDCComponent); 23763exports.MDCTabIndicator = MDCTabIndicator; 23764 23765/***/ }), 23766 23767/***/ "./packages/mdc-tab-indicator/constants.ts": 23768/*!*************************************************!*\ 23769 !*** ./packages/mdc-tab-indicator/constants.ts ***! 23770 \*************************************************/ 23771/*! no static exports found */ 23772/***/ (function(module, exports, __webpack_require__) { 23773 23774"use strict"; 23775 23776/** 23777 * @license 23778 * Copyright 2018 Google Inc. 23779 * 23780 * Permission is hereby granted, free of charge, to any person obtaining a copy 23781 * of this software and associated documentation files (the "Software"), to deal 23782 * in the Software without restriction, including without limitation the rights 23783 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23784 * copies of the Software, and to permit persons to whom the Software is 23785 * furnished to do so, subject to the following conditions: 23786 * 23787 * The above copyright notice and this permission notice shall be included in 23788 * all copies or substantial portions of the Software. 23789 * 23790 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23791 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23792 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23793 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23794 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23795 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23796 * THE SOFTWARE. 23797 */ 23798 23799Object.defineProperty(exports, "__esModule", { value: true }); 23800exports.strings = exports.cssClasses = void 0; 23801var cssClasses = { 23802 ACTIVE: 'mdc-tab-indicator--active', 23803 FADE: 'mdc-tab-indicator--fade', 23804 NO_TRANSITION: 'mdc-tab-indicator--no-transition' 23805}; 23806exports.cssClasses = cssClasses; 23807var strings = { 23808 CONTENT_SELECTOR: '.mdc-tab-indicator__content' 23809}; 23810exports.strings = strings; 23811 23812/***/ }), 23813 23814/***/ "./packages/mdc-tab-indicator/fading-foundation.ts": 23815/*!*********************************************************!*\ 23816 !*** ./packages/mdc-tab-indicator/fading-foundation.ts ***! 23817 \*********************************************************/ 23818/*! no static exports found */ 23819/***/ (function(module, exports, __webpack_require__) { 23820 23821"use strict"; 23822 23823/** 23824 * @license 23825 * Copyright 2018 Google Inc. 23826 * 23827 * Permission is hereby granted, free of charge, to any person obtaining a copy 23828 * of this software and associated documentation files (the "Software"), to deal 23829 * in the Software without restriction, including without limitation the rights 23830 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23831 * copies of the Software, and to permit persons to whom the Software is 23832 * furnished to do so, subject to the following conditions: 23833 * 23834 * The above copyright notice and this permission notice shall be included in 23835 * all copies or substantial portions of the Software. 23836 * 23837 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23838 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23839 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23840 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23841 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23842 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23843 * THE SOFTWARE. 23844 */ 23845 23846var __extends = this && this.__extends || function () { 23847 var _extendStatics = function extendStatics(d, b) { 23848 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 23849 d.__proto__ = b; 23850 } || function (d, b) { 23851 for (var p in b) { 23852 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 23853 } 23854 }; 23855 return _extendStatics(d, b); 23856 }; 23857 return function (d, b) { 23858 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 23859 _extendStatics(d, b); 23860 function __() { 23861 this.constructor = d; 23862 } 23863 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 23864 }; 23865}(); 23866Object.defineProperty(exports, "__esModule", { value: true }); 23867exports.MDCFadingTabIndicatorFoundation = void 0; 23868var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"); 23869/* istanbul ignore next: subclass is not a branch statement */ 23870var MDCFadingTabIndicatorFoundation = /** @class */function (_super) { 23871 __extends(MDCFadingTabIndicatorFoundation, _super); 23872 function MDCFadingTabIndicatorFoundation() { 23873 return _super !== null && _super.apply(this, arguments) || this; 23874 } 23875 MDCFadingTabIndicatorFoundation.prototype.activate = function () { 23876 this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 23877 }; 23878 MDCFadingTabIndicatorFoundation.prototype.deactivate = function () { 23879 this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 23880 }; 23881 return MDCFadingTabIndicatorFoundation; 23882}(foundation_1.MDCTabIndicatorFoundation); 23883exports.MDCFadingTabIndicatorFoundation = MDCFadingTabIndicatorFoundation; 23884// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 23885exports.default = MDCFadingTabIndicatorFoundation; 23886 23887/***/ }), 23888 23889/***/ "./packages/mdc-tab-indicator/foundation.ts": 23890/*!**************************************************!*\ 23891 !*** ./packages/mdc-tab-indicator/foundation.ts ***! 23892 \**************************************************/ 23893/*! no static exports found */ 23894/***/ (function(module, exports, __webpack_require__) { 23895 23896"use strict"; 23897 23898/** 23899 * @license 23900 * Copyright 2018 Google Inc. 23901 * 23902 * Permission is hereby granted, free of charge, to any person obtaining a copy 23903 * of this software and associated documentation files (the "Software"), to deal 23904 * in the Software without restriction, including without limitation the rights 23905 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23906 * copies of the Software, and to permit persons to whom the Software is 23907 * furnished to do so, subject to the following conditions: 23908 * 23909 * The above copyright notice and this permission notice shall be included in 23910 * all copies or substantial portions of the Software. 23911 * 23912 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23913 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23914 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23915 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23916 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23917 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23918 * THE SOFTWARE. 23919 */ 23920 23921var __extends = this && this.__extends || function () { 23922 var _extendStatics = function extendStatics(d, b) { 23923 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 23924 d.__proto__ = b; 23925 } || function (d, b) { 23926 for (var p in b) { 23927 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 23928 } 23929 }; 23930 return _extendStatics(d, b); 23931 }; 23932 return function (d, b) { 23933 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 23934 _extendStatics(d, b); 23935 function __() { 23936 this.constructor = d; 23937 } 23938 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 23939 }; 23940}(); 23941var __assign = this && this.__assign || function () { 23942 __assign = Object.assign || function (t) { 23943 for (var s, i = 1, n = arguments.length; i < n; i++) { 23944 s = arguments[i]; 23945 for (var p in s) { 23946 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 23947 } 23948 } 23949 return t; 23950 }; 23951 return __assign.apply(this, arguments); 23952}; 23953Object.defineProperty(exports, "__esModule", { value: true }); 23954exports.MDCTabIndicatorFoundation = void 0; 23955var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 23956var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts"); 23957var MDCTabIndicatorFoundation = /** @class */function (_super) { 23958 __extends(MDCTabIndicatorFoundation, _super); 23959 function MDCTabIndicatorFoundation(adapter) { 23960 return _super.call(this, __assign(__assign({}, MDCTabIndicatorFoundation.defaultAdapter), adapter)) || this; 23961 } 23962 Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", { 23963 get: function get() { 23964 return constants_1.cssClasses; 23965 }, 23966 enumerable: false, 23967 configurable: true 23968 }); 23969 Object.defineProperty(MDCTabIndicatorFoundation, "strings", { 23970 get: function get() { 23971 return constants_1.strings; 23972 }, 23973 enumerable: false, 23974 configurable: true 23975 }); 23976 Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", { 23977 get: function get() { 23978 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 23979 return { 23980 addClass: function addClass() { 23981 return undefined; 23982 }, 23983 removeClass: function removeClass() { 23984 return undefined; 23985 }, 23986 computeContentClientRect: function computeContentClientRect() { 23987 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 23988 }, 23989 setContentStyleProperty: function setContentStyleProperty() { 23990 return undefined; 23991 } 23992 }; 23993 // tslint:enable:object-literal-sort-keys 23994 }, 23995 enumerable: false, 23996 configurable: true 23997 }); 23998 MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () { 23999 return this.adapter.computeContentClientRect(); 24000 }; 24001 return MDCTabIndicatorFoundation; 24002}(foundation_1.MDCFoundation); 24003exports.MDCTabIndicatorFoundation = MDCTabIndicatorFoundation; 24004// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 24005exports.default = MDCTabIndicatorFoundation; 24006 24007/***/ }), 24008 24009/***/ "./packages/mdc-tab-indicator/index.ts": 24010/*!*********************************************!*\ 24011 !*** ./packages/mdc-tab-indicator/index.ts ***! 24012 \*********************************************/ 24013/*! no static exports found */ 24014/***/ (function(module, exports, __webpack_require__) { 24015 24016"use strict"; 24017 24018/** 24019 * @license 24020 * Copyright 2019 Google Inc. 24021 * 24022 * Permission is hereby granted, free of charge, to any person obtaining a copy 24023 * of this software and associated documentation files (the "Software"), to deal 24024 * in the Software without restriction, including without limitation the rights 24025 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24026 * copies of the Software, and to permit persons to whom the Software is 24027 * furnished to do so, subject to the following conditions: 24028 * 24029 * The above copyright notice and this permission notice shall be included in 24030 * all copies or substantial portions of the Software. 24031 * 24032 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24033 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24034 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24035 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24036 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24037 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24038 * THE SOFTWARE. 24039 */ 24040 24041var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 24042 if (k2 === undefined) k2 = k; 24043 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 24044 return m[k]; 24045 } }); 24046} : function (o, m, k, k2) { 24047 if (k2 === undefined) k2 = k; 24048 o[k2] = m[k]; 24049}); 24050var __exportStar = this && this.__exportStar || function (m, exports) { 24051 for (var p in m) { 24052 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 24053 } 24054}; 24055Object.defineProperty(exports, "__esModule", { value: true }); 24056__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-tab-indicator/adapter.ts"), exports); 24057__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-tab-indicator/component.ts"), exports); 24058__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts"), exports); 24059__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"), exports); 24060__exportStar(__webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts"), exports); 24061__exportStar(__webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts"), exports); 24062 24063/***/ }), 24064 24065/***/ "./packages/mdc-tab-indicator/sliding-foundation.ts": 24066/*!**********************************************************!*\ 24067 !*** ./packages/mdc-tab-indicator/sliding-foundation.ts ***! 24068 \**********************************************************/ 24069/*! no static exports found */ 24070/***/ (function(module, exports, __webpack_require__) { 24071 24072"use strict"; 24073 24074/** 24075 * @license 24076 * Copyright 2018 Google Inc. 24077 * 24078 * Permission is hereby granted, free of charge, to any person obtaining a copy 24079 * of this software and associated documentation files (the "Software"), to deal 24080 * in the Software without restriction, including without limitation the rights 24081 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24082 * copies of the Software, and to permit persons to whom the Software is 24083 * furnished to do so, subject to the following conditions: 24084 * 24085 * The above copyright notice and this permission notice shall be included in 24086 * all copies or substantial portions of the Software. 24087 * 24088 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24089 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24090 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24091 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24092 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24093 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24094 * THE SOFTWARE. 24095 */ 24096 24097var __extends = this && this.__extends || function () { 24098 var _extendStatics = function extendStatics(d, b) { 24099 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 24100 d.__proto__ = b; 24101 } || function (d, b) { 24102 for (var p in b) { 24103 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 24104 } 24105 }; 24106 return _extendStatics(d, b); 24107 }; 24108 return function (d, b) { 24109 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 24110 _extendStatics(d, b); 24111 function __() { 24112 this.constructor = d; 24113 } 24114 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 24115 }; 24116}(); 24117Object.defineProperty(exports, "__esModule", { value: true }); 24118exports.MDCSlidingTabIndicatorFoundation = void 0; 24119var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"); 24120/* istanbul ignore next: subclass is not a branch statement */ 24121var MDCSlidingTabIndicatorFoundation = /** @class */function (_super) { 24122 __extends(MDCSlidingTabIndicatorFoundation, _super); 24123 function MDCSlidingTabIndicatorFoundation() { 24124 return _super !== null && _super.apply(this, arguments) || this; 24125 } 24126 MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) { 24127 // Early exit if no indicator is present to handle cases where an indicator 24128 // may be activated without a prior indicator state 24129 if (!previousIndicatorClientRect) { 24130 this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 24131 return; 24132 } 24133 // This animation uses the FLIP approach. You can read more about it at the link below: 24134 // https://aerotwist.com/blog/flip-your-animations/ 24135 // Calculate the dimensions based on the dimensions of the previous indicator 24136 var currentClientRect = this.computeContentClientRect(); 24137 var widthDelta = previousIndicatorClientRect.width / currentClientRect.width; 24138 var xPosition = previousIndicatorClientRect.left - currentClientRect.left; 24139 this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); 24140 this.adapter.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")"); 24141 // Force repaint before updating classes and transform to ensure the transform properly takes effect 24142 this.computeContentClientRect(); 24143 this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasse
vendor: 693 bytes, lines 24143-24157
24143s.NO_TRANSITION); 24144 this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 24145 this.adapter.setContentStyleProperty('transform', ''); 24146 }; 24147 MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () { 24148 this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE); 24149 }; 24150 return MDCSlidingTabIndicatorFoundation; 24151}(foundation_1.MDCTabIndicatorFoundation); 24152exports.MDCSlidingTabIndicatorFoundation = MDCSlidingTabIndicatorFoundation; 24153// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 24154exports.default = MDCSlidingTabIndicatorFoundation; 24155 24156/***/ }), 24157
vendor: 5,572 bytes, lines 24158-24283
24158/***/ "./packages/mdc-tab-scroller/adapter.ts": 24159/*!**********************************************!*\ 24160 !*** ./packages/mdc-tab-scroller/adapter.ts ***! 24161 \**********************************************/ 24162/*! no static exports found */ 24163/***/ (function(module, exports, __webpack_require__) { 24164 24165"use strict"; 24166 24167/** 24168 * @license 24169 * Copyright 2018 Google Inc. 24170 * 24171 * Permission is hereby granted, free of charge, to any person obtaining a copy 24172 * of this software and associated documentation files (the "Software"), to deal 24173 * in the Software without restriction, including without limitation the rights 24174 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24175 * copies of the Software, and to permit persons to whom the Software is 24176 * furnished to do so, subject to the following conditions: 24177 * 24178 * The above copyright notice and this permission notice shall be included in 24179 * all copies or substantial portions of the Software. 24180 * 24181 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24182 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24183 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24184 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24185 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24186 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24187 * THE SOFTWARE. 24188 */ 24189 24190Object.defineProperty(exports, "__esModule", { value: true }); 24191 24192/***/ }), 24193 24194/***/ "./packages/mdc-tab-scroller/component.ts": 24195/*!************************************************!*\ 24196 !*** ./packages/mdc-tab-scroller/component.ts ***! 24197 \************************************************/ 24198/*! no static exports found */ 24199/***/ (function(module, exports, __webpack_require__) { 24200 24201"use strict"; 24202 24203/** 24204 * @license 24205 * Copyright 2018 Google Inc. 24206 * 24207 * Permission is hereby granted, free of charge, to any person obtaining a copy 24208 * of this software and associated documentation files (the "Software"), to deal 24209 * in the Software without restriction, including without limitation the rights 24210 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24211 * copies of the Software, and to permit persons to whom the Software is 24212 * furnished to do so, subject to the following conditions: 24213 * 24214 * The above copyright notice and this permission notice shall be included in 24215 * all copies or substantial portions of the Software. 24216 * 24217 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24218 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24219 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24220 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24221 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24222 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24223 * THE SOFTWARE. 24224 */ 24225 24226var __extends = this && this.__extends || function () { 24227 var _extendStatics = function extendStatics(d, b) { 24228 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 24229 d.__proto__ = b; 24230 } || function (d, b) { 24231 for (var p in b) { 24232 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 24233 } 24234 }; 24235 return _extendStatics(d, b); 24236 }; 24237 return function (d, b) { 24238 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 24239 _extendStatics(d, b); 24240 function __() { 24241 this.constructor = d; 24242 } 24243 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 24244 }; 24245}(); 24246var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 24247 if (k2 === undefined) k2 = k; 24248 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 24249 return m[k]; 24250 } }); 24251} : function (o, m, k, k2) { 24252 if (k2 === undefined) k2 = k; 24253 o[k2] = m[k]; 24254}); 24255var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 24256 Object.defineProperty(o, "default", { enumerable: true, value: v }); 24257} : function (o, v) { 24258 o["default"] = v; 24259}); 24260var __importStar = this && this.__importStar || function (mod) { 24261 if (mod && mod.__esModule) return mod; 24262 var result = {}; 24263 if (mod != null) for (var k in mod) { 24264 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 24265 }__setModuleDefault(result, mod); 24266 return result; 24267}; 24268Object.defineProperty(exports, "__esModule", { value: true }); 24269exports.MDCTabScroller = void 0; 24270var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 24271var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 24272var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); 24273var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts"); 24274var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts")); 24275var MDCTabScroller = /** @class */function (_super) { 24276 __extends(MDCTabScroller, _super); 24277 function MDCTabScroller() { 24278 return _super !== null && _super.apply(this, arguments) || this; 24279 } 24280 MDCTabScroller.attachTo = function (root) { 24281 return new MDCTabScroller(root); 24282 }; 24283
vendor: 3,122 bytes, lines 24283-24331
24283MDCTabScroller.prototype.initialize = function () { 24284 this.area_ = this.root.querySelector(foundation_1.MDCTabScrollerFoundation.strings.AREA_SELECTOR); 24285 this.content_ = this.root.querySelector(foundation_1.MDCTabScrollerFoundation.strings.CONTENT_SELECTOR); 24286 }; 24287 MDCTabScroller.prototype.initialSyncWithDOM = function () { 24288 var _this = this; 24289 this.handleInteraction_ = function () { 24290 return _this.foundation.handleInteraction(); 24291 }; 24292 this.handleTransitionEnd_ = function (evt) { 24293 return _this.foundation.handleTransitionEnd(evt); 24294 }; 24295 this.area_.addEventListener('wheel', this.handleInteraction_, events_1.applyPassive()); 24296 this.area_.addEventListener('touchstart', this.handleInteraction_, events_1.applyPassive()); 24297 this.area_.addEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive()); 24298 this.area_.addEventListener('mousedown', this.handleInteraction_, events_1.applyPassive()); 24299 this.area_.addEventListener('keydown', this.handleInteraction_, events_1.applyPassive()); 24300 this.content_.addEventListener('transitionend', this.handleTransitionEnd_); 24301 }; 24302 MDCTabScroller.prototype.destroy = function () { 24303 _super.prototype.destroy.call(this); 24304 this.area_.removeEventListener('wheel', this.handleInteraction_, events_1.applyPassive()); 24305 this.area_.removeEventListener('touchstart', this.handleInteraction_, events_1.applyPassive()); 24306 this.area_.removeEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive()); 24307 this.area_.removeEventListener('mousedown', this.handleInteraction_, events_1.applyPassive()); 24308 this.area_.removeEventListener('keydown', this.handleInteraction_, events_1.applyPassive()); 24309 this.content_.removeEventListener('transitionend', this.handleTransitionEnd_); 24310 }; 24311 MDCTabScroller.prototype.getDefaultFoundation = function () { 24312 var _this = this; 24313 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 24314 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 24315 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 24316 var adapter = { 24317 eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) { 24318 return ponyfill_1.matches(evtTarget, selector); 24319 }, 24320 addClass: function addClass(className) { 24321 return _this.root.classList.add(className); 24322 }, 24323 removeClass: function removeClass(className) { 24324 return _this.root.classList.remove(className); 24325 }, 24326 addScrollAreaClass: function addScrollAreaClass(className) { 24327 return _this.area_.classList.add(className); 24328 }, 24329 setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) { 24330 return _this.area_.style.setProperty(prop, value); 24331 },
24332 setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) { 24333 return _this.content_.style.setProperty(prop, value); 24334 }, 24335 getScrollContentStyleValue: function getScrollContentStyleValue(propName) { 24336 return window.getComputedStyle(_this.content_).getPropertyValue(propName); 24337 }, 24338 setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) { 24339 return _this.area_.scrollLeft = scrollX; 24340 }, 24341 getScrollAreaScrollLeft: function getScrollAreaScrollLeft() { 24342 return _this.area_.scrollLeft; 24343 }, 24344 getScrollContentOffsetWidth: function getScrollContentOffsetWidth() { 24345 return _this.content_.offsetWidth; 24346 }, 24347 getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() { 24348 return _this.area_.offsetWidth; 24349 }, 24350 computeScrollAreaClientRect: function computeScrollAreaClientRect() { 24351 return _this.area_.getBoundingClientRect(); 24352 }, 24353 computeScrollContentClientRect: function computeScrollContentClientRect() { 24354 return _this.content_.getBoundingClientRect(); 24355 }, 24356 computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() { 24357 return util.computeHorizontalScrollbarHeight(document); 24358 } 24359 }; 24360 // tslint:enable:object-literal-sort-keys 24361 return new foundation_1.MDCTabScrollerFoundation(adapter); 24362 }; 24363 /** 24364 * Returns the current visual scroll position 24365 */ 24366 MDCTabScroller.prototype.getScrollPosition = function () { 24367 return this.foundation.getScrollPosition(); 24368 }; 24369 /** 24370 * Returns the width of the scroll content 24371 */ 24372 MDCTabScroller.prototype.getScrollContentWidth = function () { 24373 return this.content_
vendor: 6,968 bytes, lines 24373-24543
24373.offsetWidth; 24374 }; 24375 /** 24376 * Increments the scroll value by the given amount 24377 * @param scrollXIncrement The pixel value by which to increment the scroll value 24378 */ 24379 MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) { 24380 this.foundation.incrementScroll(scrollXIncrement); 24381 }; 24382 /** 24383 * Scrolls to the given pixel position 24384 * @param scrollX The pixel value to scroll to 24385 */ 24386 MDCTabScroller.prototype.scrollTo = function (scrollX) { 24387 this.foundation.scrollTo(scrollX); 24388 }; 24389 return MDCTabScroller; 24390}(component_1.MDCComponent); 24391exports.MDCTabScroller = MDCTabScroller; 24392 24393/***/ }), 24394 24395/***/ "./packages/mdc-tab-scroller/constants.ts": 24396/*!************************************************!*\ 24397 !*** ./packages/mdc-tab-scroller/constants.ts ***! 24398 \************************************************/ 24399/*! no static exports found */ 24400/***/ (function(module, exports, __webpack_require__) { 24401 24402"use strict"; 24403 24404/** 24405 * @license 24406 * Copyright 2018 Google Inc. 24407 * 24408 * Permission is hereby granted, free of charge, to any person obtaining a copy 24409 * of this software and associated documentation files (the "Software"), to deal 24410 * in the Software without restriction, including without limitation the rights 24411 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24412 * copies of the Software, and to permit persons to whom the Software is 24413 * furnished to do so, subject to the following conditions: 24414 * 24415 * The above copyright notice and this permission notice shall be included in 24416 * all copies or substantial portions of the Software. 24417 * 24418 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24419 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24420 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24421 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24422 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24423 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24424 * THE SOFTWARE. 24425 */ 24426 24427Object.defineProperty(exports, "__esModule", { value: true }); 24428exports.strings = exports.cssClasses = void 0; 24429var cssClasses = { 24430 ANIMATING: 'mdc-tab-scroller--animating', 24431 SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll', 24432 SCROLL_TEST: 'mdc-tab-scroller__test' 24433}; 24434exports.cssClasses = cssClasses; 24435var strings = { 24436 AREA_SELECTOR: '.mdc-tab-scroller__scroll-area', 24437 CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content' 24438}; 24439exports.strings = strings; 24440 24441/***/ }), 24442 24443/***/ "./packages/mdc-tab-scroller/foundation.ts": 24444/*!*************************************************!*\ 24445 !*** ./packages/mdc-tab-scroller/foundation.ts ***! 24446 \*************************************************/ 24447/*! no static exports found */ 24448/***/ (function(module, exports, __webpack_require__) { 24449 24450"use strict"; 24451 24452/** 24453 * @license 24454 * Copyright 2018 Google Inc. 24455 * 24456 * Permission is hereby granted, free of charge, to any person obtaining a copy 24457 * of this software and associated documentation files (the "Software"), to deal 24458 * in the Software without restriction, including without limitation the rights 24459 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24460 * copies of the Software, and to permit persons to whom the Software is 24461 * furnished to do so, subject to the following conditions: 24462 * 24463 * The above copyright notice and this permission notice shall be included in 24464 * all copies or substantial portions of the Software. 24465 * 24466 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24467 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24468 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24469 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24470 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24471 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24472 * THE SOFTWARE. 24473 */ 24474 24475var __extends = this && this.__extends || function () { 24476 var _extendStatics = function extendStatics(d, b) { 24477 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 24478 d.__proto__ = b; 24479 } || function (d, b) { 24480 for (var p in b) { 24481 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 24482 } 24483 }; 24484 return _extendStatics(d, b); 24485 }; 24486 return function (d, b) { 24487 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 24488 _extendStatics(d, b); 24489 function __() { 24490 this.constructor = d; 24491 } 24492 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 24493 }; 24494}(); 24495var __assign = this && this.__assign || function () { 24496 __assign = Object.assign || function (t) { 24497 for (var s, i = 1, n = arguments.length; i < n; i++) { 24498 s = arguments[i]; 24499 for (var p in s) { 24500 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 24501 } 24502 } 24503 return t; 24504 }; 24505 return __assign.apply(this, arguments); 24506}; 24507var __read = this && this.__read || function (o, n) { 24508 var m = typeof Symbol === "function" && o[Symbol.iterator]; 24509 if (!m) return o; 24510 var i = m.call(o), 24511 r, 24512 ar = [], 24513 e; 24514 try { 24515 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { 24516 ar.push(r.value); 24517 } 24518 } catch (error) { 24519 e = { error: error }; 24520 } finally { 24521 try { 24522 if (r && !r.done && (m = i["return"])) m.call(i); 24523 } finally { 24524 if (e) throw e.error; 24525 } 24526 } 24527 return ar; 24528}; 24529Object.defineProperty(exports, "__esModule", { value: true }); 24530exports.MDCTabScrollerFoundation = void 0; 24531var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 24532var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"); 24533var rtl_default_scroller_1 = __webpack_require__(/*! ./rtl-default-scroller */ "./packages/mdc-tab-scroller/rtl-default-scroller.ts"); 24534var rtl_negative_scroller_1 = __webpack_require__(/*! ./rtl-negative-scroller */ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts"); 24535var rtl_reverse_scroller_1 = __webpack_require__(/*! ./rtl-reverse-scroller */ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts"); 24536var MDCTabScrollerFoundation = /** @class */function (_super) { 24537 __extends(MDCTabScrollerFoundation, _super); 24538 function MDCTabScrollerFoundation(adapter) { 24539 var _this = _super.call(this, __assign(__assign({}, MDCTabScrollerFoundation.defaultAdapter), adapter)) || this; 24540 /** 24541 * Controls whether we should handle the transitionend and interaction events during the animation. 24542 */ 24543 _this.isAnimating
24543_
vendor: 3,553 bytes, lines 24543-24623
24543 = false; 24544 return _this; 24545 } 24546 Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", { 24547 get: function get() { 24548 return constants_1.cssClasses; 24549 }, 24550 enumerable: false, 24551 configurable: true 24552 }); 24553 Object.defineProperty(MDCTabScrollerFoundation, "strings", { 24554 get: function get() { 24555 return constants_1.strings; 24556 }, 24557 enumerable: false, 24558 configurable: true 24559 }); 24560 Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", { 24561 get: function get() { 24562 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 24563 return { 24564 eventTargetMatchesSelector: function eventTargetMatchesSelector() { 24565 return false; 24566 }, 24567 addClass: function addClass() { 24568 return undefined; 24569 }, 24570 removeClass: function removeClass() { 24571 return undefined; 24572 }, 24573 addScrollAreaClass: function addScrollAreaClass() { 24574 return undefined; 24575 }, 24576 setScrollAreaStyleProperty: function setScrollAreaStyleProperty() { 24577 return undefined; 24578 }, 24579 setScrollContentStyleProperty: function setScrollContentStyleProperty() { 24580 return undefined; 24581 }, 24582 getScrollContentStyleValue: function getScrollContentStyleValue() { 24583 return ''; 24584 }, 24585 setScrollAreaScrollLeft: function setScrollAreaScrollLeft() { 24586 return undefined; 24587 }, 24588 getScrollAreaScrollLeft: function getScrollAreaScrollLeft() { 24589 return 0; 24590 }, 24591 getScrollContentOffsetWidth: function getScrollContentOffsetWidth() { 24592 return 0; 24593 }, 24594 getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() { 24595 return 0; 24596 }, 24597 computeScrollAreaClientRect: function computeScrollAreaClientRect() { 24598 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 24599 }, 24600 computeScrollContentClientRect: function computeScrollContentClientRect() { 24601 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 24602 }, 24603 computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() { 24604 return 0; 24605 } 24606 }; 24607 // tslint:enable:object-literal-sort-keys 24608 }, 24609 enumerable: false, 24610 configurable: true 24611 }); 24612 MDCTabScrollerFoundation.prototype.init = function () { 24613 // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll 24614 // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs. 24615 var horizontalScrollbarHeight = this.adapter.computeHorizontalScrollbarHeight(); 24616 this.adapter.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px'); 24617 this.adapter.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL); 24618 }; 24619 /** 24620 * Computes the current visual scroll position 24621 */ 24622 MDCTabScrollerFoundation.prototype.getScrollPosition = function () { 24623 if (this.isRTL
vendor: 11,010 bytes, lines 24623-24876
24623_()) { 24624 return this.computeCurrentScrollPositionRTL_(); 24625 } 24626 var currentTranslateX = this.calculateCurrentTranslateX_(); 24627 var scrollLeft = this.adapter.getScrollAreaScrollLeft(); 24628 return scrollLeft - currentTranslateX; 24629 }; 24630 /** 24631 * Handles interaction events that occur during transition 24632 */ 24633 MDCTabScrollerFoundation.prototype.handleInteraction = function () { 24634 // Early exit if we aren't animating 24635 if (!this.isAnimating_) { 24636 return; 24637 } 24638 // Prevent other event listeners from handling this event 24639 this.stopScrollAnimation_(); 24640 }; 24641 /** 24642 * Handles the transitionend event 24643 */ 24644 MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) { 24645 // Early exit if we aren't animating or the event was triggered by a different element. 24646 var evtTarget = evt.target; 24647 if (!this.isAnimating_ || !this.adapter.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) { 24648 return; 24649 } 24650 this.isAnimating_ = false; 24651 this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); 24652 }; 24653 /** 24654 * Increment the scroll value by the scrollXIncrement using animation. 24655 * @param scrollXIncrement The value by which to increment the scroll position 24656 */ 24657 MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) { 24658 // Early exit for non-operational increment values 24659 if (scrollXIncrement === 0) { 24660 return; 24661 } 24662 this.animate_(this.getIncrementScrollOperation_(scrollXIncrement)); 24663 }; 24664 /** 24665 * Increment the scroll value by the scrollXIncrement without animation. 24666 * @param scrollXIncrement The value by which to increment the scroll position 24667 */ 24668 MDCTabScrollerFoundation.prototype.incrementScrollImmediate = function (scrollXIncrement) { 24669 // Early exit for non-operational increment values 24670 if (scrollXIncrement === 0) { 24671 return; 24672 } 24673 var operation = this.getIncrementScrollOperation_(scrollXIncrement); 24674 if (operation.scrollDelta === 0) { 24675 return; 24676 } 24677 this.stopScrollAnimation_(); 24678 this.adapter.setScrollAreaScrollLeft(operation.finalScrollPosition); 24679 }; 24680 /** 24681 * Scrolls to the given scrollX value 24682 */ 24683 MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) { 24684 if (this.isRTL_()) { 24685 return this.scrollToRTL_(scrollX); 24686 } 24687 this.scrollTo_(scrollX); 24688 }; 24689 /** 24690 * @return Browser-specific {@link MDCTabScrollerRTL} instance. 24691 */ 24692 MDCTabScrollerFoundation.prototype.getRTLScroller = function () { 24693 if (!this.rtlScrollerInstance_) { 24694 this.rtlScrollerInstance_ = this.rtlScrollerFactory_(); 24695 } 24696 return this.rtlScrollerInstance_; 24697 }; 24698 /** 24699 * @return translateX value from a CSS matrix transform function string. 24700 */ 24701 MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX_ = function () { 24702 var transformValue = this.adapter.getScrollContentStyleValue('transform'); 24703 // Early exit if no transform is present 24704 if (transformValue === 'none') { 24705 return 0; 24706 } 24707 // The transform value comes back as a matrix transformation in the form 24708 // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so 24709 // we're going to grab all the parenthesized values, strip out tx, and 24710 // parse it. 24711 var match = /\((.+?)\)/.exec(transformValue); 24712 if (!match) { 24713 return 0; 24714 } 24715 var matrixParams = match[1]; 24716 // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error. 24717 // @ts-ignore These unused variables should retain their semantic names for clarity. 24718 var _a = __read(matrixParams.split(','), 6), 24719 a = _a[0], 24720 b = _a[1], 24721 c = _a[2], 24722 d = _a[3], 24723 tx = _a[4], 24724 ty = _a[5]; 24725 return parseFloat(tx); // tslint:disable-line:ban 24726 }; 24727 /** 24728 * Calculates a safe scroll value that is > 0 and < the max scroll value 24729 * @param scrollX The distance to scroll 24730 */ 24731 MDCTabScrollerFoundation.prototype.clampScrollValue_ = function (scrollX) { 24732 var edges = this.calculateScrollEdges_(); 24733 return Math.min(Math.max(edges.left, scrollX), edges.right); 24734 }; 24735 MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL_ = function () { 24736 var translateX = this.calculateCurrentTranslateX_(); 24737 return this.getRTLScroller().getScrollPositionRTL(translateX); 24738 }; 24739 MDCTabScrollerFoundation.prototype.calculateScrollEdges_ = function () { 24740 var contentWidth = this.adapter.getScrollContentOffsetWidth(); 24741 var rootWidth = this.adapter.getScrollAreaOffsetWidth(); 24742 return { 24743 left: 0, 24744 right: contentWidth - rootWidth 24745 }; 24746 }; 24747 /** 24748 * Internal scroll method 24749 * @param scrollX The new scroll position 24750 */ 24751 MDCTabScrollerFoundation.prototype.scrollTo_ = function (scrollX) { 24752 var currentScrollX = this.getScrollPosition(); 24753 var safeScrollX = this.clampScrollValue_(scrollX); 24754 var scrollDelta = safeScrollX - currentScrollX; 24755 this.animate_({ 24756 finalScrollPosition: safeScrollX, 24757 scrollDelta: scrollDelta 24758 }); 24759 }; 24760 /** 24761 * Internal RTL scroll method 24762 * @param scrollX The new scroll position 24763 */ 24764 MDCTabScrollerFoundation.prototype.scrollToRTL_ = function (scrollX) { 24765 var animation = this.getRTLScroller().scrollToRTL(scrollX); 24766 this.animate_(animation); 24767 }; 24768 /** 24769 * Internal method to compute the increment scroll operation values. 24770 * @param scrollX The desired scroll position increment 24771 * @return MDCTabScrollerAnimation with the sanitized values for performing the scroll operation. 24772 */ 24773 MDCTabScrollerFoundation.prototype.getIncrementScrollOperation_ = function (scrollX) { 24774 if (this.isRTL_()) { 24775 return this.getRTLScroller().incrementScrollRTL(scrollX); 24776 } 24777 var currentScrollX = this.getScrollPosition(); 24778 var targetScrollX = scrollX + currentScrollX; 24779 var safeScrollX = this.clampScrollValue_(targetScrollX); 24780 var scrollDelta = safeScrollX - currentScrollX; 24781 return { 24782 finalScrollPosition: safeScrollX, 24783 scrollDelta: scrollDelta 24784 }; 24785 }; 24786 /** 24787 * Animates the tab scrolling 24788 * @param animation The animation to apply 24789 */ 24790 MDCTabScrollerFoundation.prototype.animate_ = function (animation) { 24791 var _this = this; 24792 // Early exit if translateX is 0, which means there's no animation to perform 24793 if (animation.scrollDelta === 0) { 24794 return; 24795 } 24796 this.stopScrollAnimation_(); 24797 // This animation uses the FLIP approach. 24798 // Read more here: https://aerotwist.com/blog/flip-your-animations/ 24799 this.adapter.setScrollAreaScrollLeft(animation.finalScrollPosition); 24800 this.adapter.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)"); 24801 // Force repaint 24802 this.adapter.computeScrollAreaClientRect(); 24803 requestAnimationFrame(function () { 24804 _this.adapter.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); 24805 _this.adapter.setScrollContentStyleProperty('transform', 'none'); 24806 }); 24807 this.isAnimating_ = true; 24808 }; 24809 /** 24810 * Stops scroll animation 24811 */ 24812 MDCTabScrollerFoundation.prototype.stopScrollAnimation_ = function () { 24813 this.isAnimating_ = false; 24814 var currentScrollPosition = this.getAnimatingScrollPosition_(); 24815 this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); 24816 this.adapter.setScrollContentStyleProperty('transform', 'translateX(0px)'); 24817 this.adapter.setScrollAreaScrollLeft(currentScrollPosition); 24818 }; 24819 /** 24820 * Gets the current scroll position during animation 24821 */ 24822 MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition_ = function () { 24823 var currentTranslateX = this.calculateCurrentTranslateX_(); 24824 var scrollLeft = this.adapter.getScrollAreaScrollLeft(); 24825 if (this.isRTL_()) { 24826 return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX); 24827 } 24828 return scrollLeft - currentTranslateX; 24829 }; 24830 /** 24831 * Determines the RTL Scroller to use 24832 */ 24833 MDCTabScrollerFoundation.prototype.rtlScrollerFactory_ = function () { 24834 // Browsers have three different implementations of scrollLeft in RTL mode, 24835 // dependent on the browser. The behavior is based off the max LTR 24836 // scrollLeft value and 0. 24837 // 24838 // * Default scrolling in RTL * 24839 // - Left-most value: 0 24840 // - Right-most value: Max LTR scrollLeft value 24841 // 24842 // * Negative scrolling in RTL * 24843 // - Left-most value: Negated max LTR scrollLeft value 24844 // - Right-most value: 0 24845 // 24846 // * Reverse scrolling in RTL * 24847 // - Left-most value: Max LTR scrollLeft value 24848 // - Right-most value: 0 24849 // 24850 // We use those principles below to determine which RTL scrollLeft 24851 // behavior is implemented in the current browser. 24852 var initialScrollLeft = this.adapter.getScrollAreaScrollLeft(); 24853 this.adapter.setScrollAreaScrollLeft(initialScrollLeft - 1); 24854 var newScrollLeft = this.adapter.getScrollAreaScrollLeft(); 24855 // If the newScrollLeft value is negative,then we know that the browser has 24856 // implemented negative RTL scrolling, since all other implementations have 24857 // only positive values. 24858 if (newScrollLeft < 0) { 24859 // Undo the scrollLeft test check 24860 this.adapter.setScrollAreaScrollLeft(initialScrollLeft); 24861 return new rtl_negative_scroller_1.MDCTabScrollerRTLNegative(this.adapter); 24862 } 24863 var rootClientRect = this.adapter.computeScrollAreaClientRect(); 24864 var contentClientRect = this.adapter.computeScrollContentClientRect(); 24865 var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right); 24866 // Undo the scrollLeft test check 24867 this.adapter.setScrollAreaScrollLeft(initialScrollLeft); 24868 // By calculating the clientRect of the root element and the clientRect of 24869 // the content element, we can determine how much the scroll value changed 24870 // when we performed the scrollLeft subtraction above. 24871 if (rightEdgeDelta === newScrollLeft) { 24872 return new rtl_reverse_scroller_1.MDCTabScrollerRTLReverse(this.adapter); 24873 } 24874 return new rtl_default_scroller_1.MDCTabScrollerRTLDefault(this.adapter); 24875 }; 24876 MDCTabScrollerFoundation.prototype.isRTL_
vendor: 6,631 bytes, lines 24876-25020
24876 = function () { 24877 return this.adapter.getScrollContentStyleValue('direction') === 'rtl'; 24878 }; 24879 return MDCTabScrollerFoundation; 24880}(foundation_1.MDCFoundation); 24881exports.MDCTabScrollerFoundation = MDCTabScrollerFoundation; 24882// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 24883exports.default = MDCTabScrollerFoundation; 24884 24885/***/ }), 24886 24887/***/ "./packages/mdc-tab-scroller/index.ts": 24888/*!********************************************!*\ 24889 !*** ./packages/mdc-tab-scroller/index.ts ***! 24890 \********************************************/ 24891/*! no static exports found */ 24892/***/ (function(module, exports, __webpack_require__) { 24893 24894"use strict"; 24895 24896/** 24897 * @license 24898 * Copyright 2019 Google Inc. 24899 * 24900 * Permission is hereby granted, free of charge, to any person obtaining a copy 24901 * of this software and associated documentation files (the "Software"), to deal 24902 * in the Software without restriction, including without limitation the rights 24903 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24904 * copies of the Software, and to permit persons to whom the Software is 24905 * furnished to do so, subject to the following conditions: 24906 * 24907 * The above copyright notice and this permission notice shall be included in 24908 * all copies or substantial portions of the Software. 24909 * 24910 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24911 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24912 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24913 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24914 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24915 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24916 * THE SOFTWARE. 24917 */ 24918 24919var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 24920 if (k2 === undefined) k2 = k; 24921 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 24922 return m[k]; 24923 } }); 24924} : function (o, m, k, k2) { 24925 if (k2 === undefined) k2 = k; 24926 o[k2] = m[k]; 24927}); 24928var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 24929 Object.defineProperty(o, "default", { enumerable: true, value: v }); 24930} : function (o, v) { 24931 o["default"] = v; 24932}); 24933var __importStar = this && this.__importStar || function (mod) { 24934 if (mod && mod.__esModule) return mod; 24935 var result = {}; 24936 if (mod != null) for (var k in mod) { 24937 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 24938 }__setModuleDefault(result, mod); 24939 return result; 24940}; 24941var __exportStar = this && this.__exportStar || function (m, exports) { 24942 for (var p in m) { 24943 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 24944 } 24945}; 24946Object.defineProperty(exports, "__esModule", { value: true }); 24947exports.util = void 0; 24948var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts")); 24949exports.util = util; 24950__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-tab-scroller/adapter.ts"), exports); 24951__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-tab-scroller/component.ts"), exports); 24952__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"), exports); 24953__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts"), exports); 24954__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-tab-scroller/types.ts"), exports); 24955 24956/***/ }), 24957 24958/***/ "./packages/mdc-tab-scroller/rtl-default-scroller.ts": 24959/*!***********************************************************!*\ 24960 !*** ./packages/mdc-tab-scroller/rtl-default-scroller.ts ***! 24961 \***********************************************************/ 24962/*! no static exports found */ 24963/***/ (function(module, exports, __webpack_require__) { 24964 24965"use strict"; 24966 24967/** 24968 * @license 24969 * Copyright 2018 Google Inc. 24970 * 24971 * Permission is hereby granted, free of charge, to any person obtaining a copy 24972 * of this software and associated documentation files (the "Software"), to deal 24973 * in the Software without restriction, including without limitation the rights 24974 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24975 * copies of the Software, and to permit persons to whom the Software is 24976 * furnished to do so, subject to the following conditions: 24977 * 24978 * The above copyright notice and this permission notice shall be included in 24979 * all copies or substantial portions of the Software. 24980 * 24981 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24982 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24983 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24984 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24985 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24986 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24987 * THE SOFTWARE. 24988 */ 24989 24990var __extends = this && this.__extends || function () { 24991 var _extendStatics = function extendStatics(d, b) { 24992 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 24993 d.__proto__ = b; 24994 } || function (d, b) { 24995 for (var p in b) { 24996 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 24997 } 24998 }; 24999 return _extendStatics(d, b); 25000 }; 25001 return function (d, b) { 25002 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 25003 _extendStatics(d, b); 25004 function __() { 25005 this.constructor = d; 25006 } 25007 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25008 }; 25009}(); 25010Object.defineProperty(exports, "__esModule", { value: true }); 25011exports.MDCTabScrollerRTLDefault = void 0; 25012var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts"); 25013var MDCTabScrollerRTLDefault = /** @class */function (_super) { 25014 __extends(MDCTabScrollerRTLDefault, _super); 25015 function MDCTabScrollerRTLDefault() { 25016 return _super !== null && _super.apply(this, arguments) || this; 25017 } 25018 MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () { 25019 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25020 var right = this.calculateScrollEdges
25020_().right; 25021 // Scroll values on most browsers are ints instead of floats so we round 25022 return Math.round(right - currentScrollLeft); 25023 }; 25024 MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) { 25025 var edges = this.calculateScrollEdges_(); 25026 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25027 var clampedScrollLeft = this.clampScrollValue_(edges.right - scrollX); 25028 return { 25029 finalScrollPosition: clampedScrollLeft, 25030 scrollDelta: clampedScrollLeft - currentScrollLeft 25031 }; 25032 }; 25033 MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) { 25034 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25035 var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX); 25036 return { 25037 finalScrollPosition: clampedScrollLeft, 25038 scrollDelta: clampedScrollLeft - currentScrollLeft 25039 }; 25040 }; 25041 MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) { 25042 return scrollX; 25043 }; 25044 MDCTabScrollerRTLDefault.prototype.calculateScrollEdges_ = function () { 25045 var contentWidth = this.adapter.getScrollContentOffsetWidth(); 25046 var rootWidth = this.adapter.getScrollAreaOffsetWidth(); 25047 return { 25048 left: 0, 25049 right: contentWidth - rootWidth 25050 }; 25051 }; 25052 MDCTabScrollerRTLDefault.prototype.clampScrollValue_ = function (scrollX) { 25053 var edges = this.calculateScrollEdges_(); 25054 return Math.min(Math.max(edges.left, scrollX), edges.right); 25055 }; 25056 return MDCTabScrollerRTLDefault; 25057}(rtl_scroller_1.MDCTabScrollerRTL); 25058exports.MDCTabScrollerRTLDefault = MDCTabScrollerRTLDefault; 25059// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 25060exports.default = MDCTabScrollerRTLDefault; 25061 25062/***/ }), 25063
vendor: 9,129 bytes, lines 25064-25260
25064/***/ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts": 25065/*!************************************************************!*\ 25066 !*** ./packages/mdc-tab-scroller/rtl-negative-scroller.ts ***! 25067 \************************************************************/ 25068/*! no static exports found */ 25069/***/ (function(module, exports, __webpack_require__) { 25070 25071"use strict"; 25072 25073/** 25074 * @license 25075 * Copyright 2018 Google Inc. 25076 * 25077 * Permission is hereby granted, free of charge, to any person obtaining a copy 25078 * of this software and associated documentation files (the "Software"), to deal 25079 * in the Software without restriction, including without limitation the rights 25080 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25081 * copies of the Software, and to permit persons to whom the Software is 25082 * furnished to do so, subject to the following conditions: 25083 * 25084 * The above copyright notice and this permission notice shall be included in 25085 * all copies or substantial portions of the Software. 25086 * 25087 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25088 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25089 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25090 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25091 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25092 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25093 * THE SOFTWARE. 25094 */ 25095 25096var __extends = this && this.__extends || function () { 25097 var _extendStatics = function extendStatics(d, b) { 25098 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 25099 d.__proto__ = b; 25100 } || function (d, b) { 25101 for (var p in b) { 25102 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 25103 } 25104 }; 25105 return _extendStatics(d, b); 25106 }; 25107 return function (d, b) { 25108 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 25109 _extendStatics(d, b); 25110 function __() { 25111 this.constructor = d; 25112 } 25113 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25114 }; 25115}(); 25116Object.defineProperty(exports, "__esModule", { value: true }); 25117exports.MDCTabScrollerRTLNegative = void 0; 25118var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts"); 25119var MDCTabScrollerRTLNegative = /** @class */function (_super) { 25120 __extends(MDCTabScrollerRTLNegative, _super); 25121 function MDCTabScrollerRTLNegative() { 25122 return _super !== null && _super.apply(this, arguments) || this; 25123 } 25124 MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) { 25125 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25126 return Math.round(translateX - currentScrollLeft); 25127 }; 25128 MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) { 25129 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25130 var clampedScrollLeft = this.clampScrollValue_(-scrollX); 25131 return { 25132 finalScrollPosition: clampedScrollLeft, 25133 scrollDelta: clampedScrollLeft - currentScrollLeft 25134 }; 25135 }; 25136 MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) { 25137 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25138 var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX); 25139 return { 25140 finalScrollPosition: clampedScrollLeft, 25141 scrollDelta: clampedScrollLeft - currentScrollLeft 25142 }; 25143 }; 25144 MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) { 25145 return scrollX - translateX; 25146 }; 25147 MDCTabScrollerRTLNegative.prototype.calculateScrollEdges_ = function () { 25148 var contentWidth = this.adapter.getScrollContentOffsetWidth(); 25149 var rootWidth = this.adapter.getScrollAreaOffsetWidth(); 25150 return { 25151 left: rootWidth - contentWidth, 25152 right: 0 25153 }; 25154 }; 25155 MDCTabScrollerRTLNegative.prototype.clampScrollValue_ = function (scrollX) { 25156 var edges = this.calculateScrollEdges_(); 25157 return Math.max(Math.min(edges.right, scrollX), edges.left); 25158 }; 25159 return MDCTabScrollerRTLNegative; 25160}(rtl_scroller_1.MDCTabScrollerRTL); 25161exports.MDCTabScrollerRTLNegative = MDCTabScrollerRTLNegative; 25162// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 25163exports.default = MDCTabScrollerRTLNegative; 25164 25165/***/ }), 25166 25167/***/ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts": 25168/*!***********************************************************!*\ 25169 !*** ./packages/mdc-tab-scroller/rtl-reverse-scroller.ts ***! 25170 \***********************************************************/ 25171/*! no static exports found */ 25172/***/ (function(module, exports, __webpack_require__) { 25173 25174"use strict"; 25175 25176/** 25177 * @license 25178 * Copyright 2018 Google Inc. 25179 * 25180 * Permission is hereby granted, free of charge, to any person obtaining a copy 25181 * of this software and associated documentation files (the "Software"), to deal 25182 * in the Software without restriction, including without limitation the rights 25183 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25184 * copies of the Software, and to permit persons to whom the Software is 25185 * furnished to do so, subject to the following conditions: 25186 * 25187 * The above copyright notice and this permission notice shall be included in 25188 * all copies or substantial portions of the Software. 25189 * 25190 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25191 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25192 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25193 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25194 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25195 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25196 * THE SOFTWARE. 25197 */ 25198 25199var __extends = this && this.__extends || function () { 25200 var _extendStatics = function extendStatics(d, b) { 25201 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 25202 d.__proto__ = b; 25203 } || function (d, b) { 25204 for (var p in b) { 25205 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 25206 } 25207 }; 25208 return _extendStatics(d, b); 25209 }; 25210 return function (d, b) { 25211 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 25212 _extendStatics(d, b); 25213 function __() { 25214 this.constructor = d; 25215 } 25216 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25217 }; 25218}(); 25219Object.defineProperty(exports, "__esModule", { value: true }); 25220exports.MDCTabScrollerRTLReverse = void 0; 25221var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts"); 25222var MDCTabScrollerRTLReverse = /** @class */function (_super) { 25223 __extends(MDCTabScrollerRTLReverse, _super); 25224 function MDCTabScrollerRTLReverse() { 25225 return _super !== null && _super.apply(this, arguments) || this; 25226 } 25227 MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) { 25228 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25229 // Scroll values on most browsers are ints instead of floats so we round 25230 return Math.round(currentScrollLeft - translateX); 25231 }; 25232 MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) { 25233 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25234 var clampedScrollLeft = this.clampScrollValue_(scrollX); 25235 return { 25236 finalScrollPosition: clampedScrollLeft, 25237 scrollDelta: currentScrollLeft - clampedScrollLeft 25238 }; 25239 }; 25240 MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) { 25241 var currentScrollLeft = this.adapter.getScrollAreaScrollLeft(); 25242 var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft + scrollX); 25243 return { 25244 finalScrollPosition: clampedScrollLeft, 25245 scrollDelta: currentScrollLeft - clampedScrollLeft 25246 }; 25247 }; 25248 MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) { 25249 return scrollX + translateX; 25250 }; 25251 MDCTabScrollerRTLReverse.prototype.calculateScrollEdges_ = function () { 25252 var contentWidth = this.adapter.getScrollContentOffsetWidth(); 25253 var rootWidth = this.adapter.getScrollAreaOffsetWidth(); 25254 return { 25255 left: contentWidth - rootWidth, 25256 right: 0 25257 }; 25258 }; 25259 MDCTabScrollerRTLReverse.prototype.clampScrollValue_ = function (scrollX) { 25260 var edges = this.calculateScrollEdges_
vendor: 6,066 bytes, lines 25260-25403
25260(); 25261 return Math.min(Math.max(edges.right, scrollX), edges.left); 25262 }; 25263 return MDCTabScrollerRTLReverse; 25264}(rtl_scroller_1.MDCTabScrollerRTL); 25265exports.MDCTabScrollerRTLReverse = MDCTabScrollerRTLReverse; 25266// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 25267exports.default = MDCTabScrollerRTLReverse; 25268 25269/***/ }), 25270 25271/***/ "./packages/mdc-tab-scroller/rtl-scroller.ts": 25272/*!***************************************************!*\ 25273 !*** ./packages/mdc-tab-scroller/rtl-scroller.ts ***! 25274 \***************************************************/ 25275/*! no static exports found */ 25276/***/ (function(module, exports, __webpack_require__) { 25277 25278"use strict"; 25279 25280/** 25281 * @license 25282 * Copyright 2018 Google Inc. 25283 * 25284 * Permission is hereby granted, free of charge, to any person obtaining a copy 25285 * of this software and associated documentation files (the "Software"), to deal 25286 * in the Software without restriction, including without limitation the rights 25287 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25288 * copies of the Software, and to permit persons to whom the Software is 25289 * furnished to do so, subject to the following conditions: 25290 * 25291 * The above copyright notice and this permission notice shall be included in 25292 * all copies or substantial portions of the Software. 25293 * 25294 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25295 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25296 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25297 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25298 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25299 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25300 * THE SOFTWARE. 25301 */ 25302 25303Object.defineProperty(exports, "__esModule", { value: true }); 25304exports.MDCTabScrollerRTL = void 0; 25305var MDCTabScrollerRTL = /** @class */function () { 25306 function MDCTabScrollerRTL(adapter) { 25307 this.adapter = adapter; 25308 } 25309 return MDCTabScrollerRTL; 25310}(); 25311exports.MDCTabScrollerRTL = MDCTabScrollerRTL; 25312// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 25313exports.default = MDCTabScrollerRTL; 25314 25315/***/ }), 25316 25317/***/ "./packages/mdc-tab-scroller/types.ts": 25318/*!********************************************!*\ 25319 !*** ./packages/mdc-tab-scroller/types.ts ***! 25320 \********************************************/ 25321/*! no static exports found */ 25322/***/ (function(module, exports, __webpack_require__) { 25323 25324"use strict"; 25325 25326/** 25327 * @license 25328 * Copyright 2018 Google Inc. 25329 * 25330 * Permission is hereby granted, free of charge, to any person obtaining a copy 25331 * of this software and associated documentation files (the "Software"), to deal 25332 * in the Software without restriction, including without limitation the rights 25333 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25334 * copies of the Software, and to permit persons to whom the Software is 25335 * furnished to do so, subject to the following conditions: 25336 * 25337 * The above copyright notice and this permission notice shall be included in 25338 * all copies or substantial portions of the Software. 25339 * 25340 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25341 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25342 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25343 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25344 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25345 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25346 * THE SOFTWARE. 25347 */ 25348 25349Object.defineProperty(exports, "__esModule", { value: true }); 25350 25351/***/ }), 25352 25353/***/ "./packages/mdc-tab-scroller/util.ts": 25354/*!*******************************************!*\ 25355 !*** ./packages/mdc-tab-scroller/util.ts ***! 25356 \*******************************************/ 25357/*! no static exports found */ 25358/***/ (function(module, exports, __webpack_require__) { 25359 25360"use strict"; 25361 25362/** 25363 * @license 25364 * Copyright 2018 Google Inc. 25365 * 25366 * Permission is hereby granted, free of charge, to any person obtaining a copy 25367 * of this software and associated documentation files (the "Software"), to deal 25368 * in the Software without restriction, including without limitation the rights 25369 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25370 * copies of the Software, and to permit persons to whom the Software is 25371 * furnished to do so, subject to the following conditions: 25372 * 25373 * The above copyright notice and this permission notice shall be included in 25374 * all copies or substantial portions of the Software. 25375 * 25376 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25377 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25378 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25379 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25380 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25381 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25382 * THE SOFTWARE. 25383 */ 25384 25385Object.defineProperty(exports, "__esModule", { value: true }); 25386exports.computeHorizontalScrollbarHeight = void 0; 25387var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"); 25388/** 25389 * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing. 25390 */ 25391var horizontalScrollbarHeight_; 25392/** 25393 * Computes the height of browser-rendered horizontal scrollbars using a self-created test element. 25394 * May return 0 (e.g. on OS X browsers under default configuration). 25395 */ 25396function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) { 25397 if (shouldCacheResult === void 0) { 25398 shouldCacheResult = true; 25399 } 25400 if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') { 25401 return horizontalScrollbarHeight_; 25402 } 25403 var el = documentObj.createElement('div');
vendor: 5,666 bytes, lines 25404-25533
25404 el.classList.add(constants_1.cssClasses.SCROLL_TEST); 25405 documentObj.body.appendChild(el); 25406 var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight; 25407 documentObj.body.removeChild(el); 25408 if (shouldCacheResult) { 25409 horizontalScrollbarHeight_ = horizontalScrollbarHeight; 25410 } 25411 return horizontalScrollbarHeight; 25412} 25413exports.computeHorizontalScrollbarHeight = computeHorizontalScrollbarHeight; 25414 25415/***/ }), 25416 25417/***/ "./packages/mdc-tab/adapter.ts": 25418/*!*************************************!*\ 25419 !*** ./packages/mdc-tab/adapter.ts ***! 25420 \*************************************/ 25421/*! no static exports found */ 25422/***/ (function(module, exports, __webpack_require__) { 25423 25424"use strict"; 25425 25426/** 25427 * @license 25428 * Copyright 2018 Google Inc. 25429 * 25430 * Permission is hereby granted, free of charge, to any person obtaining a copy 25431 * of this software and associated documentation files (the "Software"), to deal 25432 * in the Software without restriction, including without limitation the rights 25433 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25434 * copies of the Software, and to permit persons to whom the Software is 25435 * furnished to do so, subject to the following conditions: 25436 * 25437 * The above copyright notice and this permission notice shall be included in 25438 * all copies or substantial portions of the Software. 25439 * 25440 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25441 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25442 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25443 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25444 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25445 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25446 * THE SOFTWARE. 25447 */ 25448 25449Object.defineProperty(exports, "__esModule", { value: true }); 25450 25451/***/ }), 25452 25453/***/ "./packages/mdc-tab/component.ts": 25454/*!***************************************!*\ 25455 !*** ./packages/mdc-tab/component.ts ***! 25456 \***************************************/ 25457/*! no static exports found */ 25458/***/ (function(module, exports, __webpack_require__) { 25459 25460"use strict"; 25461 25462/** 25463 * @license 25464 * Copyright 2018 Google Inc. 25465 * 25466 * Permission is hereby granted, free of charge, to any person obtaining a copy 25467 * of this software and associated documentation files (the "Software"), to deal 25468 * in the Software without restriction, including without limitation the rights 25469 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25470 * copies of the Software, and to permit persons to whom the Software is 25471 * furnished to do so, subject to the following conditions: 25472 * 25473 * The above copyright notice and this permission notice shall be included in 25474 * all copies or substantial portions of the Software. 25475 * 25476 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25477 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25478 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25479 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25480 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25481 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25482 * THE SOFTWARE. 25483 */ 25484 25485var __extends = this && this.__extends || function () { 25486 var _extendStatics = function extendStatics(d, b) { 25487 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 25488 d.__proto__ = b; 25489 } || function (d, b) { 25490 for (var p in b) { 25491 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 25492 } 25493 }; 25494 return _extendStatics(d, b); 25495 }; 25496 return function (d, b) { 25497 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 25498 _extendStatics(d, b); 25499 function __() { 25500 this.constructor = d; 25501 } 25502 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25503 }; 25504}(); 25505Object.defineProperty(exports, "__esModule", { value: true }); 25506exports.MDCTab = void 0; 25507var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 25508var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 25509var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 25510var component_3 = __webpack_require__(/*! @material/tab-indicator/component */ "./packages/mdc-tab-indicator/component.ts"); 25511var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts"); 25512var MDCTab = /** @class */function (_super) { 25513 __extends(MDCTab, _super); 25514 function MDCTab() { 25515 return _super !== null && _super.apply(this, arguments) || this; 25516 } 25517 MDCTab.attachTo = function (root) { 25518 return new MDCTab(root); 25519 }; 25520 MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) { 25521 if (rippleFactory === void 0) { 25522 rippleFactory = function rippleFactory(el, foundation) { 25523 return new component_2.MDCRipple(el, foundation); 25524 }; 25525 } 25526 if (tabIndicatorFactory === void 0) { 25527 tabIndicatorFactory = function tabIndicatorFactory(el) { 25528 return new component_3.MDCTabIndicator(el); 25529 }; 25530 } 25531 this.id = this.root.id; 25532 var rippleFoundation = new foundation_1.MDCRippleFoundation(component_2.MDCRipple.createAdapter(this)); 25533 this.ripple
vendor: 2,131 bytes, lines 25533-25574
25533_ = rippleFactory(this.root, rippleFoundation); 25534 var tabIndicatorElement = this.root.querySelector(foundation_2.MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR); 25535 this.tabIndicator_ = tabIndicatorFactory(tabIndicatorElement); 25536 this.content_ = this.root.querySelector(foundation_2.MDCTabFoundation.strings.CONTENT_SELECTOR); 25537 }; 25538 MDCTab.prototype.initialSyncWithDOM = function () { 25539 var _this = this; 25540 this.handleClick_ = function () { 25541 return _this.foundation.handleClick(); 25542 }; 25543 this.listen('click', this.handleClick_); 25544 }; 25545 MDCTab.prototype.destroy = function () { 25546 this.unlisten('click', this.handleClick_); 25547 this.ripple_.destroy(); 25548 _super.prototype.destroy.call(this); 25549 }; 25550 MDCTab.prototype.getDefaultFoundation = function () { 25551 var _this = this; 25552 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 25553 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 25554 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 25555 var adapter = { 25556 setAttr: function setAttr(attr, value) { 25557 return _this.root.setAttribute(attr, value); 25558 }, 25559 addClass: function addClass(className) { 25560 return _this.root.classList.add(className); 25561 }, 25562 removeClass: function removeClass(className) { 25563 return _this.root.classList.remove(className); 25564 }, 25565 hasClass: function hasClass(className) { 25566 return _this.root.classList.contains(className); 25567 }, 25568 activateIndicator: function activateIndicator(previousIndicatorClientRect) { 25569 return _this.tabIndicator_.activate(previousIndicatorClientRect); 25570 }, 25571 deactivateIndicator: function deactivateIndicator() { 25572 return _this.tabIndicator_.deactivate(); 25573 }, 25574 notifyInteracted: function notifyInteracted() {
25575 return _this.emit(foundation_2.MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */); 25576 }, 25577 getOffsetLeft: function getOffsetLeft() { 25578 return _this.root.offsetLeft; 25579 }, 25580 getOffsetWidth: function getOffsetWidth() { 25581 return _this.root.offsetWidth; 25582 }, 25583 getContentOffsetLeft: function getContentOffsetLeft() { 25584 return _this.content_.offsetLeft; 25585 }, 25586 getContentOffsetWidth: function getContentOffsetWidth() { 25587 return _this.content_.offsetWidth; 25588 }, 25589 focus: function focus() { 25590 return _this.root.focus(); 25591 } 25592 }; 25593 // tslint:enable:object-literal-sort-keys 25594 return new foundation_2.MDCTabFoundation(adapter); 25595 }; 25596 Object.defineProperty(MDCTab.prototype, "active", { 25597 /** 25598 * Getter for the active state of the tab 25599 */ 25600 get: function get() { 25601 return this.foundation.isActive(); 25602 }, 25603 enumerable: false, 25604 configurable: true 25605 }); 25606 Object.defineProperty(MDCTab.prototype, "focusOnActivate", { 25607 set: function set(focusOnActivate) { 25608 this.foundation.setFocusOnActivate(focusOnActivate); 25609 }, 25610 enumerable: false, 25611 configurable: true 25612 }); 25613 /** 25614 * Activates the tab 25615 */ 25616 MDCTab.prototype.activate = function (computeIndicatorClientRect) { 25617 this.foundation.activate(computeIndicatorClientRect); 25618 }; 25619 /** 25620 * Deactivates the tab 25621 */ 25622 MDCTab.prototype.deactivate = function () { 25623 this.foundation.deactivate(); 25624 }; 25625 /** 25626 * Returns the indicator's client rect 25627 */ 25628 MDCTab.prototype.computeIndicatorClientRect = function () { 25629 return this.tabIndicator_
vendor: 5,463 bytes, lines 25629-25768
25629.computeContentClientRect(); 25630 }; 25631 MDCTab.prototype.computeDimensions = function () { 25632 return this.foundation.computeDimensions(); 25633 }; 25634 /** 25635 * Focuses the tab 25636 */ 25637 MDCTab.prototype.focus = function () { 25638 this.root.focus(); 25639 }; 25640 return MDCTab; 25641}(component_1.MDCComponent); 25642exports.MDCTab = MDCTab; 25643 25644/***/ }), 25645 25646/***/ "./packages/mdc-tab/constants.ts": 25647/*!***************************************!*\ 25648 !*** ./packages/mdc-tab/constants.ts ***! 25649 \***************************************/ 25650/*! no static exports found */ 25651/***/ (function(module, exports, __webpack_require__) { 25652 25653"use strict"; 25654 25655/** 25656 * @license 25657 * Copyright 2018 Google Inc. 25658 * 25659 * Permission is hereby granted, free of charge, to any person obtaining a copy 25660 * of this software and associated documentation files (the "Software"), to deal 25661 * in the Software without restriction, including without limitation the rights 25662 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25663 * copies of the Software, and to permit persons to whom the Software is 25664 * furnished to do so, subject to the following conditions: 25665 * 25666 * The above copyright notice and this permission notice shall be included in 25667 * all copies or substantial portions of the Software. 25668 * 25669 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25670 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25671 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25672 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25673 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25674 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25675 * THE SOFTWARE. 25676 */ 25677 25678Object.defineProperty(exports, "__esModule", { value: true }); 25679exports.strings = exports.cssClasses = void 0; 25680var cssClasses = { 25681 ACTIVE: 'mdc-tab--active' 25682}; 25683exports.cssClasses = cssClasses; 25684var strings = { 25685 ARIA_SELECTED: 'aria-selected', 25686 CONTENT_SELECTOR: '.mdc-tab__content', 25687 INTERACTED_EVENT: 'MDCTab:interacted', 25688 RIPPLE_SELECTOR: '.mdc-tab__ripple', 25689 TABINDEX: 'tabIndex', 25690 TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator' 25691}; 25692exports.strings = strings; 25693 25694/***/ }), 25695 25696/***/ "./packages/mdc-tab/foundation.ts": 25697/*!****************************************!*\ 25698 !*** ./packages/mdc-tab/foundation.ts ***! 25699 \****************************************/ 25700/*! no static exports found */ 25701/***/ (function(module, exports, __webpack_require__) { 25702 25703"use strict"; 25704 25705/** 25706 * @license 25707 * Copyright 2018 Google Inc. 25708 * 25709 * Permission is hereby granted, free of charge, to any person obtaining a copy 25710 * of this software and associated documentation files (the "Software"), to deal 25711 * in the Software without restriction, including without limitation the rights 25712 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25713 * copies of the Software, and to permit persons to whom the Software is 25714 * furnished to do so, subject to the following conditions: 25715 * 25716 * The above copyright notice and this permission notice shall be included in 25717 * all copies or substantial portions of the Software. 25718 * 25719 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25720 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25721 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25722 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25723 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25724 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25725 * THE SOFTWARE. 25726 */ 25727 25728var __extends = this && this.__extends || function () { 25729 var _extendStatics = function extendStatics(d, b) { 25730 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 25731 d.__proto__ = b; 25732 } || function (d, b) { 25733 for (var p in b) { 25734 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 25735 } 25736 }; 25737 return _extendStatics(d, b); 25738 }; 25739 return function (d, b) { 25740 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 25741 _extendStatics(d, b); 25742 function __() { 25743 this.constructor = d; 25744 } 25745 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 25746 }; 25747}(); 25748var __assign = this && this.__assign || function () { 25749 __assign = Object.assign || function (t) { 25750 for (var s, i = 1, n = arguments.length; i < n; i++) { 25751 s = arguments[i]; 25752 for (var p in s) { 25753 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 25754 } 25755 } 25756 return t; 25757 }; 25758 return __assign.apply(this, arguments); 25759}; 25760Object.defineProperty(exports, "__esModule", { value: true }); 25761exports.MDCTabFoundation = void 0; 25762var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 25763var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts"); 25764var MDCTabFoundation = /** @class */function (_super) { 25765 __extends(MDCTabFoundation, _super); 25766 function MDCTabFoundation(adapter) { 25767 var _this = _super.call(this, __assign(__assign({}, MDCTabFoundation.defaultAdapter), adapter)) || this; 25768 _this.focusOnActivate
25768_
vendor: 2,737 bytes, lines 25768-25843
25768 = true; 25769 return _this; 25770 } 25771 Object.defineProperty(MDCTabFoundation, "cssClasses", { 25772 get: function get() { 25773 return constants_1.cssClasses; 25774 }, 25775 enumerable: false, 25776 configurable: true 25777 }); 25778 Object.defineProperty(MDCTabFoundation, "strings", { 25779 get: function get() { 25780 return constants_1.strings; 25781 }, 25782 enumerable: false, 25783 configurable: true 25784 }); 25785 Object.defineProperty(MDCTabFoundation, "defaultAdapter", { 25786 get: function get() { 25787 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 25788 return { 25789 addClass: function addClass() { 25790 return undefined; 25791 }, 25792 removeClass: function removeClass() { 25793 return undefined; 25794 }, 25795 hasClass: function hasClass() { 25796 return false; 25797 }, 25798 setAttr: function setAttr() { 25799 return undefined; 25800 }, 25801 activateIndicator: function activateIndicator() { 25802 return undefined; 25803 }, 25804 deactivateIndicator: function deactivateIndicator() { 25805 return undefined; 25806 }, 25807 notifyInteracted: function notifyInteracted() { 25808 return undefined; 25809 }, 25810 getOffsetLeft: function getOffsetLeft() { 25811 return 0; 25812 }, 25813 getOffsetWidth: function getOffsetWidth() { 25814 return 0; 25815 }, 25816 getContentOffsetLeft: function getContentOffsetLeft() { 25817 return 0; 25818 }, 25819 getContentOffsetWidth: function getContentOffsetWidth() { 25820 return 0; 25821 }, 25822 focus: function focus() { 25823 return undefined; 25824 } 25825 }; 25826 // tslint:enable:object-literal-sort-keys 25827 }, 25828 enumerable: false, 25829 configurable: true 25830 }); 25831 MDCTabFoundation.prototype.handleClick = function () { 25832 // It's up to the parent component to keep track of the active Tab and 25833 // ensure we don't activate a Tab that's already active. 25834 this.adapter.notifyInteracted(); 25835 }; 25836 MDCTabFoundation.prototype.isActive = function () { 25837 return this.adapter.hasClass(constants_1.cssClasses.ACTIVE); 25838 }; 25839 /** 25840 * Sets whether the tab should focus itself when activated 25841 */ 25842 MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) { 25843 this.focusOnActivate
25843_ = focusOnActivate; 25844 }; 25845 /** 25846 * Activates the Tab 25847 */ 25848 MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) { 25849 this.adapter.addClass(constants_1.cssClasses.ACTIVE); 25850 this.adapter.setAttr(constants_1.strings.ARIA_SELECTED, 'true'); 25851 this.adapter.setAttr(constants_1.strings.TABINDEX, '0'); 25852 this.adapter.activateIndicator(previousIndicatorClientRect); 25853 if (this.focusOnActivate_
vendor: 29,346 bytes, lines 25853-26511
25853) { 25854 this.adapter.focus(); 25855 } 25856 }; 25857 /** 25858 * Deactivates the Tab 25859 */ 25860 MDCTabFoundation.prototype.deactivate = function () { 25861 // Early exit 25862 if (!this.isActive()) { 25863 return; 25864 } 25865 this.adapter.removeClass(constants_1.cssClasses.ACTIVE); 25866 this.adapter.setAttr(constants_1.strings.ARIA_SELECTED, 'false'); 25867 this.adapter.setAttr(constants_1.strings.TABINDEX, '-1'); 25868 this.adapter.deactivateIndicator(); 25869 }; 25870 /** 25871 * Returns the dimensions of the Tab 25872 */ 25873 MDCTabFoundation.prototype.computeDimensions = function () { 25874 var rootWidth = this.adapter.getOffsetWidth(); 25875 var rootLeft = this.adapter.getOffsetLeft(); 25876 var contentWidth = this.adapter.getContentOffsetWidth(); 25877 var contentLeft = this.adapter.getContentOffsetLeft(); 25878 return { 25879 contentLeft: rootLeft + contentLeft, 25880 contentRight: rootLeft + contentLeft + contentWidth, 25881 rootLeft: rootLeft, 25882 rootRight: rootLeft + rootWidth 25883 }; 25884 }; 25885 return MDCTabFoundation; 25886}(foundation_1.MDCFoundation); 25887exports.MDCTabFoundation = MDCTabFoundation; 25888// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 25889exports.default = MDCTabFoundation; 25890 25891/***/ }), 25892 25893/***/ "./packages/mdc-tab/index.ts": 25894/*!***********************************!*\ 25895 !*** ./packages/mdc-tab/index.ts ***! 25896 \***********************************/ 25897/*! no static exports found */ 25898/***/ (function(module, exports, __webpack_require__) { 25899 25900"use strict"; 25901 25902/** 25903 * @license 25904 * Copyright 2019 Google Inc. 25905 * 25906 * Permission is hereby granted, free of charge, to any person obtaining a copy 25907 * of this software and associated documentation files (the "Software"), to deal 25908 * in the Software without restriction, including without limitation the rights 25909 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25910 * copies of the Software, and to permit persons to whom the Software is 25911 * furnished to do so, subject to the following conditions: 25912 * 25913 * The above copyright notice and this permission notice shall be included in 25914 * all copies or substantial portions of the Software. 25915 * 25916 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25917 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25918 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25919 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25920 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25921 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25922 * THE SOFTWARE. 25923 */ 25924 25925var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 25926 if (k2 === undefined) k2 = k; 25927 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 25928 return m[k]; 25929 } }); 25930} : function (o, m, k, k2) { 25931 if (k2 === undefined) k2 = k; 25932 o[k2] = m[k]; 25933}); 25934var __exportStar = this && this.__exportStar || function (m, exports) { 25935 for (var p in m) { 25936 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 25937 } 25938}; 25939Object.defineProperty(exports, "__esModule", { value: true }); 25940__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-tab/adapter.ts"), exports); 25941__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-tab/component.ts"), exports); 25942__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts"), exports); 25943__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts"), exports); 25944__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-tab/types.ts"), exports); 25945 25946/***/ }), 25947 25948/***/ "./packages/mdc-tab/types.ts": 25949/*!***********************************!*\ 25950 !*** ./packages/mdc-tab/types.ts ***! 25951 \***********************************/ 25952/*! no static exports found */ 25953/***/ (function(module, exports, __webpack_require__) { 25954 25955"use strict"; 25956 25957/** 25958 * @license 25959 * Copyright 2019 Google Inc. 25960 * 25961 * Permission is hereby granted, free of charge, to any person obtaining a copy 25962 * of this software and associated documentation files (the "Software"), to deal 25963 * in the Software without restriction, including without limitation the rights 25964 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25965 * copies of the Software, and to permit persons to whom the Software is 25966 * furnished to do so, subject to the following conditions: 25967 * 25968 * The above copyright notice and this permission notice shall be included in 25969 * all copies or substantial portions of the Software. 25970 * 25971 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25972 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25973 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25974 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25975 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25976 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25977 * THE SOFTWARE. 25978 */ 25979 25980Object.defineProperty(exports, "__esModule", { value: true }); 25981 25982/***/ }), 25983 25984/***/ "./packages/mdc-textfield/adapter.ts": 25985/*!*******************************************!*\ 25986 !*** ./packages/mdc-textfield/adapter.ts ***! 25987 \*******************************************/ 25988/*! no static exports found */ 25989/***/ (function(module, exports, __webpack_require__) { 25990 25991"use strict"; 25992 25993/** 25994 * @license 25995 * Copyright 2017 Google Inc. 25996 * 25997 * Permission is hereby granted, free of charge, to any person obtaining a copy 25998 * of this software and associated documentation files (the "Software"), to deal 25999 * in the Software without restriction, including without limitation the rights 26000 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26001 * copies of the Software, and to permit persons to whom the Software is 26002 * furnished to do so, subject to the following conditions: 26003 * 26004 * The above copyright notice and this permission notice shall be included in 26005 * all copies or substantial portions of the Software. 26006 * 26007 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26008 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26009 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26010 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26011 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26012 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26013 * THE SOFTWARE. 26014 */ 26015 26016Object.defineProperty(exports, "__esModule", { value: true }); 26017 26018/***/ }), 26019 26020/***/ "./packages/mdc-textfield/character-counter/adapter.ts": 26021/*!*************************************************************!*\ 26022 !*** ./packages/mdc-textfield/character-counter/adapter.ts ***! 26023 \*************************************************************/ 26024/*! no static exports found */ 26025/***/ (function(module, exports, __webpack_require__) { 26026 26027"use strict"; 26028 26029/** 26030 * @license 26031 * Copyright 2019 Google Inc. 26032 * 26033 * Permission is hereby granted, free of charge, to any person obtaining a copy 26034 * of this software and associated documentation files (the "Software"), to deal 26035 * in the Software without restriction, including without limitation the rights 26036 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26037 * copies of the Software, and to permit persons to whom the Software is 26038 * furnished to do so, subject to the following conditions: 26039 * 26040 * The above copyright notice and this permission notice shall be included in 26041 * all copies or substantial portions of the Software. 26042 * 26043 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26044 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26045 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26046 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26047 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26048 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26049 * THE SOFTWARE. 26050 */ 26051 26052Object.defineProperty(exports, "__esModule", { value: true }); 26053 26054/***/ }), 26055 26056/***/ "./packages/mdc-textfield/character-counter/component.ts": 26057/*!***************************************************************!*\ 26058 !*** ./packages/mdc-textfield/character-counter/component.ts ***! 26059 \***************************************************************/ 26060/*! no static exports found */ 26061/***/ (function(module, exports, __webpack_require__) { 26062 26063"use strict"; 26064 26065/** 26066 * @license 26067 * Copyright 2019 Google Inc. 26068 * 26069 * Permission is hereby granted, free of charge, to any person obtaining a copy 26070 * of this software and associated documentation files (the "Software"), to deal 26071 * in the Software without restriction, including without limitation the rights 26072 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26073 * copies of the Software, and to permit persons to whom the Software is 26074 * furnished to do so, subject to the following conditions: 26075 * 26076 * The above copyright notice and this permission notice shall be included in 26077 * all copies or substantial portions of the Software. 26078 * 26079 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26080 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26081 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26082 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26083 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26084 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26085 * THE SOFTWARE. 26086 */ 26087 26088var __extends = this && this.__extends || function () { 26089 var _extendStatics = function extendStatics(d, b) { 26090 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 26091 d.__proto__ = b; 26092 } || function (d, b) { 26093 for (var p in b) { 26094 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 26095 } 26096 }; 26097 return _extendStatics(d, b); 26098 }; 26099 return function (d, b) { 26100 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 26101 _extendStatics(d, b); 26102 function __() { 26103 this.constructor = d; 26104 } 26105 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 26106 }; 26107}(); 26108Object.defineProperty(exports, "__esModule", { value: true }); 26109exports.MDCTextFieldCharacterCounter = void 0; 26110var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 26111var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"); 26112var MDCTextFieldCharacterCounter = /** @class */function (_super) { 26113 __extends(MDCTextFieldCharacterCounter, _super); 26114 function MDCTextFieldCharacterCounter() { 26115 return _super !== null && _super.apply(this, arguments) || this; 26116 } 26117 MDCTextFieldCharacterCounter.attachTo = function (root) { 26118 return new MDCTextFieldCharacterCounter(root); 26119 }; 26120 Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundationForTextField", { 26121 // Provided for access by MDCTextField component 26122 get: function get() { 26123 return this.foundation; 26124 }, 26125 enumerable: false, 26126 configurable: true 26127 }); 26128 MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () { 26129 var _this = this; 26130 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 26131 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 26132 var adapter = { 26133 setContent: function setContent(content) { 26134 _this.root.textContent = content; 26135 } 26136 }; 26137 return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter); 26138 }; 26139 return MDCTextFieldCharacterCounter; 26140}(component_1.MDCComponent); 26141exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter; 26142 26143/***/ }), 26144 26145/***/ "./packages/mdc-textfield/character-counter/constants.ts": 26146/*!***************************************************************!*\ 26147 !*** ./packages/mdc-textfield/character-counter/constants.ts ***! 26148 \***************************************************************/ 26149/*! no static exports found */ 26150/***/ (function(module, exports, __webpack_require__) { 26151 26152"use strict"; 26153 26154/** 26155 * @license 26156 * Copyright 2019 Google Inc. 26157 * 26158 * Permission is hereby granted, free of charge, to any person obtaining a copy 26159 * of this software and associated documentation files (the "Software"), to deal 26160 * in the Software without restriction, including without limitation the rights 26161 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26162 * copies of the Software, and to permit persons to whom the Software is 26163 * furnished to do so, subject to the following conditions: 26164 * 26165 * The above copyright notice and this permission notice shall be included in 26166 * all copies or substantial portions of the Software. 26167 * 26168 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26169 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26170 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26171 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26172 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26173 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26174 * THE SOFTWARE. 26175 */ 26176 26177Object.defineProperty(exports, "__esModule", { value: true }); 26178exports.cssClasses = exports.strings = void 0; 26179var cssClasses = { 26180 ROOT: 'mdc-text-field-character-counter' 26181}; 26182exports.cssClasses = cssClasses; 26183var strings = { 26184 ROOT_SELECTOR: "." + cssClasses.ROOT 26185}; 26186exports.strings = strings; 26187 26188/***/ }), 26189 26190/***/ "./packages/mdc-textfield/character-counter/foundation.ts": 26191/*!****************************************************************!*\ 26192 !*** ./packages/mdc-textfield/character-counter/foundation.ts ***! 26193 \****************************************************************/ 26194/*! no static exports found */ 26195/***/ (function(module, exports, __webpack_require__) { 26196 26197"use strict"; 26198 26199/** 26200 * @license 26201 * Copyright 2019 Google Inc. 26202 * 26203 * Permission is hereby granted, free of charge, to any person obtaining a copy 26204 * of this software and associated documentation files (the "Software"), to deal 26205 * in the Software without restriction, including without limitation the rights 26206 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26207 * copies of the Software, and to permit persons to whom the Software is 26208 * furnished to do so, subject to the following conditions: 26209 * 26210 * The above copyright notice and this permission notice shall be included in 26211 * all copies or substantial portions of the Software. 26212 * 26213 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26214 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26215 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26216 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26217 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26218 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26219 * THE SOFTWARE. 26220 */ 26221 26222var __extends = this && this.__extends || function () { 26223 var _extendStatics = function extendStatics(d, b) { 26224 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 26225 d.__proto__ = b; 26226 } || function (d, b) { 26227 for (var p in b) { 26228 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 26229 } 26230 }; 26231 return _extendStatics(d, b); 26232 }; 26233 return function (d, b) { 26234 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 26235 _extendStatics(d, b); 26236 function __() { 26237 this.constructor = d; 26238 } 26239 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 26240 }; 26241}(); 26242var __assign = this && this.__assign || function () { 26243 __assign = Object.assign || function (t) { 26244 for (var s, i = 1, n = arguments.length; i < n; i++) { 26245 s = arguments[i]; 26246 for (var p in s) { 26247 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 26248 } 26249 } 26250 return t; 26251 }; 26252 return __assign.apply(this, arguments); 26253}; 26254Object.defineProperty(exports, "__esModule", { value: true }); 26255exports.MDCTextFieldCharacterCounterFoundation = void 0; 26256var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 26257var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts"); 26258var MDCTextFieldCharacterCounterFoundation = /** @class */function (_super) { 26259 __extends(MDCTextFieldCharacterCounterFoundation, _super); 26260 function MDCTextFieldCharacterCounterFoundation(adapter) { 26261 return _super.call(this, __assign(__assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter), adapter)) || this; 26262 } 26263 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", { 26264 get: function get() { 26265 return constants_1.cssClasses; 26266 }, 26267 enumerable: false, 26268 configurable: true 26269 }); 26270 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", { 26271 get: function get() { 26272 return constants_1.strings; 26273 }, 26274 enumerable: false, 26275 configurable: true 26276 }); 26277 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", { 26278 /** 26279 * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types. 26280 */ 26281 get: function get() { 26282 return { 26283 setContent: function setContent() { 26284 return undefined; 26285 } 26286 }; 26287 }, 26288 enumerable: false, 26289 configurable: true 26290 }); 26291 MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) { 26292 currentLength = Math.min(currentLength, maxLength); 26293 this.adapter.setContent(currentLength + " / " + maxLength); 26294 }; 26295 return MDCTextFieldCharacterCounterFoundation; 26296}(foundation_1.MDCFoundation); 26297exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation; 26298// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 26299exports.default = MDCTextFieldCharacterCounterFoundation; 26300 26301/***/ }), 26302 26303/***/ "./packages/mdc-textfield/character-counter/index.ts": 26304/*!***********************************************************!*\ 26305 !*** ./packages/mdc-textfield/character-counter/index.ts ***! 26306 \***********************************************************/ 26307/*! no static exports found */ 26308/***/ (function(module, exports, __webpack_require__) { 26309 26310"use strict"; 26311 26312/** 26313 * @license 26314 * Copyright 2019 Google Inc. 26315 * 26316 * Permission is hereby granted, free of charge, to any person obtaining a copy 26317 * of this software and associated documentation files (the "Software"), to deal 26318 * in the Software without restriction, including without limitation the rights 26319 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26320 * copies of the Software, and to permit persons to whom the Software is 26321 * furnished to do so, subject to the following conditions: 26322 * 26323 * The above copyright notice and this permission notice shall be included in 26324 * all copies or substantial portions of the Software. 26325 * 26326 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26327 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26328 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26329 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26330 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26331 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26332 * THE SOFTWARE. 26333 */ 26334 26335var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 26336 if (k2 === undefined) k2 = k; 26337 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 26338 return m[k]; 26339 } }); 26340} : function (o, m, k, k2) { 26341 if (k2 === undefined) k2 = k; 26342 o[k2] = m[k]; 26343}); 26344var __exportStar = this && this.__exportStar || function (m, exports) { 26345 for (var p in m) { 26346 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 26347 } 26348}; 26349Object.defineProperty(exports, "__esModule", { value: true }); 26350exports.characterCountStrings = exports.characterCountCssClasses = void 0; 26351__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/character-counter/adapter.ts"), exports); 26352__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/character-counter/component.ts"), exports); 26353__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"), exports); 26354var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts"); 26355Object.defineProperty(exports, "characterCountCssClasses", { enumerable: true, get: function get() { 26356 return constants_1.cssClasses; 26357 } }); 26358Object.defineProperty(exports, "characterCountStrings", { enumerable: true, get: function get() { 26359 return constants_1.strings; 26360 } }); 26361 26362/***/ }), 26363 26364/***/ "./packages/mdc-textfield/component.ts": 26365/*!*********************************************!*\ 26366 !*** ./packages/mdc-textfield/component.ts ***! 26367 \*********************************************/ 26368/*! no static exports found */ 26369/***/ (function(module, exports, __webpack_require__) { 26370 26371"use strict"; 26372 26373/** 26374 * @license 26375 * Copyright 2016 Google Inc. 26376 * 26377 * Permission is hereby granted, free of charge, to any person obtaining a copy 26378 * of this software and associated documentation files (the "Software"), to deal 26379 * in the Software without restriction, including without limitation the rights 26380 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26381 * copies of the Software, and to permit persons to whom the Software is 26382 * furnished to do so, subject to the following conditions: 26383 * 26384 * The above copyright notice and this permission notice shall be included in 26385 * all copies or substantial portions of the Software. 26386 * 26387 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26388 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26389 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26390 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26391 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26392 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26393 * THE SOFTWARE. 26394 */ 26395 26396var __extends = this && this.__extends || function () { 26397 var _extendStatics = function extendStatics(d, b) { 26398 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 26399 d.__proto__ = b; 26400 } || function (d, b) { 26401 for (var p in b) { 26402 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 26403 } 26404 }; 26405 return _extendStatics(d, b); 26406 }; 26407 return function (d, b) { 26408 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 26409 _extendStatics(d, b); 26410 function __() { 26411 this.constructor = d; 26412 } 26413 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 26414 }; 26415}(); 26416var __assign = this && this.__assign || function () { 26417 __assign = Object.assign || function (t) { 26418 for (var s, i = 1, n = arguments.length; i < n; i++) { 26419 s = arguments[i]; 26420 for (var p in s) { 26421 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 26422 } 26423 } 26424 return t; 26425 }; 26426 return __assign.apply(this, arguments); 26427}; 26428var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 26429 if (k2 === undefined) k2 = k; 26430 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 26431 return m[k]; 26432 } }); 26433} : function (o, m, k, k2) { 26434 if (k2 === undefined) k2 = k; 26435 o[k2] = m[k]; 26436}); 26437var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 26438 Object.defineProperty(o, "default", { enumerable: true, value: v }); 26439} : function (o, v) { 26440 o["default"] = v; 26441}); 26442var __importStar = this && this.__importStar || function (mod) { 26443 if (mod && mod.__esModule) return mod; 26444 var result = {}; 26445 if (mod != null) for (var k in mod) { 26446 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 26447 }__setModuleDefault(result, mod); 26448 return result; 26449}; 26450Object.defineProperty(exports, "__esModule", { value: true }); 26451exports.MDCTextField = void 0; 26452var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 26453var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); 26454var ponyfill = __importStar(__webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts")); 26455var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts"); 26456var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts"); 26457var component_4 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts"); 26458var component_5 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 26459var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); 26460var component_6 = __webpack_require__(/*! ./character-counter/component */ "./packages/mdc-textfield/character-counter/component.ts"); 26461var foundation_2 = __webpack_require__(/*! ./character-counter/foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"); 26462var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"); 26463var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts"); 26464var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-textfield/helper-text/component.ts"); 26465var foundation_4 = __webpack_require__(/*! ./helper-text/foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"); 26466var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-textfield/icon/component.ts"); 26467var MDCTextField = /** @class */function (_super) { 26468 __extends(MDCTextField, _super); 26469 function MDCTextField() { 26470 return _super !== null && _super.apply(this, arguments) || this; 26471 } 26472 MDCTextField.attachTo = function (root) { 26473 return new MDCTextField(root); 26474 }; 26475 MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) { 26476 if (rippleFactory === void 0) { 26477 rippleFactory = function rippleFactory(el, foundation) { 26478 return new component_5.MDCRipple(el, foundation); 26479 }; 26480 } 26481 if (lineRippleFactory === void 0) { 26482 lineRippleFactory = function lineRippleFactory(el) { 26483 return new component_3.MDCLineRipple(el); 26484 }; 26485 } 26486 if (helperTextFactory === void 0) { 26487 helperTextFactory = function helperTextFactory(el) { 26488 return new component_7.MDCTextFieldHelperText(el); 26489 }; 26490 } 26491 if (characterCounterFactory === void 0) { 26492 characterCounterFactory = function characterCounterFactory(el) { 26493 return new component_6.MDCTextFieldCharacterCounter(el); 26494 }; 26495 } 26496 if (iconFactory === void 0) { 26497 iconFactory = function iconFactory(el) { 26498 return new component_8.MDCTextFieldIcon(el); 26499 }; 26500 } 26501 if (labelFactory === void 0) { 26502 labelFactory = function labelFactory(el) { 26503 return new component_2.MDCFloatingLabel(el); 26504 }; 26505 } 26506 if (outlineFactory === void 0) { 26507 outlineFactory = function outlineFactory(el) { 26508 return new component_4.MDCNotchedOutline(el); 26509 }; 26510 } 26511 this.input
26511_ = this.root.querySelector(constants_1.strings.INPUT_SELECTOR); 26512 var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR); 26513 this.label_ = labelElement ? labelFactory(labelElement) : null; 26514 var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR); 26515 this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null; 26516 var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR); 26517 this.outline_ = outlineElement ? outlineFactory(outlineElement) : null; 26518 // Helper text 26519 var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings; 26520 var nextElementSibling = this.root.nextElementSibling; 26521 var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasse
vendor: 4,435 bytes, lines 26521-26641
26521s.HELPER_LINE); 26522 var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR); 26523 this.helperText_ = helperTextEl ? helperTextFactory(helperTextEl) : null; 26524 // Character counter 26525 var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings; 26526 var characterCounterEl = this.root.querySelector(characterCounterStrings.ROOT_SELECTOR); 26527 // If character counter is not found in root element search in sibling element. 26528 if (!characterCounterEl && hasHelperLine && nextElementSibling) { 26529 characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR); 26530 } 26531 this.characterCounter_ = characterCounterEl ? characterCounterFactory(characterCounterEl) : null; 26532 // Leading icon 26533 var leadingIconEl = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR); 26534 this.leadingIcon_ = leadingIconEl ? iconFactory(leadingIconEl) : null; 26535 // Trailing icon 26536 var trailingIconEl = this.root.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR); 26537 this.trailingIcon_ = trailingIconEl ? iconFactory(trailingIconEl) : null; 26538 // Prefix and Suffix 26539 this.prefix_ = this.root.querySelector(constants_1.strings.PREFIX_SELECTOR); 26540 this.suffix_ = this.root.querySelector(constants_1.strings.SUFFIX_SELECTOR); 26541 this.ripple = this.createRipple_(rippleFactory); 26542 }; 26543 MDCTextField.prototype.destroy = function () { 26544 if (this.ripple) { 26545 this.ripple.destroy(); 26546 } 26547 if (this.lineRipple_) { 26548 this.lineRipple_.destroy(); 26549 } 26550 if (this.helperText_) { 26551 this.helperText_.destroy(); 26552 } 26553 if (this.characterCounter_) { 26554 this.characterCounter_.destroy(); 26555 } 26556 if (this.leadingIcon_) { 26557 this.leadingIcon_.destroy(); 26558 } 26559 if (this.trailingIcon_) { 26560 this.trailingIcon_.destroy(); 26561 } 26562 if (this.label_) { 26563 this.label_.destroy(); 26564 } 26565 if (this.outline_) { 26566 this.outline_.destroy(); 26567 } 26568 _super.prototype.destroy.call(this); 26569 }; 26570 /** 26571 * Initializes the Text Field's internal state based on the environment's 26572 * state. 26573 */ 26574 MDCTextField.prototype.initialSyncWithDOM = function () { 26575 this.disabled = this.input_.disabled; 26576 }; 26577 Object.defineProperty(MDCTextField.prototype, "value", { 26578 get: function get() { 26579 return this.foundation.getValue(); 26580 }, 26581 /** 26582 * @param value The value to set on the input. 26583 */ 26584 set: function set(value) { 26585 this.foundation.setValue(value); 26586 }, 26587 enumerable: false, 26588 configurable: true 26589 }); 26590 Object.defineProperty(MDCTextField.prototype, "disabled", { 26591 get: function get() { 26592 return this.foundation.isDisabled(); 26593 }, 26594 /** 26595 * @param disabled Sets the Text Field disabled or enabled. 26596 */ 26597 set: function set(disabled) { 26598 this.foundation.setDisabled(disabled); 26599 }, 26600 enumerable: false, 26601 configurable: true 26602 }); 26603 Object.defineProperty(MDCTextField.prototype, "valid", { 26604 get: function get() { 26605 return this.foundation.isValid(); 26606 }, 26607 /** 26608 * @param valid Sets the Text Field valid or invalid. 26609 */ 26610 set: function set(valid) { 26611 this.foundation.setValid(valid); 26612 }, 26613 enumerable: false, 26614 configurable: true 26615 }); 26616 Object.defineProperty(MDCTextField.prototype, "required", { 26617 get: function get() { 26618 return this.input_.required; 26619 }, 26620 /** 26621 * @param required Sets the Text Field to required. 26622 */ 26623 set: function set(required) { 26624 this.input_.required = required; 26625 }, 26626 enumerable: false, 26627 configurable: true 26628 }); 26629 Object.defineProperty(MDCTextField.prototype, "pattern", { 26630 get: function get() { 26631 return this.input_.pattern; 26632 }, 26633 /** 26634 * @param pattern Sets the input element's validation pattern. 26635 */ 26636 set: function set(pattern) { 26637 this.input_.pattern = pattern; 26638 }, 26639 enumerable: false, 26640 configurable: true 26641 });
26642 Object.defineProperty(MDCTextField.prototype, "minLength", { 26643 get: function get() { 26644 return this.input_.minLength; 26645 }, 26646 /** 26647 * @param minLength Sets the input element's minLength. 26648 */ 26649 set: function set(minLength) { 26650 this.input_.minLength = minLength; 26651 }, 26652 enumerable: false, 26653 configurable: true 26654 }); 26655 Object.defineProperty(MDCTextField.prototype, "maxLength", { 26656 get: function get() { 26657 return this.input_.maxLength; 26658 }, 26659 /** 26660 * @param maxLength Sets the input element's maxLength. 26661 */ 26662 set: function set(maxLength) { 26663 // Chrome throws exception if maxLength is set to a value less than zero 26664 if (maxLength < 0) { 26665 this.input_.removeAttribute('maxLength'); 26666 } else { 26667 this.input_.maxLength = maxLength; 26668 } 26669 }, 26670 enumerable: false, 26671 configurable: true 26672 }); 26673 Object.defineProperty(MDCTextField.prototype, "min", { 26674 get: function get() { 26675 return this.input_.min; 26676 }, 26677 /** 26678 * @param min Sets the input element's min. 26679 */ 26680 set: function set(min) { 26681 this.input_.min = min; 26682 }, 26683 enumerable: false, 26684 configurable: true 26685 }); 26686 Object.defineProperty(MDCTextField.prototype, "max", { 26687 get: function get() { 26688 return this.input_.max; 26689 }, 26690 /** 26691 * @param max Sets the input element's max. 26692 */ 26693 set: function set(max) { 26694 this.input_.max = max; 26695 }, 26696 enumerable: false, 26697 configurable: true 26698 }); 26699 Object.defineProperty(MDCTextField.prototype, "step", { 26700 get: function get() { 26701 return this.input_.step; 26702 }, 26703 /** 26704 * @param step Sets the input element's step. 26705 */ 26706 set: function set(step) { 26707 this.input_.step = step; 26708 }, 26709 enumerable: false, 26710 configurable: true 26711 }); 26712 Object.defineProperty(MDCTextField.prototype, "helperTextContent", { 26713 /** 26714 * Sets the helper text element content. 26715 */ 26716 set: function set(content) { 26717 this.foundation.setHelperTextContent(content); 26718 }, 26719 enumerable: false, 26720 configurable: true 26721 }); 26722 Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", { 26723 /** 26724 * Sets the aria label of the leading icon. 26725 */ 26726 set: function set(label) { 26727 this.foundation.setLeadingIconAriaLabel(label); 26728 }, 26729 enumerable: false, 26730 configurable: true 26731 }); 26732 Object.defineProperty(MDCTextField.prototype, "leadingIconContent", { 26733 /** 26734 * Sets the text content of the leading icon. 26735 */ 26736 set: function set(content) { 26737 this.foundation.setLeadingIconContent(content); 26738 }, 26739 enumerable: false, 26740 configurable: true 26741 }); 26742 Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", { 26743 /** 26744 * Sets the aria label of the trailing icon. 26745 */ 26746 set: function set(label) { 26747 this.foundation.setTrailingIconAriaLabel(label); 26748 }, 26749 enumerable: false, 26750 configurable: true 26751 }); 26752 Object.defineProperty(MDCTextField.prototype, "trailingIconContent", { 26753 /** 26754 * Sets the text content of the trailing icon. 26755 */ 26756 set: function set(content) { 26757 this.foundation.setTrailingIconContent(content); 26758 }, 26759 enumerable: false, 26760 configurable: true 26761 }); 26762 Object.defineProperty(MDCTextField.prototype, "useNativeValidation", { 26763 /** 26764 * Enables or disables the use of native validation. Use this for custom validation. 26765 * @param useNativeValidation Set this to false to ignore native input validation. 26766 */ 26767 set: function set(useNativeValidation) { 26768 this.foundation.setUseNativeValidation(useNativeValidation); 26769 }, 26770 enumerable: false, 26771 configurable: true 26772 });
vendor: 8,401 bytes, lines 26773-26962
26773 Object.defineProperty(MDCTextField.prototype, "prefixText", { 26774 /** 26775 * Gets the text content of the prefix, or null if it does not exist. 26776 */ 26777 get: function get() { 26778 return this.prefix_ ? this.prefix_.textContent : null; 26779 }, 26780 /** 26781 * Sets the text content of the prefix, if it exists. 26782 */ 26783 set: function set(prefixText) { 26784 if (this.prefix_) { 26785 this.prefix_.textContent = prefixText; 26786 } 26787 }, 26788 enumerable: false, 26789 configurable: true 26790 }); 26791 Object.defineProperty(MDCTextField.prototype, "suffixText", { 26792 /** 26793 * Gets the text content of the suffix, or null if it does not exist. 26794 */ 26795 get: function get() { 26796 return this.suffix_ ? this.suffix_.textContent : null; 26797 }, 26798 /** 26799 * Sets the text content of the suffix, if it exists. 26800 */ 26801 set: function set(suffixText) { 26802 if (this.suffix_) { 26803 this.suffix_.textContent = suffixText; 26804 } 26805 }, 26806 enumerable: false, 26807 configurable: true 26808 }); 26809 /** 26810 * Focuses the input element. 26811 */ 26812 MDCTextField.prototype.focus = function () { 26813 this.input_.focus(); 26814 }; 26815 /** 26816 * Recomputes the outline SVG path for the outline element. 26817 */ 26818 MDCTextField.prototype.layout = function () { 26819 var openNotch = this.foundation.shouldFloat; 26820 this.foundation.notchOutline(openNotch); 26821 }; 26822 MDCTextField.prototype.getDefaultFoundation = function () { 26823 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 26824 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 26825 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 26826 var adapter = __assign(__assign(__assign(__assign(__assign({}, this.getRootAdapterMethods_()), this.getInputAdapterMethods_()), this.getLabelAdapterMethods_()), this.getLineRippleAdapterMethods_()), this.getOutlineAdapterMethods_()); 26827 // tslint:enable:object-literal-sort-keys 26828 return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap_()); 26829 }; 26830 MDCTextField.prototype.getRootAdapterMethods_ = function () { 26831 var _this = this; 26832 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 26833 return { 26834 addClass: function addClass(className) { 26835 return _this.root.classList.add(className); 26836 }, 26837 removeClass: function removeClass(className) { 26838 return _this.root.classList.remove(className); 26839 }, 26840 hasClass: function hasClass(className) { 26841 return _this.root.classList.contains(className); 26842 }, 26843 registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) { 26844 _this.listen(evtType, handler); 26845 }, 26846 deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) { 26847 _this.unlisten(evtType, handler); 26848 }, 26849 registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) { 26850 var getAttributesList = function getAttributesList(mutationsList) { 26851 return mutationsList.map(function (mutation) { 26852 return mutation.attributeName; 26853 }).filter(function (attributeName) { 26854 return attributeName; 26855 }); 26856 }; 26857 var observer = new MutationObserver(function (mutationsList) { 26858 return handler(getAttributesList(mutationsList)); 26859 }); 26860 var config = { attributes: true }; 26861 observer.observe(_this.input_, config); 26862 return observer; 26863 }, 26864 deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) { 26865 observer.disconnect(); 26866 } 26867 }; 26868 // tslint:enable:object-literal-sort-keys 26869 }; 26870 MDCTextField.prototype.getInputAdapterMethods_ = function () { 26871 var _this = this; 26872 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 26873 return { 26874 getNativeInput: function getNativeInput() { 26875 return _this.input_; 26876 }, 26877 setInputAttr: function setInputAttr(attr, value) { 26878 _this.input_.setAttribute(attr, value); 26879 }, 26880 removeInputAttr: function removeInputAttr(attr) { 26881 _this.input_.removeAttribute(attr); 26882 }, 26883 isFocused: function isFocused() { 26884 return document.activeElement === _this.input_; 26885 }, 26886 registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) { 26887 _this.input_.addEventListener(evtType, handler, events_1.applyPassive()); 26888 }, 26889 deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) { 26890 _this.input_.removeEventListener(evtType, handler, events_1.applyPassive()); 26891 } 26892 }; 26893 // tslint:enable:object-literal-sort-keys 26894 }; 26895 MDCTextField.prototype.getLabelAdapterMethods_ = function () { 26896 var _this = this; 26897 return { 26898 floatLabel: function floatLabel(shouldFloat) { 26899 return _this.label_ && _this.label_.float(shouldFloat); 26900 }, 26901 getLabelWidth: function getLabelWidth() { 26902 return _this.label_ ? _this.label_.getWidth() : 0; 26903 }, 26904 hasLabel: function hasLabel() { 26905 return Boolean(_this.label_); 26906 }, 26907 shakeLabel: function shakeLabel(shouldShake) { 26908 return _this.label_ && _this.label_.shake(shouldShake); 26909 }, 26910 setLabelRequired: function setLabelRequired(isRequired) { 26911 return _this.label_ && _this.label_.setRequired(isRequired); 26912 } 26913 }; 26914 }; 26915 MDCTextField.prototype.getLineRippleAdapterMethods_ = function () { 26916 var _this = this; 26917 return { 26918 activateLineRipple: function activateLineRipple() { 26919 if (_this.lineRipple_) { 26920 _this.lineRipple_.activate(); 26921 } 26922 }, 26923 deactivateLineRipple: function deactivateLineRipple() { 26924 if (_this.lineRipple_) { 26925 _this.lineRipple_.deactivate(); 26926 } 26927 }, 26928 setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) { 26929 if (_this.lineRipple_) { 26930 _this.lineRipple_.setRippleCenter(normalizedX); 26931 } 26932 } 26933 }; 26934 }; 26935 MDCTextField.prototype.getOutlineAdapterMethods_ = function () { 26936 var _this = this; 26937 return { 26938 closeOutline: function closeOutline() { 26939 return _this.outline_ && _this.outline_.closeNotch(); 26940 }, 26941 hasOutline: function hasOutline() { 26942 return Boolean(_this.outline_); 26943 }, 26944 notchOutline: function notchOutline(labelWidth) { 26945 return _this.outline_ && _this.outline_.notch(labelWidth); 26946 } 26947 }; 26948 }; 26949 /** 26950 * @return A map of all subcomponents to subfoundations. 26951 */ 26952 MDCTextField.prototype.getFoundationMap_ = function () { 26953 return { 26954 characterCounter: this.characterCounter_ ? this.characterCounter_.foundationForTextField : undefined, 26955 helperText: this.helperText_ ? this.helperText_.foundationForTextField : undefined, 26956 leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundationForTextField : undefined, 26957 trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundationForTextField : undefined 26958 }; 26959 }; 26960 MDCTextField.prototype.createRipple_ = function (rippleFactory) { 26961 var _this = this; 26962 var isTextArea = this.root.classList.contains(constants_1.cssClasse
26962s.TEXTAREA); 26963 var isOutlined = this.root.classList.contains(constants_1.cssClasses.OUTLINED); 26964 if (isTextArea || isOutlined) { 26965 return null; 26966 } 26967 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 26968 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 26969 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 26970 var adapter = __assign(__assign({}, component_5.MDCRipple.createAdapter(this)), { isSurfaceActive: function isSurfaceActive() { 26971 return ponyfill.matches(_this.input_, ':active'); 26972 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 26973 return _this.input_.addEventListener(evtType, handler, events_1.applyPassive()); 26974 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 26975 return _this.input_
vendor: 3,006 bytes, lines 26975-27044
26975.removeEventListener(evtType, handler, events_1.applyPassive()); 26976 } }); 26977 // tslint:enable:object-literal-sort-keys 26978 return rippleFactory(this.root, new foundation_1.MDCRippleFoundation(adapter)); 26979 }; 26980 return MDCTextField; 26981}(component_1.MDCComponent); 26982exports.MDCTextField = MDCTextField; 26983 26984/***/ }), 26985 26986/***/ "./packages/mdc-textfield/constants.ts": 26987/*!*********************************************!*\ 26988 !*** ./packages/mdc-textfield/constants.ts ***! 26989 \*********************************************/ 26990/*! no static exports found */ 26991/***/ (function(module, exports, __webpack_require__) { 26992 26993"use strict"; 26994 26995/** 26996 * @license 26997 * Copyright 2016 Google Inc. 26998 * 26999 * Permission is hereby granted, free of charge, to any person obtaining a copy 27000 * of this software and associated documentation files (the "Software"), to deal 27001 * in the Software without restriction, including without limitation the rights 27002 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27003 * copies of the Software, and to permit persons to whom the Software is 27004 * furnished to do so, subject to the following conditions: 27005 * 27006 * The above copyright notice and this permission notice shall be included in 27007 * all copies or substantial portions of the Software. 27008 * 27009 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27010 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27011 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27012 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27013 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27014 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27015 * THE SOFTWARE. 27016 */ 27017 27018Object.defineProperty(exports, "__esModule", { value: true }); 27019exports.ALWAYS_FLOAT_TYPES = exports.VALIDATION_ATTR_WHITELIST = exports.numbers = exports.strings = exports.cssClasses = void 0; 27020var strings = { 27021 ARIA_CONTROLS: 'aria-controls', 27022 ARIA_DESCRIBEDBY: 'aria-describedby', 27023 INPUT_SELECTOR: '.mdc-text-field__input', 27024 LABEL_SELECTOR: '.mdc-floating-label', 27025 LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading', 27026 LINE_RIPPLE_SELECTOR: '.mdc-line-ripple', 27027 OUTLINE_SELECTOR: '.mdc-notched-outline', 27028 PREFIX_SELECTOR: '.mdc-text-field__affix--prefix', 27029 SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix', 27030 TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing' 27031}; 27032exports.strings = strings; 27033var cssClasses = { 27034 DISABLED: 'mdc-text-field--disabled', 27035 FOCUSED: 'mdc-text-field--focused', 27036 HELPER_LINE: 'mdc-text-field-helper-line', 27037 INVALID: 'mdc-text-field--invalid', 27038 LABEL_FLOATING: 'mdc-text-field--label-floating', 27039 NO_LABEL: 'mdc-text-field--no-label', 27040 OUTLINED: 'mdc-text-field--outlined', 27041 ROOT: 'mdc-text-field', 27042 TEXTAREA: 'mdc-text-field--textarea', 27043 WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon', 27044 WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon'
27044 27045}; 27046exports.cssClasses = cssClasses; 27047var numbers = { 27048 LABEL_SCALE: 0.75 27049}; 27050exports.numbers = numbers; 27051/** 27052 * Whitelist based off of https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation 27053 * under the "Validation-related attributes" section. 27054 */ 27055var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength']; 27056exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST; 27057/** 27058 * Label should always float for these types as they show some UI even if value is empty. 27059 */ 27060var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week']; 27061exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES; 27062 27063/***/ }), 27064
vendor: 22,546 bytes, lines 27065-27625
27065/***/ "./packages/mdc-textfield/foundation.ts": 27066/*!**********************************************!*\ 27067 !*** ./packages/mdc-textfield/foundation.ts ***! 27068 \**********************************************/ 27069/*! no static exports found */ 27070/***/ (function(module, exports, __webpack_require__) { 27071 27072"use strict"; 27073 27074/** 27075 * @license 27076 * Copyright 2016 Google Inc. 27077 * 27078 * Permission is hereby granted, free of charge, to any person obtaining a copy 27079 * of this software and associated documentation files (the "Software"), to deal 27080 * in the Software without restriction, including without limitation the rights 27081 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27082 * copies of the Software, and to permit persons to whom the Software is 27083 * furnished to do so, subject to the following conditions: 27084 * 27085 * The above copyright notice and this permission notice shall be included in 27086 * all copies or substantial portions of the Software. 27087 * 27088 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27089 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27090 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27091 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27092 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27093 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27094 * THE SOFTWARE. 27095 */ 27096 27097var __extends = this && this.__extends || function () { 27098 var _extendStatics = function extendStatics(d, b) { 27099 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 27100 d.__proto__ = b; 27101 } || function (d, b) { 27102 for (var p in b) { 27103 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 27104 } 27105 }; 27106 return _extendStatics(d, b); 27107 }; 27108 return function (d, b) { 27109 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 27110 _extendStatics(d, b); 27111 function __() { 27112 this.constructor = d; 27113 } 27114 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 27115 }; 27116}(); 27117var __assign = this && this.__assign || function () { 27118 __assign = Object.assign || function (t) { 27119 for (var s, i = 1, n = arguments.length; i < n; i++) { 27120 s = arguments[i]; 27121 for (var p in s) { 27122 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 27123 } 27124 } 27125 return t; 27126 }; 27127 return __assign.apply(this, arguments); 27128}; 27129Object.defineProperty(exports, "__esModule", { value: true }); 27130exports.MDCTextFieldFoundation = void 0; 27131var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 27132var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"); 27133var POINTERDOWN_EVENTS = ['mousedown', 'touchstart']; 27134var INTERACTION_EVENTS = ['click', 'keydown']; 27135var MDCTextFieldFoundation = /** @class */function (_super) { 27136 __extends(MDCTextFieldFoundation, _super); 27137 /** 27138 * @param adapter 27139 * @param foundationMap Map from subcomponent names to their subfoundations. 27140 */ 27141 function MDCTextFieldFoundation(adapter, foundationMap) { 27142 if (foundationMap === void 0) { 27143 foundationMap = {}; 27144 } 27145 var _this = _super.call(this, __assign(__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this; 27146 _this.isFocused_ = false; 27147 _this.receivedUserInput_ = false; 27148 _this.isValid_ = true; 27149 _this.useNativeValidation_ = true; 27150 _this.validateOnValueChange_ = true; 27151 _this.helperText_ = foundationMap.helperText; 27152 _this.characterCounter_ = foundationMap.characterCounter; 27153 _this.leadingIcon_ = foundationMap.leadingIcon; 27154 _this.trailingIcon_ = foundationMap.trailingIcon; 27155 _this.inputFocusHandler_ = function () { 27156 return _this.activateFocus(); 27157 }; 27158 _this.inputBlurHandler_ = function () { 27159 return _this.deactivateFocus(); 27160 }; 27161 _this.inputInputHandler_ = function () { 27162 return _this.handleInput(); 27163 }; 27164 _this.setPointerXOffset_ = function (evt) { 27165 return _this.setTransformOrigin(evt); 27166 }; 27167 _this.textFieldInteractionHandler_ = function () { 27168 return _this.handleTextFieldInteraction(); 27169 }; 27170 _this.validationAttributeChangeHandler_ = function (attributesList) { 27171 return _this.handleValidationAttributeChange(attributesList); 27172 }; 27173 return _this; 27174 } 27175 Object.defineProperty(MDCTextFieldFoundation, "cssClasses", { 27176 get: function get() { 27177 return constants_1.cssClasses; 27178 }, 27179 enumerable: false, 27180 configurable: true 27181 }); 27182 Object.defineProperty(MDCTextFieldFoundation, "strings", { 27183 get: function get() { 27184 return constants_1.strings; 27185 }, 27186 enumerable: false, 27187 configurable: true 27188 }); 27189 Object.defineProperty(MDCTextFieldFoundation, "numbers", { 27190 get: function get() { 27191 return constants_1.numbers; 27192 }, 27193 enumerable: false, 27194 configurable: true 27195 }); 27196 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat_", { 27197 get: function get() { 27198 var type = this.getNativeInput_().type; 27199 return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0; 27200 }, 27201 enumerable: false, 27202 configurable: true 27203 }); 27204 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", { 27205 get: function get() { 27206 return this.shouldAlwaysFloat_ || this.isFocused_ || !!this.getValue() || this.isBadInput_(); 27207 }, 27208 enumerable: false, 27209 configurable: true 27210 }); 27211 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", { 27212 get: function get() { 27213 return !this.isFocused_ && !this.isValid() && !!this.getValue(); 27214 }, 27215 enumerable: false, 27216 configurable: true 27217 }); 27218 Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", { 27219 /** 27220 * See {@link MDCTextFieldAdapter} for typing information on parameters and 27221 * return types. 27222 */ 27223 get: function get() { 27224 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 27225 return { 27226 addClass: function addClass() { 27227 return undefined; 27228 }, 27229 removeClass: function removeClass() { 27230 return undefined; 27231 }, 27232 hasClass: function hasClass() { 27233 return true; 27234 }, 27235 setInputAttr: function setInputAttr() { 27236 return undefined; 27237 }, 27238 removeInputAttr: function removeInputAttr() { 27239 return undefined; 27240 }, 27241 registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() { 27242 return undefined; 27243 }, 27244 deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() { 27245 return undefined; 27246 }, 27247 registerInputInteractionHandler: function registerInputInteractionHandler() { 27248 return undefined; 27249 }, 27250 deregisterInputInteractionHandler: function deregisterInputInteractionHandler() { 27251 return undefined; 27252 }, 27253 registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() { 27254 return new MutationObserver(function () { 27255 return undefined; 27256 }); 27257 }, 27258 deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() { 27259 return undefined; 27260 }, 27261 getNativeInput: function getNativeInput() { 27262 return null; 27263 }, 27264 isFocused: function isFocused() { 27265 return false; 27266 }, 27267 activateLineRipple: function activateLineRipple() { 27268 return undefined; 27269 }, 27270 deactivateLineRipple: function deactivateLineRipple() { 27271 return undefined; 27272 }, 27273 setLineRippleTransformOrigin: function setLineRippleTransformOrigin() { 27274 return undefined; 27275 }, 27276 shakeLabel: function shakeLabel() { 27277 return undefined; 27278 }, 27279 floatLabel: function floatLabel() { 27280 return undefined; 27281 }, 27282 setLabelRequired: function setLabelRequired() { 27283 return undefined; 27284 }, 27285 hasLabel: function hasLabel() { 27286 return false; 27287 }, 27288 getLabelWidth: function getLabelWidth() { 27289 return 0; 27290 }, 27291 hasOutline: function hasOutline() { 27292 return false; 27293 }, 27294 notchOutline: function notchOutline() { 27295 return undefined; 27296 }, 27297 closeOutline: function closeOutline() { 27298 return undefined; 27299 } 27300 }; 27301 // tslint:enable:object-literal-sort-keys 27302 }, 27303 enumerable: false, 27304 configurable: true 27305 }); 27306 MDCTextFieldFoundation.prototype.init = function () { 27307 var _this = this; 27308 if (this.adapter.hasLabel() && this.getNativeInput_().required) { 27309 this.adapter.setLabelRequired(true); 27310 } 27311 if (this.adapter.isFocused()) { 27312 this.inputFocusHandler_(); 27313 } else if (this.adapter.hasLabel() && this.shouldFloat) { 27314 this.notchOutline(true); 27315 this.adapter.floatLabel(true); 27316 this.styleFloating_(true); 27317 } 27318 this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler_); 27319 this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler_); 27320 this.adapter.registerInputInteractionHandler('input', this.inputInputHandler_); 27321 POINTERDOWN_EVENTS.forEach(function (evtType) { 27322 _this.adapter.registerInputInteractionHandler(evtType, _this.setPointerXOffset_); 27323 }); 27324 INTERACTION_EVENTS.forEach(function (evtType) { 27325 _this.adapter.registerTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_); 27326 }); 27327 this.validationObserver_ = this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_); 27328 this.setCharacterCounter_(this.getValue().length); 27329 }; 27330 MDCTextFieldFoundation.prototype.destroy = function () { 27331 var _this = this; 27332 this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler_); 27333 this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler_); 27334 this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler_); 27335 POINTERDOWN_EVENTS.forEach(function (evtType) { 27336 _this.adapter.deregisterInputInteractionHandler(evtType, _this.setPointerXOffset_); 27337 }); 27338 INTERACTION_EVENTS.forEach(function (evtType) { 27339 _this.adapter.deregisterTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_); 27340 }); 27341 this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver_); 27342 }; 27343 /** 27344 * Handles user interactions with the Text Field. 27345 */ 27346 MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () { 27347 var nativeInput = this.adapter.getNativeInput(); 27348 if (nativeInput && nativeInput.disabled) { 27349 return; 27350 } 27351 this.receivedUserInput_ = true; 27352 }; 27353 /** 27354 * Handles validation attribute changes 27355 */ 27356 MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) { 27357 var _this = this; 27358 attributesList.some(function (attributeName) { 27359 if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) { 27360 _this.styleValidity_(true); 27361 _this.adapter.setLabelRequired(_this.getNativeInput_().required); 27362 return true; 27363 } 27364 return false; 27365 }); 27366 if (attributesList.indexOf('maxlength') > -1) { 27367 this.setCharacterCounter_(this.getValue().length); 27368 } 27369 }; 27370 /** 27371 * Opens/closes the notched outline. 27372 */ 27373 MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) { 27374 if (!this.adapter.hasOutline() || !this.adapter.hasLabel()) { 27375 return; 27376 } 27377 if (openNotch) { 27378 var labelWidth = this.adapter.getLabelWidth() * constants_1.numbers.LABEL_SCALE; 27379 this.adapter.notchOutline(labelWidth); 27380 } else { 27381 this.adapter.closeOutline(); 27382 } 27383 }; 27384 /** 27385 * Activates the text field focus state. 27386 */ 27387 MDCTextFieldFoundation.prototype.activateFocus = function () { 27388 this.isFocused_ = true; 27389 this.styleFocused_(this.isFocused_); 27390 this.adapter.activateLineRipple(); 27391 if (this.adapter.hasLabel()) { 27392 this.notchOutline(this.shouldFloat); 27393 this.adapter.floatLabel(this.shouldFloat); 27394 this.styleFloating_(this.shouldFloat); 27395 this.adapter.shakeLabel(this.shouldShake); 27396 } 27397 if (this.helperText_ && (this.helperText_.isPersistent() || !this.helperText_.isValidation() || !this.isValid_)) { 27398 this.helperText_.showToScreenReader(); 27399 } 27400 }; 27401 /** 27402 * Sets the line ripple's transform origin, so that the line ripple activate 27403 * animation will animate out from the user's click location. 27404 */ 27405 MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) { 27406 if (this.isDisabled() || this.adapter.hasOutline()) { 27407 return; 27408 } 27409 var touches = evt.touches; 27410 var targetEvent = touches ? touches[0] : evt; 27411 var targetClientRect = targetEvent.target.getBoundingClientRect(); 27412 var normalizedX = targetEvent.clientX - targetClientRect.left; 27413 this.adapter.setLineRippleTransformOrigin(normalizedX); 27414 }; 27415 /** 27416 * Handles input change of text input and text area. 27417 */ 27418 MDCTextFieldFoundation.prototype.handleInput = function () { 27419 this.autoCompleteFocus(); 27420 this.setCharacterCounter_(this.getValue().length); 27421 }; 27422 /** 27423 * Activates the Text Field's focus state in cases when the input value 27424 * changes without user input (e.g. programmatically). 27425 */ 27426 MDCTextFieldFoundation.prototype.autoCompleteFocus = function () { 27427 if (!this.receivedUserInput_) { 27428 this.activateFocus(); 27429 } 27430 }; 27431 /** 27432 * Deactivates the Text Field's focus state. 27433 */ 27434 MDCTextFieldFoundation.prototype.deactivateFocus = function () { 27435 this.isFocused_ = false; 27436 this.adapter.deactivateLineRipple(); 27437 var isValid = this.isValid(); 27438 this.styleValidity_(isValid); 27439 this.styleFocused_(this.isFocused_); 27440 if (this.adapter.hasLabel()) { 27441 this.notchOutline(this.shouldFloat); 27442 this.adapter.floatLabel(this.shouldFloat); 27443 this.styleFloating_(this.shouldFloat); 27444 this.adapter.shakeLabel(this.shouldShake); 27445 } 27446 if (!this.shouldFloat) { 27447 this.receivedUserInput_ = false; 27448 } 27449 }; 27450 MDCTextFieldFoundation.prototype.getValue = function () { 27451 return this.getNativeInput_().value; 27452 }; 27453 /** 27454 * @param value The value to set on the input Element. 27455 */ 27456 MDCTextFieldFoundation.prototype.setValue = function (value) { 27457 // Prevent Safari from moving the caret to the end of the input when the 27458 // value has not changed. 27459 if (this.getValue() !== value) { 27460 this.getNativeInput_().value = value; 27461 } 27462 this.setCharacterCounter_(value.length); 27463 if (this.validateOnValueChange_) { 27464 var isValid = this.isValid(); 27465 this.styleValidity_(isValid); 27466 } 27467 if (this.adapter.hasLabel()) { 27468 this.notchOutline(this.shouldFloat); 27469 this.adapter.floatLabel(this.shouldFloat); 27470 this.styleFloating_(this.shouldFloat); 27471 if (this.validateOnValueChange_) { 27472 this.adapter.shakeLabel(this.shouldShake); 27473 } 27474 } 27475 }; 27476 /** 27477 * @return The custom validity state, if set; otherwise, the result of a 27478 * native validity check. 27479 */ 27480 MDCTextFieldFoundation.prototype.isValid = function () { 27481 return this.useNativeValidation_ ? this.isNativeInputValid_() : this.isValid_; 27482 }; 27483 /** 27484 * @param isValid Sets the custom validity state of the Text Field. 27485 */ 27486 MDCTextFieldFoundation.prototype.setValid = function (isValid) { 27487 this.isValid_ = isValid; 27488 this.styleValidity_(isValid); 27489 var shouldShake = !isValid && !this.isFocused_ && !!this.getValue(); 27490 if (this.adapter.hasLabel()) { 27491 this.adapter.shakeLabel(shouldShake); 27492 } 27493 }; 27494 /** 27495 * @param shouldValidate Whether or not validity should be updated on 27496 * value change. 27497 */ 27498 MDCTextFieldFoundation.prototype.setValidateOnValueChange = function (shouldValidate) { 27499 this.validateOnValueChange_ = shouldValidate; 27500 }; 27501 /** 27502 * @return Whether or not validity should be updated on value change. `true` 27503 * by default. 27504 */ 27505 MDCTextFieldFoundation.prototype.getValidateOnValueChange = function () { 27506 return this.validateOnValueChange_; 27507 }; 27508 /** 27509 * Enables or disables the use of native validation. Use this for custom 27510 * validation. 27511 * @param useNativeValidation Set this to false to ignore native input 27512 * validation. 27513 */ 27514 MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) { 27515 this.useNativeValidation_ = useNativeValidation; 27516 }; 27517 MDCTextFieldFoundation.prototype.isDisabled = function () { 27518 return this.getNativeInput_().disabled; 27519 }; 27520 /** 27521 * @param disabled Sets the text-field disabled or enabled. 27522 */ 27523 MDCTextFieldFoundation.prototype.setDisabled = function (disabled) { 27524 this.getNativeInput_().disabled = disabled; 27525 this.styleDisabled_(disabled); 27526 }; 27527 /** 27528 * @param content Sets the content of the helper text. 27529 */ 27530 MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) { 27531 if (this.helperText_) { 27532 this.helperText_.setContent(content); 27533 } 27534 }; 27535 /** 27536 * Sets the aria label of the leading icon. 27537 */ 27538 MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) { 27539 if (this.leadingIcon_) { 27540 this.leadingIcon_.setAriaLabel(label); 27541 } 27542 }; 27543 /** 27544 * Sets the text content of the leading icon. 27545 */ 27546 MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) { 27547 if (this.leadingIcon_) { 27548 this.leadingIcon_.setContent(content); 27549 } 27550 }; 27551 /** 27552 * Sets the aria label of the trailing icon. 27553 */ 27554 MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) { 27555 if (this.trailingIcon_) { 27556 this.trailingIcon_.setAriaLabel(label); 27557 } 27558 }; 27559 /** 27560 * Sets the text content of the trailing icon. 27561 */ 27562 MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) { 27563 if (this.trailingIcon_) { 27564 this.trailingIcon_.setContent(content); 27565 } 27566 }; 27567 /** 27568 * Sets character counter values that shows characters used and the total 27569 * character limit. 27570 */ 27571 MDCTextFieldFoundation.prototype.setCharacterCounter_ = function (currentLength) { 27572 if (!this.characterCounter_) { 27573 return; 27574 } 27575 var maxLength = this.getNativeInput_().maxLength; 27576 if (maxLength === -1) { 27577 throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.'); 27578 } 27579 this.characterCounter_.setCounterValue(currentLength, maxLength); 27580 }; 27581 /** 27582 * @return True if the Text Field input fails in converting the user-supplied 27583 * value. 27584 */ 27585 MDCTextFieldFoundation.prototype.isBadInput_ = function () { 27586 // The badInput property is not supported in IE 11 💩. 27587 return this.getNativeInput_().validity.badInput || false; 27588 }; 27589 /** 27590 * @return The result of native validity checking (ValidityState.valid). 27591 */ 27592 MDCTextFieldFoundation.prototype.isNativeInputValid_ = function () { 27593 return this.getNativeInput_().validity.valid; 27594 }; 27595 /** 27596 * Styles the component based on the validity state. 27597 */ 27598 MDCTextFieldFoundation.prototype.styleValidity_ = function (isValid) { 27599 var INVALID = MDCTextFieldFoundation.cssClasses.INVALID; 27600 if (isValid) { 27601 this.adapter.removeClass(INVALID); 27602 } else { 27603 this.adapter.addClass(INVALID); 27604 } 27605 if (this.helperText_) { 27606 this.helperText_.setValidity(isValid); 27607 // We dynamically set or unset aria-describedby for validation helper text 27608 // only, based on whether the field is valid 27609 var helperTextValidation = this.helperText_.isValidation(); 27610 if (!helperTextValidation) { 27611 return; 27612 } 27613 var helperTextVisible = this.helperText_.isVisible(); 27614 var helperTextId = this.helperText_.getId(); 27615 if (helperTextVisible && helperTextId) { 27616 this.adapter.setInputAttr(constants_1.strings.ARIA_DESCRIBEDBY, helperTextId); 27617 } else { 27618 this.adapter.removeInputAttr(constants_1.strings.ARIA_DESCRIBEDBY); 27619 } 27620 } 27621 }; 27622 /** 27623 * Styles the component based on the focused state. 27624 */ 27625 MDCTextFieldFoundation.prototype.styleFocused_ = function (isFocused) {
27626 var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED; 27627 if (isFocused) { 27628 this.adapter.addClass(FOCUSED); 27629 } else { 27630 this.adapter.removeClass(FOCUSED); 27631 } 27632 }; 27633 /** 27634 * Styles the component based on the disabled state. 27635 */ 27636 MDCTextFieldFoundation.prototype.styleDisabled_ = function (isDisabled) { 27637 var _a = MDCTextFieldFoundation.cssClasses, 27638 DISABLED = _a.DISABLED, 27639 INVALID = _a.INVALID; 27640 if (isDisabled) { 27641 this.adapter.addClass(DISABLED); 27642 this.adapter.removeClass(INVALID); 27643 } else { 27644 this.adapter.removeClass(DISABLED); 27645 } 27646 if (this.leadingIcon_) { 27647 this.leadingIcon_.setDisabled(isDisabled); 27648 } 27649 if (this.trailingIcon_) { 27650 this.trailingIcon_.setDisabled(isDisabled); 27651 } 27652 }; 27653 /** 27654 * Styles the component based on the label floating state. 27655 */ 27656 MDCTextFieldFoundation.prototype.styleFloating_ = function (isFloating) { 27657 var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING; 27658 if (isFloating) { 27659 this.adapter.addClass(LABEL_FLOATING); 27660 } else { 27661 this.adapter.removeClass(LABEL_FLOATING); 27662 } 27663 }; 27664 /** 27665 * @return The native text input element from the host environment, or an 27666 * object with the same shape for unit tests. 27667 */ 27668 MDCTextFieldFoundation.prototype.getNativeInput_
vendor: 17,059 bytes, lines 27668-28066
27668 = function () { 27669 // this.adapter may be undefined in foundation unit tests. This happens when 27670 // testdouble is creating a mock object and invokes the 27671 // shouldShake/shouldFloat getters (which in turn call getValue(), which 27672 // calls this method) before init() has been called from the MDCTextField 27673 // constructor. To work around that issue, we return a dummy object. 27674 var nativeInput = this.adapter ? this.adapter.getNativeInput() : null; 27675 return nativeInput || { 27676 disabled: false, 27677 maxLength: -1, 27678 required: false, 27679 type: 'input', 27680 validity: { 27681 badInput: false, 27682 valid: true 27683 }, 27684 value: '' 27685 }; 27686 }; 27687 return MDCTextFieldFoundation; 27688}(foundation_1.MDCFoundation); 27689exports.MDCTextFieldFoundation = MDCTextFieldFoundation; 27690// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 27691exports.default = MDCTextFieldFoundation; 27692 27693/***/ }), 27694 27695/***/ "./packages/mdc-textfield/helper-text/adapter.ts": 27696/*!*******************************************************!*\ 27697 !*** ./packages/mdc-textfield/helper-text/adapter.ts ***! 27698 \*******************************************************/ 27699/*! no static exports found */ 27700/***/ (function(module, exports, __webpack_require__) { 27701 27702"use strict"; 27703 27704/** 27705 * @license 27706 * Copyright 2017 Google Inc. 27707 * 27708 * Permission is hereby granted, free of charge, to any person obtaining a copy 27709 * of this software and associated documentation files (the "Software"), to deal 27710 * in the Software without restriction, including without limitation the rights 27711 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27712 * copies of the Software, and to permit persons to whom the Software is 27713 * furnished to do so, subject to the following conditions: 27714 * 27715 * The above copyright notice and this permission notice shall be included in 27716 * all copies or substantial portions of the Software. 27717 * 27718 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27719 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27720 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27721 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27722 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27723 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27724 * THE SOFTWARE. 27725 */ 27726 27727Object.defineProperty(exports, "__esModule", { value: true }); 27728 27729/***/ }), 27730 27731/***/ "./packages/mdc-textfield/helper-text/component.ts": 27732/*!*********************************************************!*\ 27733 !*** ./packages/mdc-textfield/helper-text/component.ts ***! 27734 \*********************************************************/ 27735/*! no static exports found */ 27736/***/ (function(module, exports, __webpack_require__) { 27737 27738"use strict"; 27739 27740/** 27741 * @license 27742 * Copyright 2017 Google Inc. 27743 * 27744 * Permission is hereby granted, free of charge, to any person obtaining a copy 27745 * of this software and associated documentation files (the "Software"), to deal 27746 * in the Software without restriction, including without limitation the rights 27747 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27748 * copies of the Software, and to permit persons to whom the Software is 27749 * furnished to do so, subject to the following conditions: 27750 * 27751 * The above copyright notice and this permission notice shall be included in 27752 * all copies or substantial portions of the Software. 27753 * 27754 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27755 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27756 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27757 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27758 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27759 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27760 * THE SOFTWARE. 27761 */ 27762 27763var __extends = this && this.__extends || function () { 27764 var _extendStatics = function extendStatics(d, b) { 27765 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 27766 d.__proto__ = b; 27767 } || function (d, b) { 27768 for (var p in b) { 27769 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 27770 } 27771 }; 27772 return _extendStatics(d, b); 27773 }; 27774 return function (d, b) { 27775 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 27776 _extendStatics(d, b); 27777 function __() { 27778 this.constructor = d; 27779 } 27780 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 27781 }; 27782}(); 27783Object.defineProperty(exports, "__esModule", { value: true }); 27784exports.MDCTextFieldHelperText = void 0; 27785var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 27786var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"); 27787var MDCTextFieldHelperText = /** @class */function (_super) { 27788 __extends(MDCTextFieldHelperText, _super); 27789 function MDCTextFieldHelperText() { 27790 return _super !== null && _super.apply(this, arguments) || this; 27791 } 27792 MDCTextFieldHelperText.attachTo = function (root) { 27793 return new MDCTextFieldHelperText(root); 27794 }; 27795 Object.defineProperty(MDCTextFieldHelperText.prototype, "foundationForTextField", { 27796 // Provided for access by MDCTextField component 27797 get: function get() { 27798 return this.foundation; 27799 }, 27800 enumerable: false, 27801 configurable: true 27802 }); 27803 MDCTextFieldHelperText.prototype.getDefaultFoundation = function () { 27804 var _this = this; 27805 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 27806 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 27807 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 27808 var adapter = { 27809 addClass: function addClass(className) { 27810 return _this.root.classList.add(className); 27811 }, 27812 removeClass: function removeClass(className) { 27813 return _this.root.classList.remove(className); 27814 }, 27815 hasClass: function hasClass(className) { 27816 return _this.root.classList.contains(className); 27817 }, 27818 getAttr: function getAttr(attr) { 27819 return _this.root.getAttribute(attr); 27820 }, 27821 setAttr: function setAttr(attr, value) { 27822 return _this.root.setAttribute(attr, value); 27823 }, 27824 removeAttr: function removeAttr(attr) { 27825 return _this.root.removeAttribute(attr); 27826 }, 27827 setContent: function setContent(content) { 27828 _this.root.textContent = content; 27829 } 27830 }; 27831 // tslint:enable:object-literal-sort-keys 27832 return new foundation_1.MDCTextFieldHelperTextFoundation(adapter); 27833 }; 27834 return MDCTextFieldHelperText; 27835}(component_1.MDCComponent); 27836exports.MDCTextFieldHelperText = MDCTextFieldHelperText; 27837 27838/***/ }), 27839 27840/***/ "./packages/mdc-textfield/helper-text/constants.ts": 27841/*!*********************************************************!*\ 27842 !*** ./packages/mdc-textfield/helper-text/constants.ts ***! 27843 \*********************************************************/ 27844/*! no static exports found */ 27845/***/ (function(module, exports, __webpack_require__) { 27846 27847"use strict"; 27848 27849/** 27850 * @license 27851 * Copyright 2016 Google Inc. 27852 * 27853 * Permission is hereby granted, free of charge, to any person obtaining a copy 27854 * of this software and associated documentation files (the "Software"), to deal 27855 * in the Software without restriction, including without limitation the rights 27856 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27857 * copies of the Software, and to permit persons to whom the Software is 27858 * furnished to do so, subject to the following conditions: 27859 * 27860 * The above copyright notice and this permission notice shall be included in 27861 * all copies or substantial portions of the Software. 27862 * 27863 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27864 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27865 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27866 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27867 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27868 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27869 * THE SOFTWARE. 27870 */ 27871 27872Object.defineProperty(exports, "__esModule", { value: true }); 27873exports.cssClasses = exports.strings = void 0; 27874var cssClasses = { 27875 HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent', 27876 HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg', 27877 ROOT: 'mdc-text-field-helper-text' 27878}; 27879exports.cssClasses = cssClasses; 27880var strings = { 27881 ARIA_HIDDEN: 'aria-hidden', 27882 ROLE: 'role', 27883 ROOT_SELECTOR: "." + cssClasses.ROOT 27884}; 27885exports.strings = strings; 27886 27887/***/ }), 27888 27889/***/ "./packages/mdc-textfield/helper-text/foundation.ts": 27890/*!**********************************************************!*\ 27891 !*** ./packages/mdc-textfield/helper-text/foundation.ts ***! 27892 \**********************************************************/ 27893/*! no static exports found */ 27894/***/ (function(module, exports, __webpack_require__) { 27895 27896"use strict"; 27897 27898/** 27899 * @license 27900 * Copyright 2017 Google Inc. 27901 * 27902 * Permission is hereby granted, free of charge, to any person obtaining a copy 27903 * of this software and associated documentation files (the "Software"), to deal 27904 * in the Software without restriction, including without limitation the rights 27905 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27906 * copies of the Software, and to permit persons to whom the Software is 27907 * furnished to do so, subject to the following conditions: 27908 * 27909 * The above copyright notice and this permission notice shall be included in 27910 * all copies or substantial portions of the Software. 27911 * 27912 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27913 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27914 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27915 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27916 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27917 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27918 * THE SOFTWARE. 27919 */ 27920 27921var __extends = this && this.__extends || function () { 27922 var _extendStatics = function extendStatics(d, b) { 27923 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 27924 d.__proto__ = b; 27925 } || function (d, b) { 27926 for (var p in b) { 27927 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 27928 } 27929 }; 27930 return _extendStatics(d, b); 27931 }; 27932 return function (d, b) { 27933 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 27934 _extendStatics(d, b); 27935 function __() { 27936 this.constructor = d; 27937 } 27938 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 27939 }; 27940}(); 27941var __assign = this && this.__assign || function () { 27942 __assign = Object.assign || function (t) { 27943 for (var s, i = 1, n = arguments.length; i < n; i++) { 27944 s = arguments[i]; 27945 for (var p in s) { 27946 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 27947 } 27948 } 27949 return t; 27950 }; 27951 return __assign.apply(this, arguments); 27952}; 27953Object.defineProperty(exports, "__esModule", { value: true }); 27954exports.MDCTextFieldHelperTextFoundation = void 0; 27955var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 27956var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts"); 27957var MDCTextFieldHelperTextFoundation = /** @class */function (_super) { 27958 __extends(MDCTextFieldHelperTextFoundation, _super); 27959 function MDCTextFieldHelperTextFoundation(adapter) { 27960 return _super.call(this, __assign(__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this; 27961 } 27962 Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", { 27963 get: function get() { 27964 return constants_1.cssClasses; 27965 }, 27966 enumerable: false, 27967 configurable: true 27968 }); 27969 Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", { 27970 get: function get() { 27971 return constants_1.strings; 27972 }, 27973 enumerable: false, 27974 configurable: true 27975 }); 27976 Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", { 27977 /** 27978 * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types. 27979 */ 27980 get: function get() { 27981 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 27982 return { 27983 addClass: function addClass() { 27984 return undefined; 27985 }, 27986 removeClass: function removeClass() { 27987 return undefined; 27988 }, 27989 hasClass: function hasClass() { 27990 return false; 27991 }, 27992 getAttr: function getAttr() { 27993 return null; 27994 }, 27995 setAttr: function setAttr() { 27996 return undefined; 27997 }, 27998 removeAttr: function removeAttr() { 27999 return undefined; 28000 }, 28001 setContent: function setContent() { 28002 return undefined; 28003 } 28004 }; 28005 // tslint:enable:object-literal-sort-keys 28006 }, 28007 enumerable: false, 28008 configurable: true 28009 }); 28010 MDCTextFieldHelperTextFoundation.prototype.getId = function () { 28011 return this.adapter.getAttr('id'); 28012 }; 28013 MDCTextFieldHelperTextFoundation.prototype.isVisible = function () { 28014 return this.adapter.getAttr(constants_1.strings.ARIA_HIDDEN) !== 'true'; 28015 }; 28016 /** 28017 * Sets the content of the helper text field. 28018 */ 28019 MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) { 28020 this.adapter.setContent(content); 28021 }; 28022 MDCTextFieldHelperTextFoundation.prototype.isPersistent = function () { 28023 return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT); 28024 }; 28025 /** 28026 * @param isPersistent Sets the persistency of the helper text. 28027 */ 28028 MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) { 28029 if (isPersistent) { 28030 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT); 28031 } else { 28032 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT); 28033 } 28034 }; 28035 /** 28036 * @return whether the helper text acts as an error validation message. 28037 */ 28038 MDCTextFieldHelperTextFoundation.prototype.isValidation = function () { 28039 return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 28040 }; 28041 /** 28042 * @param isValidation True to make the helper text act as an error validation message. 28043 */ 28044 MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) { 28045 if (isValidation) { 28046 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 28047 } else { 28048 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 28049 } 28050 }; 28051 /** 28052 * Makes the helper text visible to the screen reader. 28053 */ 28054 MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () { 28055 this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN); 28056 }; 28057 /** 28058 * Sets the validity of the helper text based on the input validity. 28059 */ 28060 MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) { 28061 var helperTextIsPersistent = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT); 28062 var helperTextIsValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG); 28063 var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid; 28064 if (validationMsgNeedsDisplay) { 28065 this.showToScreenReader(); 28066
28066this.adapter.setAttr(constants_1.strings.ROLE, 'alert'); 28067 } else { 28068 this.adapter.removeAttr(constants_1.strings.ROLE); 28069 } 28070 if (!helperTextIsPersistent && !validationMsgNeedsDisplay) { 28071 this.hide_(); 28072 } 28073 }; 28074 /** 28075 * Hides the help text from screen readers. 28076 */ 28077 MDCTextFieldHelperTextFoundation.prototype.hide_ = function () { 28078 this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true'
vendor: 14,117 bytes, lines 28078-28403
28078); 28079 }; 28080 return MDCTextFieldHelperTextFoundation; 28081}(foundation_1.MDCFoundation); 28082exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation; 28083// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 28084exports.default = MDCTextFieldHelperTextFoundation; 28085 28086/***/ }), 28087 28088/***/ "./packages/mdc-textfield/helper-text/index.ts": 28089/*!*****************************************************!*\ 28090 !*** ./packages/mdc-textfield/helper-text/index.ts ***! 28091 \*****************************************************/ 28092/*! no static exports found */ 28093/***/ (function(module, exports, __webpack_require__) { 28094 28095"use strict"; 28096 28097/** 28098 * @license 28099 * Copyright 2019 Google Inc. 28100 * 28101 * Permission is hereby granted, free of charge, to any person obtaining a copy 28102 * of this software and associated documentation files (the "Software"), to deal 28103 * in the Software without restriction, including without limitation the rights 28104 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28105 * copies of the Software, and to permit persons to whom the Software is 28106 * furnished to do so, subject to the following conditions: 28107 * 28108 * The above copyright notice and this permission notice shall be included in 28109 * all copies or substantial portions of the Software. 28110 * 28111 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28112 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28113 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28114 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28115 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28116 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28117 * THE SOFTWARE. 28118 */ 28119 28120var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 28121 if (k2 === undefined) k2 = k; 28122 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 28123 return m[k]; 28124 } }); 28125} : function (o, m, k, k2) { 28126 if (k2 === undefined) k2 = k; 28127 o[k2] = m[k]; 28128}); 28129var __exportStar = this && this.__exportStar || function (m, exports) { 28130 for (var p in m) { 28131 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 28132 } 28133}; 28134Object.defineProperty(exports, "__esModule", { value: true }); 28135exports.helperTextStrings = exports.helperTextCssClasses = void 0; 28136__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/helper-text/adapter.ts"), exports); 28137__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/helper-text/component.ts"), exports); 28138__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"), exports); 28139var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts"); 28140Object.defineProperty(exports, "helperTextCssClasses", { enumerable: true, get: function get() { 28141 return constants_1.cssClasses; 28142 } }); 28143Object.defineProperty(exports, "helperTextStrings", { enumerable: true, get: function get() { 28144 return constants_1.strings; 28145 } }); 28146 28147/***/ }), 28148 28149/***/ "./packages/mdc-textfield/icon/adapter.ts": 28150/*!************************************************!*\ 28151 !*** ./packages/mdc-textfield/icon/adapter.ts ***! 28152 \************************************************/ 28153/*! no static exports found */ 28154/***/ (function(module, exports, __webpack_require__) { 28155 28156"use strict"; 28157 28158/** 28159 * @license 28160 * Copyright 2017 Google Inc. 28161 * 28162 * Permission is hereby granted, free of charge, to any person obtaining a copy 28163 * of this software and associated documentation files (the "Software"), to deal 28164 * in the Software without restriction, including without limitation the rights 28165 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28166 * copies of the Software, and to permit persons to whom the Software is 28167 * furnished to do so, subject to the following conditions: 28168 * 28169 * The above copyright notice and this permission notice shall be included in 28170 * all copies or substantial portions of the Software. 28171 * 28172 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28173 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28174 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28175 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28176 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28177 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28178 * THE SOFTWARE. 28179 */ 28180 28181Object.defineProperty(exports, "__esModule", { value: true }); 28182 28183/***/ }), 28184 28185/***/ "./packages/mdc-textfield/icon/component.ts": 28186/*!**************************************************!*\ 28187 !*** ./packages/mdc-textfield/icon/component.ts ***! 28188 \**************************************************/ 28189/*! no static exports found */ 28190/***/ (function(module, exports, __webpack_require__) { 28191 28192"use strict"; 28193 28194/** 28195 * @license 28196 * Copyright 2017 Google Inc. 28197 * 28198 * Permission is hereby granted, free of charge, to any person obtaining a copy 28199 * of this software and associated documentation files (the "Software"), to deal 28200 * in the Software without restriction, including without limitation the rights 28201 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28202 * copies of the Software, and to permit persons to whom the Software is 28203 * furnished to do so, subject to the following conditions: 28204 * 28205 * The above copyright notice and this permission notice shall be included in 28206 * all copies or substantial portions of the Software. 28207 * 28208 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28209 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28210 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28211 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28212 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28213 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28214 * THE SOFTWARE. 28215 */ 28216 28217var __extends = this && this.__extends || function () { 28218 var _extendStatics = function extendStatics(d, b) { 28219 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 28220 d.__proto__ = b; 28221 } || function (d, b) { 28222 for (var p in b) { 28223 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 28224 } 28225 }; 28226 return _extendStatics(d, b); 28227 }; 28228 return function (d, b) { 28229 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 28230 _extendStatics(d, b); 28231 function __() { 28232 this.constructor = d; 28233 } 28234 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 28235 }; 28236}(); 28237Object.defineProperty(exports, "__esModule", { value: true }); 28238exports.MDCTextFieldIcon = void 0; 28239var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 28240var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"); 28241var MDCTextFieldIcon = /** @class */function (_super) { 28242 __extends(MDCTextFieldIcon, _super); 28243 function MDCTextFieldIcon() { 28244 return _super !== null && _super.apply(this, arguments) || this; 28245 } 28246 MDCTextFieldIcon.attachTo = function (root) { 28247 return new MDCTextFieldIcon(root); 28248 }; 28249 Object.defineProperty(MDCTextFieldIcon.prototype, "foundationForTextField", { 28250 // Provided for access by MDCTextField component 28251 get: function get() { 28252 return this.foundation; 28253 }, 28254 enumerable: false, 28255 configurable: true 28256 }); 28257 MDCTextFieldIcon.prototype.getDefaultFoundation = function () { 28258 var _this = this; 28259 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 28260 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 28261 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 28262 var adapter = { 28263 getAttr: function getAttr(attr) { 28264 return _this.root.getAttribute(attr); 28265 }, 28266 setAttr: function setAttr(attr, value) { 28267 return _this.root.setAttribute(attr, value); 28268 }, 28269 removeAttr: function removeAttr(attr) { 28270 return _this.root.removeAttribute(attr); 28271 }, 28272 setContent: function setContent(content) { 28273 _this.root.textContent = content; 28274 }, 28275 registerInteractionHandler: function registerInteractionHandler(evtType, handler) { 28276 return _this.listen(evtType, handler); 28277 }, 28278 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { 28279 return _this.unlisten(evtType, handler); 28280 }, 28281 notifyIconAction: function notifyIconAction() { 28282 return _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */); 28283 } 28284 }; 28285 // tslint:enable:object-literal-sort-keys 28286 return new foundation_1.MDCTextFieldIconFoundation(adapter); 28287 }; 28288 return MDCTextFieldIcon; 28289}(component_1.MDCComponent); 28290exports.MDCTextFieldIcon = MDCTextFieldIcon; 28291 28292/***/ }), 28293 28294/***/ "./packages/mdc-textfield/icon/constants.ts": 28295/*!**************************************************!*\ 28296 !*** ./packages/mdc-textfield/icon/constants.ts ***! 28297 \**************************************************/ 28298/*! no static exports found */ 28299/***/ (function(module, exports, __webpack_require__) { 28300 28301"use strict"; 28302 28303/** 28304 * @license 28305 * Copyright 2016 Google Inc. 28306 * 28307 * Permission is hereby granted, free of charge, to any person obtaining a copy 28308 * of this software and associated documentation files (the "Software"), to deal 28309 * in the Software without restriction, including without limitation the rights 28310 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28311 * copies of the Software, and to permit persons to whom the Software is 28312 * furnished to do so, subject to the following conditions: 28313 * 28314 * The above copyright notice and this permission notice shall be included in 28315 * all copies or substantial portions of the Software. 28316 * 28317 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28318 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28319 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28320 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28321 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28322 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28323 * THE SOFTWARE. 28324 */ 28325 28326Object.defineProperty(exports, "__esModule", { value: true }); 28327exports.cssClasses = exports.strings = void 0; 28328var strings = { 28329 ICON_EVENT: 'MDCTextField:icon', 28330 ICON_ROLE: 'button' 28331}; 28332exports.strings = strings; 28333var cssClasses = { 28334 ROOT: 'mdc-text-field__icon' 28335}; 28336exports.cssClasses = cssClasses; 28337 28338/***/ }), 28339 28340/***/ "./packages/mdc-textfield/icon/foundation.ts": 28341/*!***************************************************!*\ 28342 !*** ./packages/mdc-textfield/icon/foundation.ts ***! 28343 \***************************************************/ 28344/*! no static exports found */ 28345/***/ (function(module, exports, __webpack_require__) { 28346 28347"use strict"; 28348 28349/** 28350 * @license 28351 * Copyright 2017 Google Inc. 28352 * 28353 * Permission is hereby granted, free of charge, to any person obtaining a copy 28354 * of this software and associated documentation files (the "Software"), to deal 28355 * in the Software without restriction, including without limitation the rights 28356 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28357 * copies of the Software, and to permit persons to whom the Software is 28358 * furnished to do so, subject to the following conditions: 28359 * 28360 * The above copyright notice and this permission notice shall be included in 28361 * all copies or substantial portions of the Software. 28362 * 28363 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28364 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28365 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28366 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28367 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28368 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28369 * THE SOFTWARE. 28370 */ 28371 28372var __extends = this && this.__extends || function () { 28373 var _extendStatics = function extendStatics(d, b) { 28374 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 28375 d.__proto__ = b; 28376 } || function (d, b) { 28377 for (var p in b) { 28378 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 28379 } 28380 }; 28381 return _extendStatics(d, b); 28382 }; 28383 return function (d, b) { 28384 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 28385 _extendStatics(d, b); 28386 function __() { 28387 this.constructor = d; 28388 } 28389 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 28390 }; 28391}(); 28392var __assign = this && this.__assign || function () { 28393 __assign = Object.assign || function (t) { 28394 for (var s, i = 1, n = arguments.length; i < n; i++) { 28395 s = arguments[i]; 28396 for (var p in s) { 28397 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 28398 } 28399 } 28400 return t; 28401 }; 28402 return __assign.apply(this, arguments); 28403};
vendor: 1,148 bytes, lines 28404-28427
28404Object.defineProperty(exports, "__esModule", { value: true }); 28405exports.MDCTextFieldIconFoundation = void 0; 28406var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 28407var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts"); 28408var INTERACTION_EVENTS = ['click', 'keydown']; 28409var MDCTextFieldIconFoundation = /** @class */function (_super) { 28410 __extends(MDCTextFieldIconFoundation, _super); 28411 function MDCTextFieldIconFoundation(adapter) { 28412 var _this = _super.call(this, __assign(__assign({}, MDCTextFieldIconFoundation.defaultAdapter), adapter)) || this; 28413 _this.savedTabIndex_ = null; 28414 _this.interactionHandler_ = function (evt) { 28415 return _this.handleInteraction(evt); 28416 }; 28417 return _this; 28418 } 28419 Object.defineProperty(MDCTextFieldIconFoundation, "strings", { 28420 get: function get() { 28421 return constants_1.strings; 28422 }, 28423 enumerable: false, 28424 configurable: true 28425 }); 28426 Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", { 28427 get: function get() {
28428 return constants_1.cssClasses; 28429 }, 28430 enumerable: false, 28431 configurable: true 28432 }); 28433 Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", { 28434 /** 28435 * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types. 28436 */ 28437 get: function get() { 28438 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 28439 return { 28440 getAttr: function getAttr() { 28441 return null; 28442 }, 28443 setAttr: function setAttr() { 28444 return undefined; 28445 }, 28446 removeAttr: function removeAttr() { 28447 return undefined; 28448 }, 28449 setContent: function setContent() { 28450 return undefined; 28451 }, 28452 registerInteractionHandler: function registerInteractionHandler() { 28453 return undefined; 28454 }, 28455 deregisterInteractionHandler: function deregisterInteractionHandler() { 28456 return undefined; 28457 }, 28458 notifyIconAction: function notifyIconAction() { 28459 return undefined; 28460 } 28461 }; 28462 // tslint:enable:object-literal-sort-keys 28463 }, 28464 enumerable: false, 28465 configurable: true 28466 }); 28467 MDCTextFieldIconFoundation.prototype.init = function () { 28468 var _this = this; 28469 this.savedTabIndex_ = this.adapter.getAttr('tabindex'); 28470 INTERACTION_EVENTS.forEach(function (evtType) { 28471 _this.adapter.registerInteractionHandler(evtType, _this.interactionHandler_); 28472 }); 28473 }; 28474 MDCTextFieldIconFoundation.prototype.destroy = function () { 28475 var _this = this; 28476 INTERACTION_EVENTS.forEach(function (evtType) { 28477 _this.adapter.deregisterInteractionHandler(evtType, _this.interactionHandler_); 28478 }); 28479 }; 28480 MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) { 28481 if (!this.savedTabIndex_) { 28482 return; 28483 } 28484 if (disabled) { 28485 this.adapter.setAttr('tabindex', '-1'); 28486 this.adapter.removeAttr('role'); 28487 } else { 28488 this.adapter.setAttr('tabindex', this.savedTabIndex_
vendor: 16,033 bytes, lines 28488-28839
28488); 28489 this.adapter.setAttr('role', constants_1.strings.ICON_ROLE); 28490 } 28491 }; 28492 MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) { 28493 this.adapter.setAttr('aria-label', label); 28494 }; 28495 MDCTextFieldIconFoundation.prototype.setContent = function (content) { 28496 this.adapter.setContent(content); 28497 }; 28498 MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) { 28499 var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13; 28500 if (evt.type === 'click' || isEnterKey) { 28501 evt.preventDefault(); // stop click from causing host label to focus 28502 // input 28503 this.adapter.notifyIconAction(); 28504 } 28505 }; 28506 return MDCTextFieldIconFoundation; 28507}(foundation_1.MDCFoundation); 28508exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation; 28509// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 28510exports.default = MDCTextFieldIconFoundation; 28511 28512/***/ }), 28513 28514/***/ "./packages/mdc-textfield/icon/index.ts": 28515/*!**********************************************!*\ 28516 !*** ./packages/mdc-textfield/icon/index.ts ***! 28517 \**********************************************/ 28518/*! no static exports found */ 28519/***/ (function(module, exports, __webpack_require__) { 28520 28521"use strict"; 28522 28523/** 28524 * @license 28525 * Copyright 2019 Google Inc. 28526 * 28527 * Permission is hereby granted, free of charge, to any person obtaining a copy 28528 * of this software and associated documentation files (the "Software"), to deal 28529 * in the Software without restriction, including without limitation the rights 28530 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28531 * copies of the Software, and to permit persons to whom the Software is 28532 * furnished to do so, subject to the following conditions: 28533 * 28534 * The above copyright notice and this permission notice shall be included in 28535 * all copies or substantial portions of the Software. 28536 * 28537 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28538 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28539 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28540 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28541 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28542 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28543 * THE SOFTWARE. 28544 */ 28545 28546var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 28547 if (k2 === undefined) k2 = k; 28548 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 28549 return m[k]; 28550 } }); 28551} : function (o, m, k, k2) { 28552 if (k2 === undefined) k2 = k; 28553 o[k2] = m[k]; 28554}); 28555var __exportStar = this && this.__exportStar || function (m, exports) { 28556 for (var p in m) { 28557 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 28558 } 28559}; 28560Object.defineProperty(exports, "__esModule", { value: true }); 28561exports.iconStrings = exports.iconCssClasses = void 0; 28562__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/icon/adapter.ts"), exports); 28563__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/icon/component.ts"), exports); 28564__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"), exports); 28565var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts"); 28566Object.defineProperty(exports, "iconCssClasses", { enumerable: true, get: function get() { 28567 return constants_1.cssClasses; 28568 } }); 28569Object.defineProperty(exports, "iconStrings", { enumerable: true, get: function get() { 28570 return constants_1.strings; 28571 } }); 28572 28573/***/ }), 28574 28575/***/ "./packages/mdc-textfield/index.ts": 28576/*!*****************************************!*\ 28577 !*** ./packages/mdc-textfield/index.ts ***! 28578 \*****************************************/ 28579/*! no static exports found */ 28580/***/ (function(module, exports, __webpack_require__) { 28581 28582"use strict"; 28583 28584/** 28585 * @license 28586 * Copyright 2019 Google Inc. 28587 * 28588 * Permission is hereby granted, free of charge, to any person obtaining a copy 28589 * of this software and associated documentation files (the "Software"), to deal 28590 * in the Software without restriction, including without limitation the rights 28591 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28592 * copies of the Software, and to permit persons to whom the Software is 28593 * furnished to do so, subject to the following conditions: 28594 * 28595 * The above copyright notice and this permission notice shall be included in 28596 * all copies or substantial portions of the Software. 28597 * 28598 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28599 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28600 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28601 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28602 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28603 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28604 * THE SOFTWARE. 28605 */ 28606 28607var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 28608 if (k2 === undefined) k2 = k; 28609 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 28610 return m[k]; 28611 } }); 28612} : function (o, m, k, k2) { 28613 if (k2 === undefined) k2 = k; 28614 o[k2] = m[k]; 28615}); 28616var __exportStar = this && this.__exportStar || function (m, exports) { 28617 for (var p in m) { 28618 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 28619 } 28620}; 28621Object.defineProperty(exports, "__esModule", { value: true }); 28622__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/adapter.ts"), exports); 28623__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/component.ts"), exports); 28624__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"), exports); 28625__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts"), exports); 28626__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-textfield/types.ts"), exports); 28627__exportStar(__webpack_require__(/*! ./character-counter/index */ "./packages/mdc-textfield/character-counter/index.ts"), exports); 28628__exportStar(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-textfield/helper-text/index.ts"), exports); 28629__exportStar(__webpack_require__(/*! ./icon/index */ "./packages/mdc-textfield/icon/index.ts"), exports); 28630 28631/***/ }), 28632 28633/***/ "./packages/mdc-textfield/types.ts": 28634/*!*****************************************!*\ 28635 !*** ./packages/mdc-textfield/types.ts ***! 28636 \*****************************************/ 28637/*! no static exports found */ 28638/***/ (function(module, exports, __webpack_require__) { 28639 28640"use strict"; 28641 28642/** 28643 * @license 28644 * Copyright 2019 Google Inc. 28645 * 28646 * Permission is hereby granted, free of charge, to any person obtaining a copy 28647 * of this software and associated documentation files (the "Software"), to deal 28648 * in the Software without restriction, including without limitation the rights 28649 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28650 * copies of the Software, and to permit persons to whom the Software is 28651 * furnished to do so, subject to the following conditions: 28652 * 28653 * The above copyright notice and this permission notice shall be included in 28654 * all copies or substantial portions of the Software. 28655 * 28656 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28657 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28658 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28659 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28660 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28661 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28662 * THE SOFTWARE. 28663 */ 28664 28665Object.defineProperty(exports, "__esModule", { value: true }); 28666 28667/***/ }), 28668 28669/***/ "./packages/mdc-tooltip/adapter.ts": 28670/*!*****************************************!*\ 28671 !*** ./packages/mdc-tooltip/adapter.ts ***! 28672 \*****************************************/ 28673/*! no static exports found */ 28674/***/ (function(module, exports, __webpack_require__) { 28675 28676"use strict"; 28677 28678/** 28679 * @license 28680 * Copyright 2020 Google Inc. 28681 * 28682 * Permission is hereby granted, free of charge, to any person obtaining a copy 28683 * of this software and associated documentation files (the "Software"), to deal 28684 * in the Software without restriction, including without limitation the rights 28685 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28686 * copies of the Software, and to permit persons to whom the Software is 28687 * furnished to do so, subject to the following conditions: 28688 * 28689 * The above copyright notice and this permission notice shall be included in 28690 * all copies or substantial portions of the Software. 28691 * 28692 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28693 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28694 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28695 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28696 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28697 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28698 * THE SOFTWARE. 28699 */ 28700 28701Object.defineProperty(exports, "__esModule", { value: true }); 28702 28703/***/ }), 28704 28705/***/ "./packages/mdc-tooltip/component.ts": 28706/*!*******************************************!*\ 28707 !*** ./packages/mdc-tooltip/component.ts ***! 28708 \*******************************************/ 28709/*! no static exports found */ 28710/***/ (function(module, exports, __webpack_require__) { 28711 28712"use strict"; 28713 28714/** 28715 * @license 28716 * Copyright 2020 Google Inc. 28717 * 28718 * Permission is hereby granted, free of charge, to any person obtaining a copy 28719 * of this software and associated documentation files (the "Software"), to deal 28720 * in the Software without restriction, including without limitation the rights 28721 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28722 * copies of the Software, and to permit persons to whom the Software is 28723 * furnished to do so, subject to the following conditions: 28724 * 28725 * The above copyright notice and this permission notice shall be included in 28726 * all copies or substantial portions of the Software. 28727 * 28728 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28729 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28730 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28731 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28732 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28733 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28734 * THE SOFTWARE. 28735 */ 28736 28737var __extends = this && this.__extends || function () { 28738 var _extendStatics = function extendStatics(d, b) { 28739 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 28740 d.__proto__ = b; 28741 } || function (d, b) { 28742 for (var p in b) { 28743 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 28744 } 28745 }; 28746 return _extendStatics(d, b); 28747 }; 28748 return function (d, b) { 28749 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 28750 _extendStatics(d, b); 28751 function __() { 28752 this.constructor = d; 28753 } 28754 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 28755 }; 28756}(); 28757Object.defineProperty(exports, "__esModule", { value: true }); 28758exports.MDCTooltip = void 0; 28759var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 28760var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tooltip/constants.ts"); 28761var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tooltip/foundation.ts"); 28762var MDCTooltip = /** @class */function (_super) { 28763 __extends(MDCTooltip, _super); 28764 function MDCTooltip() { 28765 return _super !== null && _super.apply(this, arguments) || this; 28766 } 28767 MDCTooltip.attachTo = function (root) { 28768 return new MDCTooltip(root); 28769 }; 28770 MDCTooltip.prototype.initialize = function () { 28771 var tooltipId = this.root.getAttribute('id'); 28772 if (!tooltipId) { 28773 throw new Error('MDCTooltip: Tooltip component must have an id.'); 28774 } 28775 var anchorElem = document.querySelector("[data-tooltip-id=\"" + tooltipId + "\"]") || document.querySelector("[aria-describedby=\"" + tooltipId + "\"]"); 28776 if (!anchorElem) { 28777 throw new Error('MDCTooltip: Tooltip component requires an anchor element annotated with [aria-describedby] or [data-tooltip-id].'); 28778 } 28779 this.anchorElem = anchorElem; 28780 }; 28781 MDCTooltip.prototype.initialSyncWithDOM = function () { 28782 var _this = this; 28783 this.isTooltipRich = this.foundation.isRich(); 28784 this.isTooltipPersistent = this.foundation.isPersistent(); 28785 this.handleMouseEnter = function () { 28786 _this.foundation.handleAnchorMouseEnter(); 28787 }; 28788 this.handleFocus = function (evt) { 28789 _this.foundation.handleAnchorFocus(evt); 28790 }; 28791 this.handleMouseLeave = function () { 28792 _this.foundation.handleAnchorMouseLeave(); 28793 }; 28794 this.handleTransitionEnd = function () { 28795 _this.foundation.handleTransitionEnd(); 28796 }; 28797 this.handleClick = function () { 28798 _this.foundation.handleAnchorClick(); 28799 }; 28800 this.handleTouchstart = function () { 28801 _this.foundation.handleAnchorTouchstart(); 28802 }; 28803 this.handleTouchend = function () { 28804 _this.foundation.handleAnchorTouchend(); 28805 }; 28806 if (this.isTooltipRich && this.isTooltipPersistent) { 28807 this.anchorElem.addEventListener('click', this.handleClick); 28808 } else { 28809 this.anchorElem.addEventListener('mouseenter', this.handleMouseEnter); 28810 // TODO(b/157075286): Listening for a 'focus' event is too broad. 28811 this.anchorElem.addEventListener('focus', this.handleFocus); 28812 this.anchorElem.addEventListener('mouseleave', this.handleMouseLeave); 28813 this.anchorElem.addEventListener('touchstart', this.handleTouchstart); 28814 this.anchorElem.addEventListener('touchend', this.handleTouchend); 28815 } 28816 this.listen('transitionend', this.handleTransitionEnd); 28817 }; 28818 MDCTooltip.prototype.destroy = function () { 28819 if (this.anchorElem) { 28820 if (this.isTooltipRich && this.isTooltipPersistent) { 28821 this.anchorElem.removeEventListener('click', this.handleClick); 28822 } else { 28823 this.anchorElem.removeEventListener('mouseenter', this.handleMouseEnter); 28824 this.anchorElem.removeEventListener('focus', this.handleFocus); 28825 this.anchorElem.removeEventListener('mouseleave', this.handleMouseLeave); 28826 this.anchorElem.removeEventListener('touchstart', this.handleTouchstart); 28827 this.anchorElem.removeEventListener('touchend', this.handleTouchend); 28828 } 28829 } 28830 this.unlisten('transitionend', this.handleTransitionEnd); 28831 _super.prototype.destroy.call(this); 28832 }; 28833 MDCTooltip.prototype.setTooltipPosition = function (position) { 28834 this.foundation.setTooltipPosition(position); 28835 }; 28836 MDCTooltip.prototype.setAnchorBoundaryType = function (type) { 28837 this.foundation.setAnchorBoundaryType(type); 28838 }; 28839 MDCTooltip.prototype.
28839hide = function () { 28840 this.foundation.hide(); 28841 }; 28842 MDCTooltip.prototype.isShown = function () { 28843 this.foundation.isShown(); 28844 }; 28845 /** 28846 * Method that allows user to specify additional elements that should have a 28847 * scroll event listener attached to it. This should be used in instances
vendor: 5,767 bytes, lines 28848-28960
28848 * where the anchor element is placed inside a scrollable container (that is 28849 * not the body element), and will ensure that the tooltip will stay attached 28850 * to the anchor on scroll. 28851 */ 28852 MDCTooltip.prototype.attachScrollHandler = function (addEventListenerFn) { 28853 this.foundation.attachScrollHandler(addEventListenerFn); 28854 }; 28855 /** 28856 * Must be used in conjunction with #attachScrollHandler. Removes the scroll 28857 * event handler from elements on the page. 28858 */ 28859 MDCTooltip.prototype.removeScrollHandler = function (removeEventHandlerFn) { 28860 this.foundation.removeScrollHandler(removeEventHandlerFn); 28861 }; 28862 MDCTooltip.prototype.getDefaultFoundation = function () { 28863 var _this = this; 28864 var adapter = { 28865 getAttribute: function getAttribute(attr) { 28866 return _this.root.getAttribute(attr); 28867 }, 28868 setAttribute: function setAttribute(attr, value) { 28869 _this.root.setAttribute(attr, value); 28870 }, 28871 addClass: function addClass(className) { 28872 _this.root.classList.add(className); 28873 }, 28874 hasClass: function hasClass(className) { 28875 return _this.root.classList.contains(className); 28876 }, 28877 removeClass: function removeClass(className) { 28878 _this.root.classList.remove(className); 28879 }, 28880 getComputedStyleProperty: function getComputedStyleProperty(propertyName) { 28881 return window.getComputedStyle(_this.root).getPropertyValue(propertyName); 28882 }, 28883 setStyleProperty: function setStyleProperty(propertyName, value) { 28884 _this.root.style.setProperty(propertyName, value); 28885 }, 28886 setSurfaceStyleProperty: function setSurfaceStyleProperty(propertyName, value) { 28887 var surface = _this.root.querySelector("." + constants_1.CssClasses.SURFACE); 28888 surface === null || surface === void 0 ? void 0 : surface.style.setProperty(propertyName, value); 28889 }, 28890 getViewportWidth: function getViewportWidth() { 28891 return window.innerWidth; 28892 }, 28893 getViewportHeight: function getViewportHeight() { 28894 return window.innerHeight; 28895 }, 28896 getTooltipSize: function getTooltipSize() { 28897 return { 28898 width: _this.root.offsetWidth, 28899 height: _this.root.offsetHeight 28900 }; 28901 }, 28902 getAnchorBoundingRect: function getAnchorBoundingRect() { 28903 return _this.anchorElem ? _this.anchorElem.getBoundingClientRect() : null; 28904 }, 28905 getParentBoundingRect: function getParentBoundingRect() { 28906 var _a, _b; 28907 return (_b = (_a = _this.root.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) !== null && _b !== void 0 ? _b : null; 28908 }, 28909 getAnchorAttribute: function getAnchorAttribute(attr) { 28910 return _this.anchorElem ? _this.anchorElem.getAttribute(attr) : null; 28911 }, 28912 setAnchorAttribute: function setAnchorAttribute(attr, value) { 28913 var _a; 28914 (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.setAttribute(attr, value); 28915 }, 28916 isRTL: function isRTL() { 28917 return getComputedStyle(_this.root).direction === 'rtl'; 28918 }, 28919 anchorContainsElement: function anchorContainsElement(element) { 28920 var _a; 28921 return !!((_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.contains(element)); 28922 }, 28923 tooltipContainsElement: function tooltipContainsElement(element) { 28924 return _this.root.contains(element); 28925 }, 28926 focusAnchorElement: function focusAnchorElement() { 28927 var _a; 28928 (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.focus(); 28929 }, 28930 registerEventHandler: function registerEventHandler(evt, handler) { 28931 if (_this.root instanceof HTMLElement) { 28932 _this.root.addEventListener(evt, handler); 28933 } 28934 }, 28935 deregisterEventHandler: function deregisterEventHandler(evt, handler) { 28936 if (_this.root instanceof HTMLElement) { 28937 _this.root.removeEventListener(evt, handler); 28938 } 28939 }, 28940 registerAnchorEventHandler: function registerAnchorEventHandler(evt, handler) { 28941 var _a; 28942 (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.addEventListener(evt, handler); 28943 }, 28944 deregisterAnchorEventHandler: function deregisterAnchorEventHandler(evt, handler) { 28945 var _a; 28946 (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.addEventListener(evt, handler); 28947 }, 28948 registerDocumentEventHandler: function registerDocumentEventHandler(evt, handler) { 28949 document.body.addEventListener(evt, handler); 28950 }, 28951 deregisterDocumentEventHandler: function deregisterDocumentEventHandler(evt, handler) { 28952 document.body.removeEventListener(evt, handler); 28953 }, 28954 registerWindowEventHandler: function registerWindowEventHandler(evt, handler) { 28955 window.addEventListener(evt, handler); 28956 }, 28957 deregisterWindowEventHandler: function deregisterWindowEventHandler(evt, handler) { 28958 window.removeEventListener(evt, handler); 28959 }, 28960 notifyHidden: function notifyHidden() {
28961 _this.emit(constants_1.events.HIDDEN, {}); 28962 }, 28963 getTooltipCaretSize: function getTooltipCaretSize() { 28964 var caret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_TOP); 28965 if (!caret) { 28966 return null; 28967 } 28968 return { width: caret.offsetWidth, height: caret.offsetHeight }; 28969 }, 28970 setTooltipCaretStyle: function setTooltipCaretStyle(propertyName, value) { 28971 var topCaret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_TOP); 28972 var bottomCaret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_BOTTOM); 28973 if (!topCaret || !bottomCaret) { 28974 return; 28975 } 28976 topCaret.style.setProperty(propertyName, value); 28977 bottomCaret.style.setProperty(propertyName, value); 28978 }, 28979 clearTooltipCaretStyles: function clearTooltipCaretStyles() { 28980 var topCaret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_TOP); 28981 var bottomCaret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_BOTTOM); 28982 if (!topCaret || !bottomCaret) { 28983 return; 28984 } 28985 topCaret.removeAttribute('style'); 28986 bottomCaret.removeAttribute('style'); 28987 } 28988 }; 28989 //tslint:enable:object-literal-sort-keys 28990 return new foundation_1.MDCTooltipFoundation(adapter); 28991 }; 28992 return MDCTooltip; 28993}(component_1.MDCComponent); 28994exports.MDCTooltip = MDCTooltip; 28995 28996/***/ }), 28997
28998/***/ "./packages/mdc-tooltip/constants.ts": 28999/*!*******************************************!*\ 29000 !*** ./packages/mdc-tooltip/constants.ts ***! 29001 \*******************************************/ 29002/*! no static exports found */ 29003/***/ (function(module, exports, __webpack_require__) { 29004 29005"use strict"; 29006 29007/** 29008 * @license 29009 * Copyright 2020 Google Inc. 29010 * 29011 * Permission is hereby granted, free of charge, to any person obtaining a copy 29012 * of this software and associated documentation files (the "Software"), to deal 29013 * in the Software without restriction, including without limitation the rights 29014 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 29015 * copies of the Software, and to permit persons to whom the Software is 29016 * furnished to do so, subject to the following conditions: 29017 * 29018 * The above copyright notice and this permission notice shall be included in 29019 * all copies or substantial portions of the Software. 29020 * 29021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29022 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29024 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29026 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29027 * THE SOFTWARE. 29028 */ 29029 29030Object.defineProperty(exports, "__esModule", { value: true }); 29031exports.PositionWithCaret = exports.strings = exports.YPosition = exports.AnchorBoundaryType = exports.XPosition = exports.events = exports.attributes = exports.numbers = exports.CssClasses = void 0; 29032var CssClasses; 29033(function (CssClasses) { 29034 CssClasses["RICH"] = "mdc-tooltip--rich"; 29035 CssClasses["SHOWN"] = "mdc-tooltip--shown"; 29036 CssClasses["SHOWING"] = "mdc-tooltip--showing"; 29037 CssClasses["SHOWING_TRANSITION"] = "mdc-tooltip--showing-transition"; 29038 CssClasses["HIDE"] = "mdc-tooltip--hide"; 29039 CssClasses["HIDE_TRANSITION"] = "mdc-tooltip--hide-transition"; 29040 CssClasses["MULTILINE_TOOLTIP"] = "mdc-tooltip--multiline"; 29041 CssClasses["SURFACE"] = "mdc-tooltip__surface"; 29042 CssClasses["TOOLTIP_CARET_TOP"] = "mdc-tooltip__caret-surface-top"; 29043 CssClasses["TOOLTIP_CARET_BOTTOM"] = "mdc-tooltip__caret-surface-bottom"; 29044})(CssClasses || (CssClasses = {})); 29045exports.CssClasses = CssClasses; 29046var numbers = { 29047 BOUNDED_ANCHOR_GAP: 4, 29048 UNBOUNDED_ANCHOR_GAP: 8, 29049 MIN_VIEWPORT_TOOLTIP_THRESHOLD: 8, 29050 HIDE_DELAY_MS: 600, 29051 SHOW_DELAY_MS: 500, 29052 // LINT.IfChange(tooltip-dimensions) 29053 MIN_HEIGHT: 24, 29054 MAX_WIDTH: 200, 29055 // LINT.ThenChange(_tooltip.scss:tooltip-dimensions) 29056 CARET_INDENTATION: 24 29057}; 29058exports.numbers = numbers; 29059var attributes = { 29060 ARIA_EXPANDED: 'aria-expanded', 29061 ARIA_HASPOPUP: 'aria-haspopup', 29062 PERSISTENT: 'data-mdc-tooltip-persistent', 29063 SCROLLABLE_ANCESTOR: 'tooltip-scrollable-ancestor', 29064 HAS_CARET: 'data-mdc-tooltip-has-caret' 29065}; 29066exports.attributes = attributes; 29067var events = { 29068 HIDDEN: 'MDCTooltip:hidden' 29069}; 29070exports.events = events; 29071/** Enum for possible tooltip positioning relative to its anchor element. */ 29072var XPosition; 29073(function (XPosition) { 29074 XPosition[XPosition["DETECTED"] = 0] = "DETECTED"; 29075 XPosition[XPosition["START"] = 1] = "START"; 29076 // Note: CENTER is not valid for rich tooltips. 29077 XPosition[XPosition["CENTER"] = 2] = "CENTER"; 29078 XPosition[XPosition["END"] = 3] = "END"; 29079})(XPosition || (XPosition = {})); 29080exports.XPosition = XPosition; 29081var YPosition; 29082(function (YPosition) { 29083 YPosition[YPosition["DETECTED"] = 0] = "DETECTED"; 29084 YPosition[YPosition["ABOVE"] = 1] = "ABOVE"; 29085 YPosition[YPosition["BELOW"] = 2] = "BELOW"; 29086})(YPosition || (YPosition = {})); 29087exports.YPosition = YPosition; 29088/** 29089 * Enum for possible anchor boundary types. This determines the gap between the 29090 * bottom of the anchor and the tooltip element. 29091 * Bounded anchors have an identifiable boundary (e.g. buttons). 29092 * Unbounded anchors don't have a visually declared boundary (e.g. plain text). 29093 */ 29094var AnchorBoundaryType; 29095(function (AnchorBoundaryType) { 29096 AnchorBoundaryType[AnchorBoundaryType["BOUNDED"] = 0] = "BOUNDED"; 29097 AnchorBoundaryType[AnchorBoundaryType["UNBOUNDED"] = 1] = "UNBOUNDED"; 29098})(AnchorBoundaryType || (AnchorBoundaryType = {})); 29099exports.AnchorBoundaryType = AnchorBoundaryType; 29100var strings = { 29101 LEFT: 'left', 29102 RIGHT: 'right', 29103 CENTER: 'center', 29104 TOP: 'top', 29105 BOTTOM: 'bottom' 29106}; 29107exports.strings = strings; 29108/** 29109 * Enum for possible positions of a tooltip with caret (this specifies the
29110 * positioning of the tooltip relative to the anchor -- the position of the 29111 * caret will follow that of the tooltip). This can NOT be combined with the 29112 * above X/YPosition options. Naming for the enums follows: (vertical 29113 * placement)_(horizontal placement). 29114 */ 29115var PositionWithCaret; 29116(function (PositionWithCaret) { 29117 PositionWithCaret[PositionWithCaret["DETECTED"] = 0] = "DETECTED"; 29118 PositionWithCaret[PositionWithCaret["ABOVE_START"] = 1] = "ABOVE_START"; 29119 PositionWithCaret[PositionWithCaret["ABOVE_CENTER"] = 2] = "ABOVE_CENTER"; 29120 PositionWithCaret[PositionWithCaret["ABOVE_END"] = 3] = "ABOVE_END"; 29121 PositionWithCaret[PositionWithCaret["TOP_SIDE_START"] = 4] = "TOP_SIDE_START"; 29122 PositionWithCaret[PositionWithCaret["CENTER_SIDE_START"] = 5] = "CENTER_SIDE_START"; 29123 PositionWithCaret[PositionWithCaret["BOTTOM_SIDE_START"] = 6] = "BOTTOM_SIDE_START"; 29124 PositionWithCaret[PositionWithCaret["TOP_SIDE_END"] = 7] = "TOP_SIDE_END"; 29125 PositionWithCaret[PositionWithCaret["CENTER_SIDE_END"] = 8] = "CENTER_SIDE_END"; 29126 PositionWithCaret[PositionWithCaret["BOTTOM_SIDE_END"] = 9] = "BOTTOM_SIDE_END"; 29127 PositionWithCaret[PositionWithCaret["BELOW_START"] = 10] = "BELOW_START"; 29128 PositionWithCaret[PositionWithCaret["BELOW_CENTER"] = 11] = "BELOW_CENTER"; 29129 PositionWithCaret[PositionWithCaret["BELOW_END"] = 12] = "BELOW_END"; 29130})(PositionWithCaret || (PositionWithCaret = {})); 29131exports.PositionWithCaret =
vendor: 6,000 bytes, lines 29131-29262
29131PositionWithCaret; 29132 29133/***/ }), 29134 29135/***/ "./packages/mdc-tooltip/foundation.ts": 29136/*!********************************************!*\ 29137 !*** ./packages/mdc-tooltip/foundation.ts ***! 29138 \********************************************/ 29139/*! no static exports found */ 29140/***/ (function(module, exports, __webpack_require__) { 29141 29142"use strict"; 29143 29144/** 29145 * @license 29146 * Copyright 2020 Google Inc. 29147 * 29148 * Permission is hereby granted, free of charge, to any person obtaining a copy 29149 * of this software and associated documentation files (the "Software"), to deal 29150 * in the Software without restriction, including without limitation the rights 29151 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 29152 * copies of the Software, and to permit persons to whom the Software is 29153 * furnished to do so, subject to the following conditions: 29154 * 29155 * The above copyright notice and this permission notice shall be included in 29156 * all copies or substantial portions of the Software. 29157 * 29158 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29159 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29160 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29161 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29162 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29163 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29164 * THE SOFTWARE. 29165 */ 29166 29167var __extends = this && this.__extends || function () { 29168 var _extendStatics = function extendStatics(d, b) { 29169 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 29170 d.__proto__ = b; 29171 } || function (d, b) { 29172 for (var p in b) { 29173 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 29174 } 29175 }; 29176 return _extendStatics(d, b); 29177 }; 29178 return function (d, b) { 29179 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 29180 _extendStatics(d, b); 29181 function __() { 29182 this.constructor = d; 29183 } 29184 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 29185 }; 29186}(); 29187var __assign = this && this.__assign || function () { 29188 __assign = Object.assign || function (t) { 29189 for (var s, i = 1, n = arguments.length; i < n; i++) { 29190 s = arguments[i]; 29191 for (var p in s) { 29192 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 29193 } 29194 } 29195 return t; 29196 }; 29197 return __assign.apply(this, arguments); 29198}; 29199var __values = this && this.__values || function (o) { 29200 var s = typeof Symbol === "function" && Symbol.iterator, 29201 m = s && o[s], 29202 i = 0; 29203 if (m) return m.call(o); 29204 if (o && typeof o.length === "number") return { 29205 next: function next() { 29206 if (o && i >= o.length) o = void 0; 29207 return { value: o && o[i++], done: !o }; 29208 } 29209 }; 29210 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 29211}; 29212Object.defineProperty(exports, "__esModule", { value: true }); 29213exports.MDCTooltipFoundation = void 0; 29214var animationframe_1 = __webpack_require__(/*! @material/animation/animationframe */ "./packages/mdc-animation/animationframe.ts"); 29215var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 29216var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 29217var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); 29218var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tooltip/constants.ts"); 29219var RICH = constants_1.CssClasses.RICH, 29220 SHOWN = constants_1.CssClasses.SHOWN, 29221 SHOWING = constants_1.CssClasses.SHOWING, 29222 SHOWING_TRANSITION = constants_1.CssClasses.SHOWING_TRANSITION, 29223 HIDE = constants_1.CssClasses.HIDE, 29224 HIDE_TRANSITION = constants_1.CssClasses.HIDE_TRANSITION, 29225 MULTILINE_TOOLTIP = constants_1.CssClasses.MULTILINE_TOOLTIP; 29226var AnimationKeys; 29227(function (AnimationKeys) { 29228 AnimationKeys["POLL_ANCHOR"] = "poll_anchor"; 29229})(AnimationKeys || (AnimationKeys = {})); 29230// Accessing `window` without a `typeof` check will throw on Node environments. 29231var HAS_WINDOW = typeof window !== 'undefined'; 29232var MDCTooltipFoundation = /** @class */function (_super) { 29233 __extends(MDCTooltipFoundation, _super); 29234 function MDCTooltipFoundation(adapter) { 29235 var _this = _super.call(this, __assign(__assign({}, MDCTooltipFoundation.defaultAdapter), adapter)) || this; 29236 _this.tooltipShown = false; 29237 _this.anchorGap = constants_1.numbers.BOUNDED_ANCHOR_GAP; 29238 _this.xTooltipPos = constants_1.XPosition.DETECTED; 29239 _this.yTooltipPos = constants_1.YPosition.DETECTED; 29240 _this.tooltipPositionWithCaret = constants_1.PositionWithCaret.DETECTED; 29241 // Minimum threshold distance needed between the tooltip and the viewport. 29242 _this.minViewportTooltipThreshold = constants_1.numbers.MIN_VIEWPORT_TOOLTIP_THRESHOLD; 29243 _this.hideDelayMs = constants_1.numbers.HIDE_DELAY_MS; 29244 _this.showDelayMs = constants_1.numbers.SHOW_DELAY_MS; 29245 _this.anchorRect = null; 29246 _this.parentRect = null; 29247 _this.frameId = null; 29248 _this.hideTimeout = null; 29249 _this.showTimeout = null; 29250 _this.addAncestorScrollEventListeners = new Array(); 29251 _this.removeAncestorScrollEventListeners = new Array(); 29252 _this.animFrame = new animationframe_1.AnimationFrame(); 29253 _this.anchorBlurHandler = function (evt) { 29254 _this.handleAnchorBlur(evt); 29255 }; 29256 _this.documentClickHandler = function (evt) { 29257 _this.handleDocumentClick(evt); 29258 }; 29259 _this.documentKeydownHandler = function (evt) { 29260 _this.handleKeydown(evt); 29261 }; 29262 _this.
vendor: 21,494 bytes, lines 29262-29724
29262richTooltipMouseEnterHandler = function () { 29263 _this.handleRichTooltipMouseEnter(); 29264 }; 29265 _this.richTooltipMouseLeaveHandler = function () { 29266 _this.handleRichTooltipMouseLeave(); 29267 }; 29268 _this.richTooltipFocusOutHandler = function (evt) { 29269 _this.handleRichTooltipFocusOut(evt); 29270 }; 29271 _this.windowScrollHandler = function () { 29272 _this.handleWindowChangeEvent(); 29273 }; 29274 _this.windowResizeHandler = function () { 29275 _this.handleWindowChangeEvent(); 29276 }; 29277 return _this; 29278 } 29279 Object.defineProperty(MDCTooltipFoundation, "defaultAdapter", { 29280 get: function get() { 29281 return { 29282 getAttribute: function getAttribute() { 29283 return null; 29284 }, 29285 setAttribute: function setAttribute() { 29286 return undefined; 29287 }, 29288 addClass: function addClass() { 29289 return undefined; 29290 }, 29291 hasClass: function hasClass() { 29292 return false; 29293 }, 29294 removeClass: function removeClass() { 29295 return undefined; 29296 }, 29297 getComputedStyleProperty: function getComputedStyleProperty() { 29298 return ''; 29299 }, 29300 setStyleProperty: function setStyleProperty() { 29301 return undefined; 29302 }, 29303 setSurfaceStyleProperty: function setSurfaceStyleProperty() { 29304 return undefined; 29305 }, 29306 getViewportWidth: function getViewportWidth() { 29307 return 0; 29308 }, 29309 getViewportHeight: function getViewportHeight() { 29310 return 0; 29311 }, 29312 getTooltipSize: function getTooltipSize() { 29313 return { width: 0, height: 0 }; 29314 }, 29315 getAnchorBoundingRect: function getAnchorBoundingRect() { 29316 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 29317 }, 29318 getParentBoundingRect: function getParentBoundingRect() { 29319 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 29320 }, 29321 getAnchorAttribute: function getAnchorAttribute() { 29322 return null; 29323 }, 29324 setAnchorAttribute: function setAnchorAttribute() { 29325 return null; 29326 }, 29327 isRTL: function isRTL() { 29328 return false; 29329 }, 29330 anchorContainsElement: function anchorContainsElement() { 29331 return false; 29332 }, 29333 tooltipContainsElement: function tooltipContainsElement() { 29334 return false; 29335 }, 29336 focusAnchorElement: function focusAnchorElement() { 29337 return undefined; 29338 }, 29339 registerEventHandler: function registerEventHandler() { 29340 return undefined; 29341 }, 29342 deregisterEventHandler: function deregisterEventHandler() { 29343 return undefined; 29344 }, 29345 registerAnchorEventHandler: function registerAnchorEventHandler() { 29346 return undefined; 29347 }, 29348 deregisterAnchorEventHandler: function deregisterAnchorEventHandler() { 29349 return undefined; 29350 }, 29351 registerDocumentEventHandler: function registerDocumentEventHandler() { 29352 return undefined; 29353 }, 29354 deregisterDocumentEventHandler: function deregisterDocumentEventHandler() { 29355 return undefined; 29356 }, 29357 registerWindowEventHandler: function registerWindowEventHandler() { 29358 return undefined; 29359 }, 29360 deregisterWindowEventHandler: function deregisterWindowEventHandler() { 29361 return undefined; 29362 }, 29363 notifyHidden: function notifyHidden() { 29364 return undefined; 29365 }, 29366 getTooltipCaretSize: function getTooltipCaretSize() { 29367 return null; 29368 }, 29369 setTooltipCaretStyle: function setTooltipCaretStyle() { 29370 return undefined; 29371 }, 29372 clearTooltipCaretStyles: function clearTooltipCaretStyles() { 29373 return undefined; 29374 } 29375 }; 29376 }, 29377 enumerable: false, 29378 configurable: true 29379 }); 29380 MDCTooltipFoundation.prototype.init = function () { 29381 this.richTooltip = this.adapter.hasClass(RICH); 29382 this.persistentTooltip = this.adapter.getAttribute(constants_1.attributes.PERSISTENT) === 'true'; 29383 this.interactiveTooltip = !!this.adapter.getAnchorAttribute(constants_1.attributes.ARIA_EXPANDED) && this.adapter.getAnchorAttribute(constants_1.attributes.ARIA_HASPOPUP) === 'dialog'; 29384 this.hasCaret = this.richTooltip && this.adapter.getAttribute(constants_1.attributes.HAS_CARET) === 'true'; 29385 }; 29386 MDCTooltipFoundation.prototype.isShown = function () { 29387 return this.tooltipShown; 29388 }; 29389 MDCTooltipFoundation.prototype.isRich = function () { 29390 return this.richTooltip; 29391 }; 29392 MDCTooltipFoundation.prototype.isPersistent = function () { 29393 return this.persistentTooltip; 29394 }; 29395 MDCTooltipFoundation.prototype.handleAnchorMouseEnter = function () { 29396 var _this = this; 29397 if (this.tooltipShown) { 29398 // Covers the instance where a user hovers over the anchor to reveal the 29399 // tooltip, and then quickly navigates away and then back to the anchor. 29400 // The tooltip should stay visible without animating out and then back in 29401 // again. 29402 this.show(); 29403 } else { 29404 // clearHideTimeout here since handleAnchorMouseLeave sets a hideTimeout 29405 // and that can execute before the showTimeout executes, resulting in hide 29406 // being called and the showTimeout set below to be cleared. 29407 this.clearHideTimeout(); 29408 this.showTimeout = setTimeout(function () { 29409 _this.show(); 29410 }, this.showDelayMs); 29411 } 29412 }; 29413 MDCTooltipFoundation.prototype.handleAnchorTouchstart = function () { 29414 var _this = this; 29415 this.showTimeout = setTimeout(function () { 29416 _this.show(); 29417 }, this.showDelayMs); 29418 // Prevent a context menu from appearing if user is long-pressing on a 29419 // tooltip anchor. 29420 this.adapter.registerWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch); 29421 }; 29422 MDCTooltipFoundation.prototype.preventContextMenuOnLongTouch = function (evt) { 29423 evt.preventDefault(); 29424 }; 29425 MDCTooltipFoundation.prototype.handleAnchorTouchend = function () { 29426 this.clearShowTimeout(); 29427 // Only remove the 'contextmenu' listener if the tooltip is not shown. When 29428 // the tooltip *is* shown, listener is removed in the close method. 29429 if (!this.isShown()) { 29430 this.adapter.deregisterWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch); 29431 } 29432 }; 29433 MDCTooltipFoundation.prototype.handleAnchorFocus = function (evt) { 29434 var _this = this; 29435 // TODO(b/157075286): Need to add some way to distinguish keyboard 29436 // navigation focus events from other focus events, and only show the 29437 // tooltip on the former of these events. 29438 var relatedTarget = evt.relatedTarget; 29439 var tooltipContainsRelatedTarget = relatedTarget instanceof HTMLElement && this.adapter.tooltipContainsElement(relatedTarget); 29440 // Do not show tooltip if the previous focus was on a tooltip element. This 29441 // occurs when a rich tooltip is closed and focus is restored to the anchor 29442 // or when user tab-navigates back into the anchor from the rich tooltip. 29443 if (tooltipContainsRelatedTarget) { 29444 return; 29445 } 29446 this.showTimeout = setTimeout(function () { 29447 _this.show(); 29448 }, this.showDelayMs); 29449 }; 29450 MDCTooltipFoundation.prototype.handleAnchorMouseLeave = function () { 29451 var _this = this; 29452 this.clearShowTimeout(); 29453 this.hideTimeout = setTimeout(function () { 29454 _this.hide(); 29455 }, this.hideDelayMs); 29456 }; 29457 MDCTooltipFoundation.prototype.handleAnchorClick = function () { 29458 if (this.tooltipShown) { 29459 this.hide(); 29460 } else { 29461 this.show(); 29462 } 29463 }; 29464 MDCTooltipFoundation.prototype.handleDocumentClick = function (evt) { 29465 var anchorOrTooltipContainsTargetElement = evt.target instanceof HTMLElement && (this.adapter.anchorContainsElement(evt.target) || this.adapter.tooltipContainsElement(evt.target)); 29466 // For persistent rich tooltips, we will not hide if: 29467 // - The click target is within the anchor element. Otherwise, both 29468 // the anchor element's click handler and this handler will handle the 29469 // click (due to event propagation), resulting in a shown tooltip 29470 // being immediately hidden if the tooltip was initially hidden. 29471 // - The click target is within the tooltip element, since clicks 29472 // on the tooltip do not close the tooltip. 29473 if (this.richTooltip && this.persistentTooltip && anchorOrTooltipContainsTargetElement) { 29474 return; 29475 } 29476 // Hide the tooltip immediately on click. 29477 this.hide(); 29478 }; 29479 MDCTooltipFoundation.prototype.handleKeydown = function (evt) { 29480 // Hide the tooltip immediately on ESC key. 29481 var key = keyboard_1.normalizeKey(evt); 29482 if (key === keyboard_1.KEY.ESCAPE) { 29483 var tooltipContainsActiveElement = document.activeElement instanceof HTMLElement && this.adapter.tooltipContainsElement(document.activeElement); 29484 if (tooltipContainsActiveElement) { 29485 this.adapter.focusAnchorElement(); 29486 } 29487 this.hide(); 29488 } 29489 }; 29490 MDCTooltipFoundation.prototype.handleAnchorBlur = function (evt) { 29491 if (this.richTooltip) { 29492 var tooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement && this.adapter.tooltipContainsElement(evt.relatedTarget); 29493 // If focus changed to the tooltip element, don't hide the tooltip. 29494 if (tooltipContainsRelatedTargetElement) { 29495 return; 29496 } 29497 } 29498 // Hide tooltip immediately on focus change. 29499 this.hide(); 29500 }; 29501 MDCTooltipFoundation.prototype.handleRichTooltipMouseEnter = function () { 29502 this.show(); 29503 }; 29504 MDCTooltipFoundation.prototype.handleRichTooltipMouseLeave = function () { 29505 var _this = this; 29506 this.clearShowTimeout(); 29507 this.hideTimeout = setTimeout(function () { 29508 _this.hide(); 29509 }, this.hideDelayMs); 29510 }; 29511 MDCTooltipFoundation.prototype.handleRichTooltipFocusOut = function (evt) { 29512 var anchorOrTooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement && (this.adapter.anchorContainsElement(evt.relatedTarget) || this.adapter.tooltipContainsElement(evt.relatedTarget)); 29513 // If the focus is still within the anchor or the tooltip, do not hide the 29514 // tooltip. 29515 if (anchorOrTooltipContainsRelatedTargetElement) { 29516 return; 29517 } 29518 this.hide(); 29519 }; 29520 /** 29521 * On window resize or scroll, check the anchor position and size and 29522 * repostion tooltip if necessary. 29523 */ 29524 MDCTooltipFoundation.prototype.handleWindowChangeEvent = function () { 29525 var _this = this; 29526 // Since scroll and resize events can fire at a high rate, we throttle 29527 // the potential re-positioning of tooltip component using 29528 // requestAnimationFrame. 29529 this.animFrame.request(AnimationKeys.POLL_ANCHOR, function () { 29530 _this.repositionTooltipOnAnchorMove(); 29531 }); 29532 }; 29533 MDCTooltipFoundation.prototype.show = function () { 29534 var e_1, _a; 29535 var _this = this; 29536 this.clearHideTimeout(); 29537 this.clearShowTimeout(); 29538 if (this.tooltipShown) { 29539 return; 29540 } 29541 this.tooltipShown = true; 29542 var showTooltipOptions = this.parseShowTooltipOptions(); 29543 if (!showTooltipOptions.hideFromScreenreader) { 29544 this.adapter.setAttribute('aria-hidden', 'false'); 29545 } 29546 if (this.richTooltip) { 29547 if (this.interactiveTooltip) { 29548 this.adapter.setAnchorAttribute('aria-expanded', 'true'); 29549 } 29550 this.adapter.registerEventHandler('focusout', this.richTooltipFocusOutHandler); 29551 if (!this.persistentTooltip) { 29552 this.adapter.registerEventHandler('mouseenter', this.richTooltipMouseEnterHandler); 29553 this.adapter.registerEventHandler('mouseleave', this.richTooltipMouseLeaveHandler); 29554 } 29555 } 29556 this.adapter.removeClass(HIDE); 29557 this.adapter.addClass(SHOWING); 29558 if (this.isTooltipMultiline() && !this.richTooltip) { 29559 this.adapter.addClass(MULTILINE_TOOLTIP); 29560 } 29561 this.anchorRect = this.adapter.getAnchorBoundingRect(); 29562 this.parentRect = this.adapter.getParentBoundingRect(); 29563 this.richTooltip ? this.positionRichTooltip() : this.positionPlainTooltip(); 29564 // TODO(b/182906431): Position of the tooltip caret should be informed by 29565 // the position of the tooltip. 29566 if (this.hasCaret) { 29567 this.setCaretPositionStyles(this.tooltipPositionWithCaret); 29568 } 29569 this.adapter.registerAnchorEventHandler('blur', this.anchorBlurHandler); 29570 this.adapter.registerDocumentEventHandler('click', this.documentClickHandler); 29571 this.adapter.registerDocumentEventHandler('keydown', this.documentKeydownHandler); 29572 this.adapter.registerWindowEventHandler('scroll', this.windowScrollHandler); 29573 this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler); 29574 try { 29575 // Register any additional scroll handlers 29576 for (var _b = __values(this.addAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) { 29577 var fn = _c.value; 29578 fn(); 29579 } 29580 } catch (e_1_1) { 29581 e_1 = { error: e_1_1 }; 29582 } finally { 29583 try { 29584 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 29585 } finally { 29586 if (e_1) throw e_1.error; 29587 } 29588 } 29589 this.frameId = requestAnimationFrame(function () { 29590 _this.clearAllAnimationClasses(); 29591 _this.adapter.addClass(SHOWN); 29592 _this.adapter.addClass(SHOWING_TRANSITION); 29593 }); 29594 }; 29595 MDCTooltipFoundation.prototype.hide = function () { 29596 var e_2, _a; 29597 this.clearHideTimeout(); 29598 this.clearShowTimeout(); 29599 if (!this.tooltipShown) { 29600 return; 29601 } 29602 if (this.frameId) { 29603 cancelAnimationFrame(this.frameId); 29604 } 29605 this.tooltipShown = false; 29606 this.adapter.setAttribute('aria-hidden', 'true'); 29607 this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler); 29608 if (this.richTooltip) { 29609 if (this.interactiveTooltip) { 29610 this.adapter.setAnchorAttribute('aria-expanded', 'false'); 29611 } 29612 if (!this.persistentTooltip) { 29613 this.adapter.deregisterEventHandler('mouseenter', this.richTooltipMouseEnterHandler); 29614 this.adapter.deregisterEventHandler('mouseleave', this.richTooltipMouseLeaveHandler); 29615 } 29616 } 29617 this.clearAllAnimationClasses(); 29618 this.adapter.addClass(HIDE); 29619 this.adapter.addClass(HIDE_TRANSITION); 29620 this.adapter.removeClass(SHOWN); 29621 this.adapter.deregisterAnchorEventHandler('blur', this.anchorBlurHandler); 29622 this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler); 29623 this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler); 29624 this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler); 29625 this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler); 29626 this.adapter.deregisterWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch); 29627 try { 29628 // Deregister any additional scroll handlers 29629 for (var _b = __values(this.removeAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) { 29630 var fn = _c.value; 29631 fn(); 29632 } 29633 } catch (e_2_1) { 29634 e_2 = { error: e_2_1 }; 29635 } finally { 29636 try { 29637 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 29638 } finally { 29639 if (e_2) throw e_2.error; 29640 } 29641 } 29642 }; 29643 MDCTooltipFoundation.prototype.handleTransitionEnd = function () { 29644 var isHidingTooltip = this.adapter.hasClass(HIDE); 29645 this.adapter.removeClass(SHOWING); 29646 this.adapter.removeClass(SHOWING_TRANSITION); 29647 this.adapter.removeClass(HIDE); 29648 this.adapter.removeClass(HIDE_TRANSITION); 29649 // If handleTransitionEnd is called after hiding the tooltip, the tooltip 29650 // will have the HIDE class (before calling the adapter removeClass method). 29651 // If tooltip is now hidden, send a notification that the animation has 29652 // completed and the tooltip is no longer visible. 29653 if (isHidingTooltip) { 29654 this.adapter.notifyHidden(); 29655 } 29656 }; 29657 MDCTooltipFoundation.prototype.clearAllAnimationClasses = function () { 29658 this.adapter.removeClass(SHOWING_TRANSITION); 29659 this.adapter.removeClass(HIDE_TRANSITION); 29660 }; 29661 MDCTooltipFoundation.prototype.setTooltipPosition = function (position) { 29662 var xPos = position.xPos, 29663 yPos = position.yPos, 29664 withCaretPos = position.withCaretPos; 29665 if (this.hasCaret && withCaretPos) { 29666 this.tooltipPositionWithCaret = withCaretPos; 29667 return; 29668 } 29669 if (xPos) { 29670 this.xTooltipPos = xPos; 29671 } 29672 if (yPos) { 29673 this.yTooltipPos = yPos; 29674 } 29675 }; 29676 MDCTooltipFoundation.prototype.setAnchorBoundaryType = function (type) { 29677 if (type === constants_1.AnchorBoundaryType.UNBOUNDED) { 29678 this.anchorGap = constants_1.numbers.UNBOUNDED_ANCHOR_GAP; 29679 } else { 29680 this.anchorGap = constants_1.numbers.BOUNDED_ANCHOR_GAP; 29681 } 29682 }; 29683 MDCTooltipFoundation.prototype.parseShowTooltipOptions = function () { 29684 var hideFromScreenreader = Boolean(this.adapter.getAnchorAttribute('data-tooltip-id')); 29685 return { hideFromScreenreader: hideFromScreenreader }; 29686 }; 29687 MDCTooltipFoundation.prototype.isTooltipMultiline = function () { 29688 var tooltipSize = this.adapter.getTooltipSize(); 29689 return tooltipSize.height > constants_1.numbers.MIN_HEIGHT && tooltipSize.width >= constants_1.numbers.MAX_WIDTH; 29690 }; 29691 MDCTooltipFoundation.prototype.positionPlainTooltip = function () { 29692 // A plain tooltip has `fixed` positioning and is placed as an immediate 29693 // child of the document body. Its positioning is calculated with respect to 29694 // the viewport. 29695 var _a = this.calculateTooltipStyles(this.anchorRect), 29696 top = _a.top, 29697 yTransformOrigin = _a.yTransformOrigin, 29698 left = _a.left, 29699 xTransformOrigin = _a.xTransformOrigin; 29700 var transformProperty = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; 29701 this.adapter.setSurfaceStyleProperty(transformProperty + "-origin", yTransformOrigin + " " + xTransformOrigin); 29702 this.adapter.setStyleProperty('top', top + "px"); 29703 this.adapter.setStyleProperty('left', left + "px"); 29704 }; 29705 MDCTooltipFoundation.prototype.positionRichTooltip = function () { 29706 // TODO(b/177686782): Remove width setting when max-content is used to style 29707 // the rich tooltip. 29708 var _a, _b, _c, _d; 29709 // getComputedStyleProperty is used instead of getTooltipSize since 29710 // getTooltipSize returns the offSetWidth, which includes the border and 29711 // padding. What we need is the width of the tooltip without border and 29712 // padding. 29713 var width = this.adapter.getComputedStyleProperty('width'); 29714 // When rich tooltips are positioned within their parent containers, the 29715 // tooltip width might be shrunk if it collides with the edge of the parent 29716 // container. We set the width of the tooltip to prevent this. 29717 this.adapter.setStyleProperty('width', width); 29718 var _e = this.calculateTooltipStyles(this.anchorRect), 29719 top = _e.top, 29720 yTransformOrigin = _e.yTransformOrigin, 29721 left = _e.left, 29722 xTransformOrigin = _e.xTransformOrigin; 29723 var transformProperty = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; 29724 this.adapter.setSurfaceStyleProperty(transformProperty + "-origin", yTransformOrigin + " " + x
vendor: 12,015 bytes, lines 29724-29934
29724TransformOrigin); 29725 // A rich tooltip has `absolute` positioning and is placed as a sibling to 29726 // the anchor element. Its positioning is calculated with respect to the 29727 // parent element, and so the values need to be adjusted against the parent 29728 // element. 29729 var leftAdjustment = left - ((_b = (_a = this.parentRect) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0); 29730 var topAdjustment = top - ((_d = (_c = this.parentRect) === null || _c === void 0 ? void 0 : _c.top) !== null && _d !== void 0 ? _d : 0); 29731 this.adapter.setStyleProperty('top', topAdjustment + "px"); 29732 this.adapter.setStyleProperty('left', leftAdjustment + "px"); 29733 }; 29734 /** 29735 * Calculates the position of the tooltip. A tooltip will be placed beneath 29736 * the anchor element and aligned either with the 'start'/'end' edge of the 29737 * anchor element or the 'center'. 29738 * 29739 * Tooltip alignment is selected such that the tooltip maintains a threshold 29740 * distance away from the viewport (defaulting to 'center' alignment). If the 29741 * placement of the anchor prevents this threshold distance from being 29742 * maintained, the tooltip is positioned so that it does not collide with the 29743 * viewport. 29744 * 29745 * Users can specify an alignment, however, if this alignment results in the 29746 * tooltip colliding with the viewport, this specification is overwritten. 29747 */ 29748 MDCTooltipFoundation.prototype.calculateTooltipStyles = function (anchorRect) { 29749 if (!anchorRect) { 29750 return { top: 0, left: 0 }; 29751 } 29752 var tooltipSize = this.adapter.getTooltipSize(); 29753 var top = this.calculateYTooltipDistance(anchorRect, tooltipSize.height); 29754 var left = this.calculateXTooltipDistance(anchorRect, tooltipSize.width); 29755 return { 29756 top: top.distance, 29757 yTransformOrigin: top.yTransformOrigin, 29758 left: left.distance, 29759 xTransformOrigin: left.xTransformOrigin 29760 }; 29761 }; 29762 /** 29763 * Calculates the `left` distance for the tooltip. 29764 * Returns the distance value and a string indicating the x-axis transform- 29765 * origin that should be used when animating the tooltip. 29766 */ 29767 MDCTooltipFoundation.prototype.calculateXTooltipDistance = function (anchorRect, tooltipWidth) { 29768 var isLTR = !this.adapter.isRTL(); 29769 var startPos, endPos, centerPos; 29770 var startTransformOrigin, endTransformOrigin; 29771 if (this.richTooltip) { 29772 startPos = isLTR ? anchorRect.left - tooltipWidth : anchorRect.right; 29773 endPos = isLTR ? anchorRect.right : anchorRect.left - tooltipWidth; 29774 startTransformOrigin = isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT; 29775 endTransformOrigin = isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT; 29776 } else { 29777 startPos = isLTR ? anchorRect.left : anchorRect.right - tooltipWidth; 29778 endPos = isLTR ? anchorRect.right - tooltipWidth : anchorRect.left; 29779 centerPos = anchorRect.left + (anchorRect.width - tooltipWidth) / 2; 29780 startTransformOrigin = isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT; 29781 endTransformOrigin = isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT; 29782 } 29783 var positionOptions = this.richTooltip ? this.determineValidPositionOptions(startPos, endPos) : 29784 // For plain tooltips, centerPos is defined 29785 this.determineValidPositionOptions(centerPos, startPos, endPos); 29786 if (this.xTooltipPos === constants_1.XPosition.START && positionOptions.has(startPos)) { 29787 return { distance: startPos, xTransformOrigin: startTransformOrigin }; 29788 } 29789 if (this.xTooltipPos === constants_1.XPosition.END && positionOptions.has(endPos)) { 29790 return { distance: endPos, xTransformOrigin: endTransformOrigin }; 29791 } 29792 if (this.xTooltipPos === constants_1.XPosition.CENTER && positionOptions.has(centerPos)) { 29793 // This code path is only executed if calculating the distance for plain 29794 // tooltips. In this instance, centerPos will always be defined, so we can 29795 // safely assert that the returned value is non-null/undefined. 29796 return { distance: centerPos, xTransformOrigin: constants_1.strings.CENTER }; 29797 } 29798 // If no user position is supplied, rich tooltips default to end pos, then 29799 // start position. Plain tooltips default to center, start, then end. 29800 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 }]; 29801 var validPosition = possiblePositions.find(function (_a) { 29802 var distance = _a.distance; 29803 return positionOptions.has(distance); 29804 }); 29805 if (validPosition) { 29806 return validPosition; 29807 } 29808 // Indicates that all potential positions would result in the tooltip 29809 // colliding with the viewport. This would only occur when the anchor 29810 // element itself collides with the viewport, or the viewport is very 29811 // narrow. In this case, we allow the tooltip to be mis-aligned from the 29812 // anchor element. 29813 if (anchorRect.left < 0) { 29814 return { 29815 distance: this.minViewportTooltipThreshold, 29816 xTransformOrigin: constants_1.strings.LEFT 29817 }; 29818 } else { 29819 var viewportWidth = this.adapter.getViewportWidth(); 29820 var distance = viewportWidth - (tooltipWidth + this.minViewportTooltipThreshold); 29821 return { distance: distance, xTransformOrigin: constants_1.strings.RIGHT }; 29822 } 29823 }; 29824 /** 29825 * Given the values for the horizontal alignments of the tooltip, calculates 29826 * which of these options would result in the tooltip maintaining the required 29827 * threshold distance vs which would result in the tooltip staying within the 29828 * viewport. 29829 * 29830 * A Set of values is returned holding the distances that would honor the 29831 * above requirements. Following the logic for determining the tooltip 29832 * position, if all alignments violate the threshold, then the returned Set 29833 * contains values that keep the tooltip within the viewport. 29834 */ 29835 MDCTooltipFoundation.prototype.determineValidPositionOptions = function () { 29836 var e_3, _a; 29837 var positions = []; 29838 for (var _i = 0; _i < arguments.length; _i++) { 29839 positions[_i] = arguments[_i]; 29840 } 29841 var posWithinThreshold = new Set(); 29842 var posWithinViewport = new Set(); 29843 try { 29844 for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) { 29845 var position = positions_1_1.value; 29846 if (this.positionHonorsViewportThreshold(position)) { 29847 posWithinThreshold.add(position); 29848 } else if (this.positionDoesntCollideWithViewport(position)) { 29849 posWithinViewport.add(position); 29850 } 29851 } 29852 } catch (e_3_1) { 29853 e_3 = { error: e_3_1 }; 29854 } finally { 29855 try { 29856 if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1); 29857 } finally { 29858 if (e_3) throw e_3.error; 29859 } 29860 } 29861 return posWithinThreshold.size ? posWithinThreshold : posWithinViewport; 29862 }; 29863 MDCTooltipFoundation.prototype.positionHonorsViewportThreshold = function (leftPos) { 29864 var viewportWidth = this.adapter.getViewportWidth(); 29865 var tooltipWidth = this.adapter.getTooltipSize().width; 29866 return leftPos + tooltipWidth <= viewportWidth - this.minViewportTooltipThreshold && leftPos >= this.minViewportTooltipThreshold; 29867 }; 29868 MDCTooltipFoundation.prototype.positionDoesntCollideWithViewport = function (leftPos) { 29869 var viewportWidth = this.adapter.getViewportWidth(); 29870 var tooltipWidth = this.adapter.getTooltipSize().width; 29871 return leftPos + tooltipWidth <= viewportWidth && leftPos >= 0; 29872 }; 29873 /** 29874 * Calculates the `top` distance for the tooltip. 29875 * Returns the distance value and a string indicating the y-axis transform- 29876 * origin that should be used when animating the tooltip. 29877 */ 29878 MDCTooltipFoundation.prototype.calculateYTooltipDistance = function (anchorRect, tooltipHeight) { 29879 var belowYPos = anchorRect.bottom + this.anchorGap; 29880 var aboveYPos = anchorRect.top - (this.anchorGap + tooltipHeight); 29881 var yPositionOptions = this.determineValidYPositionOptions(aboveYPos, belowYPos); 29882 if (this.yTooltipPos === constants_1.YPosition.ABOVE && yPositionOptions.has(aboveYPos)) { 29883 return { distance: aboveYPos, yTransformOrigin: constants_1.strings.BOTTOM }; 29884 } else if (this.yTooltipPos === constants_1.YPosition.BELOW && yPositionOptions.has(belowYPos)) { 29885 return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP }; 29886 } 29887 if (yPositionOptions.has(belowYPos)) { 29888 return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP }; 29889 } 29890 if (yPositionOptions.has(aboveYPos)) { 29891 return { distance: aboveYPos, yTransformOrigin: constants_1.strings.BOTTOM }; 29892 } 29893 // Indicates that all potential positions would result in the tooltip 29894 // colliding with the viewport. This would only occur when the viewport is 29895 // very short. 29896 return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP }; 29897 }; 29898 /** 29899 * Given the values for above/below alignment of the tooltip, calculates 29900 * which of these options would result in the tooltip maintaining the required 29901 * threshold distance vs which would result in the tooltip staying within the 29902 * viewport. 29903 * 29904 * A Set of values is returned holding the distances that would honor the 29905 * above requirements. Following the logic for determining the tooltip 29906 * position, if all possible alignments violate the threshold, then the 29907 * returned Set contains values that keep the tooltip within the viewport. 29908 */ 29909 MDCTooltipFoundation.prototype.determineValidYPositionOptions = function (aboveAnchorPos, belowAnchorPos) { 29910 var posWithinThreshold = new Set(); 29911 var posWithinViewport = new Set(); 29912 if (this.yPositionHonorsViewportThreshold(aboveAnchorPos)) { 29913 posWithinThreshold.add(aboveAnchorPos); 29914 } else if (this.yPositionDoesntCollideWithViewport(aboveAnchorPos)) { 29915 posWithinViewport.add(aboveAnchorPos); 29916 } 29917 if (this.yPositionHonorsViewportThreshold(belowAnchorPos)) { 29918 posWithinThreshold.add(belowAnchorPos); 29919 } else if (this.yPositionDoesntCollideWithViewport(belowAnchorPos)) { 29920 posWithinViewport.add(belowAnchorPos); 29921 } 29922 return posWithinThreshold.size ? posWithinThreshold : posWithinViewport; 29923 }; 29924 MDCTooltipFoundation.prototype.yPositionHonorsViewportThreshold = function (yPos) { 29925 var viewportHeight = this.adapter.getViewportHeight(); 29926 var tooltipHeight = this.adapter.getTooltipSize().height; 29927 return yPos + tooltipHeight + this.minViewportTooltipThreshold <= viewportHeight && yPos >= this.minViewportTooltipThreshold; 29928 }; 29929 MDCTooltipFoundation.prototype.yPositionDoesntCollideWithViewport = function (yPos) { 29930 var viewportHeight = this.adapter.getViewportHeight(); 29931 var tooltipHeight = this.adapter.getTooltipSize().height; 29932 return yPos + tooltipHeight <= viewportHeight && yPos >= 0; 29933 }; 29934 MDCTooltipFoundation.prototype.
vendor: 4,157 bytes, lines 29934-30008
29934repositionTooltipOnAnchorMove = function () { 29935 var newAnchorRect = this.adapter.getAnchorBoundingRect(); 29936 if (!newAnchorRect || !this.anchorRect) return; 29937 if (newAnchorRect.top !== this.anchorRect.top || newAnchorRect.left !== this.anchorRect.left || newAnchorRect.height !== this.anchorRect.height || newAnchorRect.width !== this.anchorRect.width) { 29938 this.anchorRect = newAnchorRect; 29939 this.parentRect = this.adapter.getParentBoundingRect(); 29940 this.richTooltip ? this.positionRichTooltip() : this.positionPlainTooltip(); 29941 } 29942 }; 29943 /** 29944 * Given a PositionWithCaret, applies the correct styles to the caret element 29945 * so that it is positioned properly on the rich tooltip. 29946 * Returns the x and y positions of the caret, to be used as the 29947 * transform-origin on the tooltip itself for entrance animations. 29948 */ 29949 MDCTooltipFoundation.prototype.setCaretPositionStyles = function (position) { 29950 var values = this.calculateCaretPositionOnTooltip(position); 29951 if (!values) { 29952 return { yTransformOrigin: 0, xTransformOrigin: 0 }; 29953 } 29954 // Prior to setting the caret position styles, clear any previous styles 29955 // set. This is necessary as all position options do not use the same 29956 // properties (e.g. using 'left' or 'right') and so old style properties 29957 // might not get overridden, causing misplaced carets. 29958 this.adapter.clearTooltipCaretStyles(); 29959 this.adapter.setTooltipCaretStyle(values.yAlignment, values.yAxisPx); 29960 this.adapter.setTooltipCaretStyle(values.xAlignment, values.xAxisPx); 29961 this.adapter.setTooltipCaretStyle('transform', "rotate(" + values.rotation + ")"); 29962 this.adapter.setTooltipCaretStyle('transform-origin', values.yAlignment + " " + values.xAlignment); 29963 return { yTransformOrigin: values.yAxisPx, xTransformOrigin: values.xAxisPx }; 29964 }; 29965 /** 29966 * Given a PositionWithCaret, determines the correct styles to position the 29967 * caret properly on the rich tooltip. 29968 */ 29969 MDCTooltipFoundation.prototype.calculateCaretPositionOnTooltip = function (tooltipPos) { 29970 var isLTR = !this.adapter.isRTL(); 29971 var tooltipWidth = this.adapter.getComputedStyleProperty('width'); 29972 var tooltipHeight = this.adapter.getComputedStyleProperty('height'); 29973 var caretDimensions = this.adapter.getTooltipCaretSize(); 29974 if (!tooltipWidth || !tooltipHeight || !caretDimensions) { 29975 return; 29976 } 29977 var caretDiagonal = caretDimensions.width * Math.sqrt(2); 29978 var midpointWidth = "calc((" + tooltipWidth + " - " + caretDiagonal + "px) / 2)"; 29979 var midpointHeight = "calc((" + tooltipHeight + " - " + caretDiagonal + "px) / 2)"; 29980 var flushWithEdge = '0'; 29981 var indentedFromEdge = constants_1.numbers.CARET_INDENTATION + "px"; 29982 var positiveRot = '45deg'; 29983 var negativeRot = '-45deg'; 29984 switch (tooltipPos) { 29985 case constants_1.PositionWithCaret.BELOW_CENTER: 29986 return { 29987 yAlignment: constants_1.strings.TOP, 29988 xAlignment: constants_1.strings.LEFT, 29989 yAxisPx: flushWithEdge, 29990 xAxisPx: midpointWidth, 29991 rotation: negativeRot 29992 }; 29993 case constants_1.PositionWithCaret.BELOW_END: 29994 return { 29995 yAlignment: constants_1.strings.TOP, 29996 xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT, 29997 yAxisPx: flushWithEdge, 29998 xAxisPx: indentedFromEdge, 29999 rotation: isLTR ? positiveRot : negativeRot 30000 }; 30001 case constants_1.PositionWithCaret.BELOW_START: 30002 return { 30003 yAlignment: constants_1.strings.TOP, 30004 xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT, 30005 yAxisPx: flushWithEdge, 30006 xAxisPx: indentedFromEdge, 30007 rotation: isLTR ? negativeRot : positiveRot 30008 };
30009 case constants_1.PositionWithCaret.TOP_SIDE_END: 30010 return { 30011 yAlignment: constants_1.strings.TOP, 30012 xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT, 30013 yAxisPx: indentedFromEdge, 30014 xAxisPx: flushWithEdge, 30015 rotation: isLTR ? positiveRot : negativeRot 30016 }; 30017 case constants_1.PositionWithCaret.CENTER_SIDE_END: 30018 return { 30019 yAlignment: constants_1.strings.TOP, 30020 xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT, 30021 yAxisPx: midpointHeight, 30022 xAxisPx: flushWithEdge, 30023 rotation: isLTR ? positiveRot : negativeRot 30024 }; 30025 case constants_1.PositionWithCaret.BOTTOM_SIDE_END: 30026 return { 30027 yAlignment: constants_1.strings.BOTTOM, 30028 xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT, 30029 yAxisPx: indentedFromEdge, 30030 xAxisPx: flushWithEdge, 30031 rotation: isLTR ? negativeRot : positiveRot 30032 }; 30033 case constants_1.PositionWithCaret.TOP_SIDE_START: 30034 return { 30035 yAlignment: constants_1.strings.TOP, 30036 xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT, 30037 yAxisPx: indentedFromEdge, 30038 xAxisPx: flushWithEdge, 30039 rotation: isLTR ? negativeRot : positiveRot 30040 }; 30041 case constants_1.PositionWithCaret.CENTER_SIDE_START: 30042 return { 30043 yAlignment: constants_1.strings.TOP, 30044 xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT, 30045 yAxisPx: midpointHeight, 30046 xAxisPx: flushWithEdge, 30047 rotation: isLTR ? negativeRot : positiveRot 30048 }; 30049 case constants_1.PositionWithCaret.BOTTOM_SIDE_START: 30050 return { 30051 yAlignment: constants_1.strings.BOTTOM, 30052 xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT, 30053 yAxisPx: indentedFromEdge, 30054 xAxisPx: flushWithEdge, 30055 rotation: isLTR ? positiveRot : negativeRot 30056 }; 30057 case constants_1.PositionWithCaret.ABOVE_CENTER: 30058 return { 30059 yAlignment: constants_1.strings.BOTTOM, 30060 xAlignment: constants_1.strings.LEFT, 30061 yAxisPx: flushWithEdge, 30062 xAxisPx: midpointWidth, 30063 rotation: positiveRot 30064 }; 30065 case constants_1.PositionWithCaret.ABOVE_END: 30066 return { 30067 yAlignment: constants_1.strings.BOTTOM, 30068 xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT, 30069 yAxisPx: flushWithEdge, 30070 xAxisPx: indentedFromEdge, 30071 rotation: isLTR ? negativeRot : positiveRot 30072 }; 30073 default: 30074 case constants_1.PositionWithCaret.ABOVE_START: 30075 return { 30076 yAlignment: constants_1.strings.BOTTOM, 30077 xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT, 30078 yAxisPx: flushWithEdge, 30079 xAxisPx: indentedFromEdge, 30080 rotation: isLTR ? positiveRot : negativeRot 30081 }; 30082 } 30083 }; 30084 MDCTooltipFoundation.prototype.clearShowTimeout = function () { 30085 if (this.showTimeout) { 30086 clearTimeout(this.showTimeout); 30087 this.showTimeout = null; 30088 } 30089 }; 30090 MDCTooltipFoundation.prototype.clearHideTimeout = function () { 30091 if (this.hideTimeout) { 30092 clearTimeout(this.hideTimeout); 30093 this.hideTimeout = null; 30094 } 30095 }; 30096 /** 30097 * Method that allows user to specify additional elements that should have a 30098 * scroll event listener attached to it. This should be used in instances
vendor: 5,415 bytes, lines 30099-30220
30099 * where the anchor element is placed inside a scrollable container, and will 30100 * ensure that the tooltip will stay attached to the anchor on scroll. 30101 */ 30102 MDCTooltipFoundation.prototype.attachScrollHandler = function (addEventListenerFn) { 30103 var _this = this; 30104 this.addAncestorScrollEventListeners.push(function () { 30105 addEventListenerFn('scroll', _this.windowScrollHandler); 30106 }); 30107 }; 30108 /** 30109 * Must be used in conjunction with #attachScrollHandler. Removes the scroll 30110 * event handler from elements on the page. 30111 */ 30112 MDCTooltipFoundation.prototype.removeScrollHandler = function (removeEventHandlerFn) { 30113 var _this = this; 30114 this.removeAncestorScrollEventListeners.push(function () { 30115 removeEventHandlerFn('scroll', _this.windowScrollHandler); 30116 }); 30117 }; 30118 MDCTooltipFoundation.prototype.destroy = function () { 30119 var e_4, _a; 30120 if (this.frameId) { 30121 cancelAnimationFrame(this.frameId); 30122 this.frameId = null; 30123 } 30124 this.clearHideTimeout(); 30125 this.clearShowTimeout(); 30126 this.adapter.removeClass(SHOWN); 30127 this.adapter.removeClass(SHOWING_TRANSITION); 30128 this.adapter.removeClass(SHOWING); 30129 this.adapter.removeClass(HIDE); 30130 this.adapter.removeClass(HIDE_TRANSITION); 30131 if (this.richTooltip) { 30132 this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler); 30133 if (!this.persistentTooltip) { 30134 this.adapter.deregisterEventHandler('mouseenter', this.richTooltipMouseEnterHandler); 30135 this.adapter.deregisterEventHandler('mouseleave', this.richTooltipMouseLeaveHandler); 30136 } 30137 } 30138 this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler); 30139 this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler); 30140 this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler); 30141 this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler); 30142 try { 30143 for (var _b = __values(this.removeAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) { 30144 var fn = _c.value; 30145 fn(); 30146 } 30147 } catch (e_4_1) { 30148 e_4 = { error: e_4_1 }; 30149 } finally { 30150 try { 30151 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 30152 } finally { 30153 if (e_4) throw e_4.error; 30154 } 30155 } 30156 this.animFrame.cancelAll(); 30157 }; 30158 return MDCTooltipFoundation; 30159}(foundation_1.MDCFoundation); 30160exports.MDCTooltipFoundation = MDCTooltipFoundation; 30161// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 30162exports.default = MDCTooltipFoundation; 30163 30164/***/ }), 30165 30166/***/ "./packages/mdc-tooltip/index.ts": 30167/*!***************************************!*\ 30168 !*** ./packages/mdc-tooltip/index.ts ***! 30169 \***************************************/ 30170/*! no static exports found */ 30171/***/ (function(module, exports, __webpack_require__) { 30172 30173"use strict"; 30174 30175/** 30176 * @license 30177 * Copyright 2020 Google Inc. 30178 * 30179 * Permission is hereby granted, free of charge, to any person obtaining a copy 30180 * of this software and associated documentation files (the "Software"), to deal 30181 * in the Software without restriction, including without limitation the rights 30182 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30183 * copies of the Software, and to permit persons to whom the Software is 30184 * furnished to do so, subject to the following conditions: 30185 * 30186 * The above copyright notice and this permission notice shall be included in 30187 * all copies or substantial portions of the Software. 30188 * 30189 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30190 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30191 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30192 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30193 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30194 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30195 * THE SOFTWARE. 30196 */ 30197 30198var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 30199 if (k2 === undefined) k2 = k; 30200 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 30201 return m[k]; 30202 } }); 30203} : function (o, m, k, k2) { 30204 if (k2 === undefined) k2 = k; 30205 o[k2] = m[k]; 30206}); 30207var __exportStar = this && this.__exportStar || function (m, exports) { 30208 for (var p in m) { 30209 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 30210 } 30211}; 30212Object.defineProperty(exports, "__esModule", { value: true }); 30213__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-tooltip/adapter.ts"), exports); 30214__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-tooltip/component.ts"), exports); 30215__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-tooltip/foundation.ts"), exports); 30216__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-tooltip/constants.ts"), exports); 30217__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-tooltip/types.ts"), exports); 30218 30219/***/ }), 30220
30221/***/ "./packages/mdc-tooltip/types.ts": 30222/*!***************************************!*\ 30223 !*** ./packages/mdc-tooltip/types.ts ***! 30224 \***************************************/ 30225/*! no static exports found */ 30226/***/ (function(module, exports, __webpack_require__) { 30227 30228"use strict"; 30229 30230/** 30231 * @license 30232 * Copyright 2020 Google Inc. 30233 * 30234 * Permission is hereby granted, free of charge, to any person obtaining a copy 30235 * of this software and associated documentation files (the "Software"), to deal 30236 * in the Software without restriction, including without limitation the rights 30237 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30238 * copies of the Software, and to permit persons to whom the Software is 30239 * furnished to do so, subject to the following conditions: 30240 * 30241 * The above copyright notice and this permission notice shall be included in 30242 * all copies or substantial portions of the Software. 30243 * 30244 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30245 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30246 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30247 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30248 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30249 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30250 * THE SOFTWARE. 30251 */ 30252 30253Object.defineProperty(exports, "__esModule", { value: true }
vendor: 3,784 bytes, lines 30253-30344
30253); 30254 30255/***/ }), 30256 30257/***/ "./packages/mdc-top-app-bar/adapter.ts": 30258/*!*********************************************!*\ 30259 !*** ./packages/mdc-top-app-bar/adapter.ts ***! 30260 \*********************************************/ 30261/*! no static exports found */ 30262/***/ (function(module, exports, __webpack_require__) { 30263 30264"use strict"; 30265 30266/** 30267 * @license 30268 * Copyright 2018 Google Inc. 30269 * 30270 * Permission is hereby granted, free of charge, to any person obtaining a copy 30271 * of this software and associated documentation files (the "Software"), to deal 30272 * in the Software without restriction, including without limitation the rights 30273 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30274 * copies of the Software, and to permit persons to whom the Software is 30275 * furnished to do so, subject to the following conditions: 30276 * 30277 * The above copyright notice and this permission notice shall be included in 30278 * all copies or substantial portions of the Software. 30279 * 30280 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30281 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30282 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30283 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30284 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30285 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30286 * THE SOFTWARE. 30287 */ 30288 30289Object.defineProperty(exports, "__esModule", { value: true }); 30290 30291/***/ }), 30292 30293/***/ "./packages/mdc-top-app-bar/component.ts": 30294/*!***********************************************!*\ 30295 !*** ./packages/mdc-top-app-bar/component.ts ***! 30296 \***********************************************/ 30297/*! no static exports found */ 30298/***/ (function(module, exports, __webpack_require__) { 30299 30300"use strict"; 30301 30302/** 30303 * @license 30304 * Copyright 2018 Google Inc. 30305 * 30306 * Permission is hereby granted, free of charge, to any person obtaining a copy 30307 * of this software and associated documentation files (the "Software"), to deal 30308 * in the Software without restriction, including without limitation the rights 30309 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30310 * copies of the Software, and to permit persons to whom the Software is 30311 * furnished to do so, subject to the following conditions: 30312 * 30313 * The above copyright notice and this permission notice shall be included in 30314 * all copies or substantial portions of the Software. 30315 * 30316 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30317 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30318 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30319 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30320 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30321 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30322 * THE SOFTWARE. 30323 */ 30324 30325var __extends = this && this.__extends || function () { 30326 var _extendStatics = function extendStatics(d, b) { 30327 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 30328 d.__proto__ = b; 30329 } || function (d, b) { 30330 for (var p in b) { 30331 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 30332 } 30333 }; 30334 return _extendStatics(d, b); 30335 }; 30336 return function (d, b) { 30337 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 30338 _extendStatics(d, b); 30339 function __() { 30340 this.constructor = d; 30341 } 30342 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 30343 }; 30344}();
vendor: 5,388 bytes, lines 30345-30443
30345Object.defineProperty(exports, "__esModule", { value: true }); 30346exports.MDCTopAppBar = void 0; 30347var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); 30348var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); 30349var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"); 30350var foundation_1 = __webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts"); 30351var foundation_2 = __webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts"); 30352var foundation_3 = __webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"); 30353var MDCTopAppBar = /** @class */function (_super) { 30354 __extends(MDCTopAppBar, _super); 30355 function MDCTopAppBar() { 30356 return _super !== null && _super.apply(this, arguments) || this; 30357 } 30358 MDCTopAppBar.attachTo = function (root) { 30359 return new MDCTopAppBar(root); 30360 }; 30361 MDCTopAppBar.prototype.initialize = function (rippleFactory) { 30362 if (rippleFactory === void 0) { 30363 rippleFactory = function rippleFactory(el) { 30364 return component_2.MDCRipple.attachTo(el); 30365 }; 30366 } 30367 this.navIcon_ = this.root.querySelector(constants_1.strings.NAVIGATION_ICON_SELECTOR); 30368 // Get all icons in the toolbar and instantiate the ripples 30369 var icons = [].slice.call(this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR)); 30370 if (this.navIcon_) { 30371 icons.push(this.navIcon_); 30372 } 30373 this.iconRipples_ = icons.map(function (icon) { 30374 var ripple = rippleFactory(icon); 30375 ripple.unbounded = true; 30376 return ripple; 30377 }); 30378 this.scrollTarget_ = window; 30379 }; 30380 MDCTopAppBar.prototype.initialSyncWithDOM = function () { 30381 this.handleNavigationClick_ = this.foundation.handleNavigationClick.bind(this.foundation); 30382 this.handleWindowResize_ = this.foundation.handleWindowResize.bind(this.foundation); 30383 this.handleTargetScroll_ = this.foundation.handleTargetScroll.bind(this.foundation); 30384 this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_); 30385 if (this.navIcon_) { 30386 this.navIcon_.addEventListener('click', this.handleNavigationClick_); 30387 } 30388 var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS); 30389 var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS); 30390 if (!isShort && !isFixed) { 30391 window.addEventListener('resize', this.handleWindowResize_); 30392 } 30393 }; 30394 MDCTopAppBar.prototype.destroy = function () { 30395 this.iconRipples_.forEach(function (iconRipple) { 30396 return iconRipple.destroy(); 30397 }); 30398 this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_); 30399 if (this.navIcon_) { 30400 this.navIcon_.removeEventListener('click', this.handleNavigationClick_); 30401 } 30402 var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS); 30403 var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS); 30404 if (!isShort && !isFixed) { 30405 window.removeEventListener('resize', this.handleWindowResize_); 30406 } 30407 _super.prototype.destroy.call(this); 30408 }; 30409 MDCTopAppBar.prototype.setScrollTarget = function (target) { 30410 // Remove scroll handler from the previous scroll target 30411 this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_); 30412 this.scrollTarget_ = target; 30413 // Initialize scroll handler on the new scroll target 30414 this.handleTargetScroll_ = this.foundation.handleTargetScroll.bind(this.foundation); 30415 this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_); 30416 }; 30417 MDCTopAppBar.prototype.getDefaultFoundation = function () { 30418 var _this = this; 30419 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. 30420 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. 30421 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 30422 var adapter = { 30423 hasClass: function hasClass(className) { 30424 return _this.root.classList.contains(className); 30425 }, 30426 addClass: function addClass(className) { 30427 return _this.root.classList.add(className); 30428 }, 30429 removeClass: function removeClass(className) { 30430 return _this.root.classList.remove(className); 30431 }, 30432 setStyle: function setStyle(property, value) { 30433 return _this.root.style.setProperty(property, value); 30434 }, 30435 getTopAppBarHeight: function getTopAppBarHeight() { 30436 return _this.root.clientHeight; 30437 }, 30438 notifyNavigationIconClicked: function notifyNavigationIconClicked() { 30439 return _this.emit(constants_1.strings.NAVIGATION_EVENT, {}); 30440 }, 30441 getViewportScrollY: function getViewportScrollY() { 30442 var win = _this.scrollTarget_; 30443 var el = _this.scrollTarget_
vendor: 6,268 bytes, lines 30443-30588
30443; 30444 return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop; 30445 }, 30446 getTotalActionItems: function getTotalActionItems() { 30447 return _this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR).length; 30448 } 30449 }; 30450 // tslint:enable:object-literal-sort-keys 30451 var foundation; 30452 if (this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS)) { 30453 foundation = new foundation_2.MDCShortTopAppBarFoundation(adapter); 30454 } else if (this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS)) { 30455 foundation = new foundation_1.MDCFixedTopAppBarFoundation(adapter); 30456 } else { 30457 foundation = new foundation_3.MDCTopAppBarFoundation(adapter); 30458 } 30459 return foundation; 30460 }; 30461 return MDCTopAppBar; 30462}(component_1.MDCComponent); 30463exports.MDCTopAppBar = MDCTopAppBar; 30464 30465/***/ }), 30466 30467/***/ "./packages/mdc-top-app-bar/constants.ts": 30468/*!***********************************************!*\ 30469 !*** ./packages/mdc-top-app-bar/constants.ts ***! 30470 \***********************************************/ 30471/*! no static exports found */ 30472/***/ (function(module, exports, __webpack_require__) { 30473 30474"use strict"; 30475 30476/** 30477 * @license 30478 * Copyright 2018 Google Inc. 30479 * 30480 * Permission is hereby granted, free of charge, to any person obtaining a copy 30481 * of this software and associated documentation files (the "Software"), to deal 30482 * in the Software without restriction, including without limitation the rights 30483 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30484 * copies of the Software, and to permit persons to whom the Software is 30485 * furnished to do so, subject to the following conditions: 30486 * 30487 * The above copyright notice and this permission notice shall be included in 30488 * all copies or substantial portions of the Software. 30489 * 30490 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30491 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30492 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30493 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30494 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30495 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30496 * THE SOFTWARE. 30497 */ 30498 30499Object.defineProperty(exports, "__esModule", { value: true }); 30500exports.strings = exports.numbers = exports.cssClasses = void 0; 30501var cssClasses = { 30502 FIXED_CLASS: 'mdc-top-app-bar--fixed', 30503 FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled', 30504 SHORT_CLASS: 'mdc-top-app-bar--short', 30505 SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed', 30506 SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item' 30507}; 30508exports.cssClasses = cssClasses; 30509var numbers = { 30510 DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100, 30511 MAX_TOP_APP_BAR_HEIGHT: 128 30512}; 30513exports.numbers = numbers; 30514var strings = { 30515 ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item', 30516 NAVIGATION_EVENT: 'MDCTopAppBar:nav', 30517 NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon', 30518 ROOT_SELECTOR: '.mdc-top-app-bar', 30519 TITLE_SELECTOR: '.mdc-top-app-bar__title' 30520}; 30521exports.strings = strings; 30522 30523/***/ }), 30524 30525/***/ "./packages/mdc-top-app-bar/fixed/foundation.ts": 30526/*!******************************************************!*\ 30527 !*** ./packages/mdc-top-app-bar/fixed/foundation.ts ***! 30528 \******************************************************/ 30529/*! no static exports found */ 30530/***/ (function(module, exports, __webpack_require__) { 30531 30532"use strict"; 30533 30534/** 30535 * @license 30536 * Copyright 2018 Google Inc. 30537 * 30538 * Permission is hereby granted, free of charge, to any person obtaining a copy 30539 * of this software and associated documentation files (the "Software"), to deal 30540 * in the Software without restriction, including without limitation the rights 30541 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30542 * copies of the Software, and to permit persons to whom the Software is 30543 * furnished to do so, subject to the following conditions: 30544 * 30545 * The above copyright notice and this permission notice shall be included in 30546 * all copies or substantial portions of the Software. 30547 * 30548 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30549 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30550 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30551 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30552 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30553 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30554 * THE SOFTWARE. 30555 */ 30556 30557var __extends = this && this.__extends || function () { 30558 var _extendStatics = function extendStatics(d, b) { 30559 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 30560 d.__proto__ = b; 30561 } || function (d, b) { 30562 for (var p in b) { 30563 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 30564 } 30565 }; 30566 return _extendStatics(d, b); 30567 }; 30568 return function (d, b) { 30569 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 30570 _extendStatics(d, b); 30571 function __() { 30572 this.constructor = d; 30573 } 30574 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 30575 }; 30576}(); 30577Object.defineProperty(exports, "__esModule", { value: true }); 30578exports.MDCFixedTopAppBarFoundation = void 0; 30579var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts"); 30580var foundation_1 = __webpack_require__(/*! ../standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"); 30581var MDCFixedTopAppBarFoundation = /** @class */function (_super) { 30582 __extends(MDCFixedTopAppBarFoundation, _super); 30583 function MDCFixedTopAppBarFoundation() { 30584 var _this = _super !== null && _super.apply(this, arguments) || this; 30585 /** 30586 * State variable for the previous scroll iteration top app bar state 30587 */ 30588 _this.wasScrolled
30588_ = false; 30589 return _this; 30590 } 30591 /** 30592 * Scroll handler for applying/removing the modifier class on the fixed top app bar. 30593 * @override 30594 */ 30595 MDCFixedTopAppBarFoundation.prototype.handleTargetScroll = function () { 30596 var currentScroll = this.adapter.getViewportScrollY(); 30597 if (currentScroll <= 0) { 30598 if (this.wasScrolled_) { 30599 this.adapter.removeClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS); 30600 this.wasScrolled_ = false; 30601 } 30602 } else { 30603 if (!this.wasScrolled_) { 30604 this.adapter.addClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS); 30605 this.wasScrolled_
vendor: 12,340 bytes, lines 30605-30882
30605 = true; 30606 } 30607 } 30608 }; 30609 return MDCFixedTopAppBarFoundation; 30610}(foundation_1.MDCTopAppBarFoundation); 30611exports.MDCFixedTopAppBarFoundation = MDCFixedTopAppBarFoundation; 30612// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 30613exports.default = MDCFixedTopAppBarFoundation; 30614 30615/***/ }), 30616 30617/***/ "./packages/mdc-top-app-bar/foundation.ts": 30618/*!************************************************!*\ 30619 !*** ./packages/mdc-top-app-bar/foundation.ts ***! 30620 \************************************************/ 30621/*! no static exports found */ 30622/***/ (function(module, exports, __webpack_require__) { 30623 30624"use strict"; 30625 30626/** 30627 * @license 30628 * Copyright 2018 Google Inc. 30629 * 30630 * Permission is hereby granted, free of charge, to any person obtaining a copy 30631 * of this software and associated documentation files (the "Software"), to deal 30632 * in the Software without restriction, including without limitation the rights 30633 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30634 * copies of the Software, and to permit persons to whom the Software is 30635 * furnished to do so, subject to the following conditions: 30636 * 30637 * The above copyright notice and this permission notice shall be included in 30638 * all copies or substantial portions of the Software. 30639 * 30640 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30641 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30642 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30643 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30644 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30645 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30646 * THE SOFTWARE. 30647 */ 30648 30649var __extends = this && this.__extends || function () { 30650 var _extendStatics = function extendStatics(d, b) { 30651 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 30652 d.__proto__ = b; 30653 } || function (d, b) { 30654 for (var p in b) { 30655 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 30656 } 30657 }; 30658 return _extendStatics(d, b); 30659 }; 30660 return function (d, b) { 30661 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 30662 _extendStatics(d, b); 30663 function __() { 30664 this.constructor = d; 30665 } 30666 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 30667 }; 30668}(); 30669var __assign = this && this.__assign || function () { 30670 __assign = Object.assign || function (t) { 30671 for (var s, i = 1, n = arguments.length; i < n; i++) { 30672 s = arguments[i]; 30673 for (var p in s) { 30674 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 30675 } 30676 } 30677 return t; 30678 }; 30679 return __assign.apply(this, arguments); 30680}; 30681Object.defineProperty(exports, "__esModule", { value: true }); 30682exports.MDCTopAppBarBaseFoundation = void 0; 30683var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); 30684var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"); 30685var MDCTopAppBarBaseFoundation = /** @class */function (_super) { 30686 __extends(MDCTopAppBarBaseFoundation, _super); 30687 /* istanbul ignore next: optional argument is not a branch statement */ 30688 function MDCTopAppBarBaseFoundation(adapter) { 30689 return _super.call(this, __assign(__assign({}, MDCTopAppBarBaseFoundation.defaultAdapter), adapter)) || this; 30690 } 30691 Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", { 30692 get: function get() { 30693 return constants_1.strings; 30694 }, 30695 enumerable: false, 30696 configurable: true 30697 }); 30698 Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", { 30699 get: function get() { 30700 return constants_1.cssClasses; 30701 }, 30702 enumerable: false, 30703 configurable: true 30704 }); 30705 Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", { 30706 get: function get() { 30707 return constants_1.numbers; 30708 }, 30709 enumerable: false, 30710 configurable: true 30711 }); 30712 Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", { 30713 /** 30714 * See {@link MDCTopAppBarAdapter} for typing information on parameters and return types. 30715 */ 30716 get: function get() { 30717 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. 30718 return { 30719 addClass: function addClass() { 30720 return undefined; 30721 }, 30722 removeClass: function removeClass() { 30723 return undefined; 30724 }, 30725 hasClass: function hasClass() { 30726 return false; 30727 }, 30728 setStyle: function setStyle() { 30729 return undefined; 30730 }, 30731 getTopAppBarHeight: function getTopAppBarHeight() { 30732 return 0; 30733 }, 30734 notifyNavigationIconClicked: function notifyNavigationIconClicked() { 30735 return undefined; 30736 }, 30737 getViewportScrollY: function getViewportScrollY() { 30738 return 0; 30739 }, 30740 getTotalActionItems: function getTotalActionItems() { 30741 return 0; 30742 } 30743 }; 30744 // tslint:enable:object-literal-sort-keys 30745 }, 30746 enumerable: false, 30747 configurable: true 30748 }); 30749 /** Other variants of TopAppBar foundation overrides this method */ 30750 MDCTopAppBarBaseFoundation.prototype.handleTargetScroll = function () {}; // tslint:disable-line:no-empty 30751 /** Other variants of TopAppBar foundation overrides this method */ 30752 MDCTopAppBarBaseFoundation.prototype.handleWindowResize = function () {}; // tslint:disable-line:no-empty 30753 MDCTopAppBarBaseFoundation.prototype.handleNavigationClick = function () { 30754 this.adapter.notifyNavigationIconClicked(); 30755 }; 30756 return MDCTopAppBarBaseFoundation; 30757}(foundation_1.MDCFoundation); 30758exports.MDCTopAppBarBaseFoundation = MDCTopAppBarBaseFoundation; 30759// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 30760exports.default = MDCTopAppBarBaseFoundation; 30761 30762/***/ }), 30763 30764/***/ "./packages/mdc-top-app-bar/index.ts": 30765/*!*******************************************!*\ 30766 !*** ./packages/mdc-top-app-bar/index.ts ***! 30767 \*******************************************/ 30768/*! no static exports found */ 30769/***/ (function(module, exports, __webpack_require__) { 30770 30771"use strict"; 30772 30773/** 30774 * @license 30775 * Copyright 2019 Google Inc. 30776 * 30777 * Permission is hereby granted, free of charge, to any person obtaining a copy 30778 * of this software and associated documentation files (the "Software"), to deal 30779 * in the Software without restriction, including without limitation the rights 30780 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30781 * copies of the Software, and to permit persons to whom the Software is 30782 * furnished to do so, subject to the following conditions: 30783 * 30784 * The above copyright notice and this permission notice shall be included in 30785 * all copies or substantial portions of the Software. 30786 * 30787 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30788 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30789 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30790 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30791 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30792 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30793 * THE SOFTWARE. 30794 */ 30795 30796var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 30797 if (k2 === undefined) k2 = k; 30798 Object.defineProperty(o, k2, { enumerable: true, get: function get() { 30799 return m[k]; 30800 } }); 30801} : function (o, m, k, k2) { 30802 if (k2 === undefined) k2 = k; 30803 o[k2] = m[k]; 30804}); 30805var __exportStar = this && this.__exportStar || function (m, exports) { 30806 for (var p in m) { 30807 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 30808 } 30809}; 30810Object.defineProperty(exports, "__esModule", { value: true }); 30811__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-top-app-bar/adapter.ts"), exports); 30812__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-top-app-bar/component.ts"), exports); 30813__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"), exports); 30814__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-top-app-bar/foundation.ts"), exports); 30815__exportStar(__webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts"), exports); 30816__exportStar(__webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts"), exports); 30817__exportStar(__webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"), exports); 30818 30819/***/ }), 30820 30821/***/ "./packages/mdc-top-app-bar/short/foundation.ts": 30822/*!******************************************************!*\ 30823 !*** ./packages/mdc-top-app-bar/short/foundation.ts ***! 30824 \******************************************************/ 30825/*! no static exports found */ 30826/***/ (function(module, exports, __webpack_require__) { 30827 30828"use strict"; 30829 30830/** 30831 * @license 30832 * Copyright 2018 Google Inc. 30833 * 30834 * Permission is hereby granted, free of charge, to any person obtaining a copy 30835 * of this software and associated documentation files (the "Software"), to deal 30836 * in the Software without restriction, including without limitation the rights 30837 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30838 * copies of the Software, and to permit persons to whom the Software is 30839 * furnished to do so, subject to the following conditions: 30840 * 30841 * The above copyright notice and this permission notice shall be included in 30842 * all copies or substantial portions of the Software. 30843 * 30844 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30845 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30846 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30847 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30848 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30849 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30850 * THE SOFTWARE. 30851 */ 30852 30853var __extends = this && this.__extends || function () { 30854 var _extendStatics = function extendStatics(d, b) { 30855 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 30856 d.__proto__ = b; 30857 } || function (d, b) { 30858 for (var p in b) { 30859 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 30860 } 30861 }; 30862 return _extendStatics(d, b); 30863 }; 30864 return function (d, b) { 30865 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 30866 _extendStatics(d, b); 30867 function __() { 30868 this.constructor = d; 30869 } 30870 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 30871 }; 30872}(); 30873Object.defineProperty(exports, "__esModule", { value: true }); 30874exports.MDCShortTopAppBarFoundation = void 0; 30875var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts"); 30876var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts"); 30877var MDCShortTopAppBarFoundation = /** @class */function (_super) { 30878 __extends(MDCShortTopAppBarFoundation, _super); 30879 /* istanbul ignore next: optional argument is not a branch statement */ 30880 function MDCShortTopAppBarFoundation(adapter) { 30881 var _this = _super.call(this, adapter) || this; 30882 _this.
30882isCollapsed_ = false; 30883 _this.isAlwaysCollapsed_ = false; 30884 return _this; 30885 } 30886 Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", { 30887 // Public visibility for backward compatibility. 30888 get: function get() { 30889 return this.isCollapsed_; 30890 }, 30891 enumerable: false, 30892 configurable: true 30893 }); 30894 MDCShortTopAppBarFoundation.prototype.init = function () { 30895 _super.prototype.init.call(this); 30896 if (this.adapter.getTotalActionItems() > 0) {
vendor: 1,740 bytes, lines 30897-30941
30897 this.adapter.addClass(constants_1.cssClasses.SHORT_HAS_ACTION_ITEM_CLASS); 30898 } 30899 // If initialized with SHORT_COLLAPSED_CLASS, the bar should always be collapsed 30900 this.setAlwaysCollapsed(this.adapter.hasClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS)); 30901 }; 30902 /** 30903 * Set if the short top app bar should always be collapsed. 30904 * 30905 * @param value When `true`, bar will always be collapsed. When `false`, bar may collapse or expand based on scroll. 30906 */ 30907 MDCShortTopAppBarFoundation.prototype.setAlwaysCollapsed = function (value) { 30908 this.isAlwaysCollapsed_ = !!value; 30909 if (this.isAlwaysCollapsed_) { 30910 this.collapse_(); 30911 } else { 30912 // let maybeCollapseBar_ determine if the bar should be collapsed 30913 this.maybeCollapseBar_(); 30914 } 30915 }; 30916 MDCShortTopAppBarFoundation.prototype.getAlwaysCollapsed = function () { 30917 return this.isAlwaysCollapsed_; 30918 }; 30919 /** 30920 * Scroll handler for applying/removing the collapsed modifier class on the short top app bar. 30921 * @override 30922 */ 30923 MDCShortTopAppBarFoundation.prototype.handleTargetScroll = function () { 30924 this.maybeCollapseBar_(); 30925 }; 30926 MDCShortTopAppBarFoundation.prototype.maybeCollapseBar_ = function () { 30927 if (this.isAlwaysCollapsed_) { 30928 return; 30929 } 30930 var currentScroll = this.adapter.getViewportScrollY(); 30931 if (currentScroll <= 0) { 30932 if (this.isCollapsed_) { 30933 this.uncollapse_(); 30934 } 30935 } else { 30936 if (!this.isCollapsed_) { 30937 this.collapse_(); 30938 } 30939 } 30940 }; 30941 MDCShortTopAppBarFoundation.prototype.uncollapse_ = function () {
30942 this.adapter.removeClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS); 30943 this.isCollapsed_ = false; 30944 }; 30945 MDCShortTopAppBarFoundation.prototype.collapse_ = function () { 30946 this.adapter.addClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS); 30947 this.isCollapsed_ = true; 30948 }; 30949 return MDCShortTopAppBarFoundation; 30950}(foundation_1.MDCTopAppBarBaseFoundation); 30951exports.MDCShortTopAppBarFoundation = MDCShortTopAppBarFoundation; 30952// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 30953exports.default = MDCShortTopAppBarFoundation; 30954 30955/***/ }), 30956
vendor: 8,523 bytes, lines 30957-31143
30957/***/ "./packages/mdc-top-app-bar/standard/foundation.ts": 30958/*!*********************************************************!*\ 30959 !*** ./packages/mdc-top-app-bar/standard/foundation.ts ***! 30960 \*********************************************************/ 30961/*! no static exports found */ 30962/***/ (function(module, exports, __webpack_require__) { 30963 30964"use strict"; 30965 30966/** 30967 * @license 30968 * Copyright 2018 Google Inc. 30969 * 30970 * Permission is hereby granted, free of charge, to any person obtaining a copy 30971 * of this software and associated documentation files (the "Software"), to deal 30972 * in the Software without restriction, including without limitation the rights 30973 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30974 * copies of the Software, and to permit persons to whom the Software is 30975 * furnished to do so, subject to the following conditions: 30976 * 30977 * The above copyright notice and this permission notice shall be included in 30978 * all copies or substantial portions of the Software. 30979 * 30980 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30981 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30982 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30983 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30984 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30985 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30986 * THE SOFTWARE. 30987 */ 30988 30989var __extends = this && this.__extends || function () { 30990 var _extendStatics = function extendStatics(d, b) { 30991 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { 30992 d.__proto__ = b; 30993 } || function (d, b) { 30994 for (var p in b) { 30995 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 30996 } 30997 }; 30998 return _extendStatics(d, b); 30999 }; 31000 return function (d, b) { 31001 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 31002 _extendStatics(d, b); 31003 function __() { 31004 this.constructor = d; 31005 } 31006 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 31007 }; 31008}(); 31009Object.defineProperty(exports, "__esModule", { value: true }); 31010exports.MDCTopAppBarFoundation = void 0; 31011var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts"); 31012var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts"); 31013var INITIAL_VALUE = 0; 31014var MDCTopAppBarFoundation = /** @class */function (_super) { 31015 __extends(MDCTopAppBarFoundation, _super); 31016 /* istanbul ignore next: optional argument is not a branch statement */ 31017 function MDCTopAppBarFoundation(adapter) { 31018 var _this = _super.call(this, adapter) || this; 31019 /** 31020 * Indicates if the top app bar was docked in the previous scroll handler iteration. 31021 */ 31022 _this.wasDocked_ = true; 31023 /** 31024 * Indicates if the top app bar is docked in the fully shown position. 31025 */ 31026 _this.isDockedShowing_ = true; 31027 /** 31028 * Variable for current scroll position of the top app bar 31029 */ 31030 _this.currentAppBarOffsetTop_ = 0; 31031 /** 31032 * Used to prevent the top app bar from being scrolled out of view during resize events 31033 */ 31034 _this.isCurrentlyBeingResized_ = false; 31035 /** 31036 * The timeout that's used to throttle the resize events 31037 */ 31038 _this.resizeThrottleId_ = INITIAL_VALUE; 31039 /** 31040 * The timeout that's used to debounce toggling the isCurrentlyBeingResized_ variable after a resize 31041 */ 31042 _this.resizeDebounceId_ = INITIAL_VALUE; 31043 _this.lastScrollPosition_ = _this.adapter.getViewportScrollY(); 31044 _this.topAppBarHeight_ = _this.adapter.getTopAppBarHeight(); 31045 return _this; 31046 } 31047 MDCTopAppBarFoundation.prototype.destroy = function () { 31048 _super.prototype.destroy.call(this); 31049 this.adapter.setStyle('top', ''); 31050 }; 31051 /** 31052 * Scroll handler for the default scroll behavior of the top app bar. 31053 * @override 31054 */ 31055 MDCTopAppBarFoundation.prototype.handleTargetScroll = function () { 31056 var currentScrollPosition = Math.max(this.adapter.getViewportScrollY(), 0); 31057 var diff = currentScrollPosition - this.lastScrollPosition_; 31058 this.lastScrollPosition_ = currentScrollPosition; 31059 // If the window is being resized the lastScrollPosition_ needs to be updated but the 31060 // current scroll of the top app bar should stay in the same position. 31061 if (!this.isCurrentlyBeingResized_) { 31062 this.currentAppBarOffsetTop_ -= diff; 31063 if (this.currentAppBarOffsetTop_ > 0) { 31064 this.currentAppBarOffsetTop_ = 0; 31065 } else if (Math.abs(this.currentAppBarOffsetTop_) > this.topAppBarHeight_) { 31066 this.currentAppBarOffsetTop_ = -this.topAppBarHeight_; 31067 } 31068 this.moveTopAppBar_(); 31069 } 31070 }; 31071 /** 31072 * Top app bar resize handler that throttle/debounce functions that execute updates. 31073 * @override 31074 */ 31075 MDCTopAppBarFoundation.prototype.handleWindowResize = function () { 31076 var _this = this; 31077 // Throttle resize events 10 p/s 31078 if (!this.resizeThrottleId_) { 31079 this.resizeThrottleId_ = setTimeout(function () { 31080 _this.resizeThrottleId_ = INITIAL_VALUE; 31081 _this.throttledResizeHandler_(); 31082 }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS); 31083 } 31084 this.isCurrentlyBeingResized_ = true; 31085 if (this.resizeDebounceId_) { 31086 clearTimeout(this.resizeDebounceId_); 31087 } 31088 this.resizeDebounceId_ = setTimeout(function () { 31089 _this.handleTargetScroll(); 31090 _this.isCurrentlyBeingResized_ = false; 31091 _this.resizeDebounceId_ = INITIAL_VALUE; 31092 }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS); 31093 }; 31094 /** 31095 * Function to determine if the DOM needs to update. 31096 */ 31097 MDCTopAppBarFoundation.prototype.checkForUpdate_ = function () { 31098 var offscreenBoundaryTop = -this.topAppBarHeight_; 31099 var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop_ < 0; 31100 var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop_ > offscreenBoundaryTop; 31101 var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen; 31102 // If it's partially showing, it can't be docked. 31103 if (partiallyShowing) { 31104 this.wasDocked_ = false; 31105 } else { 31106 // Not previously docked and not partially showing, it's now docked. 31107 if (!this.wasDocked_) { 31108 this.wasDocked_ = true; 31109 return true; 31110 } else if (this.isDockedShowing_ !== hasAnyPixelsOnscreen) { 31111 this.isDockedShowing_ = hasAnyPixelsOnscreen; 31112 return true; 31113 } 31114 } 31115 return partiallyShowing; 31116 }; 31117 /** 31118 * Function to move the top app bar if needed. 31119 */ 31120 MDCTopAppBarFoundation.prototype.moveTopAppBar_ = function () { 31121 if (this.checkForUpdate_()) { 31122 // Once the top app bar is fully hidden we use the max potential top app bar height as our offset 31123 // so the top app bar doesn't show if the window resizes and the new height > the old height. 31124 var offset = this.currentAppBarOffsetTop_; 31125 if (Math.abs(offset) >= this.topAppBarHeight_) { 31126 offset = -constants_1.numbers.MAX_TOP_APP_BAR_HEIGHT; 31127 } 31128 this.adapter.setStyle('top', offset + 'px'); 31129 } 31130 }; 31131 /** 31132 * Throttled function that updates the top app bar scrolled values if the 31133 * top app bar height changes. 31134 */ 31135 MDCTopAppBarFoundation.prototype.throttledResizeHandler_ = function () { 31136 var currentHeight = this.adapter.getTopAppBarHeight(); 31137 if (this.topAppBarHeight_ !== currentHeight) { 31138 this.wasDocked_ = false; 31139 // Since the top app bar has a different height depending on the screen width, this 31140 // will ensure that the top app bar remains in the correct location if 31141 // completely hidden and a resize makes the top app bar a different height. 31142 this.currentAppBarOffsetTop_ -= this.topAppBarHeight_ - currentHeight; 31143 this.topAppBarHeight_
vendor: 441 bytes, lines 31143-31157
31143 = currentHeight; 31144 } 31145 this.handleTargetScroll(); 31146 }; 31147 return MDCTopAppBarFoundation; 31148}(foundation_1.MDCTopAppBarBaseFoundation); 31149exports.MDCTopAppBarFoundation = MDCTopAppBarFoundation; 31150// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. 31151exports.default = MDCTopAppBarFoundation; 31152 31153/***/ }) 31154 31155/******/ }); 31156}); 31157//# 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.