(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["vendor"],{ /***/ "./node_modules/@angular-mdc/web/esm5/base.es5.js": /*!********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/base.es5.js ***! \********************************************************/ /*! exports provided: MDCComponent */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCComponent", function() { return MDCComponent; }); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template FoundationType */ var /** * @template FoundationType */ MDCComponent = /** @class */ (function () { function MDCComponent(elementRef, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this._elementRef = elementRef; this.initialize.apply(this, args); // Note that we initialize foundation here and not within the constructor's default param. this._foundation = foundation === undefined ? this.getDefaultFoundation() : foundation; } /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ /** * @param {...?} _args * @return {?} */ MDCComponent.prototype.initialize = /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ /** * @param {...?} _args * @return {?} */ function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; /** * @return {?} */ MDCComponent.prototype.getDefaultFoundation = /** * @return {?} */ function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; /** * @return {?} */ MDCComponent.prototype.destroy = /** * @return {?} */ function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this._foundation.destroy(); }; return MDCComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=base.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/button.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/button.es5.js ***! \**********************************************************/ /*! exports provided: MdcButton, MdcButtonLabel, MdcButtonModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcButton", function() { return MdcButton; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcButtonLabel", function() { return MdcButtonLabel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcButtonModule", function() { return MdcButtonModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /* harmony import */ var _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/icon */ "./node_modules/@angular-mdc/web/esm5/icon.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcButtonLabel = /** @class */ (function () { function MdcButtonLabel() { } MdcButtonLabel.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-button-label, [mdcButtonLabel]', exportAs: 'mdcButtonLabel', host: { 'class': 'mdc-button__label' } },] }, ]; return MdcButtonLabel; }()); var MdcButton = /** @class */ (function () { function MdcButton(elementRef, _ripple) { this.elementRef = elementRef; this._ripple = _ripple; this._raised = false; this._primary = false; this._dense = false; this._secondary = false; this._unelevated = false; this._outlined = false; this._disabled = false; } Object.defineProperty(MdcButton.prototype, "raised", { get: /** * @return {?} */ function () { return this._raised; }, set: /** * @param {?} value * @return {?} */ function (value) { this._raised = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcButton.prototype, "primary", { get: /** * @return {?} */ function () { return this._primary; }, set: /** * @param {?} value * @return {?} */ function (value) { this._primary = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcButton.prototype, "dense", { get: /** * @return {?} */ function () { return this._dense; }, set: /** * @param {?} value * @return {?} */ function (value) { this._dense = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcButton.prototype, "secondary", { get: /** * @return {?} */ function () { return this._secondary; }, set: /** * @param {?} value * @return {?} */ function (value) { this._secondary = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcButton.prototype, "unelevated", { get: /** * @return {?} */ function () { return this._unelevated; }, set: /** * @param {?} value * @return {?} */ function (value) { this._unelevated = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcButton.prototype, "outlined", { get: /** * @return {?} */ function () { return this._outlined; }, set: /** * @param {?} value * @return {?} */ function (value) { this._outlined = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcButton.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setDisabled(value); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcButton.prototype.ngOnInit = /** * @return {?} */ function () { if (this._icon) { this._icon.elementRef.nativeElement.classList.add('mdc-button__icon'); } this._ripple.init({ surface: this.getHostElement() }); }; /** * @return {?} */ MdcButton.prototype.ngOnDestroy = /** * @return {?} */ function () { this._ripple.destroy(); }; /** * @param {?} disabled * @return {?} */ MdcButton.prototype.setDisabled = /** * @param {?} disabled * @return {?} */ function (disabled) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(disabled); if (this._disabled) { this.getHostElement().setAttribute('disabled', 'true'); this.getHostElement().setAttribute('aria-disabled', 'true'); } else { this.getHostElement().removeAttribute('disabled'); this.getHostElement().removeAttribute('aria-disabled'); } }; /** Focuses the button. */ /** * Focuses the button. * @return {?} */ MdcButton.prototype.focus = /** * Focuses the button. * @return {?} */ function () { this.getHostElement().focus(); }; /** * @return {?} */ MdcButton.prototype.getHostElement = /** * @return {?} */ function () { return this.elementRef.nativeElement; }; /** * @param {?} event * @return {?} */ MdcButton.prototype.onClick = /** * @param {?} event * @return {?} */ function (event) { // A disabled button shouldn't apply any actions if (this.disabled) { event.preventDefault(); event.stopImmediatePropagation(); } }; MdcButton.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{exportAs: 'mdcButton', selector: 'button[mdc-button], a[mdc-button]', host: { '[tabIndex]': 'disabled ? -1 : 0', 'class': 'mdc-button', '[class.ngx-mdc-button--primary]': 'primary', '[class.ngx-mdc-button--secondary]': 'secondary', '[class.mdc-button--raised]': 'raised', '[class.mdc-button--dense]': 'dense', '[class.mdc-button--unelevated]': 'unelevated', '[class.mdc-button--outlined]': 'outlined', '(click)': 'onClick($event)' }, template: "\n {{label}}\n \n ", providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_3__["MdcRipple"]], encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcButton.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_3__["MdcRipple"] } ]; }; MdcButton.propDecorators = { raised: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], primary: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], dense: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], secondary: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], unelevated: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], outlined: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], _icon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [_angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_4__["MdcIcon"],] }], label: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcButton; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcButtonModule = /** @class */ (function () { function MdcButtonModule() { } MdcButtonModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"] ], exports: [MdcButton, MdcButtonLabel], declarations: [MdcButton, MdcButtonLabel] },] }, ]; return MdcButtonModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=button.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/card.es5.js": /*!********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/card.es5.js ***! \********************************************************/ /*! exports provided: MdcCard, MdcCardAction, MdcCardActionButtons, MdcCardActionIcons, MdcCardActions, MdcCardMedia, MdcCardMediaContent, MdcCardModule, MdcCardPrimaryAction */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCard", function() { return MdcCard; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCardAction", function() { return MdcCardAction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCardActionButtons", function() { return MdcCardActionButtons; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCardActionIcons", function() { return MdcCardActionIcons; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCardActions", function() { return MdcCardActions; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCardMedia", function() { return MdcCardMedia; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCardMediaContent", function() { return MdcCardMediaContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCardModule", function() { return MdcCardModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCardPrimaryAction", function() { return MdcCardPrimaryAction; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcCardMediaContent = /** @class */ (function () { function MdcCardMediaContent(elementRef) { this.elementRef = elementRef; } MdcCardMediaContent.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-card-media-content, [mdcCardMediaContent]', exportAs: 'mdcCardMediaContent', host: { 'class': 'mdc-card__media-content' } },] }, ]; /** @nocollapse */ MdcCardMediaContent.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcCardMediaContent; }()); var MdcCardMedia = /** @class */ (function () { function MdcCardMedia(elementRef) { this.elementRef = elementRef; this._square = false; this._wide = false; } Object.defineProperty(MdcCardMedia.prototype, "square", { get: /** * @return {?} */ function () { return this._square; }, set: /** * @param {?} value * @return {?} */ function (value) { this._square = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcCardMedia.prototype, "wide", { get: /** * @return {?} */ function () { return this._wide; }, set: /** * @param {?} value * @return {?} */ function (value) { this._wide = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__["toBoolean"])(value); }, enumerable: true, configurable: true }); MdcCardMedia.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-card-media, [mdcCardMedia]', exportAs: 'mdcCardMedia', host: { 'class': 'mdc-card__media', '[class.mdc-card__media--square]': 'square', '[class.mdc-card__media--16-9]': 'wide' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcCardMedia.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcCardMedia.propDecorators = { square: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], wide: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcCardMedia; }()); var MdcCardPrimaryAction = /** @class */ (function () { function MdcCardPrimaryAction(_ripple, elementRef) { this._ripple = _ripple; this.elementRef = elementRef; this._ripple.init({ surface: this.elementRef.nativeElement }); } /** * @return {?} */ MdcCardPrimaryAction.prototype.ngOnDestroy = /** * @return {?} */ function () { this._ripple.destroy(); }; MdcCardPrimaryAction.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-card-primary-action, [mdcCardPrimaryAction]', exportAs: 'mdcCardPrimaryAction', host: { 'class': 'mdc-card__primary-action' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_2__["MdcRipple"]] },] }, ]; /** @nocollapse */ MdcCardPrimaryAction.ctorParameters = function () { return [ { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_2__["MdcRipple"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcCardPrimaryAction; }()); var MdcCardActions = /** @class */ (function () { function MdcCardActions(elementRef) { this.elementRef = elementRef; this._fullBleed = false; } Object.defineProperty(MdcCardActions.prototype, "fullBleed", { get: /** * @return {?} */ function () { return this._fullBleed; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fullBleed = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__["toBoolean"])(value); }, enumerable: true, configurable: true }); MdcCardActions.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-card-actions, [mdcCardActions]', template: '', exportAs: 'mdcCardActions', host: { 'class': 'mdc-card__actions', '[class.mdc-card__actions--full-bleed]': 'fullBleed' }, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcCardActions.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcCardActions.propDecorators = { fullBleed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcCardActions; }()); var MdcCardActionButtons = /** @class */ (function () { function MdcCardActionButtons(elementRef) { this.elementRef = elementRef; } MdcCardActionButtons.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-card-action-buttons, [mdcCardActionButtons]', exportAs: 'mdcCardActionButtons', host: { 'class': 'mdc-card__action-buttons' } },] }, ]; /** @nocollapse */ MdcCardActionButtons.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcCardActionButtons; }()); var MdcCardActionIcons = /** @class */ (function () { function MdcCardActionIcons(elementRef) { this.elementRef = elementRef; } MdcCardActionIcons.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-card-action-icons, [mdcCardActionIcons]', exportAs: 'mdcCardActionIcons', host: { 'class': 'mdc-card__action-icons' } },] }, ]; /** @nocollapse */ MdcCardActionIcons.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcCardActionIcons; }()); var MdcCardAction = /** @class */ (function () { function MdcCardAction(elementRef) { this.elementRef = elementRef; this._action = ''; } Object.defineProperty(MdcCardAction.prototype, "action", { get: /** * @return {?} */ function () { return this._action; }, set: /** * @param {?} action * @return {?} */ function (action) { // If the directive is set without a name (updated programatically), then this setter will // trigger with an empty string and should not overwrite the programatically set value. if (!action) { return; } if (action === 'button') { this.elementRef.nativeElement.classList.remove('mdc-card__action--icon'); this.elementRef.nativeElement.classList.add('mdc-card__action--button'); } else if (action === 'icon') { this.elementRef.nativeElement.classList.remove('mdc-card__action--button'); this.elementRef.nativeElement.classList.add('mdc-card__action--icon'); this.elementRef.nativeElement.setAttribute('tabIndex', '0'); this.elementRef.nativeElement.setAttribute('role', 'button'); } this._action = action; }, enumerable: true, configurable: true }); MdcCardAction.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcCardAction]', host: { 'class': 'mdc-card__action' } },] }, ]; /** @nocollapse */ MdcCardAction.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcCardAction.propDecorators = { action: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['mdcCardAction',] }] }; return MdcCardAction; }()); var MdcCard = /** @class */ (function () { function MdcCard(elementRef) { this.elementRef = elementRef; this._outlined = false; } Object.defineProperty(MdcCard.prototype, "outlined", { get: /** * @return {?} */ function () { return this._outlined; }, set: /** * @param {?} value * @return {?} */ function (value) { this._outlined = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__["toBoolean"])(value); }, enumerable: true, configurable: true }); MdcCard.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-card', exportAs: 'mdcCard', host: { 'class': 'mdc-card', '[class.mdc-card--outlined]': 'outlined' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcCard.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcCard.propDecorators = { outlined: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcCard; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var CARD_DECLARATIONS = [ MdcCard, MdcCardAction, MdcCardActionButtons, MdcCardActionIcons, MdcCardActions, MdcCardMedia, MdcCardMediaContent, MdcCardPrimaryAction ]; var MdcCardModule = /** @class */ (function () { function MdcCardModule() { } MdcCardModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: CARD_DECLARATIONS, declarations: CARD_DECLARATIONS, },] }, ]; return MdcCardModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=card.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/checkbox.es5.js": /*!************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/checkbox.es5.js ***! \************************************************************/ /*! exports provided: MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR, MdcCheckbox, MdcCheckboxChange, MdcCheckboxModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR", function() { return MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCheckbox", function() { return MdcCheckbox; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCheckboxChange", function() { return MdcCheckboxChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCheckboxModule", function() { return MdcCheckboxModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/form-field */ "./node_modules/@angular-mdc/web/esm5/form-field.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var jsEventTypeMap = { animationend: { cssProperty: 'animation', prefixed: 'webkitAnimationEnd', standard: 'animationend' }, animationiteration: { cssProperty: 'animation', prefixed: 'webkitAnimationIteration', standard: 'animationiteration' }, animationstart: { cssProperty: 'animation', prefixed: 'webkitAnimationStart', standard: 'animationstart' }, transitionend: { cssProperty: 'transition', prefixed: 'webkitTransitionEnd', standard: 'transitionend' } }; function isWindow(windowObj) { return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; } function getCorrectEventName(windowObj, eventType) { if (isWindow(windowObj) && eventType in jsEventTypeMap) { var el = windowObj.document.createElement('div'); var _a = jsEventTypeMap[eventType], standard = _a.standard, prefixed = _a.prefixed, cssProperty = _a.cssProperty; var isStandard = cssProperty in el.style; return isStandard ? standard : prefixed; } return eventType; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate', ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked', ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked', ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked', ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked', ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate', CHECKED: 'mdc-checkbox--checked', DISABLED: 'mdc-checkbox--disabled', INDETERMINATE: 'mdc-checkbox--indeterminate', UPGRADED: 'mdc-checkbox--upgraded' }; var strings$1 = { ARIA_CHECKED_ATTR: 'aria-checked', ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed', NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control', TRANSITION_STATE_CHECKED: 'checked', TRANSITION_STATE_INDETERMINATE: 'indeterminate', TRANSITION_STATE_INIT: 'init', TRANSITION_STATE_UNCHECKED: 'unchecked' }; var numbers$1 = { ANIM_END_LATCH_MS: 250 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCCheckboxFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCCheckboxFoundation, _super); function MDCCheckboxFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCCheckboxFoundation.defaultAdapter, adapter)) || this; _this.currentCheckState_ = strings$1.TRANSITION_STATE_INIT; _this.currentAnimationClass_ = ''; _this.animEndLatchTimer_ = 0; _this.enableAnimationEndHandler_ = false; return _this; } Object.defineProperty(MDCCheckboxFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckboxFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckboxFoundation, "numbers", { get: function get() { return numbers$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, forceLayout: function forceLayout() { return undefined; }, hasNativeControl: function hasNativeControl() { return false; }, isAttachedToDOM: function isAttachedToDOM() { return false; }, isChecked: function isChecked() { return false; }, isIndeterminate: function isIndeterminate() { return false; }, removeClass: function removeClass() { return undefined; }, removeNativeControlAttr: function removeNativeControlAttr() { return undefined; }, setNativeControlAttr: function setNativeControlAttr() { return undefined; }, setNativeControlDisabled: function setNativeControlDisabled() { return undefined; } }; }, enumerable: true, configurable: true }); MDCCheckboxFoundation.prototype.init = function () { this.currentCheckState_ = this.determineCheckState_(); this.updateAriaChecked_(); this.adapter_.addClass(cssClasses$1.UPGRADED); }; MDCCheckboxFoundation.prototype.destroy = function () { clearTimeout(this.animEndLatchTimer_); }; MDCCheckboxFoundation.prototype.setDisabled = function (disabled) { this.adapter_.setNativeControlDisabled(disabled); if (disabled) { this.adapter_.addClass(cssClasses$1.DISABLED); } else { this.adapter_.removeClass(cssClasses$1.DISABLED); } }; /** * Handles the animationend event for the checkbox */ MDCCheckboxFoundation.prototype.handleAnimationEnd = function () { var _this = this; if (!this.enableAnimationEndHandler_) { return; } clearTimeout(this.animEndLatchTimer_); this.animEndLatchTimer_ = setTimeout(function () { _this.adapter_.removeClass(_this.currentAnimationClass_); _this.enableAnimationEndHandler_ = false; }, numbers$1.ANIM_END_LATCH_MS); }; /** * Handles the change event for the checkbox */ MDCCheckboxFoundation.prototype.handleChange = function () { this.transitionCheckState_(); }; MDCCheckboxFoundation.prototype.transitionCheckState_ = function () { if (!this.adapter_.hasNativeControl()) { return; } var oldState = this.currentCheckState_; var newState = this.determineCheckState_(); if (oldState === newState) { return; } this.updateAriaChecked_(); // Check to ensure that there isn't a previously existing animation class, in case for example // the user interacted with the checkbox before the animation was finished. if (this.currentAnimationClass_.length > 0) { clearTimeout(this.animEndLatchTimer_); this.adapter_.forceLayout(); this.adapter_.removeClass(this.currentAnimationClass_); } this.currentAnimationClass_ = this.getTransitionAnimationClass_(oldState, newState); this.currentCheckState_ = newState; // Check for parentNode so that animations are only run when the element is attached // to the DOM. if (this.adapter_.isAttachedToDOM() && this.currentAnimationClass_.length > 0) { this.adapter_.addClass(this.currentAnimationClass_); this.enableAnimationEndHandler_ = true; } }; MDCCheckboxFoundation.prototype.determineCheckState_ = function () { var TRANSITION_STATE_INDETERMINATE = strings$1.TRANSITION_STATE_INDETERMINATE, TRANSITION_STATE_CHECKED = strings$1.TRANSITION_STATE_CHECKED, TRANSITION_STATE_UNCHECKED = strings$1.TRANSITION_STATE_UNCHECKED; if (this.adapter_.isIndeterminate()) { return TRANSITION_STATE_INDETERMINATE; } return this.adapter_.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED; }; MDCCheckboxFoundation.prototype.getTransitionAnimationClass_ = function (oldState, newState) { var TRANSITION_STATE_INIT = strings$1.TRANSITION_STATE_INIT, TRANSITION_STATE_CHECKED = strings$1.TRANSITION_STATE_CHECKED, TRANSITION_STATE_UNCHECKED = strings$1.TRANSITION_STATE_UNCHECKED; var _a = MDCCheckboxFoundation.cssClasses, ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED, ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE, ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED, ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE, ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED, ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED; switch (oldState) { case TRANSITION_STATE_INIT: if (newState === TRANSITION_STATE_UNCHECKED) { return ''; } return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; case TRANSITION_STATE_UNCHECKED: return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE; case TRANSITION_STATE_CHECKED: return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE; default: // TRANSITION_STATE_INDETERMINATE return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; } }; MDCCheckboxFoundation.prototype.updateAriaChecked_ = function () { // Ensure aria-checked is set to mixed if checkbox is in indeterminate state. if (this.adapter_.isIndeterminate()) { this.adapter_.setNativeControlAttr(strings$1.ARIA_CHECKED_ATTR, strings$1.ARIA_CHECKED_INDETERMINATE_VALUE); } else { // The on/off state does not need to keep track of aria-checked, since // the screenreader uses the checked property on the checkbox element. this.adapter_.removeNativeControlAttr(strings$1.ARIA_CHECKED_ATTR); } }; return MDCCheckboxFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var CB_PROTO_PROPS = ['checked', 'indeterminate']; var MDCCheckbox = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCCheckbox, _super); function MDCCheckbox() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ripple_ = _this.createRipple_(); return _this; } MDCCheckbox.attachTo = function (root) { return new MDCCheckbox(root); }; Object.defineProperty(MDCCheckbox.prototype, "ripple", { get: function get() { return this.ripple_; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckbox.prototype, "checked", { get: function get() { return this.nativeControl_.checked; }, set: function set(checked) { this.nativeControl_.checked = checked; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckbox.prototype, "indeterminate", { get: function get() { return this.nativeControl_.indeterminate; }, set: function set(indeterminate) { this.nativeControl_.indeterminate = indeterminate; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckbox.prototype, "disabled", { get: function get() { return this.nativeControl_.disabled; }, set: function set(disabled) { this.foundation_.setDisabled(disabled); }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckbox.prototype, "value", { get: function get() { return this.nativeControl_.value; }, set: function set(value) { this.nativeControl_.value = value; }, enumerable: true, configurable: true }); MDCCheckbox.prototype.initialSyncWithDOM = function () { var _this = this; this.handleChange_ = function () { return _this.foundation_.handleChange(); }; this.handleAnimationEnd_ = function () { return _this.foundation_.handleAnimationEnd(); }; this.nativeControl_.addEventListener('change', this.handleChange_); this.listen(getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_); this.installPropertyChangeHooks_(); }; MDCCheckbox.prototype.destroy = function () { this.ripple_.destroy(); this.nativeControl_.removeEventListener('change', this.handleChange_); this.unlisten(getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_); this.uninstallPropertyChangeHooks_(); _super.prototype.destroy.call(this); }; MDCCheckbox.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, forceLayout: function forceLayout() { return _this.root_.offsetWidth; }, hasNativeControl: function hasNativeControl() { return !!_this.nativeControl_; }, isAttachedToDOM: function isAttachedToDOM() { return Boolean(_this.root_.parentNode); }, isChecked: function isChecked() { return _this.checked; }, isIndeterminate: function isIndeterminate() { return _this.indeterminate; }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, removeNativeControlAttr: function removeNativeControlAttr(attr) { return _this.nativeControl_.removeAttribute(attr); }, setNativeControlAttr: function setNativeControlAttr(attr, value) { return _this.nativeControl_.setAttribute(attr, value); }, setNativeControlDisabled: function setNativeControlDisabled(disabled) { return _this.nativeControl_.disabled = disabled; } }; return new MDCCheckboxFoundation(adapter); }; MDCCheckbox.prototype.createRipple_ = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCRipple.createAdapter(this), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.nativeControl_.removeEventListener(evtType, handler); }, isSurfaceActive: function isSurfaceActive() { return matches(_this.nativeControl_, ':active'); }, isUnbounded: function isUnbounded() { return true; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.nativeControl_.addEventListener(evtType, handler); } }); return new MDCRipple(this.root_, new MDCRippleFoundation(adapter)); }; MDCCheckbox.prototype.installPropertyChangeHooks_ = function () { var _this = this; var nativeCb = this.nativeControl_; var cbProto = Object.getPrototypeOf(nativeCb); CB_PROTO_PROPS.forEach(function (controlState) { var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); // We have to check for this descriptor, since some browsers (Safari) don't support its return. // See: https://bugs.webkit.org/show_bug.cgi?id=49739 if (!validDescriptor(desc)) { return; } // Type cast is needed for compatibility with Closure Compiler. var nativeGetter = desc.get; var nativeCbDesc = { configurable: desc.configurable, enumerable: desc.enumerable, get: nativeGetter, set: function set(state) { desc.set.call(nativeCb, state); _this.foundation_.handleChange(); } }; Object.defineProperty(nativeCb, controlState, nativeCbDesc); }); }; MDCCheckbox.prototype.uninstallPropertyChangeHooks_ = function () { var nativeCb = this.nativeControl_; var cbProto = Object.getPrototypeOf(nativeCb); CB_PROTO_PROPS.forEach(function (controlState) { var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); if (!validDescriptor(desc)) { return; } Object.defineProperty(nativeCb, controlState, desc); }); }; Object.defineProperty(MDCCheckbox.prototype, "nativeControl_", { get: function get() { var NATIVE_CONTROL_SELECTOR = MDCCheckboxFoundation.strings.NATIVE_CONTROL_SELECTOR; var el = this.root_.querySelector(NATIVE_CONTROL_SELECTOR); if (!el) { throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element"); } return el; }, enumerable: true, configurable: true }); return MDCCheckbox; }(MDCComponent); function validDescriptor(inputPropDesc) { return !!inputPropDesc && typeof inputPropDesc.set === 'function'; } /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var nextUniqueId = 0; /** * Change event object emitted by MdcCheckbox. */ var /** * Change event object emitted by MdcCheckbox. */ MdcCheckboxChange = /** @class */ (function () { function MdcCheckboxChange(source, checked) { this.source = source; this.checked = checked; } return MdcCheckboxChange; }()); /** @type {?} */ var MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR = { provide: _angular_forms__WEBPACK_IMPORTED_MODULE_3__["NG_VALUE_ACCESSOR"], useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])((/** * @return {?} */ function () { return MdcCheckbox; })), multi: true }; var MdcCheckbox = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MdcCheckbox, _super); function MdcCheckbox(_platform, _ngZone, _changeDetectorRef, elementRef, ripple, _parentFormField) { var _this = _super.call(this, elementRef) || this; _this._platform = _platform; _this._ngZone = _ngZone; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this.ripple = ripple; _this._parentFormField = _parentFormField; /** * Emits whenever the component is destroyed. */ _this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); _this._uniqueId = "mdc-checkbox-" + ++nextUniqueId; _this.id = _this._uniqueId; _this.name = null; _this._checked = false; _this._disabled = false; /** * The value attribute of the native input element */ _this.value = null; _this._indeterminate = false; _this._indeterminateToChecked = true; _this.tabIndex = 0; _this.ariaLabel = ''; _this.ariaLabelledby = null; /** * Fired when checkbox is checked or unchecked, but not when set * indeterminate. Sends the state of [checked]. */ _this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Fired when checkbox goes in and out of indeterminate state, but not when * set to checked. Sends the state of [indeterminate]; */ _this.indeterminateChange = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * View to model callback called when value changes */ _this._onChange = (/** * @return {?} */ function () { }); /** * View to model callback called when component has been touched */ _this._onTouched = (/** * @return {?} */ function () { }); if (_this._parentFormField) { _parentFormField.elementRef.nativeElement.classList.add('mdc-form-field'); } return _this; } Object.defineProperty(MdcCheckbox.prototype, "inputId", { /** Returns the unique id for the visual hidden input. */ get: /** * Returns the unique id for the visual hidden input. * @return {?} */ function () { return (this.id || this._uniqueId) + "-input"; }, enumerable: true, configurable: true }); Object.defineProperty(MdcCheckbox.prototype, "checked", { get: /** * @return {?} */ function () { return this._checked; }, set: /** * @param {?} value * @return {?} */ function (value) { if (value !== this.checked) { this._checked = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); this._changeDetectorRef.markForCheck(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcCheckbox.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setDisabledState(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcCheckbox.prototype, "indeterminate", { /** * Alternative state of the checkbox, not user set-able state. Between * [checked] and [indeterminate], only one can be true, though both can be * false. * `true` is INDETERMINATE and `false` is not. */ get: /** * Alternative state of the checkbox, not user set-able state. Between * [checked] and [indeterminate], only one can be true, though both can be * false. * `true` is INDETERMINATE and `false` is not. * @return {?} */ function () { return this._indeterminate; }, set: /** * @param {?} value * @return {?} */ function (value) { if (this.disabled) { return; } /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); if (newValue !== this._indeterminate) { this._indeterminate = newValue; if (newValue) { this.checked = false; } this.indeterminateChange.emit({ source: this, indeterminate: this._indeterminate }); this._changeDetectorRef.markForCheck(); this._foundation.handleChange(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcCheckbox.prototype, "indeterminateToChecked", { /** * Determines the state to go into when [indeterminate] state is toggled. * `true` will go to checked and `false` will go to unchecked. */ get: /** * Determines the state to go into when [indeterminate] state is toggled. * `true` will go to checked and `false` will go to unchecked. * @return {?} */ function () { return this._indeterminateToChecked; }, set: /** * @param {?} value * @return {?} */ function (value) { this._indeterminateToChecked = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcCheckbox.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), setNativeControlAttr: (/** * @param {?} attr * @param {?} value * @return {?} */ function (attr, value) { return _this._inputElement.nativeElement.setAttribute(attr, value); }), removeNativeControlAttr: (/** * @param {?} attr * @return {?} */ function (attr) { return _this._inputElement.nativeElement.removeAttribute(attr); }), isIndeterminate: (/** * @return {?} */ function () { return _this.indeterminate; }), isChecked: (/** * @return {?} */ function () { return _this.checked; }), hasNativeControl: (/** * @return {?} */ function () { return true; }), setNativeControlDisabled: (/** * @param {?} disabled * @return {?} */ function (disabled) { return _this._inputElement.nativeElement.disabled = disabled; }), forceLayout: (/** * @return {?} */ function () { return _this._getHostElement().offsetWidth; }), isAttachedToDOM: (/** * @return {?} */ function () { return true; }) }; return new MDCCheckboxFoundation(adapter); }; /** * @return {?} */ MdcCheckbox.prototype.ngAfterViewInit = /** * @return {?} */ function () { this._foundation.init(); this._initRipple(); this._loadListeners(); }; /** * @return {?} */ MdcCheckbox.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); this.ripple.destroy(); this._foundation.destroy(); }; /** * @param {?} value * @return {?} */ MdcCheckbox.prototype.writeValue = /** * @param {?} value * @return {?} */ function (value) { this.checked = !!value; }; /** * @param {?} fn * @return {?} */ MdcCheckbox.prototype.registerOnChange = /** * @param {?} fn * @return {?} */ function (fn) { this._onChange = fn; }; /** * @param {?} fn * @return {?} */ MdcCheckbox.prototype.registerOnTouched = /** * @param {?} fn * @return {?} */ function (fn) { this._onTouched = fn; }; /** Focuses the checkbox. */ /** * Focuses the checkbox. * @return {?} */ MdcCheckbox.prototype.focus = /** * Focuses the checkbox. * @return {?} */ function () { if (!this.disabled) { this._inputElement.nativeElement.focus(); } }; /** * @return {?} */ MdcCheckbox.prototype.toggle = /** * @return {?} */ function () { this._setState(); }; /** * @param {?} evt * @return {?} */ MdcCheckbox.prototype._onInteraction = /** * @param {?} evt * @return {?} */ function (evt) { // We have to stop propagation for click events on the visual hidden input element. // Preventing bubbling for the second event will solve that issue. evt.stopPropagation(); this._setState(); this._onChange(this.checked); this._changeDetectorRef.markForCheck(); this.change.emit(new MdcCheckboxChange(this, this.checked)); }; /** * @param {?} evt * @return {?} */ MdcCheckbox.prototype._onInputClick = /** * @param {?} evt * @return {?} */ function (evt) { evt.stopPropagation(); }; /** * @param {?} disabled * @return {?} */ MdcCheckbox.prototype.setDisabledState = /** * @param {?} disabled * @return {?} */ function (disabled) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(disabled); this._foundation.setDisabled(this._disabled); this._changeDetectorRef.markForCheck(); }; /** * @private * @return {?} */ MdcCheckbox.prototype._setState = /** * @private * @return {?} */ function () { var _this = this; if (this.disabled) { return; } if (this.indeterminate) { this._checked = this.indeterminateToChecked; this.indeterminate = false; } else { this.checked = !this.checked; } // Reset native input when clicked with noop. The native checkbox becomes checked after // click, reset it to be align with `checked` value of `mdc-checkbox`. this._inputElement.nativeElement.checked = this.checked; this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return requestAnimationFrame((/** * @return {?} */ function () { return _this._foundation.handleChange(); })); })); }; /** * @private * @return {?} */ MdcCheckbox.prototype._initRipple = /** * @private * @return {?} */ function () { var _this = this; this.ripple.init({ surface: this.elementRef.nativeElement, activator: this._inputElement.nativeElement }, Object.assign(this.ripple.createAdapter(), { isUnbounded: (/** * @return {?} */ function () { return true; }), isSurfaceDisabled: (/** * @return {?} */ function () { return _this._disabled; }) })); }; /** * @private * @return {?} */ MdcCheckbox.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; if (!this._platform.isBrowser) { return; } this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_4__["fromEvent"])(_this._getHostElement(), 'animationend') .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["takeUntil"])(_this._destroy), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["filter"])((/** * @param {?} e * @return {?} */ function (e) { return e.target === _this._getHostElement(); }))) .subscribe((/** * @return {?} */ function () { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleAnimationEnd(); })); })); })); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcCheckbox.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcCheckbox.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-checkbox', exportAs: 'mdcCheckbox', host: { '[id]': 'id', 'class': 'mdc-checkbox' }, template: "\n \n
\n \n \n \n
\n
\n ", providers: [ MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR, _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__["MdcRipple"], { provide: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormFieldControl"], useExisting: MdcCheckbox } ], encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcCheckbox.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__["MdcRipple"] }, { type: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormField"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] } ]; }; MdcCheckbox.propDecorators = { id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], checked: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], indeterminate: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], indeterminateToChecked: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], tabIndex: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ariaLabel: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['aria-label',] }], ariaLabelledby: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['aria-labelledby',] }], change: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], indeterminateChange: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], _inputElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['input',] }] }; return MdcCheckbox; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcCheckboxModule = /** @class */ (function () { function MdcCheckboxModule() { } MdcCheckboxModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormFieldModule"]], exports: [ _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormFieldModule"], MdcCheckbox ], declarations: [MdcCheckbox] },] }, ]; return MdcCheckboxModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=checkbox.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/chips.es5.js": /*!*********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/chips.es5.js ***! \*********************************************************/ /*! exports provided: CHIP_DECLARATIONS, MDC_CHIPSET_PARENT_COMPONENT, MdcChip, MdcChipCheckmark, MdcChipIcon, MdcChipSet, MdcChipSetChange, MdcChipText, MdcChipsModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CHIP_DECLARATIONS", function() { return CHIP_DECLARATIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_CHIPSET_PARENT_COMPONENT", function() { return MDC_CHIPSET_PARENT_COMPONENT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcChip", function() { return MdcChip; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcChipCheckmark", function() { return MdcChipCheckmark; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcChipIcon", function() { return MdcChipIcon; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcChipSet", function() { return MdcChipSet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcChipSetChange", function() { return MdcChipSetChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcChipText", function() { return MdcChipText; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcChipsModule", function() { return MdcChipsModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/icon */ "./node_modules/@angular-mdc/web/esm5/icon.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings = { CHECKMARK_SELECTOR: '.mdc-chip__checkmark', ENTRY_ANIMATION_NAME: 'mdc-chip-entry', INTERACTION_EVENT: 'MDCChip:interaction', LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading', REMOVAL_EVENT: 'MDCChip:removal', SELECTION_EVENT: 'MDCChip:selection', TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction', TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing' }; var cssClasses = { CHECKMARK: 'mdc-chip__checkmark', CHIP_EXIT: 'mdc-chip--exit', HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden', LEADING_ICON: 'mdc-chip__icon--leading', SELECTED: 'mdc-chip--selected', TRAILING_ICON: 'mdc-chip__icon--trailing' }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings$1 = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var emptyClientRect = { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0 }; var MDCChipFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCChipFoundation, _super); function MDCChipFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, MDCChipFoundation.defaultAdapter, adapter)) || this; /** * Whether a trailing icon click should immediately trigger exit/removal of the chip. */ _this.shouldRemoveOnTrailingIconClick_ = true; return _this; } Object.defineProperty(MDCChipFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, addClassToLeadingIcon: function addClassToLeadingIcon() { return undefined; }, eventTargetHasClass: function eventTargetHasClass() { return false; }, getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() { return emptyClientRect; }, getComputedStyleValue: function getComputedStyleValue() { return ''; }, getRootBoundingClientRect: function getRootBoundingClientRect() { return emptyClientRect; }, hasClass: function hasClass() { return false; }, hasLeadingIcon: function hasLeadingIcon() { return false; }, notifyInteraction: function notifyInteraction() { return undefined; }, notifyRemoval: function notifyRemoval() { return undefined; }, notifySelection: function notifySelection() { return undefined; }, notifyTrailingIconInteraction: function notifyTrailingIconInteraction() { return undefined; }, removeClass: function removeClass() { return undefined; }, removeClassFromLeadingIcon: function removeClassFromLeadingIcon() { return undefined; }, setStyleProperty: function setStyleProperty() { return undefined; } }; }, enumerable: true, configurable: true }); MDCChipFoundation.prototype.isSelected = function () { return this.adapter_.hasClass(cssClasses.SELECTED); }; MDCChipFoundation.prototype.setSelected = function (selected) { if (selected) { this.adapter_.addClass(cssClasses.SELECTED); } else { this.adapter_.removeClass(cssClasses.SELECTED); } this.adapter_.notifySelection(selected); }; MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () { return this.shouldRemoveOnTrailingIconClick_; }; MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) { this.shouldRemoveOnTrailingIconClick_ = shouldRemove; }; MDCChipFoundation.prototype.getDimensions = function () { var _this = this; var getRootRect = function getRootRect() { return _this.adapter_.getRootBoundingClientRect(); }; var getCheckmarkRect = function getCheckmarkRect() { return _this.adapter_.getCheckmarkBoundingClientRect(); }; // When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current // size of the checkmark. if (!this.adapter_.hasLeadingIcon()) { var checkmarkRect = getCheckmarkRect(); if (checkmarkRect) { var rootRect = getRootRect(); // Checkmark is a square, meaning the client rect's width and height are identical once the animation completes. // However, the checkbox is initially hidden by setting the width to 0. // To account for an initial width of 0, we use the checkbox's height instead (which equals the end-state width) // when adding it to the root client rect's width. return { bottom: rootRect.bottom, height: rootRect.height, left: rootRect.left, right: rootRect.right, top: rootRect.top, width: rootRect.width + checkmarkRect.height }; } } return getRootRect(); }; /** * Begins the exit animation which leads to removal of the chip. */ MDCChipFoundation.prototype.beginExit = function () { this.adapter_.addClass(cssClasses.CHIP_EXIT); }; /** * Handles an interaction event on the root element. */ MDCChipFoundation.prototype.handleInteraction = function (evt) { var isEnter = evt.key === 'Enter' || evt.keyCode === 13; if (evt.type === 'click' || isEnter) { this.adapter_.notifyInteraction(); } }; /** * Handles a transition end event on the root element. */ MDCChipFoundation.prototype.handleTransitionEnd = function (evt) { var _this = this; // Handle transition end event on the chip when it is about to be removed. if (this.adapter_.eventTargetHasClass(evt.target, cssClasses.CHIP_EXIT)) { if (evt.propertyName === 'width') { this.adapter_.notifyRemoval(); } else if (evt.propertyName === 'opacity') { // See: https://css-tricks.com/using-css-transitions-auto-dimensions/#article-header-id-5 var chipWidth_1 = this.adapter_.getComputedStyleValue('width'); // On the next frame (once we get the computed width), explicitly set the chip's width // to its current pixel width, so we aren't transitioning out of 'auto'. requestAnimationFrame(function () { _this.adapter_.setStyleProperty('width', chipWidth_1); // To mitigate jitter, start transitioning padding and margin before width. _this.adapter_.setStyleProperty('padding', '0'); _this.adapter_.setStyleProperty('margin', '0'); // On the next frame (once width is explicitly set), transition width to 0. requestAnimationFrame(function () { _this.adapter_.setStyleProperty('width', '0'); }); }); } return; } // Handle a transition end event on the leading icon or checkmark, since the transition end event bubbles. if (evt.propertyName !== 'opacity') { return; } if (this.adapter_.eventTargetHasClass(evt.target, cssClasses.LEADING_ICON) && this.adapter_.hasClass(cssClasses.SELECTED)) { this.adapter_.addClassToLeadingIcon(cssClasses.HIDDEN_LEADING_ICON); } else if (this.adapter_.eventTargetHasClass(evt.target, cssClasses.CHECKMARK) && !this.adapter_.hasClass(cssClasses.SELECTED)) { this.adapter_.removeClassFromLeadingIcon(cssClasses.HIDDEN_LEADING_ICON); } }; /** * Handles an interaction event on the trailing icon element. This is used to * prevent the ripple from activating on interaction with the trailing icon. */ MDCChipFoundation.prototype.handleTrailingIconInteraction = function (evt) { var isEnter = evt.key === 'Enter' || evt.keyCode === 13; evt.stopPropagation(); if (evt.type === 'click' || isEnter) { this.adapter_.notifyTrailingIconInteraction(); if (this.shouldRemoveOnTrailingIconClick_) { this.beginExit(); } } }; return MDCChipFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var INTERACTION_EVENTS = ['click', 'keydown']; var MDCChip = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCChip, _super); function MDCChip() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCChip.prototype, "selected", { /** * @return Whether the chip is selected. */ get: function get() { return this.foundation_.isSelected(); }, /** * Sets selected state on the chip. */ set: function set(selected) { this.foundation_.setSelected(selected); }, enumerable: true, configurable: true }); Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", { /** * @return Whether a trailing icon click should trigger exit/removal of the chip. */ get: function get() { return this.foundation_.getShouldRemoveOnTrailingIconClick(); }, /** * Sets whether a trailing icon click should trigger exit/removal of the chip. */ set: function set(shouldRemove) { this.foundation_.setShouldRemoveOnTrailingIconClick(shouldRemove); }, enumerable: true, configurable: true }); Object.defineProperty(MDCChip.prototype, "ripple", { get: function get() { return this.ripple_; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChip.prototype, "id", { get: function get() { return this.root_.id; }, enumerable: true, configurable: true }); MDCChip.attachTo = function (root) { return new MDCChip(root); }; MDCChip.prototype.initialize = function (rippleFactory) { var _this = this; if (rippleFactory === void 0) { rippleFactory = function rippleFactory(el, foundation) { return new MDCRipple(el, foundation); }; } this.leadingIcon_ = this.root_.querySelector(strings.LEADING_ICON_SELECTOR); this.trailingIcon_ = this.root_.querySelector(strings.TRAILING_ICON_SELECTOR); this.checkmark_ = this.root_.querySelector(strings.CHECKMARK_SELECTOR); // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var rippleAdapter = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, MDCRipple.createAdapter(this), { computeBoundingRect: function computeBoundingRect() { return _this.foundation_.getDimensions(); } }); this.ripple_ = rippleFactory(this.root_, new MDCRippleFoundation(rippleAdapter)); }; MDCChip.prototype.initialSyncWithDOM = function () { var _this = this; this.handleInteraction_ = function (evt) { return _this.foundation_.handleInteraction(evt); }; this.handleTransitionEnd_ = function (evt) { return _this.foundation_.handleTransitionEnd(evt); }; this.handleTrailingIconInteraction_ = function (evt) { return _this.foundation_.handleTrailingIconInteraction(evt); }; INTERACTION_EVENTS.forEach(function (evtType) { _this.listen(evtType, _this.handleInteraction_); }); this.listen('transitionend', this.handleTransitionEnd_); if (this.trailingIcon_) { INTERACTION_EVENTS.forEach(function (evtType) { _this.trailingIcon_.addEventListener(evtType, _this.handleTrailingIconInteraction_); }); } }; MDCChip.prototype.destroy = function () { var _this = this; this.ripple_.destroy(); INTERACTION_EVENTS.forEach(function (evtType) { _this.unlisten(evtType, _this.handleInteraction_); }); this.unlisten('transitionend', this.handleTransitionEnd_); if (this.trailingIcon_) { INTERACTION_EVENTS.forEach(function (evtType) { _this.trailingIcon_.removeEventListener(evtType, _this.handleTrailingIconInteraction_); }); } _super.prototype.destroy.call(this); }; /** * Begins the exit animation which leads to removal of the chip. */ MDCChip.prototype.beginExit = function () { this.foundation_.beginExit(); }; MDCChip.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, addClassToLeadingIcon: function addClassToLeadingIcon(className) { if (_this.leadingIcon_) { _this.leadingIcon_.classList.add(className); } }, eventTargetHasClass: function eventTargetHasClass(target, className) { return target ? target.classList.contains(className) : false; }, getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() { return _this.checkmark_ ? _this.checkmark_.getBoundingClientRect() : null; }, getComputedStyleValue: function getComputedStyleValue(propertyName) { return window.getComputedStyle(_this.root_).getPropertyValue(propertyName); }, getRootBoundingClientRect: function getRootBoundingClientRect() { return _this.root_.getBoundingClientRect(); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, hasLeadingIcon: function hasLeadingIcon() { return !!_this.leadingIcon_; }, notifyInteraction: function notifyInteraction() { return _this.emit(strings.INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */ ); }, notifyRemoval: function notifyRemoval() { return _this.emit(strings.REMOVAL_EVENT, { chipId: _this.id, root: _this.root_ }, true /* shouldBubble */ ); }, notifySelection: function notifySelection(selected) { return _this.emit(strings.SELECTION_EVENT, { chipId: _this.id, selected: selected }, true /* shouldBubble */ ); }, notifyTrailingIconInteraction: function notifyTrailingIconInteraction() { return _this.emit(strings.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */ ); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, removeClassFromLeadingIcon: function removeClassFromLeadingIcon(className) { if (_this.leadingIcon_) { _this.leadingIcon_.classList.remove(className); } }, setStyleProperty: function setStyleProperty(propertyName, value) { return _this.root_.style.setProperty(propertyName, value); } }; return new MDCChipFoundation(adapter); }; return MDCChip; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Injection token used to provide the parent MdcChipSet component to MdcChip. * @type {?} */ var MDC_CHIPSET_PARENT_COMPONENT = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('MDC_CHIPSET_PARENT_COMPONENT'); /** @type {?} */ var nextUniqueId = 0; var MdcChipCheckmark = /** @class */ (function () { function MdcChipCheckmark(elementRef) { this.elementRef = elementRef; } MdcChipCheckmark.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-chip-checkmark', exportAs: 'mdcChipCheckmark', template: "\n
\n \n \n \n
", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcChipCheckmark.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcChipCheckmark; }()); var MdcChipText = /** @class */ (function () { function MdcChipText(elementRef) { this.elementRef = elementRef; } MdcChipText.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-chip-text, [mdcChipText]', host: { 'class': 'mdc-chip__text' } },] }, ]; /** @nocollapse */ MdcChipText.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcChipText; }()); var MdcChip = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MdcChip, _super); function MdcChip(_platform, _ngZone, _changeDetectorRef, _ripple, elementRef, _parent) { var _this = _super.call(this, elementRef) || this; _this._platform = _platform; _this._ngZone = _ngZone; _this._changeDetectorRef = _changeDetectorRef; _this._ripple = _ripple; _this.elementRef = elementRef; _this._parent = _parent; /** * Emits whenever the component is destroyed. */ _this._destroyed = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); _this._id = "mdc-chip-" + nextUniqueId++; _this._selected = false; _this._filter = false; _this._choice = false; _this._input = false; _this._primary = false; _this._secondary = false; _this._removable = true; _this._disabled = false; _this._disableRipple = false; /** * Emitted when the chip is selected or deselected. */ _this.selectionChange = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Emitted when the chip icon is interacted with. */ _this.trailingIconInteraction = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Emitted when a chip is to be removed. */ _this.removed = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); return _this; } Object.defineProperty(MdcChip.prototype, "id", { /** The unique ID of the chip. */ get: /** * The unique ID of the chip. * @return {?} */ function () { return this._id; }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "leadingIcon", { get: /** * @return {?} */ function () { return this._icons.find((/** * @param {?} _ * @return {?} */ function (_) { return _.leading; })); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "selected", { get: /** * @return {?} */ function () { return this._selected; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); this._selected = newValue; this._foundation.setSelected(newValue); if (this.filter && this.leadingIcon) { this.leadingIcon.elementRef.nativeElement.classList.remove(cssClasses.HIDDEN_LEADING_ICON); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "filter", { get: /** * @return {?} */ function () { return this._filter; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); if (newValue !== this._filter) { this._filter = newValue; } }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "choice", { get: /** * @return {?} */ function () { return this._choice; }, set: /** * @param {?} value * @return {?} */ function (value) { this._choice = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "input", { get: /** * @return {?} */ function () { return this._input; }, set: /** * @param {?} value * @return {?} */ function (value) { this._input = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "primary", { get: /** * @return {?} */ function () { return this._primary; }, set: /** * @param {?} value * @return {?} */ function (value) { this._primary = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "secondary", { get: /** * @return {?} */ function () { return this._secondary; }, set: /** * @param {?} value * @return {?} */ function (value) { this._secondary = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "removable", { /** Determines whether or not the chip displays the remove styling and emits (removed) events. */ get: /** * Determines whether or not the chip displays the remove styling and emits (removed) events. * @return {?} */ function () { return this._removable; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); if (newValue !== this._removable) { this._removable = value; this._foundation.setShouldRemoveOnTrailingIconClick(this._removable); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "disabled", { /** Whether the chip is disabled. */ get: /** * Whether the chip is disabled. * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "disableRipple", { /** Whether the chip ripple is disabled. */ get: /** * Whether the chip ripple is disabled. * @return {?} */ function () { return this._disableRipple; }, set: /** * @param {?} value * @return {?} */ function (value) { this._disableRipple = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChip.prototype, "value", { /** The value of the chip. Defaults to the content inside `` tags. */ get: /** * The value of the chip. Defaults to the content inside `` tags. * @return {?} */ function () { return this._value !== undefined ? this._value : this.elementRef.nativeElement.textContent; }, set: /** * @param {?} value * @return {?} */ function (value) { this._value = value; }, enumerable: true, configurable: true }); /** * @return {?} */ MdcChip.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), addClassToLeadingIcon: (/** * @param {?} className * @return {?} */ function (className) { if (_this.leadingIcon) { _this.leadingIcon.elementRef.nativeElement.classList.add(className); } }), removeClassFromLeadingIcon: (/** * @param {?} className * @return {?} */ function (className) { if (_this.leadingIcon) { _this.leadingIcon.elementRef.nativeElement.classList.remove(className); } }), eventTargetHasClass: (/** * @param {?} target * @param {?} className * @return {?} */ function (target, className) { return target.classList.contains(className); }), notifyInteraction: (/** * @return {?} */ function () { return _this._emitSelectionChangeEvent(true); }), notifySelection: (/** * @return {?} */ function () { }), notifyTrailingIconInteraction: (/** * @return {?} */ function () { return _this.trailingIconInteraction.emit({ detail: { chipId: _this.id } }); }), notifyRemoval: (/** * @return {?} */ function () { return _this.removed.emit({ detail: { chipId: _this.id, root: _this } }); }), getComputedStyleValue: (/** * @param {?} propertyName * @return {?} */ function (propertyName) { if (!_this._platform.isBrowser) { return ''; } return window.getComputedStyle(_this._getHostElement()).getPropertyValue(propertyName); }), setStyleProperty: (/** * @param {?} propertyName * @param {?} value * @return {?} */ function (propertyName, value) { return _this._getHostElement().style.setProperty(propertyName, value); }), hasLeadingIcon: (/** * @return {?} */ function () { return !!_this.leadingIcon; }), getRootBoundingClientRect: (/** * @return {?} */ function () { return _this._getHostElement().getBoundingClientRect(); }), getCheckmarkBoundingClientRect: (/** * @return {?} */ function () { return _this._checkmark ? _this._checkmark.elementRef.nativeElement.getBoundingClientRect() : null; }) }; return new MDCChipFoundation(adapter); }; /** * @return {?} */ MdcChip.prototype.ngAfterViewInit = /** * @return {?} */ function () { this._foundation.init(); this._setVariantFromChipSet(); this._initRipple(); this._loadListeners(); }; /** * @return {?} */ MdcChip.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroyed.next(); this._destroyed.complete(); this._ripple.destroy(); if (this._foundation) { this._foundation.destroy(); } }; /** Selects the chip. */ /** * Selects the chip. * @return {?} */ MdcChip.prototype.select = /** * Selects the chip. * @return {?} */ function () { if (!this._selected) { this._selected = true; this._emitSelectionChangeEvent(); } }; /** Deselects the chip. */ /** * Deselects the chip. * @return {?} */ MdcChip.prototype.deselect = /** * Deselects the chip. * @return {?} */ function () { if (this._selected) { this._selected = false; this._emitSelectionChangeEvent(); } }; /** Select this chip and emit selected event */ /** * Select this chip and emit selected event * @return {?} */ MdcChip.prototype.selectViaInteraction = /** * Select this chip and emit selected event * @return {?} */ function () { if (!this._selected) { this._selected = true; this._emitSelectionChangeEvent(true); } }; /** Allows for programmatic focusing of the chip. */ /** * Allows for programmatic focusing of the chip. * @return {?} */ MdcChip.prototype.focus = /** * Allows for programmatic focusing of the chip. * @return {?} */ function () { this._getHostElement().focus(); }; /** * @param {?} evt * @return {?} */ MdcChip.prototype._handleInteraction = /** * @param {?} evt * @return {?} */ function (evt) { this._selected = !this._selected; this._foundation.handleInteraction(evt); }; /** * @param {?} evt * @return {?} */ MdcChip.prototype._handleTrailingIconInteraction = /** * @param {?} evt * @return {?} */ function (evt) { this._foundation.handleTrailingIconInteraction(evt); }; /** * @private * @return {?} */ MdcChip.prototype._initRipple = /** * @private * @return {?} */ function () { var _this = this; this._ripple.init({ surface: this._getHostElement() }, Object.assign(this._ripple.createAdapter(), { isSurfaceDisabled: (/** * @return {?} */ function () { return _this._disableRipple; }), computeBoundingRect: (/** * @return {?} */ function () { return _this._foundation.getDimensions(); }) })); }; /** * @private * @return {?} */ MdcChip.prototype._setVariantFromChipSet = /** * @private * @return {?} */ function () { if (this._parent) { this.input = this._parent.input; this.filter = this._parent.filter; this.choice = this._parent.choice; this._changeDetectorRef.detectChanges(); } }; /** * @private * @return {?} */ MdcChip.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_4__["fromEvent"])(_this._getHostElement(), 'transitionend') .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["takeUntil"])(_this._destroyed)) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleTransitionEnd(evt); })); })); })); }; /** Emits the removed event. */ /** * Emits the removed event. * @return {?} */ MdcChip.prototype._emitRemovedEvent = /** * Emits the removed event. * @return {?} */ function () { this.removed.emit({ detail: { chipId: this.id, root: this } }); }; /** Emits the selection change event. */ /** * Emits the selection change event. * @private * @param {?=} isUserInput * @return {?} */ MdcChip.prototype._emitSelectionChangeEvent = /** * Emits the selection change event. * @private * @param {?=} isUserInput * @return {?} */ function (isUserInput) { this.selectionChange.emit({ isUserInput: isUserInput, detail: { chipId: this.id, selected: this._selected, value: this._value } }); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcChip.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcChip.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-chip', exportAs: 'mdcChip', host: { '[id]': 'id', '[attr.tabindex]': 'disabled ? null : 0', 'class': 'mdc-chip', '[class.ngx-mdc-chip--primary]': 'primary', '[class.ngx-mdc-chip--secondary]': 'secondary', '(click)': '_handleInteraction($event)', '(keydown)': '_handleInteraction($event)' }, template: "\n \n \n
{{label}}
\n ", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__["MdcRipple"]] },] }, ]; /** @nocollapse */ MdcChip.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__["MdcRipple"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [MDC_CHIPSET_PARENT_COMPONENT,] }] } ]; }; MdcChip.propDecorators = { label: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], selected: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], filter: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], choice: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], input: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], primary: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], secondary: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], removable: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disableRipple: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], selectionChange: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], trailingIconInteraction: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], removed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], _checkmark: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [MdcChipCheckmark,] }], _icons: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])((/** * @return {?} */ function () { return MdcChipIcon; })), { descendants: true },] }] }; return MdcChip; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__["MDCComponent"])); var MdcChipIcon = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MdcChipIcon, _super); function MdcChipIcon(_parentChip, elementRef, iconRegistry, ariaHidden, location) { var _this = _super.call(this, elementRef, iconRegistry, ariaHidden, location) || this; _this._parentChip = _parentChip; _this._leading = false; _this._trailing = false; return _this; } Object.defineProperty(MdcChipIcon.prototype, "leading", { get: /** * @return {?} */ function () { return this._leading; }, set: /** * @param {?} value * @return {?} */ function (value) { this._leading = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChipIcon.prototype, "trailing", { get: /** * @return {?} */ function () { return this._trailing; }, set: /** * @param {?} value * @return {?} */ function (value) { this._trailing = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcChipIcon.prototype.ngAfterContentInit = /** * @return {?} */ function () { if (this.trailing) { this.tabIndex = 0; this.role = 'button'; } }; /** * @param {?} evt * @return {?} */ MdcChipIcon.prototype._onIconInteraction = /** * @param {?} evt * @return {?} */ function (evt) { if (this.trailing) { this._parentChip._handleTrailingIconInteraction(evt); if (this._parentChip.removable && this._parentChip.input) { this._parentChip._emitRemovedEvent(); } } }; MdcChipIcon.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-chip-icon, [mdcChipIcon]', exportAs: 'mdcChipIcon', host: { 'class': 'mdc-chip__icon ngx-mdc-icon', '[attr.role]': 'role', '[attr.tabindex]': 'tabIndex', '[class.ngx-mdc-icon--clickable]': 'clickable', '[class.ngx-mdc-icon--inline]': 'inline', '[class.mdc-chip__icon--leading]': 'leading', '[class.mdc-chip__icon--trailing]': 'trailing', '(click)': '_onIconInteraction($event)', '(keydown)': '_onIconInteraction($event)' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcChipIcon.ctorParameters = function () { return [ { type: MdcChip }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIconRegistry"] }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Attribute"], args: ['aria-hidden',] }] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MDC_ICON_LOCATION"],] }] } ]; }; MdcChipIcon.propDecorators = { leading: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], trailing: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcChipIcon; }(_angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIcon"])); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$2 = { CHIP_SELECTOR: '.mdc-chip' }; var cssClasses$2 = { CHOICE: 'mdc-chip-set--choice', FILTER: 'mdc-chip-set--filter' }; /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCChipSetFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCChipSetFoundation, _super); function MDCChipSetFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, MDCChipSetFoundation.defaultAdapter, adapter)) || this; /** * The ids of the selected chips in the set. Only used for choice chip set or filter chip set. */ _this.selectedChipIds_ = []; return _this; } Object.defineProperty(MDCChipSetFoundation, "strings", { get: function get() { return strings$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipSetFoundation, "cssClasses", { get: function get() { return cssClasses$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", { get: function get() { return { hasClass: function hasClass() { return false; }, removeChip: function removeChip() { return undefined; }, setSelected: function setSelected() { return undefined; } }; }, enumerable: true, configurable: true }); /** * Returns an array of the IDs of all selected chips. */ MDCChipSetFoundation.prototype.getSelectedChipIds = function () { return this.selectedChipIds_.slice(); }; /** * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant. */ MDCChipSetFoundation.prototype.select = function (chipId) { if (this.selectedChipIds_.indexOf(chipId) >= 0) { return; } if (this.adapter_.hasClass(cssClasses$2.CHOICE) && this.selectedChipIds_.length > 0) { var previouslySelectedChip = this.selectedChipIds_[0]; this.selectedChipIds_.length = 0; this.adapter_.setSelected(previouslySelectedChip, false); } this.selectedChipIds_.push(chipId); this.adapter_.setSelected(chipId, true); }; /** * Handles a chip interaction event */ MDCChipSetFoundation.prototype.handleChipInteraction = function (chipId) { if (this.adapter_.hasClass(cssClasses$2.CHOICE) || this.adapter_.hasClass(cssClasses$2.FILTER)) { this.toggleSelect_(chipId); } }; /** * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip. */ MDCChipSetFoundation.prototype.handleChipSelection = function (chipId, selected) { var chipIsSelected = this.selectedChipIds_.indexOf(chipId) >= 0; if (selected && !chipIsSelected) { this.select(chipId); } else if (!selected && chipIsSelected) { this.deselect_(chipId); } }; /** * Handles the event when a chip is removed. */ MDCChipSetFoundation.prototype.handleChipRemoval = function (chipId) { this.deselect_(chipId); this.adapter_.removeChip(chipId); }; /** * Deselects the chip with the given id. */ MDCChipSetFoundation.prototype.deselect_ = function (chipId) { var index = this.selectedChipIds_.indexOf(chipId); if (index >= 0) { this.selectedChipIds_.splice(index, 1); this.adapter_.setSelected(chipId, false); } }; /** * Toggles selection of the chip with the given id. */ MDCChipSetFoundation.prototype.toggleSelect_ = function (chipId) { if (this.selectedChipIds_.indexOf(chipId) >= 0) { this.deselect_(chipId); } else { this.select(chipId); } }; return MDCChipSetFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var _a = MDCChipFoundation.strings, INTERACTION_EVENT = _a.INTERACTION_EVENT, SELECTION_EVENT = _a.SELECTION_EVENT, REMOVAL_EVENT = _a.REMOVAL_EVENT; var CHIP_SELECTOR = MDCChipSetFoundation.strings.CHIP_SELECTOR; var idCounter = 0; var MDCChipSet = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCChipSet, _super); function MDCChipSet() { return _super !== null && _super.apply(this, arguments) || this; } MDCChipSet.attachTo = function (root) { return new MDCChipSet(root); }; Object.defineProperty(MDCChipSet.prototype, "chips", { get: function get() { return this.chips_.slice(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", { /** * @return An array of the IDs of all selected chips. */ get: function get() { return this.foundation_.getSelectedChipIds(); }, enumerable: true, configurable: true }); /** * @param chipFactory A function which creates a new MDCChip. */ MDCChipSet.prototype.initialize = function (chipFactory) { if (chipFactory === void 0) { chipFactory = function chipFactory(el) { return new MDCChip(el); }; } this.chipFactory_ = chipFactory; this.chips_ = this.instantiateChips_(this.chipFactory_); }; MDCChipSet.prototype.initialSyncWithDOM = function () { var _this = this; this.chips_.forEach(function (chip) { if (chip.id && chip.selected) { _this.foundation_.select(chip.id); } }); this.handleChipInteraction_ = function (evt) { return _this.foundation_.handleChipInteraction(evt.detail.chipId); }; this.handleChipSelection_ = function (evt) { return _this.foundation_.handleChipSelection(evt.detail.chipId, evt.detail.selected); }; this.handleChipRemoval_ = function (evt) { return _this.foundation_.handleChipRemoval(evt.detail.chipId); }; this.listen(INTERACTION_EVENT, this.handleChipInteraction_); this.listen(SELECTION_EVENT, this.handleChipSelection_); this.listen(REMOVAL_EVENT, this.handleChipRemoval_); }; MDCChipSet.prototype.destroy = function () { this.chips_.forEach(function (chip) { chip.destroy(); }); this.unlisten(INTERACTION_EVENT, this.handleChipInteraction_); this.unlisten(SELECTION_EVENT, this.handleChipSelection_); this.unlisten(REMOVAL_EVENT, this.handleChipRemoval_); _super.prototype.destroy.call(this); }; /** * Adds a new chip object to the chip set from the given chip element. */ MDCChipSet.prototype.addChip = function (chipEl) { chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter; this.chips_.push(this.chipFactory_(chipEl)); }; MDCChipSet.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, removeChip: function removeChip(chipId) { var index = _this.findChipIndex_(chipId); if (index >= 0) { _this.chips_[index].destroy(); _this.chips_.splice(index, 1); } }, setSelected: function setSelected(chipId, selected) { var index = _this.findChipIndex_(chipId); if (index >= 0) { _this.chips_[index].selected = selected; } } }; return new MDCChipSetFoundation(adapter); }; /** * Instantiates chip components on all of the chip set's child chip elements. */ MDCChipSet.prototype.instantiateChips_ = function (chipFactory) { var chipElements = [].slice.call(this.root_.querySelectorAll(CHIP_SELECTOR)); return chipElements.map(function (el) { el.id = el.id || "mdc-chip-" + ++idCounter; return chipFactory(el); }); }; /** * Returns the index of the chip with the given id, or -1 if the chip does not exist. */ MDCChipSet.prototype.findChipIndex_ = function (chipId) { for (var i = 0; i < this.chips_.length; i++) { if (this.chips_[i].id === chipId) { return i; } } return -1; }; return MDCChipSet; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcChipSetChange = /** @class */ (function () { function MdcChipSetChange(source, value) { this.source = source; this.value = value; } return MdcChipSetChange; }()); var MdcChipSet = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MdcChipSet, _super); function MdcChipSet(_changeDetectorRef, elementRef, _parentForm, _parentFormGroup, ngControl) { var _this = _super.call(this, elementRef) || this; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this.ngControl = ngControl; /** * Emits whenever the component is destroyed. */ _this._destroyed = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); _this._choice = false; _this._filter = false; _this._input = false; /** * A function to compare the option values with the selected values. The first argument * is a value from an option. The second is a value from the selection. A boolean * should be returned. */ _this._compareWith = (/** * @param {?} o1 * @param {?} o2 * @return {?} */ function (o1, o2) { return o1 === o2; }); _this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Function when touched */ _this._onTouched = (/** * @return {?} */ function () { }); /** * Function when changed */ _this._onChange = (/** * @return {?} */ function () { }); /** * Subscription to selection events in chips. */ _this._chipSelectionSubscription = null; /** * Subscription to remove changes in chips. */ _this._chipRemoveSubscription = null; /** * Subscription to interaction events in chips. */ _this._chipInteractionSubscription = null; if (_this.ngControl) { _this.ngControl.valueAccessor = _this; } return _this; } Object.defineProperty(MdcChipSet.prototype, "choice", { /** * Indicates that the chips in the set are choice chips, which allow a single selection from a set of options. */ get: /** * Indicates that the chips in the set are choice chips, which allow a single selection from a set of options. * @return {?} */ function () { return this._choice; }, set: /** * @param {?} value * @return {?} */ function (value) { this._choice = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChipSet.prototype, "filter", { /** * Indicates that the chips in the set are filter chips, which allow multiple selection from a set of options. */ get: /** * Indicates that the chips in the set are filter chips, which allow multiple selection from a set of options. * @return {?} */ function () { return this._filter; }, set: /** * @param {?} value * @return {?} */ function (value) { this._filter = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChipSet.prototype, "input", { /** * Indicates that the chips in the set are input chips, which enable user input by converting text into chips. */ get: /** * Indicates that the chips in the set are input chips, which enable user input by converting text into chips. * @return {?} */ function () { return this._input; }, set: /** * @param {?} value * @return {?} */ function (value) { this._input = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChipSet.prototype, "value", { get: /** * @return {?} */ function () { return this._value; }, set: /** * @param {?} value * @return {?} */ function (value) { this.writeValue(value); this._value = value; }, enumerable: true, configurable: true }); Object.defineProperty(MdcChipSet.prototype, "chipSelections", { /** Combined stream of all of the chip selection events. */ get: /** * Combined stream of all of the chip selection events. * @return {?} */ function () { return rxjs__WEBPACK_IMPORTED_MODULE_4__["merge"].apply(void 0, this.chips.map((/** * @param {?} chip * @return {?} */ function (chip) { return chip.selectionChange; }))); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChipSet.prototype, "chipInteractions", { /** Combined stream of all of the chip interaction events. */ get: /** * Combined stream of all of the chip interaction events. * @return {?} */ function () { return rxjs__WEBPACK_IMPORTED_MODULE_4__["merge"].apply(void 0, this.chips.map((/** * @param {?} chip * @return {?} */ function (chip) { return chip.trailingIconInteraction; }))); }, enumerable: true, configurable: true }); Object.defineProperty(MdcChipSet.prototype, "chipRemoveChanges", { /** Combined stream of all of the chip remove events. */ get: /** * Combined stream of all of the chip remove events. * @return {?} */ function () { return rxjs__WEBPACK_IMPORTED_MODULE_4__["merge"].apply(void 0, this.chips.map((/** * @param {?} chip * @return {?} */ function (chip) { return chip.removed; }))); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcChipSet.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), removeChip: (/** * @param {?} chipId * @return {?} */ function (chipId) { /** @type {?} */ var index = _this._findChipIndex(chipId); _this.chips.toArray().splice(index, 1); }), setSelected: (/** * @param {?} chipId * @param {?} selected * @return {?} */ function (chipId, selected) { /** @type {?} */ var chip = _this.getChipById(chipId); if (chip) { chip.selected = selected; } }) }; return new MDCChipSetFoundation(adapter); }; /** * @return {?} */ MdcChipSet.prototype.ngAfterContentInit = /** * @return {?} */ function () { var _this = this; // When chips change, re-subscribe this.chips.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["startWith"])(null), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["takeUntil"])(this._destroyed)) .subscribe((/** * @return {?} */ function () { if (_this.chips.length > 0) { _this._resetChipSet(); _this._initializeSelection(); } })); }; /** * @return {?} */ MdcChipSet.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroyed.next(); this._destroyed.complete(); this._dropSubscriptions(); if (this._chipRemoveSubscription) { this._chipRemoveSubscription.unsubscribe(); } }; // Implemented as part of ControlValueAccessor. // Implemented as part of ControlValueAccessor. /** * @param {?} value * @return {?} */ MdcChipSet.prototype.writeValue = // Implemented as part of ControlValueAccessor. /** * @param {?} value * @return {?} */ function (value) { if (this.chips) { this.selectByValue(value, false); } }; // Implemented as part of ControlValueAccessor. // Implemented as part of ControlValueAccessor. /** * @param {?} fn * @return {?} */ MdcChipSet.prototype.registerOnChange = // Implemented as part of ControlValueAccessor. /** * @param {?} fn * @return {?} */ function (fn) { this._onChange = fn; }; // Implemented as part of ControlValueAccessor. // Implemented as part of ControlValueAccessor. /** * @param {?} fn * @return {?} */ MdcChipSet.prototype.registerOnTouched = // Implemented as part of ControlValueAccessor. /** * @param {?} fn * @return {?} */ function (fn) { this._onTouched = fn; }; /** * @return {?} */ MdcChipSet.prototype.getSelectedChipIds = /** * @return {?} */ function () { return this._foundation.getSelectedChipIds(); }; /** * @param {?} chipId * @return {?} */ MdcChipSet.prototype.select = /** * @param {?} chipId * @return {?} */ function (chipId) { this._foundation.select(chipId); }; /** * @param {?} chipId * @return {?} */ MdcChipSet.prototype.getChipById = /** * @param {?} chipId * @return {?} */ function (chipId) { return this.chips.find((/** * @param {?} _ * @return {?} */ function (_) { return _.id === chipId; })); }; /** * @param {?} value * @param {?=} isUserInput * @return {?} */ MdcChipSet.prototype.selectByValue = /** * @param {?} value * @param {?=} isUserInput * @return {?} */ function (value, isUserInput) { var _this = this; if (isUserInput === void 0) { isUserInput = true; } this.chips.forEach((/** * @param {?} chip * @return {?} */ function (chip) { return chip.deselect(); })); if (Array.isArray(value)) { value.forEach((/** * @param {?} currentValue * @return {?} */ function (currentValue) { return _this._selectValue(currentValue, isUserInput); })); } else { this._selectValue(value, isUserInput); } }; /** * Finds and selects the chip based on its value. * @returns Chip that has the corresponding value. */ /** * Finds and selects the chip based on its value. * @private * @param {?} value * @param {?=} isUserInput * @return {?} Chip that has the corresponding value. */ MdcChipSet.prototype._selectValue = /** * Finds and selects the chip based on its value. * @private * @param {?} value * @param {?=} isUserInput * @return {?} Chip that has the corresponding value. */ function (value, isUserInput) { var _this = this; if (isUserInput === void 0) { isUserInput = true; } /** @type {?} */ var correspondingChip = this.chips.find((/** * @param {?} chip * @return {?} */ function (chip) { return chip.value != null && _this._compareWith(chip.value, value); })); if (correspondingChip) { isUserInput ? correspondingChip.selectViaInteraction() : correspondingChip.select(); } return correspondingChip; }; /** * @private * @return {?} */ MdcChipSet.prototype._initializeSelection = /** * @private * @return {?} */ function () { var _this = this; // Defer setting the value in order to avoid the "Expression // has changed after it was checked" errors from Angular. Promise.resolve().then((/** * @return {?} */ function () { if (_this.ngControl || _this._value) { _this.selectByValue(_this.ngControl ? _this.ngControl.value : _this._value, false); } })); }; /** * @private * @param {?} evt * @return {?} */ MdcChipSet.prototype._propagateChanges = /** * @private * @param {?} evt * @return {?} */ function (evt) { this._value = evt.detail.value; this.change.emit(new MdcChipSetChange(this, evt.detail)); this._onChange(this._value); this._changeDetectorRef.markForCheck(); }; /** * @private * @return {?} */ MdcChipSet.prototype._resetChipSet = /** * @private * @return {?} */ function () { this._dropSubscriptions(); this._listenForChipSelection(); this._listenToChipsInteraction(); this._listenToChipsRemoved(); }; /** * @private * @return {?} */ MdcChipSet.prototype._dropSubscriptions = /** * @private * @return {?} */ function () { if (this._chipSelectionSubscription) { this._chipSelectionSubscription.unsubscribe(); this._chipSelectionSubscription = null; } if (this._chipInteractionSubscription) { this._chipInteractionSubscription.unsubscribe(); this._chipInteractionSubscription = null; } if (this._chipRemoveSubscription) { this._chipRemoveSubscription.unsubscribe(); this._chipRemoveSubscription = null; } }; /** Listens to selected events on each chip. */ /** * Listens to selected events on each chip. * @private * @return {?} */ MdcChipSet.prototype._listenForChipSelection = /** * Listens to selected events on each chip. * @private * @return {?} */ function () { var _this = this; this._chipSelectionSubscription = this.chipSelections .subscribe((/** * @param {?} event * @return {?} */ function (event) { _this._foundation.handleChipSelection(event.detail.chipId, event.detail.selected); if (event.isUserInput) { _this._propagateChanges(event); } })); }; /** * @private * @return {?} */ MdcChipSet.prototype._listenToChipsInteraction = /** * @private * @return {?} */ function () { var _this = this; this._chipInteractionSubscription = this.chipInteractions .subscribe((/** * @param {?} event * @return {?} */ function (event) { return _this._foundation.handleChipInteraction(event.detail.chipId); })); }; /** * @private * @return {?} */ MdcChipSet.prototype._listenToChipsRemoved = /** * @private * @return {?} */ function () { var _this = this; this._chipRemoveSubscription = this.chipRemoveChanges .subscribe((/** * @param {?} event * @return {?} */ function (event) { return _this._foundation.handleChipRemoval(event.detail.chipId); })); }; /** * @private * @param {?} chipId * @return {?} */ MdcChipSet.prototype._findChipIndex = /** * @private * @param {?} chipId * @return {?} */ function (chipId) { return this.chips.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.id === chipId; })); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcChipSet.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcChipSet.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-chip-set', exportAs: 'mdcChipSet', host: { 'class': 'mdc-chip-set', '[class.mdc-chip-set--choice]': 'choice', '[class.mdc-chip-set--filter]': 'filter', '[class.mdc-chip-set--input]': 'input' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, providers: [{ provide: MDC_CHIPSET_PARENT_COMPONENT, useExisting: MdcChipSet }] },] }, ]; /** @nocollapse */ MdcChipSet.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_9__["NgForm"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_9__["FormGroupDirective"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_9__["NgControl"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] } ]; }; MdcChipSet.propDecorators = { choice: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], filter: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], input: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], change: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], chips: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [MdcChip, { descendants: true },] }] }; return MdcChipSet; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var CHIP_DECLARATIONS = [ MdcChip, MdcChipCheckmark, MdcChipIcon, MdcChipSet, MdcChipText ]; var MdcChipsModule = /** @class */ (function () { function MdcChipsModule() { } MdcChipsModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"], _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIconModule"]], exports: CHIP_DECLARATIONS, declarations: CHIP_DECLARATIONS },] }, ]; return MdcChipsModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=chips.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/common.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/common.es5.js ***! \**********************************************************/ /*! exports provided: A, BACKSPACE, COMMA, DELETE, DOWN_ARROW, END, ENTER, ESCAPE, HOME, LEFT_ARROW, NINE, PAGE_DOWN, PAGE_UP, Platform, RIGHT_ARROW, SPACE, TAB, UP_ARROW, UniqueSelectionDispatcher, Z, ZERO, _isNumberValue, toBoolean, toNumber */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return A; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BACKSPACE", function() { return BACKSPACE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMMA", function() { return COMMA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DELETE", function() { return DELETE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOWN_ARROW", function() { return DOWN_ARROW; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "END", function() { return END; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ENTER", function() { return ENTER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ESCAPE", function() { return ESCAPE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HOME", function() { return HOME; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LEFT_ARROW", function() { return LEFT_ARROW; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NINE", function() { return NINE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PAGE_DOWN", function() { return PAGE_DOWN; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PAGE_UP", function() { return PAGE_UP; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Platform", function() { return Platform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RIGHT_ARROW", function() { return RIGHT_ARROW; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SPACE", function() { return SPACE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TAB", function() { return TAB; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UP_ARROW", function() { return UP_ARROW; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UniqueSelectionDispatcher", function() { return UniqueSelectionDispatcher; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return Z; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ZERO", function() { return ZERO; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_isNumberValue", function() { return _isNumberValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toBoolean", function() { return toBoolean; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toNumber", function() { return toNumber; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} value * @return {?} */ function toBoolean(value) { return value != null && "" + value !== 'false'; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @type {?} */ var UP_ARROW = 38; /** @type {?} */ var DOWN_ARROW = 40; /** @type {?} */ var RIGHT_ARROW = 39; /** @type {?} */ var LEFT_ARROW = 37; /** @type {?} */ var PAGE_UP = 33; /** @type {?} */ var PAGE_DOWN = 34; /** @type {?} */ var HOME = 36; /** @type {?} */ var END = 35; /** @type {?} */ var ENTER = 13; /** @type {?} */ var SPACE = 32; /** @type {?} */ var TAB = 9; /** @type {?} */ var ESCAPE = 27; /** @type {?} */ var BACKSPACE = 8; /** @type {?} */ var DELETE = 46; /** @type {?} */ var A = 65; /** @type {?} */ var Z = 90; /** @type {?} */ var ZERO = 48; /** @type {?} */ var NINE = 57; /** @type {?} */ var COMMA = 188; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} value * @param {?=} fallbackValue * @return {?} */ function toNumber(value, fallbackValue) { if (fallbackValue === void 0) { fallbackValue = 0; } return _isNumberValue(value) ? Number(value) : fallbackValue; } /** * Whether the provided value is considered a number. * @param {?} value * @return {?} */ function _isNumberValue(value) { // parseFloat(value) handles most of the cases we're interested in (it treats null, empty string, // and other non-number values as NaN, where Number just uses 0) but it considers the string // '123hello' to be a valid number. Therefore we also check if Number(value) is NaN. return !isNaN(parseFloat((/** @type {?} */ (value)))) && !isNaN(Number(value)); } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var Platform = /** @class */ (function () { function Platform(_platformId) { this._platformId = _platformId; this.isBrowser = this._platformId ? Object(_angular_common__WEBPACK_IMPORTED_MODULE_1__["isPlatformBrowser"])(this._platformId) : typeof document === 'object' && !!document; } Platform.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"], args: [{ providedIn: 'root' },] }, ]; /** @nocollapse */ Platform.ctorParameters = function () { return [ { type: Object, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["PLATFORM_ID"],] }] } ]; }; /** @nocollapse */ Platform.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["defineInjectable"])({ factory: function Platform_Factory() { return new Platform(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["PLATFORM_ID"])); }, token: Platform, providedIn: "root" }); return Platform; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Class to coordinate unique selection based on name. * Intended to be consumed as an Angular service. * This service is needed because native radio change events are only fired on the item currently * being selected, and we still need to uncheck the previous selection. * * This service does not *store* any IDs and names because they may change at any time, so it is * less error-prone if they are simply passed through when the events occur. */ var UniqueSelectionDispatcher = /** @class */ (function () { function UniqueSelectionDispatcher() { this._listeners = []; } /** * Notify other items that selection for the given name has been set. * @param id ID of the item. * @param name Name of the item. */ /** * Notify other items that selection for the given name has been set. * @param {?} id ID of the item. * @param {?} name Name of the item. * @return {?} */ UniqueSelectionDispatcher.prototype.notify = /** * Notify other items that selection for the given name has been set. * @param {?} id ID of the item. * @param {?} name Name of the item. * @return {?} */ function (id, name) { for (var _i = 0, _a = this._listeners; _i < _a.length; _i++) { var listener = _a[_i]; listener(id, name); } }; /** * Listen for future changes to item selection. * @return Function used to deregister listener */ /** * Listen for future changes to item selection. * @param {?} listener * @return {?} Function used to deregister listener */ UniqueSelectionDispatcher.prototype.listen = /** * Listen for future changes to item selection. * @param {?} listener * @return {?} Function used to deregister listener */ function (listener) { var _this = this; this._listeners.push(listener); return (/** * @return {?} */ function () { _this._listeners = _this._listeners.filter((/** * @param {?} registered * @return {?} */ function (registered) { return listener !== registered; })); }); }; /** * @return {?} */ UniqueSelectionDispatcher.prototype.ngOnDestroy = /** * @return {?} */ function () { this._listeners = []; }; UniqueSelectionDispatcher.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"], args: [{ providedIn: 'root' },] }, ]; /** @nocollapse */ UniqueSelectionDispatcher.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["defineInjectable"])({ factory: function UniqueSelectionDispatcher_Factory() { return new UniqueSelectionDispatcher(); }, token: UniqueSelectionDispatcher, providedIn: "root" }); return UniqueSelectionDispatcher; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=common.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/dialog.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/dialog.es5.js ***! \**********************************************************/ /*! exports provided: MDC_DIALOG_DATA, MDC_DIALOG_DEFAULT_OPTIONS, MdcDialog, MdcDialogAction, MdcDialogActions, MdcDialogButton, MdcDialogComponent, MdcDialogConfig, MdcDialogContainer, MdcDialogContent, MdcDialogModule, MdcDialogPortal, MdcDialogRef, MdcDialogScrim, MdcDialogSurface, MdcDialogTitle, throwMdcDialogContentAlreadyAttachedError */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_DIALOG_DATA", function() { return MDC_DIALOG_DATA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_DIALOG_DEFAULT_OPTIONS", function() { return MDC_DIALOG_DEFAULT_OPTIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialog", function() { return MdcDialog; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogAction", function() { return MdcDialogAction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogActions", function() { return MdcDialogActions; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogButton", function() { return MdcDialogButton; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogComponent", function() { return MdcDialogComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogConfig", function() { return MdcDialogConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogContainer", function() { return MdcDialogContainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogContent", function() { return MdcDialogContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogModule", function() { return MdcDialogModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogPortal", function() { return MdcDialogPortal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogRef", function() { return MdcDialogRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogScrim", function() { return MdcDialogScrim; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogSurface", function() { return MdcDialogSurface; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDialogTitle", function() { return MdcDialogTitle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwMdcDialogContentAlreadyAttachedError", function() { return throwMdcDialogContentAlreadyAttachedError; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/overlay */ "./node_modules/@angular-mdc/web/esm5/overlay.es5.js"); /* harmony import */ var _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/portal */ "./node_modules/@angular-mdc/web/esm5/portal.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular-mdc/web/button */ "./node_modules/@angular-mdc/web/esm5/button.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])']; var candidateSelector = candidateSelectors.join(','); var matches = typeof Element === 'undefined' ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; function tabbable(el, options) { options = options || {}; var elementDocument = el.ownerDocument || el; var regularTabbables = []; var orderedTabbables = []; var untouchabilityChecker = new UntouchabilityChecker(elementDocument); var candidates = el.querySelectorAll(candidateSelector); if (options.includeContainer) { if (matches.call(el, candidateSelector)) { candidates = Array.prototype.slice.apply(candidates); candidates.unshift(el); } } var i, candidate, candidateTabindex; for (i = 0; i < candidates.length; i++) { candidate = candidates[i]; if (!isNodeMatchingSelectorTabbable(candidate, untouchabilityChecker)) continue; candidateTabindex = getTabindex(candidate); if (candidateTabindex === 0) { regularTabbables.push(candidate); } else { orderedTabbables.push({ documentOrder: i, tabIndex: candidateTabindex, node: candidate }); } } var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function (a) { return a.node; }).concat(regularTabbables); return tabbableNodes; } tabbable.isTabbable = isTabbable; tabbable.isFocusable = isFocusable; function isNodeMatchingSelectorTabbable(node, untouchabilityChecker) { if (!isNodeMatchingSelectorFocusable(node, untouchabilityChecker) || isNonTabbableRadio(node) || getTabindex(node) < 0) { return false; } return true; } function isTabbable(node, untouchabilityChecker) { if (!node) throw new Error('No node provided'); if (matches.call(node, candidateSelector) === false) return false; return isNodeMatchingSelectorTabbable(node, untouchabilityChecker); } function isNodeMatchingSelectorFocusable(node, untouchabilityChecker) { untouchabilityChecker = untouchabilityChecker || new UntouchabilityChecker(node.ownerDocument || node); if (node.disabled || isHiddenInput(node) || untouchabilityChecker.isUntouchable(node)) { return false; } return true; } var focusableCandidateSelector = candidateSelectors.concat('iframe').join(','); function isFocusable(node, untouchabilityChecker) { if (!node) throw new Error('No node provided'); if (matches.call(node, focusableCandidateSelector) === false) return false; return isNodeMatchingSelectorFocusable(node, untouchabilityChecker); } function getTabindex(node) { var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10); if (!isNaN(tabindexAttr)) return tabindexAttr; // Browsers do not return `tabIndex` correctly for contentEditable nodes; // so if they don't have a tabindex attribute specifically set, assume it's 0. if (isContentEditable(node)) return 0; return node.tabIndex; } function sortOrderedTabbables(a, b) { return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex; } // Array.prototype.find not available in IE. function find(list, predicate) { for (var i = 0, length = list.length; i < length; i++) { if (predicate(list[i])) return list[i]; } } function isContentEditable(node) { return node.contentEditable === 'true'; } function isInput(node) { return node.tagName === 'INPUT'; } function isHiddenInput(node) { return isInput(node) && node.type === 'hidden'; } function isRadio(node) { return isInput(node) && node.type === 'radio'; } function isNonTabbableRadio(node) { return isRadio(node) && !isTabbableRadio(node); } function getCheckedRadio(nodes) { for (var i = 0; i < nodes.length; i++) { if (nodes[i].checked) { return nodes[i]; } } } function isTabbableRadio(node) { if (!node.name) return true; // This won't account for the edge case where you have radio groups with the same // in separate forms on the same page. var radioSet = node.ownerDocument.querySelectorAll('input[type="radio"][name="' + node.name + '"]'); var checked = getCheckedRadio(radioSet); return !checked || checked === node; } // An element is "untouchable" if *it or one of its ancestors* has // `visibility: hidden` or `display: none`. function UntouchabilityChecker(elementDocument) { this.doc = elementDocument; // Node cache must be refreshed on every check, in case // the content of the element has changed. The cache contains tuples // mapping nodes to their boolean result. this.cache = []; } // getComputedStyle accurately reflects `visibility: hidden` of ancestors // but not `display: none`, so we need to recursively check parents. UntouchabilityChecker.prototype.hasDisplayNone = function hasDisplayNone(node, nodeComputedStyle) { if (node.nodeType !== Node.ELEMENT_NODE) return false; // Search for a cached result. var cached = find(this.cache, function (item) { return item === node; }); if (cached) return cached[1]; nodeComputedStyle = nodeComputedStyle || this.doc.defaultView.getComputedStyle(node); var result = false; if (nodeComputedStyle.display === 'none') { result = true; } else if (node.parentNode) { result = this.hasDisplayNone(node.parentNode); } this.cache.push([node, result]); return result; }; UntouchabilityChecker.prototype.isUntouchable = function isUntouchable(node) { if (node === this.doc.documentElement) return false; var computedStyle = this.doc.defaultView.getComputedStyle(node); if (this.hasDisplayNone(node, computedStyle)) return true; return computedStyle.visibility === 'hidden'; }; var tabbable_1 = tabbable; var immutable = extend; var hasOwnProperty = Object.prototype.hasOwnProperty; function extend() { var target = {}; for (var i = 0; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; } var activeFocusTraps = function () { var trapQueue = []; return { activateTrap: function activateTrap(trap) { if (trapQueue.length > 0) { var activeTrap = trapQueue[trapQueue.length - 1]; if (activeTrap !== trap) { activeTrap.pause(); } } var trapIndex = trapQueue.indexOf(trap); if (trapIndex === -1) { trapQueue.push(trap); } else { // move this existing trap to the front of the queue trapQueue.splice(trapIndex, 1); trapQueue.push(trap); } }, deactivateTrap: function deactivateTrap(trap) { var trapIndex = trapQueue.indexOf(trap); if (trapIndex !== -1) { trapQueue.splice(trapIndex, 1); } if (trapQueue.length > 0) { trapQueue[trapQueue.length - 1].unpause(); } } }; }(); function focusTrap(element, userOptions) { var doc = document; var container = typeof element === 'string' ? doc.querySelector(element) : element; var config = immutable({ returnFocusOnDeactivate: true, escapeDeactivates: true }, userOptions); var state = { firstTabbableNode: null, lastTabbableNode: null, nodeFocusedBeforeActivation: null, mostRecentlyFocusedNode: null, active: false, paused: false }; var trap = { activate: activate, deactivate: deactivate, pause: pause, unpause: unpause }; return trap; function activate(activateOptions) { if (state.active) return; updateTabbableNodes(); state.active = true; state.paused = false; state.nodeFocusedBeforeActivation = doc.activeElement; var onActivate = activateOptions && activateOptions.onActivate ? activateOptions.onActivate : config.onActivate; if (onActivate) { onActivate(); } addListeners(); return trap; } function deactivate(deactivateOptions) { if (!state.active) return; removeListeners(); state.active = false; state.paused = false; activeFocusTraps.deactivateTrap(trap); var onDeactivate = deactivateOptions && deactivateOptions.onDeactivate !== undefined ? deactivateOptions.onDeactivate : config.onDeactivate; if (onDeactivate) { onDeactivate(); } var returnFocus = deactivateOptions && deactivateOptions.returnFocus !== undefined ? deactivateOptions.returnFocus : config.returnFocusOnDeactivate; if (returnFocus) { delay(function () { tryFocus(state.nodeFocusedBeforeActivation); }); } return trap; } function pause() { if (state.paused || !state.active) return; state.paused = true; removeListeners(); } function unpause() { if (!state.paused || !state.active) return; state.paused = false; addListeners(); } function addListeners() { if (!state.active) return; // There can be only one listening focus trap at a time activeFocusTraps.activateTrap(trap); updateTabbableNodes(); // Delay ensures that the focused element doesn't capture the event // that caused the focus trap activation. delay(function () { tryFocus(getInitialFocusNode()); }); doc.addEventListener('focusin', checkFocusIn, true); doc.addEventListener('mousedown', checkPointerDown, true); doc.addEventListener('touchstart', checkPointerDown, true); doc.addEventListener('click', checkClick, true); doc.addEventListener('keydown', checkKey, true); return trap; } function removeListeners() { if (!state.active) return; doc.removeEventListener('focusin', checkFocusIn, true); doc.removeEventListener('mousedown', checkPointerDown, true); doc.removeEventListener('touchstart', checkPointerDown, true); doc.removeEventListener('click', checkClick, true); doc.removeEventListener('keydown', checkKey, true); return trap; } function getNodeForOption(optionName) { var optionValue = config[optionName]; var node = optionValue; if (!optionValue) { return null; } if (typeof optionValue === 'string') { node = doc.querySelector(optionValue); if (!node) { throw new Error('`' + optionName + '` refers to no known node'); } } if (typeof optionValue === 'function') { node = optionValue(); if (!node) { throw new Error('`' + optionName + '` did not return a node'); } } return node; } function getInitialFocusNode() { var node; if (getNodeForOption('initialFocus') !== null) { node = getNodeForOption('initialFocus'); } else if (container.contains(doc.activeElement)) { node = doc.activeElement; } else { node = state.firstTabbableNode || getNodeForOption('fallbackFocus'); } if (!node) { throw new Error("You can't have a focus-trap without at least one focusable element"); } return node; } // This needs to be done on mousedown and touchstart instead of click // so that it precedes the focus event. function checkPointerDown(e) { if (container.contains(e.target)) return; if (config.clickOutsideDeactivates) { deactivate({ returnFocus: !tabbable_1.isFocusable(e.target) }); } else { e.preventDefault(); } } // In case focus escapes the trap for some strange reason, pull it back in. function checkFocusIn(e) { // In Firefox when you Tab out of an iframe the Document is briefly focused. if (container.contains(e.target) || e.target instanceof Document) { return; } e.stopImmediatePropagation(); tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode()); } function checkKey(e) { if (config.escapeDeactivates !== false && isEscapeEvent(e)) { e.preventDefault(); deactivate(); return; } if (isTabEvent(e)) { checkTab(e); return; } } // Hijack Tab events on the first and last focusable nodes of the trap, // in order to prevent focus from escaping. If it escapes for even a // moment it can end up scrolling the page and causing confusion so we // kind of need to capture the action at the keydown phase. function checkTab(e) { updateTabbableNodes(); if (e.shiftKey && e.target === state.firstTabbableNode) { e.preventDefault(); tryFocus(state.lastTabbableNode); return; } if (!e.shiftKey && e.target === state.lastTabbableNode) { e.preventDefault(); tryFocus(state.firstTabbableNode); return; } } function checkClick(e) { if (config.clickOutsideDeactivates) return; if (container.contains(e.target)) return; e.preventDefault(); e.stopImmediatePropagation(); } function updateTabbableNodes() { var tabbableNodes = tabbable_1(container); state.firstTabbableNode = tabbableNodes[0] || getInitialFocusNode(); state.lastTabbableNode = tabbableNodes[tabbableNodes.length - 1] || getInitialFocusNode(); } function tryFocus(node) { if (node === doc.activeElement) return; if (!node || !node.focus) { tryFocus(getInitialFocusNode()); return; } node.focus(); state.mostRecentlyFocusedNode = node; if (isSelectableInput(node)) { node.select(); } } } function isSelectableInput(node) { return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function'; } function isEscapeEvent(e) { return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27; } function isTabEvent(e) { return e.key === 'Tab' || e.keyCode === 9; } function delay(fn) { return setTimeout(fn, 0); } var focusTrap_1 = focusTrap; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcDialogAction = /** @class */ (function () { function MdcDialogAction(elementRef) { this.elementRef = elementRef; this._action = ''; } Object.defineProperty(MdcDialogAction.prototype, "action", { get: /** * @return {?} */ function () { return this._action; }, set: /** * @param {?} action * @return {?} */ function (action) { // If the directive is set without a name (updated programatically), then this setter will // trigger with an empty string and should not overwrite the programatically set value. if (!action) { return; } this._action = action; this.elementRef.nativeElement.setAttribute('data-mdc-dialog-action', this._action); }, enumerable: true, configurable: true }); MdcDialogAction.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcDialogAction]' },] }, ]; /** @nocollapse */ MdcDialogAction.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcDialogAction.propDecorators = { action: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['mdcDialogAction',] }] }; return MdcDialogAction; }()); var MdcDialogScrim = /** @class */ (function () { function MdcDialogScrim(elementRef) { this.elementRef = elementRef; } MdcDialogScrim.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-dialog-scrim', host: { 'class': 'mdc-dialog__scrim' } },] }, ]; /** @nocollapse */ MdcDialogScrim.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcDialogScrim; }()); var MdcDialogContainer = /** @class */ (function () { function MdcDialogContainer(elementRef) { this.elementRef = elementRef; } MdcDialogContainer.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcDialogContainer], mdc-dialog-container', host: { 'class': 'mdc-dialog__container' } },] }, ]; /** @nocollapse */ MdcDialogContainer.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcDialogContainer; }()); var MdcDialogSurface = /** @class */ (function () { function MdcDialogSurface(elementRef) { this.elementRef = elementRef; } MdcDialogSurface.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcDialogSurface], mdc-dialog-surface', host: { 'class': 'mdc-dialog__surface' } },] }, ]; /** @nocollapse */ MdcDialogSurface.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcDialogSurface; }()); var MdcDialogTitle = /** @class */ (function () { function MdcDialogTitle(elementRef) { this.elementRef = elementRef; } MdcDialogTitle.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcDialogTitle], mdc-dialog-title', host: { 'class': 'mdc-dialog__title' } },] }, ]; /** @nocollapse */ MdcDialogTitle.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcDialogTitle; }()); var MdcDialogContent = /** @class */ (function () { function MdcDialogContent(elementRef) { this.elementRef = elementRef; } MdcDialogContent.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcDialogContent], mdc-dialog-content', host: { 'class': 'mdc-dialog__content' } },] }, ]; /** @nocollapse */ MdcDialogContent.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcDialogContent; }()); var MdcDialogActions = /** @class */ (function () { function MdcDialogActions(elementRef) { this.elementRef = elementRef; this._stacked = false; } Object.defineProperty(MdcDialogActions.prototype, "stacked", { get: /** * @return {?} */ function () { return this._stacked; }, set: /** * @param {?} value * @return {?} */ function (value) { this._stacked = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); MdcDialogActions.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-dialog-actions, [mdcDialogActions]', template: '', exportAs: 'mdcDialogActions', host: { 'class': 'mdc-dialog__actions', '[class.mdc-dialog--stacked]': 'stacked' }, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcDialogActions.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcDialogActions.propDecorators = { stacked: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcDialogActions; }()); var MdcDialogButton = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MdcDialogButton, _super); function MdcDialogButton() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._default = false; return _this; } Object.defineProperty(MdcDialogButton.prototype, "default", { get: /** * @return {?} */ function () { return this._default; }, set: /** * @param {?} value * @return {?} */ function (value) { this._default = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(value); }, enumerable: true, configurable: true }); MdcDialogButton.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdcDialogButton]', exportAs: 'mdcDialogButton', host: { 'class': 'mdc-dialog__button', '[class.mdc-button]': 'true', '[class.mdc-dialog__button--default]': 'default' }, template: '', providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_9__["MdcRipple"]], encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; MdcDialogButton.propDecorators = { default: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcDialogButton; }(_angular_mdc_web_button__WEBPACK_IMPORTED_MODULE_8__["MdcButton"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Unique id for the created dialog. * @type {?} */ var uniqueId = 0; /** * Reference to a dialog dispatched from the MdcDialog service. * @template T, R */ var /** * Reference to a dialog dispatched from the MdcDialog service. * @template T, R */ MdcDialogRef = /** @class */ (function () { function MdcDialogRef(_overlayRef, _portalInstance, id) { if (id === void 0) { id = "mdc-dialog-" + uniqueId++; } var _this = this; this._overlayRef = _overlayRef; this._portalInstance = _portalInstance; this.id = id; /** * Subject for notifying the user that the dialog has finished opening. */ this._afterOpened = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); /** * Subject for notifying the user that the dialog has started closing. */ this._beforeClosed = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); /** * Subject for notifying the user that the dialog has finished closing. */ this._afterClosed = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); // Pass the id along to the portal. _portalInstance._id = id; _overlayRef.detachments().subscribe((/** * @return {?} */ function () { _this._beforeClosed.next(_this._result); _this._beforeClosed.complete(); _this._afterClosed.next(_this._result); _this._afterClosed.complete(); _this.componentInstance = (/** @type {?} */ (null)); _this._overlayRef.dispose(); })); } /** * Close the dialog. * @param dialogResult Optional result to return to the dialog opener. */ /** * Close the dialog. * @param {?=} dialogResult Optional result to return to the dialog opener. * @return {?} */ MdcDialogRef.prototype.close = /** * Close the dialog. * @param {?=} dialogResult Optional result to return to the dialog opener. * @return {?} */ function (dialogResult) { this._result = dialogResult; this._overlayRef.dispose(); }; /** Marks the dialog as opened. */ /** * Marks the dialog as opened. * @return {?} */ MdcDialogRef.prototype.opened = /** * Marks the dialog as opened. * @return {?} */ function () { if (!this._afterOpened.closed) { this._afterOpened.next(); this._afterOpened.complete(); } }; /** Gets an observable that is notified when the dialog is finished opening. */ /** * Gets an observable that is notified when the dialog is finished opening. * @return {?} */ MdcDialogRef.prototype.afterOpened = /** * Gets an observable that is notified when the dialog is finished opening. * @return {?} */ function () { return this._afterOpened.asObservable(); }; /** Gets an observable that is notified when the dialog has started closing. */ /** * Gets an observable that is notified when the dialog has started closing. * @return {?} */ MdcDialogRef.prototype.beforeClosed = /** * Gets an observable that is notified when the dialog has started closing. * @return {?} */ function () { return this._beforeClosed.asObservable(); }; /** Gets an observable that is notified when the dialog is finished closing. */ /** * Gets an observable that is notified when the dialog is finished closing. * @return {?} */ MdcDialogRef.prototype.afterClosed = /** * Gets an observable that is notified when the dialog is finished closing. * @return {?} */ function () { return this._afterClosed.asObservable(); }; return MdcDialogRef; }()); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { CLOSING: 'mdc-dialog--closing', OPEN: 'mdc-dialog--open', OPENING: 'mdc-dialog--opening', SCROLLABLE: 'mdc-dialog--scrollable', SCROLL_LOCK: 'mdc-dialog-scroll-lock', STACKED: 'mdc-dialog--stacked' }; var strings = { ACTION_ATTRIBUTE: 'data-mdc-dialog-action', BUTTON_SELECTOR: '.mdc-dialog__button', CLOSED_EVENT: 'MDCDialog:closed', CLOSE_ACTION: 'close', CLOSING_EVENT: 'MDCDialog:closing', CONTAINER_SELECTOR: '.mdc-dialog__container', CONTENT_SELECTOR: '.mdc-dialog__content', DEFAULT_BUTTON_SELECTOR: '.mdc-dialog__button--default', DESTROY_ACTION: 'destroy', OPENED_EVENT: 'MDCDialog:opened', OPENING_EVENT: 'MDCDialog:opening', SCRIM_SELECTOR: '.mdc-dialog__scrim', SUPPRESS_DEFAULT_PRESS_SELECTOR: ['textarea', '.mdc-menu .mdc-list-item'].join(', '), SURFACE_SELECTOR: '.mdc-dialog__surface' }; var numbers = { DIALOG_ANIMATION_CLOSE_TIME_MS: 75, DIALOG_ANIMATION_OPEN_TIME_MS: 150 }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. */ function closest(element, selector) { if (element.closest) { return element.closest(selector); } var el = element; while (el) { if (matches$1(el, selector)) { return el; } el = el.parentElement; } return null; } function matches$1(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) { if (focusTrapFactory === void 0) { focusTrapFactory = focusTrap_1; } return focusTrapFactory(surfaceEl, { clickOutsideDeactivates: true, escapeDeactivates: false, initialFocus: initialFocusEl }); } function isScrollable(el) { return el ? el.scrollHeight > el.offsetHeight : false; } function areTopsMisaligned(els) { var tops = new Set(); [].forEach.call(els, function (el) { return tops.add(el.offsetTop); }); return tops.size > 1; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings$1 = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers$1 = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers$1.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches$1(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCDialogFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCDialogFoundation, _super); function MDCDialogFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, MDCDialogFoundation.defaultAdapter, adapter)) || this; _this.isOpen_ = false; _this.animationFrame_ = 0; _this.animationTimer_ = 0; _this.layoutFrame_ = 0; _this.escapeKeyAction_ = strings.CLOSE_ACTION; _this.scrimClickAction_ = strings.CLOSE_ACTION; _this.autoStackButtons_ = true; _this.areButtonsStacked_ = false; return _this; } Object.defineProperty(MDCDialogFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialogFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialogFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialogFoundation, "defaultAdapter", { get: function get() { return { addBodyClass: function addBodyClass() { return undefined; }, addClass: function addClass() { return undefined; }, areButtonsStacked: function areButtonsStacked() { return false; }, clickDefaultButton: function clickDefaultButton() { return undefined; }, eventTargetMatches: function eventTargetMatches() { return false; }, getActionFromEvent: function getActionFromEvent() { return ''; }, hasClass: function hasClass() { return false; }, isContentScrollable: function isContentScrollable() { return false; }, notifyClosed: function notifyClosed() { return undefined; }, notifyClosing: function notifyClosing() { return undefined; }, notifyOpened: function notifyOpened() { return undefined; }, notifyOpening: function notifyOpening() { return undefined; }, releaseFocus: function releaseFocus() { return undefined; }, removeBodyClass: function removeBodyClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, reverseButtons: function reverseButtons() { return undefined; }, trapFocus: function trapFocus() { return undefined; } }; }, enumerable: true, configurable: true }); MDCDialogFoundation.prototype.init = function () { if (this.adapter_.hasClass(cssClasses.STACKED)) { this.setAutoStackButtons(false); } }; MDCDialogFoundation.prototype.destroy = function () { if (this.isOpen_) { this.close(strings.DESTROY_ACTION); } if (this.animationTimer_) { clearTimeout(this.animationTimer_); this.handleAnimationTimerEnd_(); } if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); this.layoutFrame_ = 0; } }; MDCDialogFoundation.prototype.open = function () { var _this = this; this.isOpen_ = true; this.adapter_.notifyOpening(); this.adapter_.addClass(cssClasses.OPENING); // Wait a frame once display is no longer "none", to establish basis for animation this.runNextAnimationFrame_(function () { _this.adapter_.addClass(cssClasses.OPEN); _this.adapter_.addBodyClass(cssClasses.SCROLL_LOCK); _this.layout(); _this.animationTimer_ = setTimeout(function () { _this.handleAnimationTimerEnd_(); _this.adapter_.trapFocus(); _this.adapter_.notifyOpened(); }, numbers.DIALOG_ANIMATION_OPEN_TIME_MS); }); }; MDCDialogFoundation.prototype.close = function (action) { var _this = this; if (action === void 0) { action = ''; } if (!this.isOpen_) { // Avoid redundant close calls (and events), e.g. from keydown on elements that inherently emit click return; } this.isOpen_ = false; this.adapter_.notifyClosing(action); this.adapter_.addClass(cssClasses.CLOSING); this.adapter_.removeClass(cssClasses.OPEN); this.adapter_.removeBodyClass(cssClasses.SCROLL_LOCK); cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = 0; clearTimeout(this.animationTimer_); this.animationTimer_ = setTimeout(function () { _this.adapter_.releaseFocus(); _this.handleAnimationTimerEnd_(); _this.adapter_.notifyClosed(action); }, numbers.DIALOG_ANIMATION_CLOSE_TIME_MS); }; MDCDialogFoundation.prototype.isOpen = function () { return this.isOpen_; }; MDCDialogFoundation.prototype.getEscapeKeyAction = function () { return this.escapeKeyAction_; }; MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) { this.escapeKeyAction_ = action; }; MDCDialogFoundation.prototype.getScrimClickAction = function () { return this.scrimClickAction_; }; MDCDialogFoundation.prototype.setScrimClickAction = function (action) { this.scrimClickAction_ = action; }; MDCDialogFoundation.prototype.getAutoStackButtons = function () { return this.autoStackButtons_; }; MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) { this.autoStackButtons_ = autoStack; }; MDCDialogFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCDialogFoundation.prototype.handleInteraction = function (evt) { var isClick = evt.type === 'click'; var isEnter = evt.key === 'Enter' || evt.keyCode === 13; var isSpace = evt.key === 'Space' || evt.keyCode === 32; var isScrim = this.adapter_.eventTargetMatches(evt.target, strings.SCRIM_SELECTOR); var isDefault = !this.adapter_.eventTargetMatches(evt.target, strings.SUPPRESS_DEFAULT_PRESS_SELECTOR); // Check for scrim click first since it doesn't require querying ancestors if (isClick && isScrim && this.scrimClickAction_ !== '') { this.close(this.scrimClickAction_); } else if (isClick || isSpace || isEnter) { var action = this.adapter_.getActionFromEvent(evt); if (action) { this.close(action); } else if (isEnter && isDefault) { this.adapter_.clickDefaultButton(); } } }; MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) { var isEscape = evt.key === 'Escape' || evt.keyCode === 27; if (isEscape && this.escapeKeyAction_ !== '') { this.close(this.escapeKeyAction_); } }; MDCDialogFoundation.prototype.layoutInternal_ = function () { if (this.autoStackButtons_) { this.detectStackedButtons_(); } this.detectScrollableContent_(); }; MDCDialogFoundation.prototype.handleAnimationTimerEnd_ = function () { this.animationTimer_ = 0; this.adapter_.removeClass(cssClasses.OPENING); this.adapter_.removeClass(cssClasses.CLOSING); }; /** * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. */ MDCDialogFoundation.prototype.runNextAnimationFrame_ = function (callback) { var _this = this; cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = requestAnimationFrame(function () { _this.animationFrame_ = 0; clearTimeout(_this.animationTimer_); _this.animationTimer_ = setTimeout(callback, 0); }); }; MDCDialogFoundation.prototype.detectStackedButtons_ = function () { // Remove the class first to let us measure the buttons' natural positions. this.adapter_.removeClass(cssClasses.STACKED); var areButtonsStacked = this.adapter_.areButtonsStacked(); if (areButtonsStacked) { this.adapter_.addClass(cssClasses.STACKED); } if (areButtonsStacked !== this.areButtonsStacked_) { this.adapter_.reverseButtons(); this.areButtonsStacked_ = areButtonsStacked; } }; MDCDialogFoundation.prototype.detectScrollableContent_ = function () { // Remove the class first to let us measure the natural height of the content. this.adapter_.removeClass(cssClasses.SCROLLABLE); if (this.adapter_.isContentScrollable()) { this.adapter_.addClass(cssClasses.SCROLLABLE); } }; return MDCDialogFoundation; }(MDCFoundation); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$2 = MDCDialogFoundation.strings; var MDCDialog = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCDialog, _super); function MDCDialog() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCDialog.prototype, "isOpen", { get: function get() { return this.foundation_.isOpen(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", { get: function get() { return this.foundation_.getEscapeKeyAction(); }, set: function set(action) { this.foundation_.setEscapeKeyAction(action); }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialog.prototype, "scrimClickAction", { get: function get() { return this.foundation_.getScrimClickAction(); }, set: function set(action) { this.foundation_.setScrimClickAction(action); }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialog.prototype, "autoStackButtons", { get: function get() { return this.foundation_.getAutoStackButtons(); }, set: function set(autoStack) { this.foundation_.setAutoStackButtons(autoStack); }, enumerable: true, configurable: true }); MDCDialog.attachTo = function (root) { return new MDCDialog(root); }; MDCDialog.prototype.initialize = function (focusTrapFactory, initialFocusEl) { var e_1, _a; var container = this.root_.querySelector(strings$2.CONTAINER_SELECTOR); if (!container) { throw new Error("Dialog component requires a " + strings$2.CONTAINER_SELECTOR + " container element"); } this.container_ = container; this.content_ = this.root_.querySelector(strings$2.CONTENT_SELECTOR); this.buttons_ = [].slice.call(this.root_.querySelectorAll(strings$2.BUTTON_SELECTOR)); this.defaultButton_ = this.root_.querySelector(strings$2.DEFAULT_BUTTON_SELECTOR); this.focusTrapFactory_ = focusTrapFactory; this.initialFocusEl_ = initialFocusEl; this.buttonRipples_ = []; try { for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__values"])(this.buttons_), _c = _b.next(); !_c.done; _c = _b.next()) { var buttonEl = _c.value; this.buttonRipples_.push(new MDCRipple(buttonEl)); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; MDCDialog.prototype.initialSyncWithDOM = function () { var _this = this; this.focusTrap_ = createFocusTrapInstance(this.container_, this.focusTrapFactory_, this.initialFocusEl_); this.handleInteraction_ = this.foundation_.handleInteraction.bind(this.foundation_); this.handleDocumentKeydown_ = this.foundation_.handleDocumentKeydown.bind(this.foundation_); this.handleLayout_ = this.layout.bind(this); var LAYOUT_EVENTS = ['resize', 'orientationchange']; this.handleOpening_ = function () { LAYOUT_EVENTS.forEach(function (evtType) { return window.addEventListener(evtType, _this.handleLayout_); }); document.addEventListener('keydown', _this.handleDocumentKeydown_); }; this.handleClosing_ = function () { LAYOUT_EVENTS.forEach(function (evtType) { return window.removeEventListener(evtType, _this.handleLayout_); }); document.removeEventListener('keydown', _this.handleDocumentKeydown_); }; this.listen('click', this.handleInteraction_); this.listen('keydown', this.handleInteraction_); this.listen(strings$2.OPENING_EVENT, this.handleOpening_); this.listen(strings$2.CLOSING_EVENT, this.handleClosing_); }; MDCDialog.prototype.destroy = function () { this.unlisten('click', this.handleInteraction_); this.unlisten('keydown', this.handleInteraction_); this.unlisten(strings$2.OPENING_EVENT, this.handleOpening_); this.unlisten(strings$2.CLOSING_EVENT, this.handleClosing_); this.handleClosing_(); this.buttonRipples_.forEach(function (ripple) { return ripple.destroy(); }); _super.prototype.destroy.call(this); }; MDCDialog.prototype.layout = function () { this.foundation_.layout(); }; MDCDialog.prototype.open = function () { this.foundation_.open(); }; MDCDialog.prototype.close = function (action) { if (action === void 0) { action = ''; } this.foundation_.close(action); }; MDCDialog.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addBodyClass: function addBodyClass(className) { return document.body.classList.add(className); }, addClass: function addClass(className) { return _this.root_.classList.add(className); }, areButtonsStacked: function areButtonsStacked() { return areTopsMisaligned(_this.buttons_); }, clickDefaultButton: function clickDefaultButton() { return _this.defaultButton_ && _this.defaultButton_.click(); }, eventTargetMatches: function eventTargetMatches(target, selector) { return target ? matches$1(target, selector) : false; }, getActionFromEvent: function getActionFromEvent(evt) { if (!evt.target) { return ''; } var element = closest(evt.target, "[" + strings$2.ACTION_ATTRIBUTE + "]"); return element && element.getAttribute(strings$2.ACTION_ATTRIBUTE); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, isContentScrollable: function isContentScrollable() { return isScrollable(_this.content_); }, notifyClosed: function notifyClosed(action) { return _this.emit(strings$2.CLOSED_EVENT, action ? { action: action } : {}); }, notifyClosing: function notifyClosing(action) { return _this.emit(strings$2.CLOSING_EVENT, action ? { action: action } : {}); }, notifyOpened: function notifyOpened() { return _this.emit(strings$2.OPENED_EVENT, {}); }, notifyOpening: function notifyOpening() { return _this.emit(strings$2.OPENING_EVENT, {}); }, releaseFocus: function releaseFocus() { return _this.focusTrap_.deactivate(); }, removeBodyClass: function removeBodyClass(className) { return document.body.classList.remove(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, reverseButtons: function reverseButtons() { _this.buttons_.reverse(); _this.buttons_.forEach(function (button) { button.parentElement.appendChild(button); }); }, trapFocus: function trapFocus() { return _this.focusTrap_.activate(); } }; return new MDCDialogFoundation(adapter); }; return MDCDialog; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var LAYOUT_EVENTS = ['resize', 'orientationchange']; var MdcDialogComponent = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MdcDialogComponent, _super); function MdcDialogComponent(_ngZone, _platform, elementRef, dialogRef) { var _this = _super.call(this, elementRef) || this; _this._ngZone = _ngZone; _this._platform = _platform; _this.elementRef = elementRef; _this.dialogRef = dialogRef; /** * Emits whenever the component is destroyed. */ _this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); _this._focusTrapInstance = null; _this._scrollable = true; _this._layoutEventSubscription = null; _this.config = dialogRef._portalInstance._config; return _this; } Object.defineProperty(MdcDialogComponent.prototype, "layoutEvents", { /** Combined stream of all of the dialog layout events. */ get: /** * Combined stream of all of the dialog layout events. * @return {?} */ function () { return rxjs__WEBPACK_IMPORTED_MODULE_4__["merge"].apply(void 0, LAYOUT_EVENTS.map((/** * @param {?} evt * @return {?} */ function (evt) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_4__["fromEvent"])(window, evt); }))); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcDialogComponent.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getDialog().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getDialog().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getDialog().classList.contains(className); }), addBodyClass: (/** * @param {?} className * @return {?} */ function (className) { if (_this._platform.isBrowser) { (/** @type {?} */ (document.body)).classList.add(className); } }), removeBodyClass: (/** * @param {?} className * @return {?} */ function (className) { if (_this._platform.isBrowser) { (/** @type {?} */ (document.body)).classList.remove(className); } }), eventTargetMatches: (/** * @param {?} target * @param {?} selector * @return {?} */ function (target, selector) { return matches$1((/** @type {?} */ (target)), selector); }), trapFocus: (/** * @return {?} */ function () { return (/** @type {?} */ (_this._focusTrapInstance)).activate(); }), releaseFocus: (/** * @return {?} */ function () { return (/** @type {?} */ (_this._focusTrapInstance)).deactivate(); }), isContentScrollable: (/** * @return {?} */ function () { return !!_this._content && _this._scrollable && isScrollable(_this._content.elementRef.nativeElement); }), areButtonsStacked: (/** * @return {?} */ function () { return areTopsMisaligned((/** @type {?} */ (_this._buttons))); }), getActionFromEvent: (/** * @param {?} event * @return {?} */ function (event) { /** @type {?} */ var element = closest((/** @type {?} */ (event.target)), "[" + strings.ACTION_ATTRIBUTE + "]"); return element && element.getAttribute(strings.ACTION_ATTRIBUTE); }), clickDefaultButton: (/** * @return {?} */ function () { /** @type {?} */ var defaultBtn = _this._getDefaultButton(); if (defaultBtn) { defaultBtn.click(); } }), reverseButtons: (/** * @return {?} */ function () { if (!_this._buttons) { return; } _this._buttons.toArray().reverse(); _this._buttons.forEach((/** * @param {?} button * @return {?} */ function (button) { return (/** @type {?} */ (button.getHostElement().parentElement)).appendChild(button.getHostElement()); })); }), notifyOpened: (/** * @return {?} */ function () { return _this.dialogRef.opened(); }), notifyOpening: (/** * @return {?} */ function () { }), notifyClosed: (/** * @param {?} action * @return {?} */ function (action) { return _this._closeDialogByRef(action); }), notifyClosing: (/** * @return {?} */ function () { }) }; return new MDCDialogFoundation(adapter); }; /** * @return {?} */ MdcDialogComponent.prototype.ngAfterViewInit = /** * @return {?} */ function () { this._foundation = this.getDefaultFoundation(); this._focusTrapInstance = this._createFocusTrapInstance(); this._initialize(); this._loadListeners(); this._foundation.open(); }; /** * @private * @return {?} */ MdcDialogComponent.prototype._initialize = /** * @private * @return {?} */ function () { this._scrollable = !!this.config.scrollable; if (!this.config.clickOutsideToClose) { this._foundation.setScrimClickAction(''); } if (!this.config.escapeToClose) { this._foundation.setEscapeKeyAction(''); } if (!this.config.buttonsStacked) { this._foundation.setAutoStackButtons(false); } }; /** * @return {?} */ MdcDialogComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); if (this._layoutEventSubscription) { this._layoutEventSubscription.unsubscribe(); } if (this._foundation) { this._foundation.destroy(); } }; /** * @param {?} evt * @return {?} */ MdcDialogComponent.prototype._onInteraction = /** * @param {?} evt * @return {?} */ function (evt) { this._foundation.handleInteraction(evt); }; /** * @private * @return {?} */ MdcDialogComponent.prototype._getDefaultButton = /** * @private * @return {?} */ function () { /** @type {?} */ var defaultBtn = this._buttons ? this._buttons.find((/** * @param {?} _ * @return {?} */ function (_) { return _.default; })) : undefined; return defaultBtn ? defaultBtn.getHostElement() : undefined; }; /** * @private * @param {?=} action * @return {?} */ MdcDialogComponent.prototype._closeDialogByRef = /** * @private * @param {?=} action * @return {?} */ function (action) { this.dialogRef.close(action); }; /** * @private * @return {?} */ MdcDialogComponent.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._layoutEventSubscription = this.layoutEvents.pipe() .subscribe((/** * @return {?} */ function () { return _this._foundation.layout(); })); if (this._platform.isBrowser) { this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_4__["fromEvent"])(document, 'keydown').pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["takeUntil"])(_this._destroy)) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleDocumentKeydown(evt); })); })); })); } }; /** * @private * @param {?=} focusTrapFactory * @return {?} */ MdcDialogComponent.prototype._createFocusTrapInstance = /** * @private * @param {?=} focusTrapFactory * @return {?} */ function (focusTrapFactory) { if (focusTrapFactory === void 0) { focusTrapFactory = focusTrap_1; } return focusTrapFactory(this._getDialog(), { initialFocus: this._getDefaultButton(), clickOutsideDeactivates: true, // Allow handling of scrim clicks escapeDeactivates: false // Dialog foundation handles escape key }); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcDialogComponent.prototype._getDialog = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this._elementRef.nativeElement; }; MdcDialogComponent.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-dialog', exportAs: 'mdc-dialog', host: { '[attr.id]': 'config?.id', 'role': 'alertdialog', 'class': 'mdc-dialog', '[attr.aria-modal]': 'true', '[attr.aria-labelledby]': 'config?.ariaLabel', '[attr.aria-label]': 'config?.ariaLabel', '[attr.aria-describedby]': 'config?.ariaDescribedBy || null', '(click)': '_onInteraction($event)', '(keydown)': '_onInteraction($event)' }, template: "\n \n ", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcDialogComponent.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: MdcDialogRef } ]; }; MdcDialogComponent.propDecorators = { _surface: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [MdcDialogSurface,] }], _content: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [MdcDialogContent,] }], _buttons: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [MdcDialogButton, { descendants: true },] }] }; return MdcDialogComponent; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template D */ var /** * @template D */ MdcDialogConfig = /** @class */ (function () { function MdcDialogConfig() { /** * ID of the element that describes the dialog. */ this.ariaDescribedBy = null; /** * Aria label to assign to the dialog element */ this.ariaLabel = null; /** * Whether the user can use escape key to close the dialog */ this.escapeToClose = true; /** * Whether the user can click outside to close the dialog */ this.clickOutsideToClose = true; /** * Applied automatically when the dialog has overflowing content to warrant scrolling. */ this.scrollable = true; /** * Applied automatically when the dialog's action buttons can't fit on a single line and must be stacked. */ this.buttonsStacked = true; /** * Data to be injected into the dialog content. */ this.data = null; } return MdcDialogConfig; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Throws an exception for the case when a ComponentPortal is * attached to a DomPortalOutlet without an origin. * @return {?} */ function throwMdcDialogContentAlreadyAttachedError() { throw Error('Attempting to attach dialog content after content is already attached'); } var MdcDialogPortal = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MdcDialogPortal, _super); function MdcDialogPortal(_config) { var _this = _super.call(this) || this; _this._config = _config; /** * A subject emitting after the dialog exits the view. */ _this._afterExit = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); return _this; } /** * Attach a ComponentPortal as content to this dialog container. * @param portal Portal to be attached as the dialog content. */ /** * Attach a ComponentPortal as content to this dialog container. * @template T * @param {?} portal Portal to be attached as the dialog content. * @return {?} */ MdcDialogPortal.prototype.attachComponentPortal = /** * Attach a ComponentPortal as content to this dialog container. * @template T * @param {?} portal Portal to be attached as the dialog content. * @return {?} */ function (portal) { if (this._portalOutlet.hasAttached()) { throwMdcDialogContentAlreadyAttachedError(); } return this._portalOutlet.attachComponentPortal(portal); }; /** * Attach a TemplatePortal as content to this dialog container. * @param portal Portal to be attached as the dialog content. */ /** * Attach a TemplatePortal as content to this dialog container. * @template C * @param {?} portal Portal to be attached as the dialog content. * @return {?} */ MdcDialogPortal.prototype.attachTemplatePortal = /** * Attach a TemplatePortal as content to this dialog container. * @template C * @param {?} portal Portal to be attached as the dialog content. * @return {?} */ function (portal) { if (this._portalOutlet.hasAttached()) { throwMdcDialogContentAlreadyAttachedError(); } return this._portalOutlet.attachTemplatePortal(portal); }; MdcDialogPortal.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-dialog-portal', host: { '[attr.id]': '_id' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcDialogPortal.ctorParameters = function () { return [ { type: MdcDialogConfig } ]; }; MdcDialogPortal.propDecorators = { _portalOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__["CdkPortalOutlet"],] }] }; return MdcDialogPortal; }(_angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__["BasePortalOutlet"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Injection token that can be used to access the data that was passed in to a dialog. * @type {?} */ var MDC_DIALOG_DATA = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('MdcDialogData'); /** * Injection token that can be used to specify default dialog options. * @type {?} */ var MDC_DIALOG_DEFAULT_OPTIONS = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('mdc-dialog-default-options'); var MdcDialog = /** @class */ (function () { function MdcDialog(_overlay, _injector, _defaultOptions, _parentDialog) { var _this = this; this._overlay = _overlay; this._injector = _injector; this._defaultOptions = _defaultOptions; this._parentDialog = _parentDialog; this._openDialogsAtThisLevel = []; this._afterAllClosedAtThisLevel = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); this._afterOpenedAtThisLevel = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); this._ariaHiddenElements = new Map(); /** * Stream that emits when all open dialog have finished closing. * Will emit on subscribe if there are no open dialogs to begin with. */ this.afterAllClosed = (/** @type {?} */ (Object(rxjs__WEBPACK_IMPORTED_MODULE_4__["defer"])((/** * @return {?} */ function () { return _this.openDialogs.length ? _this._afterAllClosed : _this._afterAllClosed.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["startWith"])(undefined)); })))); } Object.defineProperty(MdcDialog.prototype, "openDialogs", { /** Keeps track of the currently-open dialogs. */ get: /** * Keeps track of the currently-open dialogs. * @return {?} */ function () { return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel; }, enumerable: true, configurable: true }); Object.defineProperty(MdcDialog.prototype, "afterOpened", { /** Stream that emits when a dialog has been opened. */ get: /** * Stream that emits when a dialog has been opened. * @return {?} */ function () { return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel; }, enumerable: true, configurable: true }); Object.defineProperty(MdcDialog.prototype, "_afterAllClosed", { get: /** * @return {?} */ function () { /** @type {?} */ var parent = this._parentDialog; return parent ? parent._afterAllClosed : this._afterAllClosedAtThisLevel; }, enumerable: true, configurable: true }); /** * Opens a modal dialog containing the given template. * @param componentOrTemplateRef Type of the component to load into the dialog, * or a TemplateRef to instantiate as the dialog content. * @param config Extra configuration options. * @returns Reference to the newly-opened dialog. */ /** * Opens a modal dialog containing the given template. * @template T, D * @param {?} componentOrTemplateRef Type of the component to load into the dialog, * or a TemplateRef to instantiate as the dialog content. * @param {?=} config Extra configuration options. * @return {?} Reference to the newly-opened dialog. */ MdcDialog.prototype.open = /** * Opens a modal dialog containing the given template. * @template T, D * @param {?} componentOrTemplateRef Type of the component to load into the dialog, * or a TemplateRef to instantiate as the dialog content. * @param {?=} config Extra configuration options. * @return {?} Reference to the newly-opened dialog. */ function (componentOrTemplateRef, config) { var _this = this; config = _applyConfigDefaults(config, this._defaultOptions || new MdcDialogConfig()); if (config.id && this.getDialogById(config.id)) { throw Error("Dialog with id \"" + config.id + "\" exists already. The dialog id must be unique."); } /** @type {?} */ var overlayRef = this._createOverlay(); /** @type {?} */ var dialogContainer = this._attachDialogContainer(overlayRef, config); /** @type {?} */ var dialogRef = this._attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config); this.openDialogs.push(dialogRef); dialogRef.afterClosed().subscribe((/** * @return {?} */ function () { return _this._removeOpenDialog(dialogRef); })); this.afterOpened.next(dialogRef); return dialogRef; }; /** Closes all of the currently-open dialogs. */ /** * Closes all of the currently-open dialogs. * @return {?} */ MdcDialog.prototype.closeAll = /** * Closes all of the currently-open dialogs. * @return {?} */ function () { this._closeDialogs(this.openDialogs); }; /** * Finds an open dialog by its id. * @param id ID to use when looking up the dialog. */ /** * Finds an open dialog by its id. * @param {?} id ID to use when looking up the dialog. * @return {?} */ MdcDialog.prototype.getDialogById = /** * Finds an open dialog by its id. * @param {?} id ID to use when looking up the dialog. * @return {?} */ function (id) { return this.openDialogs.find((/** * @param {?} dialog * @return {?} */ function (dialog) { return dialog.id === id; })); }; /** * @return {?} */ MdcDialog.prototype.ngOnDestroy = /** * @return {?} */ function () { // Only close the dialogs at this level on destroy // since the parent service may still be active. this._closeDialogs(this._openDialogsAtThisLevel); this._afterAllClosedAtThisLevel.complete(); this._afterOpenedAtThisLevel.complete(); }; /** * Creates the overlay into which the dialog will be loaded. * @returns A promise resolving to the OverlayRef for the created overlay. */ /** * Creates the overlay into which the dialog will be loaded. * @private * @return {?} A promise resolving to the OverlayRef for the created overlay. */ MdcDialog.prototype._createOverlay = /** * Creates the overlay into which the dialog will be loaded. * @private * @return {?} A promise resolving to the OverlayRef for the created overlay. */ function () { return this._overlay.create(); }; /** * Attaches an MdcDialogPortal to a dialog's already-created overlay. * @param overlay Reference to the dialog's underlying overlay. * @param config The dialog configuration. * @returns A promise resolving to a ComponentRef for the attached container. */ /** * Attaches an MdcDialogPortal to a dialog's already-created overlay. * @private * @param {?} overlay Reference to the dialog's underlying overlay. * @param {?} config The dialog configuration. * @return {?} A promise resolving to a ComponentRef for the attached container. */ MdcDialog.prototype._attachDialogContainer = /** * Attaches an MdcDialogPortal to a dialog's already-created overlay. * @private * @param {?} overlay Reference to the dialog's underlying overlay. * @param {?} config The dialog configuration. * @return {?} A promise resolving to a ComponentRef for the attached container. */ function (overlay, config) { /** @type {?} */ var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; /** @type {?} */ var injector = new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__["PortalInjector"](userInjector || this._injector, new WeakMap([ [MdcDialogConfig, config] ])); /** @type {?} */ var containerPortal = new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__["ComponentPortal"](MdcDialogPortal, config.viewContainerRef, injector); /** @type {?} */ var containerRef = overlay.attach(containerPortal); return containerRef.instance; }; /** * Attaches the user-provided component to the already-created MdcDialogPortal. * @param componentOrTemplateRef The type of component being loaded into the dialog, * or a TemplateRef to instantiate as the content. * @param dialogContainer Reference to the wrapping MdcDialogPortal. * @param overlayRef Reference to the overlay in which the dialog resides. * @param config The dialog configuration. * @returns A promise resolving to the MdcDialogRef that should be returned to the user. */ /** * Attaches the user-provided component to the already-created MdcDialogPortal. * @private * @template T * @param {?} componentOrTemplateRef The type of component being loaded into the dialog, * or a TemplateRef to instantiate as the content. * @param {?} dialogContainer Reference to the wrapping MdcDialogPortal. * @param {?} overlayRef Reference to the overlay in which the dialog resides. * @param {?} config The dialog configuration. * @return {?} A promise resolving to the MdcDialogRef that should be returned to the user. */ MdcDialog.prototype._attachDialogContent = /** * Attaches the user-provided component to the already-created MdcDialogPortal. * @private * @template T * @param {?} componentOrTemplateRef The type of component being loaded into the dialog, * or a TemplateRef to instantiate as the content. * @param {?} dialogContainer Reference to the wrapping MdcDialogPortal. * @param {?} overlayRef Reference to the overlay in which the dialog resides. * @param {?} config The dialog configuration. * @return {?} A promise resolving to the MdcDialogRef that should be returned to the user. */ function (componentOrTemplateRef, dialogContainer, overlayRef, config) { // Create a reference to the dialog we're creating in order to give the user a handle // to modify and close it. /** @type {?} */ var dialogRef = new MdcDialogRef(overlayRef, dialogContainer, config.id); if (componentOrTemplateRef instanceof _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]) { dialogContainer.attachTemplatePortal(new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__["TemplatePortal"](componentOrTemplateRef, (/** @type {?} */ (null)), (/** @type {?} */ ({ $implicit: config.data, dialogRef: dialogRef })))); } else { /** @type {?} */ var injector = this._createInjector(config, dialogRef, dialogContainer); /** @type {?} */ var contentRef = dialogContainer.attachComponentPortal(new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__["ComponentPortal"](componentOrTemplateRef, undefined, injector)); dialogRef.componentInstance = contentRef.instance; } return dialogRef; }; /** * Creates a custom injector to be used inside the dialog. This allows a component loaded inside * of a dialog to close itself and, optionally, to return a value. * @param config Config object that is used to construct the dialog. * @param dialogRef Reference to the dialog. * @param container Dialog container element that wraps all of the contents. * @returns The custom injector that can be used inside the dialog. */ /** * Creates a custom injector to be used inside the dialog. This allows a component loaded inside * of a dialog to close itself and, optionally, to return a value. * @private * @template T * @param {?} config Config object that is used to construct the dialog. * @param {?} dialogRef Reference to the dialog. * @param {?} portalContainer * @return {?} The custom injector that can be used inside the dialog. */ MdcDialog.prototype._createInjector = /** * Creates a custom injector to be used inside the dialog. This allows a component loaded inside * of a dialog to close itself and, optionally, to return a value. * @private * @template T * @param {?} config Config object that is used to construct the dialog. * @param {?} dialogRef Reference to the dialog. * @param {?} portalContainer * @return {?} The custom injector that can be used inside the dialog. */ function (config, dialogRef, portalContainer) { /** @type {?} */ var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; // The MdcDialogPortal is injected in the portal as the MdcDialogPortal and the dialog's // content are created out of the same ViewContainerRef and as such, are siblings for injector // purposes. To allow the hierarchy that is expected, the MdcDialogPortal is explicitly // added to the injection tokens. /** @type {?} */ var injectionTokens = new WeakMap([ [MdcDialogPortal, portalContainer], [MDC_DIALOG_DATA, config.data], [MdcDialogRef, dialogRef] ]); return new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__["PortalInjector"](userInjector || this._injector, injectionTokens); }; /** * Removes a dialog from the array of open dialogs. * @param dialogRef Dialog to be removed. */ /** * Removes a dialog from the array of open dialogs. * @private * @param {?} dialogRef Dialog to be removed. * @return {?} */ MdcDialog.prototype._removeOpenDialog = /** * Removes a dialog from the array of open dialogs. * @private * @param {?} dialogRef Dialog to be removed. * @return {?} */ function (dialogRef) { /** @type {?} */ var index = this.openDialogs.indexOf(dialogRef); if (index > -1) { this.openDialogs.splice(index, 1); // If all the dialogs were closed, remove/restore the `aria-hidden` // to a the siblings and emit to the `afterAllClosed` stream. if (!this.openDialogs.length) { this._ariaHiddenElements.forEach((/** * @param {?} previousValue * @param {?} element * @return {?} */ function (previousValue, element) { if (previousValue) { element.setAttribute('aria-hidden', previousValue); } else { element.removeAttribute('aria-hidden'); } })); this._ariaHiddenElements.clear(); this._afterAllClosed.next(); } } }; /** Closes all of the dialogs in an array. */ /** * Closes all of the dialogs in an array. * @private * @param {?} dialogs * @return {?} */ MdcDialog.prototype._closeDialogs = /** * Closes all of the dialogs in an array. * @private * @param {?} dialogs * @return {?} */ function (dialogs) { /** @type {?} */ var i = dialogs.length; while (i--) { // The `_openDialogs` property isn't updated after close until the rxjs subscription // runs on the next microtask, in addition to modifying the array as we're going // through it. We loop through all of them and call close without assuming that // they'll be removed from the list instantaneously. dialogs[i].close(); } }; MdcDialog.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, ]; /** @nocollapse */ MdcDialog.ctorParameters = function () { return [ { type: _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_1__["Overlay"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injector"] }, { type: MdcDialogConfig, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [MDC_DIALOG_DEFAULT_OPTIONS,] }] }, { type: MdcDialog, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["SkipSelf"] }] } ]; }; return MdcDialog; }()); /** * Applies default options to the dialog config. * @param {?=} config Config to be modified. * @param {?=} defaultOptions Default options provided. * @return {?} The new configuration object. */ function _applyConfigDefaults(config, defaultOptions) { return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, defaultOptions, config); } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var DIALOG_DECLARATIONS = [ MdcDialogAction, MdcDialogActions, MdcDialogButton, MdcDialogComponent, MdcDialogContainer, MdcDialogPortal, MdcDialogContent, MdcDialogScrim, MdcDialogSurface, MdcDialogSurface, MdcDialogTitle ]; var MdcDialogModule = /** @class */ (function () { function MdcDialogModule() { } MdcDialogModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_1__["OverlayModule"], _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_2__["PortalModule"] ], exports: DIALOG_DECLARATIONS, declarations: DIALOG_DECLARATIONS, providers: [MdcDialog], entryComponents: [ MdcDialogPortal, MdcDialogComponent ] },] }, ]; return MdcDialogModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=dialog.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/drawer.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/drawer.es5.js ***! \**********************************************************/ /*! exports provided: MdcDrawer, MdcDrawerAppContent, MdcDrawerContent, MdcDrawerHeader, MdcDrawerModule, MdcDrawerSubtitle, MdcDrawerTitle */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDrawer", function() { return MdcDrawer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerAppContent", function() { return MdcDrawerAppContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerContent", function() { return MdcDrawerContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerHeader", function() { return MdcDrawerHeader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerModule", function() { return MdcDrawerModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerSubtitle", function() { return MdcDrawerSubtitle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerTitle", function() { return MdcDrawerTitle; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/list */ "./node_modules/@angular-mdc/web/esm5/list.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])']; var candidateSelector = candidateSelectors.join(','); var matches = typeof Element === 'undefined' ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; function tabbable(el, options) { options = options || {}; var elementDocument = el.ownerDocument || el; var regularTabbables = []; var orderedTabbables = []; var untouchabilityChecker = new UntouchabilityChecker(elementDocument); var candidates = el.querySelectorAll(candidateSelector); if (options.includeContainer) { if (matches.call(el, candidateSelector)) { candidates = Array.prototype.slice.apply(candidates); candidates.unshift(el); } } var i, candidate, candidateTabindex; for (i = 0; i < candidates.length; i++) { candidate = candidates[i]; if (!isNodeMatchingSelectorTabbable(candidate, untouchabilityChecker)) continue; candidateTabindex = getTabindex(candidate); if (candidateTabindex === 0) { regularTabbables.push(candidate); } else { orderedTabbables.push({ documentOrder: i, tabIndex: candidateTabindex, node: candidate }); } } var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function (a) { return a.node; }).concat(regularTabbables); return tabbableNodes; } tabbable.isTabbable = isTabbable; tabbable.isFocusable = isFocusable; function isNodeMatchingSelectorTabbable(node, untouchabilityChecker) { if (!isNodeMatchingSelectorFocusable(node, untouchabilityChecker) || isNonTabbableRadio(node) || getTabindex(node) < 0) { return false; } return true; } function isTabbable(node, untouchabilityChecker) { if (!node) throw new Error('No node provided'); if (matches.call(node, candidateSelector) === false) return false; return isNodeMatchingSelectorTabbable(node, untouchabilityChecker); } function isNodeMatchingSelectorFocusable(node, untouchabilityChecker) { untouchabilityChecker = untouchabilityChecker || new UntouchabilityChecker(node.ownerDocument || node); if (node.disabled || isHiddenInput(node) || untouchabilityChecker.isUntouchable(node)) { return false; } return true; } var focusableCandidateSelector = candidateSelectors.concat('iframe').join(','); function isFocusable(node, untouchabilityChecker) { if (!node) throw new Error('No node provided'); if (matches.call(node, focusableCandidateSelector) === false) return false; return isNodeMatchingSelectorFocusable(node, untouchabilityChecker); } function getTabindex(node) { var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10); if (!isNaN(tabindexAttr)) return tabindexAttr; // Browsers do not return `tabIndex` correctly for contentEditable nodes; // so if they don't have a tabindex attribute specifically set, assume it's 0. if (isContentEditable(node)) return 0; return node.tabIndex; } function sortOrderedTabbables(a, b) { return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex; } // Array.prototype.find not available in IE. function find(list, predicate) { for (var i = 0, length = list.length; i < length; i++) { if (predicate(list[i])) return list[i]; } } function isContentEditable(node) { return node.contentEditable === 'true'; } function isInput(node) { return node.tagName === 'INPUT'; } function isHiddenInput(node) { return isInput(node) && node.type === 'hidden'; } function isRadio(node) { return isInput(node) && node.type === 'radio'; } function isNonTabbableRadio(node) { return isRadio(node) && !isTabbableRadio(node); } function getCheckedRadio(nodes) { for (var i = 0; i < nodes.length; i++) { if (nodes[i].checked) { return nodes[i]; } } } function isTabbableRadio(node) { if (!node.name) return true; // This won't account for the edge case where you have radio groups with the same // in separate forms on the same page. var radioSet = node.ownerDocument.querySelectorAll('input[type="radio"][name="' + node.name + '"]'); var checked = getCheckedRadio(radioSet); return !checked || checked === node; } // An element is "untouchable" if *it or one of its ancestors* has // `visibility: hidden` or `display: none`. function UntouchabilityChecker(elementDocument) { this.doc = elementDocument; // Node cache must be refreshed on every check, in case // the content of the element has changed. The cache contains tuples // mapping nodes to their boolean result. this.cache = []; } // getComputedStyle accurately reflects `visibility: hidden` of ancestors // but not `display: none`, so we need to recursively check parents. UntouchabilityChecker.prototype.hasDisplayNone = function hasDisplayNone(node, nodeComputedStyle) { if (node.nodeType !== Node.ELEMENT_NODE) return false; // Search for a cached result. var cached = find(this.cache, function (item) { return item === node; }); if (cached) return cached[1]; nodeComputedStyle = nodeComputedStyle || this.doc.defaultView.getComputedStyle(node); var result = false; if (nodeComputedStyle.display === 'none') { result = true; } else if (node.parentNode) { result = this.hasDisplayNone(node.parentNode); } this.cache.push([node, result]); return result; }; UntouchabilityChecker.prototype.isUntouchable = function isUntouchable(node) { if (node === this.doc.documentElement) return false; var computedStyle = this.doc.defaultView.getComputedStyle(node); if (this.hasDisplayNone(node, computedStyle)) return true; return computedStyle.visibility === 'hidden'; }; var tabbable_1 = tabbable; var immutable = extend; var hasOwnProperty = Object.prototype.hasOwnProperty; function extend() { var target = {}; for (var i = 0; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; } var activeFocusTraps = function () { var trapQueue = []; return { activateTrap: function activateTrap(trap) { if (trapQueue.length > 0) { var activeTrap = trapQueue[trapQueue.length - 1]; if (activeTrap !== trap) { activeTrap.pause(); } } var trapIndex = trapQueue.indexOf(trap); if (trapIndex === -1) { trapQueue.push(trap); } else { // move this existing trap to the front of the queue trapQueue.splice(trapIndex, 1); trapQueue.push(trap); } }, deactivateTrap: function deactivateTrap(trap) { var trapIndex = trapQueue.indexOf(trap); if (trapIndex !== -1) { trapQueue.splice(trapIndex, 1); } if (trapQueue.length > 0) { trapQueue[trapQueue.length - 1].unpause(); } } }; }(); function focusTrap(element, userOptions) { var doc = document; var container = typeof element === 'string' ? doc.querySelector(element) : element; var config = immutable({ returnFocusOnDeactivate: true, escapeDeactivates: true }, userOptions); var state = { firstTabbableNode: null, lastTabbableNode: null, nodeFocusedBeforeActivation: null, mostRecentlyFocusedNode: null, active: false, paused: false }; var trap = { activate: activate, deactivate: deactivate, pause: pause, unpause: unpause }; return trap; function activate(activateOptions) { if (state.active) return; updateTabbableNodes(); state.active = true; state.paused = false; state.nodeFocusedBeforeActivation = doc.activeElement; var onActivate = activateOptions && activateOptions.onActivate ? activateOptions.onActivate : config.onActivate; if (onActivate) { onActivate(); } addListeners(); return trap; } function deactivate(deactivateOptions) { if (!state.active) return; removeListeners(); state.active = false; state.paused = false; activeFocusTraps.deactivateTrap(trap); var onDeactivate = deactivateOptions && deactivateOptions.onDeactivate !== undefined ? deactivateOptions.onDeactivate : config.onDeactivate; if (onDeactivate) { onDeactivate(); } var returnFocus = deactivateOptions && deactivateOptions.returnFocus !== undefined ? deactivateOptions.returnFocus : config.returnFocusOnDeactivate; if (returnFocus) { delay(function () { tryFocus(state.nodeFocusedBeforeActivation); }); } return trap; } function pause() { if (state.paused || !state.active) return; state.paused = true; removeListeners(); } function unpause() { if (!state.paused || !state.active) return; state.paused = false; addListeners(); } function addListeners() { if (!state.active) return; // There can be only one listening focus trap at a time activeFocusTraps.activateTrap(trap); updateTabbableNodes(); // Delay ensures that the focused element doesn't capture the event // that caused the focus trap activation. delay(function () { tryFocus(getInitialFocusNode()); }); doc.addEventListener('focusin', checkFocusIn, true); doc.addEventListener('mousedown', checkPointerDown, true); doc.addEventListener('touchstart', checkPointerDown, true); doc.addEventListener('click', checkClick, true); doc.addEventListener('keydown', checkKey, true); return trap; } function removeListeners() { if (!state.active) return; doc.removeEventListener('focusin', checkFocusIn, true); doc.removeEventListener('mousedown', checkPointerDown, true); doc.removeEventListener('touchstart', checkPointerDown, true); doc.removeEventListener('click', checkClick, true); doc.removeEventListener('keydown', checkKey, true); return trap; } function getNodeForOption(optionName) { var optionValue = config[optionName]; var node = optionValue; if (!optionValue) { return null; } if (typeof optionValue === 'string') { node = doc.querySelector(optionValue); if (!node) { throw new Error('`' + optionName + '` refers to no known node'); } } if (typeof optionValue === 'function') { node = optionValue(); if (!node) { throw new Error('`' + optionName + '` did not return a node'); } } return node; } function getInitialFocusNode() { var node; if (getNodeForOption('initialFocus') !== null) { node = getNodeForOption('initialFocus'); } else if (container.contains(doc.activeElement)) { node = doc.activeElement; } else { node = state.firstTabbableNode || getNodeForOption('fallbackFocus'); } if (!node) { throw new Error("You can't have a focus-trap without at least one focusable element"); } return node; } // This needs to be done on mousedown and touchstart instead of click // so that it precedes the focus event. function checkPointerDown(e) { if (container.contains(e.target)) return; if (config.clickOutsideDeactivates) { deactivate({ returnFocus: !tabbable_1.isFocusable(e.target) }); } else { e.preventDefault(); } } // In case focus escapes the trap for some strange reason, pull it back in. function checkFocusIn(e) { // In Firefox when you Tab out of an iframe the Document is briefly focused. if (container.contains(e.target) || e.target instanceof Document) { return; } e.stopImmediatePropagation(); tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode()); } function checkKey(e) { if (config.escapeDeactivates !== false && isEscapeEvent(e)) { e.preventDefault(); deactivate(); return; } if (isTabEvent(e)) { checkTab(e); return; } } // Hijack Tab events on the first and last focusable nodes of the trap, // in order to prevent focus from escaping. If it escapes for even a // moment it can end up scrolling the page and causing confusion so we // kind of need to capture the action at the keydown phase. function checkTab(e) { updateTabbableNodes(); if (e.shiftKey && e.target === state.firstTabbableNode) { e.preventDefault(); tryFocus(state.lastTabbableNode); return; } if (!e.shiftKey && e.target === state.lastTabbableNode) { e.preventDefault(); tryFocus(state.firstTabbableNode); return; } } function checkClick(e) { if (config.clickOutsideDeactivates) return; if (container.contains(e.target)) return; e.preventDefault(); e.stopImmediatePropagation(); } function updateTabbableNodes() { var tabbableNodes = tabbable_1(container); state.firstTabbableNode = tabbableNodes[0] || getInitialFocusNode(); state.lastTabbableNode = tabbableNodes[tabbableNodes.length - 1] || getInitialFocusNode(); } function tryFocus(node) { if (node === doc.activeElement) return; if (!node || !node.focus) { tryFocus(getInitialFocusNode()); return; } node.focus(); state.mostRecentlyFocusedNode = node; if (isSelectableInput(node)) { node.select(); } } } function isSelectableInput(node) { return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function'; } function isEscapeEvent(e) { return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27; } function isTabEvent(e) { return e.key === 'Tab' || e.keyCode === 9; } function delay(fn) { return setTimeout(fn, 0); } var focusTrap_1 = focusTrap; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function createFocusTrapInstance(surfaceEl, focusTrapFactory) { if (focusTrapFactory === void 0) { focusTrapFactory = focusTrap_1; } return focusTrapFactory(surfaceEl, { clickOutsideDeactivates: true, escapeDeactivates: false, initialFocus: undefined, returnFocusOnDeactivate: false }); } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. */ function closest(element, selector) { if (element.closest) { return element.closest(selector); } var el = element; while (el) { if (matches$1(el, selector)) { return el; } el = el.parentElement; } return null; } function matches$1(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated', LIST_ITEM_CLASS: 'mdc-list-item', LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected', ROOT: 'mdc-list' }; var strings = { ACTION_EVENT: 'MDCList:action', ARIA_CHECKED: 'aria-checked', ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]', ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]', ARIA_CURRENT: 'aria-current', ARIA_ORIENTATION: 'aria-orientation', ARIA_ORIENTATION_HORIZONTAL: 'horizontal', ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]', ARIA_SELECTED: 'aria-selected', CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled)', CHECKBOX_SELECTOR: 'input[type="checkbox"]:not(:disabled)', CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a\n ", ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)', FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a,\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled)\n ", RADIO_SELECTOR: 'input[type="radio"]:not(:disabled)' }; var numbers = { UNSET_INDEX: -1 }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select']; function isNumberArray(selectedIndex) { return selectedIndex instanceof Array; } var MDCListFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCListFoundation, _super); function MDCListFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCListFoundation.defaultAdapter, adapter)) || this; _this.wrapFocus_ = false; _this.isVertical_ = true; _this.isSingleSelectionList_ = false; _this.selectedIndex_ = numbers.UNSET_INDEX; _this.focusedItemIndex_ = numbers.UNSET_INDEX; _this.useActivatedClass_ = false; _this.ariaCurrentAttrValue_ = null; _this.isCheckboxList_ = false; _this.isRadioList_ = false; return _this; } Object.defineProperty(MDCListFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "defaultAdapter", { get: function get() { return { addClassForElementIndex: function addClassForElementIndex() { return undefined; }, focusItemAtIndex: function focusItemAtIndex() { return undefined; }, getAttributeForElementIndex: function getAttributeForElementIndex() { return null; }, getFocusedElementIndex: function getFocusedElementIndex() { return 0; }, getListItemCount: function getListItemCount() { return 0; }, hasCheckboxAtIndex: function hasCheckboxAtIndex() { return false; }, hasRadioAtIndex: function hasRadioAtIndex() { return false; }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() { return false; }, isFocusInsideList: function isFocusInsideList() { return false; }, notifyAction: function notifyAction() { return undefined; }, removeClassForElementIndex: function removeClassForElementIndex() { return undefined; }, setAttributeForElementIndex: function setAttributeForElementIndex() { return undefined; }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() { return undefined; }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren() { return undefined; } }; }, enumerable: true, configurable: true }); MDCListFoundation.prototype.layout = function () { if (this.adapter_.getListItemCount() === 0) { return; } if (this.adapter_.hasCheckboxAtIndex(0)) { this.isCheckboxList_ = true; } else if (this.adapter_.hasRadioAtIndex(0)) { this.isRadioList_ = true; } }; /** * Sets the private wrapFocus_ variable. */ MDCListFoundation.prototype.setWrapFocus = function (value) { this.wrapFocus_ = value; }; /** * Sets the isVertical_ private variable. */ MDCListFoundation.prototype.setVerticalOrientation = function (value) { this.isVertical_ = value; }; /** * Sets the isSingleSelectionList_ private variable. */ MDCListFoundation.prototype.setSingleSelection = function (value) { this.isSingleSelectionList_ = value; }; /** * Sets the useActivatedClass_ private variable. */ MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) { this.useActivatedClass_ = useActivated; }; MDCListFoundation.prototype.getSelectedIndex = function () { return this.selectedIndex_; }; MDCListFoundation.prototype.setSelectedIndex = function (index) { if (!this.isIndexValid_(index)) { return; } if (this.isCheckboxList_) { this.setCheckboxAtIndex_(index); } else if (this.isRadioList_) { this.setRadioAtIndex_(index); } else { this.setSingleSelectionAtIndex_(index); } }; /** * Focus in handler for the list items. */ MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) { if (listItemIndex >= 0) { this.adapter_.setTabIndexForListItemChildren(listItemIndex, '0'); } }; /** * Focus out handler for the list items. */ MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) { var _this = this; if (listItemIndex >= 0) { this.adapter_.setTabIndexForListItemChildren(listItemIndex, '-1'); } /** * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus * is moved to next element. */ setTimeout(function () { if (!_this.adapter_.isFocusInsideList()) { _this.setTabindexToFirstSelectedItem_(); } }, 0); }; /** * Key handler for the list. */ MDCListFoundation.prototype.handleKeydown = function (evt, isRootListItem, listItemIndex) { var arrowLeft = evt.key === 'ArrowLeft' || evt.keyCode === 37; var arrowUp = evt.key === 'ArrowUp' || evt.keyCode === 38; var arrowRight = evt.key === 'ArrowRight' || evt.keyCode === 39; var arrowDown = evt.key === 'ArrowDown' || evt.keyCode === 40; var isHome = evt.key === 'Home' || evt.keyCode === 36; var isEnd = evt.key === 'End' || evt.keyCode === 35; var isEnter = evt.key === 'Enter' || evt.keyCode === 13; var isSpace = evt.key === 'Space' || evt.keyCode === 32; var currentIndex = this.adapter_.getFocusedElementIndex(); var nextIndex = numbers.UNSET_INDEX; if (currentIndex === numbers.UNSET_INDEX) { currentIndex = listItemIndex; if (currentIndex < 0) { // If this event doesn't have a mdc-list-item ancestor from the // current list (not from a sublist), return early. return; } } if (this.isVertical_ && arrowDown || !this.isVertical_ && arrowRight) { this.preventDefaultEvent_(evt); nextIndex = this.focusNextElement(currentIndex); } else if (this.isVertical_ && arrowUp || !this.isVertical_ && arrowLeft) { this.preventDefaultEvent_(evt); nextIndex = this.focusPrevElement(currentIndex); } else if (isHome) { this.preventDefaultEvent_(evt); nextIndex = this.focusFirstElement(); } else if (isEnd) { this.preventDefaultEvent_(evt); nextIndex = this.focusLastElement(); } else if (isEnter || isSpace) { if (isRootListItem) { // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event. var target = evt.target; if (target && target.tagName === 'A' && isEnter) { return; } this.preventDefaultEvent_(evt); if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(currentIndex); } this.adapter_.notifyAction(currentIndex); } } this.focusedItemIndex_ = currentIndex; if (nextIndex >= 0) { this.setTabindexAtIndex_(nextIndex); this.focusedItemIndex_ = nextIndex; } }; /** * Click handler for the list. */ MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) { if (index === numbers.UNSET_INDEX) { return; } if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(index, toggleCheckbox); } this.adapter_.notifyAction(index); this.setTabindexAtIndex_(index); this.focusedItemIndex_ = index; }; /** * Focuses the next element on the list. */ MDCListFoundation.prototype.focusNextElement = function (index) { var count = this.adapter_.getListItemCount(); var nextIndex = index + 1; if (nextIndex >= count) { if (this.wrapFocus_) { nextIndex = 0; } else { // Return early because last item is already focused. return index; } } this.adapter_.focusItemAtIndex(nextIndex); return nextIndex; }; /** * Focuses the previous element on the list. */ MDCListFoundation.prototype.focusPrevElement = function (index) { var prevIndex = index - 1; if (prevIndex < 0) { if (this.wrapFocus_) { prevIndex = this.adapter_.getListItemCount() - 1; } else { // Return early because first item is already focused. return index; } } this.adapter_.focusItemAtIndex(prevIndex); return prevIndex; }; MDCListFoundation.prototype.focusFirstElement = function () { this.adapter_.focusItemAtIndex(0); return 0; }; MDCListFoundation.prototype.focusLastElement = function () { var lastIndex = this.adapter_.getListItemCount() - 1; this.adapter_.focusItemAtIndex(lastIndex); return lastIndex; }; /** * Ensures that preventDefault is only called if the containing element doesn't * consume the event, and it will cause an unintended scroll. */ MDCListFoundation.prototype.preventDefaultEvent_ = function (evt) { var target = evt.target; var tagName = ("" + target.tagName).toLowerCase(); if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) { evt.preventDefault(); } }; MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) { if (this.selectedIndex_ === index) { return; } var selectedClassName = cssClasses.LIST_ITEM_SELECTED_CLASS; if (this.useActivatedClass_) { selectedClassName = cssClasses.LIST_ITEM_ACTIVATED_CLASS; } if (this.selectedIndex_ !== numbers.UNSET_INDEX) { this.adapter_.removeClassForElementIndex(this.selectedIndex_, selectedClassName); } this.adapter_.addClassForElementIndex(index, selectedClassName); this.setAriaForSingleSelectionAtIndex_(index); this.selectedIndex_ = index; }; /** * Sets aria attribute for single selection at given index. */ MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) { // Detect the presence of aria-current and get the value only during list initialization when it is in unset state. if (this.selectedIndex_ === numbers.UNSET_INDEX) { this.ariaCurrentAttrValue_ = this.adapter_.getAttributeForElementIndex(index, strings.ARIA_CURRENT); } var isAriaCurrent = this.ariaCurrentAttrValue_ !== null; var ariaAttribute = isAriaCurrent ? strings.ARIA_CURRENT : strings.ARIA_SELECTED; if (this.selectedIndex_ !== numbers.UNSET_INDEX) { this.adapter_.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false'); } var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true'; this.adapter_.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue); }; /** * Toggles radio at give index. Radio doesn't change the checked state if it is already checked. */ MDCListFoundation.prototype.setRadioAtIndex_ = function (index) { this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, true); if (this.selectedIndex_ !== numbers.UNSET_INDEX) { this.adapter_.setAttributeForElementIndex(this.selectedIndex_, strings.ARIA_CHECKED, 'false'); } this.adapter_.setAttributeForElementIndex(index, strings.ARIA_CHECKED, 'true'); this.selectedIndex_ = index; }; MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) { for (var i = 0; i < this.adapter_.getListItemCount(); i++) { var isChecked = false; if (index.indexOf(i) >= 0) { isChecked = true; } this.adapter_.setCheckedCheckboxOrRadioAtIndex(i, isChecked); this.adapter_.setAttributeForElementIndex(i, strings.ARIA_CHECKED, isChecked ? 'true' : 'false'); } this.selectedIndex_ = index; }; MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) { if (this.focusedItemIndex_ === numbers.UNSET_INDEX && index !== 0) { // If no list item was selected set first list item's tabindex to -1. // Generally, tabindex is set to 0 on first list item of list that has no preselected items. this.adapter_.setAttributeForElementIndex(0, 'tabindex', '-1'); } else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) { this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_, 'tabindex', '-1'); } this.adapter_.setAttributeForElementIndex(index, 'tabindex', '0'); }; /** * @return Return true if it is single selectin list, checkbox list or radio list. */ MDCListFoundation.prototype.isSelectableList_ = function () { return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_; }; MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () { var targetIndex = 0; if (this.isSelectableList_()) { if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== numbers.UNSET_INDEX) { targetIndex = this.selectedIndex_; } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) { targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { return Math.min(currentIndex, minIndex); }); } } this.setTabindexAtIndex_(targetIndex); }; MDCListFoundation.prototype.isIndexValid_ = function (index) { var _this = this; if (index instanceof Array) { if (!this.isCheckboxList_) { throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list'); } if (index.length === 0) { return true; } else { return index.some(function (i) { return _this.isIndexInRange_(i); }); } } else if (typeof index === 'number') { if (this.isCheckboxList_) { throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index); } return this.isIndexInRange_(index); } else { return false; } }; MDCListFoundation.prototype.isIndexInRange_ = function (index) { var listSize = this.adapter_.getListItemCount(); return index >= 0 && index < listSize; }; MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) { if (toggleCheckbox === void 0) { toggleCheckbox = true; } if (this.isCheckboxList_) { this.toggleCheckboxAtIndex_(index, toggleCheckbox); } else { this.setSelectedIndex(index); } }; MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) { var isChecked = this.adapter_.isCheckboxCheckedAtIndex(index); if (toggleCheckbox) { isChecked = !isChecked; this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, isChecked); } this.adapter_.setAttributeForElementIndex(index, strings.ARIA_CHECKED, isChecked ? 'true' : 'false'); // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value. var selectedIndexes = this.selectedIndex_ === numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice(); if (isChecked) { selectedIndexes.push(index); } else { selectedIndexes = selectedIndexes.filter(function (i) { return i !== index; }); } this.selectedIndex_ = selectedIndexes; }; return MDCListFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCList = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCList, _super); function MDCList() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCList.prototype, "vertical", { set: function set(value) { this.foundation_.setVerticalOrientation(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "listElements", { get: function get() { return [].slice.call(this.root_.querySelectorAll(strings.ENABLED_ITEMS_SELECTOR)); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "wrapFocus", { set: function set(value) { this.foundation_.setWrapFocus(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "singleSelection", { set: function set(isSingleSelectionList) { this.foundation_.setSingleSelection(isSingleSelectionList); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "selectedIndex", { get: function get() { return this.foundation_.getSelectedIndex(); }, set: function set(index) { this.foundation_.setSelectedIndex(index); }, enumerable: true, configurable: true }); MDCList.attachTo = function (root) { return new MDCList(root); }; MDCList.prototype.initialSyncWithDOM = function () { this.handleClick_ = this.handleClickEvent_.bind(this); this.handleKeydown_ = this.handleKeydownEvent_.bind(this); this.focusInEventListener_ = this.handleFocusInEvent_.bind(this); this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this); this.listen('keydown', this.handleKeydown_); this.listen('click', this.handleClick_); this.listen('focusin', this.focusInEventListener_); this.listen('focusout', this.focusOutEventListener_); this.layout(); this.initializeListType(); }; MDCList.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten('click', this.handleClick_); this.unlisten('focusin', this.focusInEventListener_); this.unlisten('focusout', this.focusOutEventListener_); }; MDCList.prototype.layout = function () { var direction = this.root_.getAttribute(strings.ARIA_ORIENTATION); this.vertical = direction !== strings.ARIA_ORIENTATION_HORIZONTAL; // List items need to have at least tabindex=-1 to be focusable. [].slice.call(this.root_.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (el) { el.setAttribute('tabindex', '-1'); }); // Child button/a elements are not tabbable until the list item is focused. [].slice.call(this.root_.querySelectorAll(strings.FOCUSABLE_CHILD_ELEMENTS)).forEach(function (el) { return el.setAttribute('tabindex', '-1'); }); this.foundation_.layout(); }; /** * Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio. */ MDCList.prototype.initializeListType = function () { var _this = this; var checkboxListItems = this.root_.querySelectorAll(strings.ARIA_ROLE_CHECKBOX_SELECTOR); var singleSelectedListItem = this.root_.querySelector("\n ." + cssClasses.LIST_ITEM_ACTIVATED_CLASS + ",\n ." + cssClasses.LIST_ITEM_SELECTED_CLASS + "\n "); var radioSelectedListItem = this.root_.querySelector(strings.ARIA_CHECKED_RADIO_SELECTOR); if (checkboxListItems.length) { var preselectedItems = this.root_.querySelectorAll(strings.ARIA_CHECKED_CHECKBOX_SELECTOR); this.selectedIndex = [].map.call(preselectedItems, function (listItem) { return _this.listElements.indexOf(listItem); }); } else if (singleSelectedListItem) { if (singleSelectedListItem.classList.contains(cssClasses.LIST_ITEM_ACTIVATED_CLASS)) { this.foundation_.setUseActivatedClass(true); } this.singleSelection = true; this.selectedIndex = this.listElements.indexOf(singleSelectedListItem); } else if (radioSelectedListItem) { this.selectedIndex = this.listElements.indexOf(radioSelectedListItem); } }; MDCList.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClassForElementIndex: function addClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.add(className); } }, focusItemAtIndex: function focusItemAtIndex(index) { var element = _this.listElements[index]; if (element) { element.focus(); } }, getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) { return _this.listElements[index].getAttribute(attr); }, getFocusedElementIndex: function getFocusedElementIndex() { return _this.listElements.indexOf(document.activeElement); }, getListItemCount: function getListItemCount() { return _this.listElements.length; }, hasCheckboxAtIndex: function hasCheckboxAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(strings.CHECKBOX_SELECTOR); }, hasRadioAtIndex: function hasRadioAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(strings.RADIO_SELECTOR); }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(strings.CHECKBOX_SELECTOR); return toggleEl.checked; }, isFocusInsideList: function isFocusInsideList() { return _this.root_.contains(document.activeElement); }, notifyAction: function notifyAction(index) { _this.emit(strings.ACTION_EVENT, { index: index }, /** shouldBubble */ true); }, removeClassForElementIndex: function removeClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.remove(className); } }, setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { var element = _this.listElements[index]; if (element) { element.setAttribute(attr, value); } }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(strings.CHECKBOX_RADIO_SELECTOR); toggleEl.checked = isChecked; var event = document.createEvent('Event'); event.initEvent('change', true, true); toggleEl.dispatchEvent(event); }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { var element = _this.listElements[listItemIndex]; var listItemChildren = [].slice.call(element.querySelectorAll(strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)); listItemChildren.forEach(function (el) { return el.setAttribute('tabindex', tabIndexValue); }); } }; return new MDCListFoundation(adapter); }; /** * Used to figure out which list item this event is targetting. Or returns -1 if * there is no list item */ MDCList.prototype.getListItemIndex_ = function (evt) { var eventTarget = evt.target; var nearestParent = closest(eventTarget, "." + cssClasses.LIST_ITEM_CLASS + ", ." + cssClasses.ROOT); // Get the index of the element if it is a list item. if (nearestParent && matches$1(nearestParent, "." + cssClasses.LIST_ITEM_CLASS)) { return this.listElements.indexOf(nearestParent); } return -1; }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusInEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation_.handleFocusIn(evt, index); }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusOutEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation_.handleFocusOut(evt, index); }; /** * Used to figure out which element was focused when keydown event occurred before sending the event to the * foundation. */ MDCList.prototype.handleKeydownEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; if (index >= 0) { this.foundation_.handleKeydown(evt, target.classList.contains(cssClasses.LIST_ITEM_CLASS), index); } }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleClickEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events. var toggleCheckbox = !matches$1(target, strings.CHECKBOX_RADIO_SELECTOR); this.foundation_.handleClick(index, toggleCheckbox); }; return MDCList; }(MDCComponent); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { ANIMATE: 'mdc-drawer--animate', CLOSING: 'mdc-drawer--closing', DISMISSIBLE: 'mdc-drawer--dismissible', MODAL: 'mdc-drawer--modal', OPEN: 'mdc-drawer--open', OPENING: 'mdc-drawer--opening', ROOT: 'mdc-drawer' }; var strings$1 = { APP_CONTENT_SELECTOR: '.mdc-drawer-app-content', CLOSE_EVENT: 'MDCDrawer:closed', OPEN_EVENT: 'MDCDrawer:opened', SCRIM_SELECTOR: '.mdc-drawer-scrim' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCDismissibleDrawerFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCDismissibleDrawerFoundation, _super); function MDCDismissibleDrawerFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCDismissibleDrawerFoundation.defaultAdapter, adapter)) || this; _this.animationFrame_ = 0; _this.animationTimer_ = 0; return _this; } Object.defineProperty(MDCDismissibleDrawerFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDismissibleDrawerFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDismissibleDrawerFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, elementHasClass: function elementHasClass() { return false; }, notifyClose: function notifyClose() { return undefined; }, notifyOpen: function notifyOpen() { return undefined; }, saveFocus: function saveFocus() { return undefined; }, restoreFocus: function restoreFocus() { return undefined; }, focusActiveNavigationItem: function focusActiveNavigationItem() { return undefined; }, trapFocus: function trapFocus() { return undefined; }, releaseFocus: function releaseFocus() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCDismissibleDrawerFoundation.prototype.destroy = function () { if (this.animationFrame_) { cancelAnimationFrame(this.animationFrame_); } if (this.animationTimer_) { clearTimeout(this.animationTimer_); } }; MDCDismissibleDrawerFoundation.prototype.open = function () { var _this = this; if (this.isOpen() || this.isOpening() || this.isClosing()) { return; } this.adapter_.addClass(cssClasses$1.OPEN); this.adapter_.addClass(cssClasses$1.ANIMATE); // Wait a frame once display is no longer "none", to establish basis for animation this.runNextAnimationFrame_(function () { _this.adapter_.addClass(cssClasses$1.OPENING); }); this.adapter_.saveFocus(); }; MDCDismissibleDrawerFoundation.prototype.close = function () { if (!this.isOpen() || this.isOpening() || this.isClosing()) { return; } this.adapter_.addClass(cssClasses$1.CLOSING); }; /** * @return true if drawer is in open state. */ MDCDismissibleDrawerFoundation.prototype.isOpen = function () { return this.adapter_.hasClass(cssClasses$1.OPEN); }; /** * @return true if drawer is animating open. */ MDCDismissibleDrawerFoundation.prototype.isOpening = function () { return this.adapter_.hasClass(cssClasses$1.OPENING) || this.adapter_.hasClass(cssClasses$1.ANIMATE); }; /** * @return true if drawer is animating closed. */ MDCDismissibleDrawerFoundation.prototype.isClosing = function () { return this.adapter_.hasClass(cssClasses$1.CLOSING); }; /** * Keydown handler to close drawer when key is escape. */ MDCDismissibleDrawerFoundation.prototype.handleKeydown = function (evt) { var keyCode = evt.keyCode, key = evt.key; var isEscape = key === 'Escape' || keyCode === 27; if (isEscape) { this.close(); } }; /** * Handles a transition end event on the root element. */ MDCDismissibleDrawerFoundation.prototype.handleTransitionEnd = function (evt) { var OPENING = cssClasses$1.OPENING, CLOSING = cssClasses$1.CLOSING, OPEN = cssClasses$1.OPEN, ANIMATE = cssClasses$1.ANIMATE, ROOT = cssClasses$1.ROOT; // In Edge, transitionend on ripple pseudo-elements yields a target without classList, so check for Element first. var isRootElement = this.isElement_(evt.target) && this.adapter_.elementHasClass(evt.target, ROOT); if (!isRootElement) { return; } if (this.isClosing()) { this.adapter_.removeClass(OPEN); this.closed_(); this.adapter_.restoreFocus(); this.adapter_.notifyClose(); } else { this.adapter_.focusActiveNavigationItem(); this.opened_(); this.adapter_.notifyOpen(); } this.adapter_.removeClass(ANIMATE); this.adapter_.removeClass(OPENING); this.adapter_.removeClass(CLOSING); }; /** * Extension point for when drawer finishes open animation. */ MDCDismissibleDrawerFoundation.prototype.opened_ = function () {}; // tslint:disable-line:no-empty /** * Extension point for when drawer finishes close animation. */ MDCDismissibleDrawerFoundation.prototype.closed_ = function () {}; // tslint:disable-line:no-empty /** * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. */ MDCDismissibleDrawerFoundation.prototype.runNextAnimationFrame_ = function (callback) { var _this = this; cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = requestAnimationFrame(function () { _this.animationFrame_ = 0; clearTimeout(_this.animationTimer_); _this.animationTimer_ = setTimeout(callback, 0); }); }; MDCDismissibleDrawerFoundation.prototype.isElement_ = function (element) { // In Edge, transitionend on ripple pseudo-elements yields a target without classList. return Boolean(element.classList); }; return MDCDismissibleDrawerFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* istanbul ignore next: subclass is not a branch statement */ var MDCModalDrawerFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCModalDrawerFoundation, _super); function MDCModalDrawerFoundation() { return _super !== null && _super.apply(this, arguments) || this; } /** * Handles click event on scrim. */ MDCModalDrawerFoundation.prototype.handleScrimClick = function () { this.close(); }; /** * Called when drawer finishes open animation. */ MDCModalDrawerFoundation.prototype.opened_ = function () { this.adapter_.trapFocus(); }; /** * Called when drawer finishes close animation. */ MDCModalDrawerFoundation.prototype.closed_ = function () { this.adapter_.releaseFocus(); }; return MDCModalDrawerFoundation; }(MDCDismissibleDrawerFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$2 = MDCDismissibleDrawerFoundation.cssClasses, strings$2 = MDCDismissibleDrawerFoundation.strings; var MDCDrawer = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCDrawer, _super); function MDCDrawer() { return _super !== null && _super.apply(this, arguments) || this; } MDCDrawer.attachTo = function (root) { return new MDCDrawer(root); }; Object.defineProperty(MDCDrawer.prototype, "open", { /** * Returns true if drawer is in the open position. */ get: function get() { return this.foundation_.isOpen(); }, /** * Toggles the drawer open and closed. */ set: function set(isOpen) { if (isOpen) { this.foundation_.open(); } else { this.foundation_.close(); } }, enumerable: true, configurable: true }); Object.defineProperty(MDCDrawer.prototype, "list", { get: function get() { return this.list_; }, enumerable: true, configurable: true }); MDCDrawer.prototype.initialize = function (focusTrapFactory, listFactory) { if (focusTrapFactory === void 0) { focusTrapFactory = focusTrap_1; } if (listFactory === void 0) { listFactory = function listFactory(el) { return new MDCList(el); }; } var listEl = this.root_.querySelector("." + MDCListFoundation.cssClasses.ROOT); if (listEl) { this.list_ = listFactory(listEl); this.list_.wrapFocus = true; } this.focusTrapFactory_ = focusTrapFactory; }; MDCDrawer.prototype.initialSyncWithDOM = function () { var _this = this; var MODAL = cssClasses$2.MODAL; var SCRIM_SELECTOR = strings$2.SCRIM_SELECTOR; this.scrim_ = this.root_.parentNode.querySelector(SCRIM_SELECTOR); if (this.scrim_ && this.root_.classList.contains(MODAL)) { this.handleScrimClick_ = function () { return _this.foundation_.handleScrimClick(); }; this.scrim_.addEventListener('click', this.handleScrimClick_); this.focusTrap_ = createFocusTrapInstance(this.root_, this.focusTrapFactory_); } this.handleKeydown_ = function (evt) { return _this.foundation_.handleKeydown(evt); }; this.handleTransitionEnd_ = function (evt) { return _this.foundation_.handleTransitionEnd(evt); }; this.listen('keydown', this.handleKeydown_); this.listen('transitionend', this.handleTransitionEnd_); }; MDCDrawer.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten('transitionend', this.handleTransitionEnd_); if (this.list_) { this.list_.destroy(); } var MODAL = cssClasses$2.MODAL; if (this.scrim_ && this.handleScrimClick_ && this.root_.classList.contains(MODAL)) { this.scrim_.removeEventListener('click', this.handleScrimClick_); // Ensure drawer is closed to hide scrim and release focus this.open = false; } }; MDCDrawer.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, elementHasClass: function elementHasClass(element, className) { return element.classList.contains(className); }, saveFocus: function saveFocus() { return _this.previousFocus_ = document.activeElement; }, restoreFocus: function restoreFocus() { var previousFocus = _this.previousFocus_; if (previousFocus && previousFocus.focus && _this.root_.contains(document.activeElement)) { previousFocus.focus(); } }, focusActiveNavigationItem: function focusActiveNavigationItem() { var activeNavItemEl = _this.root_.querySelector("." + MDCListFoundation.cssClasses.LIST_ITEM_ACTIVATED_CLASS); if (activeNavItemEl) { activeNavItemEl.focus(); } }, notifyClose: function notifyClose() { return _this.emit(strings$2.CLOSE_EVENT, {}, true /* shouldBubble */ ); }, notifyOpen: function notifyOpen() { return _this.emit(strings$2.OPEN_EVENT, {}, true /* shouldBubble */ ); }, trapFocus: function trapFocus() { return _this.focusTrap_.activate(); }, releaseFocus: function releaseFocus() { return _this.focusTrap_.deactivate(); } }; // tslint:enable:object-literal-sort-keys var DISMISSIBLE = cssClasses$2.DISMISSIBLE, MODAL = cssClasses$2.MODAL; if (this.root_.classList.contains(DISMISSIBLE)) { return new MDCDismissibleDrawerFoundation(adapter); } else if (this.root_.classList.contains(MODAL)) { return new MDCModalDrawerFoundation(adapter); } else { throw new Error("MDCDrawer: Failed to instantiate component. Supported variants are " + DISMISSIBLE + " and " + MODAL + "."); } }; return MDCDrawer; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcDrawerHeader = /** @class */ (function () { function MdcDrawerHeader(elementRef) { this.elementRef = elementRef; } MdcDrawerHeader.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-drawer-header', template: "\n \n

{{title}}

\n
{{subtitle}}
", host: { 'class': 'mdc-drawer__header' }, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcDrawerHeader.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcDrawerHeader.propDecorators = { title: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], subtitle: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcDrawerHeader; }()); var MdcDrawerTitle = /** @class */ (function () { function MdcDrawerTitle() { } MdcDrawerTitle.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcDrawerTitle]', host: { 'class': 'mdc-drawer__title' } },] }, ]; return MdcDrawerTitle; }()); var MdcDrawerSubtitle = /** @class */ (function () { function MdcDrawerSubtitle() { } MdcDrawerSubtitle.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcDrawerSubtitle]', host: { 'class': 'mdc-drawer__subtitle' } },] }, ]; return MdcDrawerSubtitle; }()); var MdcDrawerContent = /** @class */ (function () { function MdcDrawerContent() { } MdcDrawerContent.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-drawer-content, [mdcDrawerContent]', host: { 'class': 'mdc-drawer__content' } },] }, ]; return MdcDrawerContent; }()); var MdcDrawerAppContent = /** @class */ (function () { function MdcDrawerAppContent() { } MdcDrawerAppContent.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-drawer-app-content, [mdcDrawerAppContent]', host: { 'class': 'mdc-drawer-app-content' } },] }, ]; return MdcDrawerAppContent; }()); var MdcDrawer = /** @class */ (function () { function MdcDrawer(_platform, _ngZone, _changeDetectorRef, elementRef) { this._platform = _platform; this._ngZone = _ngZone; this._changeDetectorRef = _changeDetectorRef; this.elementRef = elementRef; this._initialized = false; this._previousFocus = null; this._scrimElement = null; this._focusTrapInstance = null; this._open = false; this._drawer = 'permanent'; this.opened = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); this.closed = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); this._transitionEndSubscription = null; this._scrimSubscription = null; this._foundation = new MDCDismissibleDrawerFoundation(this._createAdapter()); } Object.defineProperty(MdcDrawer.prototype, "open", { get: /** * @return {?} */ function () { return this._open; }, set: /** * @param {?} value * @return {?} */ function (value) { this._open = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(value); if (this._platform.isBrowser) { this._open ? this._foundation.open() : this._foundation.close(); } this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcDrawer.prototype, "drawer", { get: /** * @return {?} */ function () { return this._drawer; }, set: /** * @param {?} drawer * @return {?} */ function (drawer) { if (this._drawer !== drawer) { this._initialized = false; this.setDrawer(drawer); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcDrawer.prototype, "fixedAdjustElement", { get: /** * @return {?} */ function () { return this._fixedAdjustElement; }, set: /** * @param {?} element * @return {?} */ function (element) { this.setFixedAdjustElement(element); }, enumerable: true, configurable: true }); Object.defineProperty(MdcDrawer.prototype, "modal", { get: /** * @return {?} */ function () { return this.drawer === 'modal'; }, enumerable: true, configurable: true }); Object.defineProperty(MdcDrawer.prototype, "dismissible", { get: /** * @return {?} */ function () { return this.drawer === 'dismissible'; }, enumerable: true, configurable: true }); Object.defineProperty(MdcDrawer.prototype, "permanent", { get: /** * @return {?} */ function () { return this.drawer === 'permanent'; }, enumerable: true, configurable: true }); /** * @private * @return {?} */ MdcDrawer.prototype._createAdapter = /** * @private * @return {?} */ function () { var _this = this; return { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), elementHasClass: (/** * @param {?} element * @param {?} className * @return {?} */ function (element, className) { return element.classList.contains(className); }), saveFocus: (/** * @return {?} */ function () { return _this._previousFocus = _this._platform.isBrowser ? (/** @type {?} */ (document.activeElement)) : null; }), restoreFocus: (/** * @return {?} */ function () { if (!_this._platform.isBrowser) { return; } /** @type {?} */ var previousFocus = _this._previousFocus && ((/** @type {?} */ (_this._previousFocus))).focus; if (_this._getHostElement().contains((/** @type {?} */ (document.activeElement))) && previousFocus) { ((/** @type {?} */ (_this._previousFocus))).focus(); } }), focusActiveNavigationItem: (/** * @return {?} */ function () { if (!_this._platform.isBrowser || !_this._list) { return; } /** @type {?} */ var selectedItem = _this._list.getSelectedItem(); if (selectedItem) { selectedItem.focus(); } }), notifyClose: (/** * @return {?} */ function () { return _this.closed.emit(); }), notifyOpen: (/** * @return {?} */ function () { return _this.opened.emit(); }), trapFocus: (/** * @return {?} */ function () { return (/** @type {?} */ (_this._focusTrapInstance)).activate(); }), releaseFocus: (/** * @return {?} */ function () { return (/** @type {?} */ (_this._focusTrapInstance)).deactivate(); }) }; }; /** * @return {?} */ MdcDrawer.prototype.ngAfterViewInit = /** * @return {?} */ function () { this._initListType(); if (!this._initialized) { this._initFoundation(); } }; /** * @return {?} */ MdcDrawer.prototype.ngOnDestroy = /** * @return {?} */ function () { this.open = false; if (this._scrimElement) { this._scrimElement.remove(); } this._unloadListeners(); if (this._foundation && this._platform.isBrowser) { this._foundation.destroy(); } }; /** * @param {?} drawer * @return {?} */ MdcDrawer.prototype.setDrawer = /** * @param {?} drawer * @return {?} */ function (drawer) { if (!drawer) { drawer = 'permanent'; } if (this.drawer !== drawer) { this._drawer = drawer; this._initFoundation(); } }; /** * @param {?} element * @return {?} */ MdcDrawer.prototype.setFixedAdjustElement = /** * @param {?} element * @return {?} */ function (element) { this._fixedAdjustElement = element; element ? this._getHostElement().style.setProperty('position', 'absolute') : this._getHostElement().style.removeProperty('position'); this._changeDetectorRef.markForCheck(); }; /** * @param {?} evt * @return {?} */ MdcDrawer.prototype._onKeydown = /** * @param {?} evt * @return {?} */ function (evt) { this._foundation.handleKeydown(evt); }; /** * @private * @return {?} */ MdcDrawer.prototype._loadListeners = /** * @private * @return {?} */ function () { this._unloadListeners(); if (this.modal && this._platform.isBrowser) { this._createScrim(); this._focusTrapInstance = this._createFocusTrapInstance(); } else if (this._scrimElement) { this._scrimElement.remove(); } this._initTransitionEndListener(); }; /** * @private * @return {?} */ MdcDrawer.prototype._unloadListeners = /** * @private * @return {?} */ function () { if (this._scrimSubscription) { this._scrimSubscription.unsubscribe(); } if (this._transitionEndSubscription) { this._transitionEndSubscription.unsubscribe(); } }; /** * @private * @return {?} */ MdcDrawer.prototype._createScrim = /** * @private * @return {?} */ function () { var _this = this; this._scrimElement = document.createElement('div'); this._scrimElement.classList.add('mdc-drawer-scrim'); this._getHostElement().insertAdjacentElement('afterend', this._scrimElement); this._scrimSubscription = this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["fromEvent"])((/** @type {?} */ (_this._scrimElement)), 'click') .subscribe((/** * @return {?} */ function () { return _this._ngZone.run((/** * @return {?} */ function () { return _this.open = false; })); })); })); }; /** * @private * @return {?} */ MdcDrawer.prototype._initFoundation = /** * @private * @return {?} */ function () { if (this._initialized) { return; } this._initialized = true; this._removeDrawerModifiers(); if (this.modal) { this._foundation = new MDCModalDrawerFoundation(this._createAdapter()); } else { this._foundation = new MDCDismissibleDrawerFoundation(this._createAdapter()); } if (!this.permanent) { this._getHostElement().classList.add("mdc-drawer--" + this.drawer); } this._loadListeners(); this._changeDetectorRef.markForCheck(); }; /** * @private * @return {?} */ MdcDrawer.prototype._initListType = /** * @private * @return {?} */ function () { if (this._list && (this._list.singleSelection || this._list.singleSelection === undefined)) { this._list.wrapFocus = true; this._list.singleSelection = true; this._list.useActivatedClass = true; } }; /** * @private * @return {?} */ MdcDrawer.prototype._removeDrawerModifiers = /** * @private * @return {?} */ function () { this._getHostElement().classList.remove('mdc-drawer--modal'); this._getHostElement().classList.remove('mdc-drawer--dismissible'); }; /** * @private * @return {?} */ MdcDrawer.prototype._initTransitionEndListener = /** * @private * @return {?} */ function () { var _this = this; this._transitionEndSubscription = this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["fromEvent"])(_this._getHostElement(), 'transitionend').pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])((/** * @param {?} e * @return {?} */ function (e) { return e.target === _this._getHostElement(); }))) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleTransitionEnd(evt); })); })); })); }; /** * @private * @param {?=} focusTrapFactory * @return {?} */ MdcDrawer.prototype._createFocusTrapInstance = /** * @private * @param {?=} focusTrapFactory * @return {?} */ function (focusTrapFactory) { if (focusTrapFactory === void 0) { focusTrapFactory = focusTrap_1; } return focusTrapFactory(this._getHostElement(), { clickOutsideDeactivates: true, initialFocus: this._getHostElement(), // Navigation drawer sets focus to activated item escapeDeactivates: false, // Navigation drawer handles ESC. returnFocusOnDeactivate: false, }); }; /** * @private * @return {?} */ MdcDrawer.prototype._getHostElement = /** * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcDrawer.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-drawer', exportAs: 'mdcDrawer', host: { 'role': 'navigation', 'class': 'mdc-drawer', '(keydown)': '_onKeydown($event)' }, template: '', changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcDrawer.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcDrawer.propDecorators = { open: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], drawer: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fixedAdjustElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], opened: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], closed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], _list: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [_angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_5__["MdcList"],] }] }; return MdcDrawer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var DRAWER_DECLARATIONS = [ MdcDrawer, MdcDrawerAppContent, MdcDrawerContent, MdcDrawerHeader, MdcDrawerSubtitle, MdcDrawerTitle ]; var MdcDrawerModule = /** @class */ (function () { function MdcDrawerModule() { } MdcDrawerModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"]], exports: [DRAWER_DECLARATIONS], declarations: [DRAWER_DECLARATIONS] },] }, ]; return MdcDrawerModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=drawer.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/elevation.es5.js": /*!*************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/elevation.es5.js ***! \*************************************************************/ /*! exports provided: MdcElevation, MdcElevationModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcElevation", function() { return MdcElevation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcElevationModule", function() { return MdcElevationModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcElevation = /** @class */ (function () { function MdcElevation(elementRef) { this.elementRef = elementRef; this._mdcElevation = 0; } Object.defineProperty(MdcElevation.prototype, "mdcElevation", { get: /** * @return {?} */ function () { return this._mdcElevation; }, set: /** * @param {?} value * @return {?} */ function (value) { this._mdcElevation = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__["toNumber"])(value); }, enumerable: true, configurable: true }); /** * @param {?} changes * @return {?} */ MdcElevation.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { /** @type {?} */ var change = changes['mdcElevation']; if (change.currentValue < 0 || change.currentValue > 24) { throw new Error("Valid mdc-elevation values are 0 through 24"); } if (!change.isFirstChange()) { this.elementRef.nativeElement.classList.remove("mdc-elevation--z" + change.previousValue); } this.elementRef.nativeElement.classList.add("mdc-elevation--z" + change.currentValue); }; MdcElevation.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcElevation]', exportAs: 'mdcElevation' },] }, ]; /** @nocollapse */ MdcElevation.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcElevation.propDecorators = { mdcElevation: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcElevation; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcElevationModule = /** @class */ (function () { function MdcElevationModule() { } MdcElevationModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: [MdcElevation], declarations: [MdcElevation] },] }, ]; return MdcElevationModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=elevation.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/fab.es5.js": /*!*******************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/fab.es5.js ***! \*******************************************************/ /*! exports provided: MdcFab, MdcFabLabel, MdcFabModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcFab", function() { return MdcFab; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcFabLabel", function() { return MdcFabLabel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcFabModule", function() { return MdcFabModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/icon */ "./node_modules/@angular-mdc/web/esm5/icon.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcFabLabel = /** @class */ (function () { function MdcFabLabel() { } MdcFabLabel.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-fab-label, [mdcFabLabel]', host: { 'class': 'mdc-fab__label' } },] }, ]; return MdcFabLabel; }()); var MdcFab = /** @class */ (function () { function MdcFab(_changeDetectionRef, elementRef, _ripple) { this._changeDetectionRef = _changeDetectionRef; this.elementRef = elementRef; this._ripple = _ripple; this._mini = false; this._exited = false; this._extended = false; this._fluid = false; this._position = null; } Object.defineProperty(MdcFab.prototype, "mini", { get: /** * @return {?} */ function () { return this._mini; }, set: /** * @param {?} value * @return {?} */ function (value) { this._mini = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "exited", { get: /** * @return {?} */ function () { return this._exited; }, set: /** * @param {?} value * @return {?} */ function (value) { this._exited = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(value); this._changeDetectionRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "extended", { get: /** * @return {?} */ function () { return this._extended; }, set: /** * @param {?} value * @return {?} */ function (value) { this._extended = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "fluid", { get: /** * @return {?} */ function () { return this._fluid; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fluid = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "position", { get: /** * @return {?} */ function () { return this._position; }, set: /** * @param {?} value * @return {?} */ function (value) { if (this._position) { this._getHostElement().classList.remove("ngx-mdc-fab--" + this._convertPosition(this._position)); } if (value) { this._getHostElement().classList.add("ngx-mdc-fab--" + this._convertPosition(value)); } this._position = value; }, enumerable: true, configurable: true }); /** * @return {?} */ MdcFab.prototype.ngAfterContentInit = /** * @return {?} */ function () { if (this.fabIcon) { this.fabIcon.elementRef.nativeElement.classList.add('mdc-fab__icon'); } this._ripple.init({ surface: this._getHostElement() }); }; /** * @private * @param {?} position * @return {?} */ MdcFab.prototype._convertPosition = /** * @private * @param {?} position * @return {?} */ function (position) { switch (position) { case 'bottomLeft': { return 'bottom-left'; } case 'bottomRight': { return 'bottom-right'; } default: { return null; } } }; /** * @return {?} */ MdcFab.prototype.ngOnDestroy = /** * @return {?} */ function () { this._ripple.destroy(); }; /** * @param {?=} exited * @return {?} */ MdcFab.prototype.toggleExited = /** * @param {?=} exited * @return {?} */ function (exited) { this._exited = exited ? exited : !this._exited; }; /** Focuses the button. */ /** * Focuses the button. * @return {?} */ MdcFab.prototype.focus = /** * Focuses the button. * @return {?} */ function () { this._getHostElement().focus(); }; /** * @private * @return {?} */ MdcFab.prototype._getHostElement = /** * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcFab.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'button[mdc-fab], a[mdc-fab]', host: { '[attr.tabindex]': 'exited ? -1 : 0', 'class': 'mdc-fab', '[class.mdc-fab--mini]': 'mini', '[class.mdc-fab--exited]': 'exited', '[class.mdc-fab--extended]': 'extended', '[class.ngx-mdc-fab-extended--fluid]': 'fluid' }, template: "\n \n {{icon}}\n {{label}}\n ", providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_4__["MdcRipple"]], encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcFab.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_4__["MdcRipple"] } ]; }; MdcFab.propDecorators = { mini: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], exited: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], extended: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fluid: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], position: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], label: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], icon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fabIcon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [_angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIcon"],] }] }; return MdcFab; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcFabModule = /** @class */ (function () { function MdcFabModule() { } MdcFabModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"], _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIconModule"] ], exports: [ MdcFab, MdcFabLabel ], declarations: [MdcFab, MdcFabLabel] },] }, ]; return MdcFabModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=fab.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/floating-label.es5.js": /*!******************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/floating-label.es5.js ***! \******************************************************************/ /*! exports provided: MdcFloatingLabel, MdcFloatingLabelModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcFloatingLabel", function() { return MdcFloatingLabel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcFloatingLabelModule", function() { return MdcFloatingLabelModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above', LABEL_SHAKE: 'mdc-floating-label--shake', ROOT: 'mdc-floating-label' }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFloatingLabelFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCFloatingLabelFoundation, _super); function MDCFloatingLabelFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, MDCFloatingLabelFoundation.defaultAdapter, adapter)) || this; _this.shakeAnimationEndHandler_ = function () { return _this.handleShakeAnimationEnd_(); }; return _this; } Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", { /** * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, getWidth: function getWidth() { return 0; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCFloatingLabelFoundation.prototype.init = function () { this.adapter_.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; MDCFloatingLabelFoundation.prototype.destroy = function () { this.adapter_.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; /** * Returns the width of the label element. */ MDCFloatingLabelFoundation.prototype.getWidth = function () { return this.adapter_.getWidth(); }; /** * Styles the label to produce a shake animation to indicate an error. * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class. */ MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; if (shouldShake) { this.adapter_.addClass(LABEL_SHAKE); } else { this.adapter_.removeClass(LABEL_SHAKE); } }; /** * Styles the label to float or dock. * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label. */ MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) { var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE; if (shouldFloat) { this.adapter_.addClass(LABEL_FLOAT_ABOVE); } else { this.adapter_.removeClass(LABEL_FLOAT_ABOVE); this.adapter_.removeClass(LABEL_SHAKE); } }; MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; this.adapter_.removeClass(LABEL_SHAKE); }; return MDCFloatingLabelFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFloatingLabel = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCFloatingLabel, _super); function MDCFloatingLabel() { return _super !== null && _super.apply(this, arguments) || this; } MDCFloatingLabel.attachTo = function (root) { return new MDCFloatingLabel(root); }; /** * Styles the label to produce the label shake for errors. * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class. */ MDCFloatingLabel.prototype.shake = function (shouldShake) { this.foundation_.shake(shouldShake); }; /** * Styles the label to float/dock. * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class. */ MDCFloatingLabel.prototype.float = function (shouldFloat) { this.foundation_.float(shouldFloat); }; MDCFloatingLabel.prototype.getWidth = function () { return this.foundation_.getWidth(); }; MDCFloatingLabel.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, getWidth: function getWidth() { return _this.root_.scrollWidth; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.unlisten(evtType, handler); } }; // tslint:enable:object-literal-sort-keys return new MDCFloatingLabelFoundation(adapter); }; return MDCFloatingLabel; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcFloatingLabel = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MdcFloatingLabel, _super); function MdcFloatingLabel(_ngZone, elementRef) { var _this = _super.call(this, elementRef) || this; _this._ngZone = _ngZone; _this.elementRef = elementRef; /** * Emits whenever the component is destroyed. */ _this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); return _this; } /** * @return {?} */ MdcFloatingLabel.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), getWidth: (/** * @return {?} */ function () { return _this._getHostElement().scrollWidth; }) }; return new MDCFloatingLabelFoundation(adapter); }; /** * @return {?} */ MdcFloatingLabel.prototype.ngAfterContentInit = /** * @return {?} */ function () { this._loadListeners(); }; /** * @return {?} */ MdcFloatingLabel.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); }; /** Returns the width of the label element. */ /** * Returns the width of the label element. * @return {?} */ MdcFloatingLabel.prototype.getWidth = /** * Returns the width of the label element. * @return {?} */ function () { return this._foundation.getWidth(); }; /** Styles the label to produce the label shake for errors. */ /** * Styles the label to produce the label shake for errors. * @param {?} shouldShake * @return {?} */ MdcFloatingLabel.prototype.shake = /** * Styles the label to produce the label shake for errors. * @param {?} shouldShake * @return {?} */ function (shouldShake) { this._foundation.shake(shouldShake); }; /** Styles the label to float or dock. */ /** * Styles the label to float or dock. * @param {?} shouldFloat * @return {?} */ MdcFloatingLabel.prototype.float = /** * Styles the label to float or dock. * @param {?} shouldFloat * @return {?} */ function (shouldFloat) { this._foundation.float(shouldFloat); }; /** * @private * @return {?} */ MdcFloatingLabel.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["fromEvent"])(_this._getHostElement(), 'animationend') .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(_this._destroy), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])((/** * @param {?} e * @return {?} */ function (e) { return e.target === _this._getHostElement(); }))) .subscribe((/** * @return {?} */ function () { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleShakeAnimationEnd_(); })); })); })); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcFloatingLabel.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcFloatingLabel.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'label[mdcFloatingLabel], mdc-floating-label', exportAs: 'mdcFloatingLabel', host: { 'class': 'mdc-floating-label', '[for]': 'for' } },] }, ]; /** @nocollapse */ MdcFloatingLabel.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcFloatingLabel.propDecorators = { for: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcFloatingLabel; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcFloatingLabelModule = /** @class */ (function () { function MdcFloatingLabelModule() { } MdcFloatingLabelModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: [MdcFloatingLabel], declarations: [MdcFloatingLabel] },] }, ]; return MdcFloatingLabelModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=floating-label.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/form-field.es5.js": /*!**************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/form-field.es5.js ***! \**************************************************************/ /*! exports provided: ErrorStateMatcher, MdcCharacterCounter, MdcFormField, MdcFormFieldControl, MdcFormFieldModule, MdcHelperText, mixinErrorState */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorStateMatcher", function() { return ErrorStateMatcher; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCharacterCounter", function() { return MdcCharacterCounter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcFormField", function() { return MdcFormField; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcFormFieldControl", function() { return MdcFormFieldControl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcFormFieldModule", function() { return MdcFormFieldModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcHelperText", function() { return MdcHelperText; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mixinErrorState", function() { return mixinErrorState; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { ROOT: 'mdc-text-field-character-counter' }; var strings = { ROOT_SELECTOR: "." + cssClasses.ROOT }; /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTextFieldCharacterCounterFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MDCTextFieldCharacterCounterFoundation, _super); function MDCTextFieldCharacterCounterFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", { /** * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types. */ get: function get() { return { setContent: function setContent() { return undefined; } }; }, enumerable: true, configurable: true }); MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) { currentLength = Math.min(currentLength, maxLength); this.adapter_.setContent(currentLength + " / " + maxLength); }; return MDCTextFieldCharacterCounterFoundation; }(MDCFoundation); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTextFieldCharacterCounter = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MDCTextFieldCharacterCounter, _super); function MDCTextFieldCharacterCounter() { return _super !== null && _super.apply(this, arguments) || this; } MDCTextFieldCharacterCounter.attachTo = function (root) { return new MDCTextFieldCharacterCounter(root); }; Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundation", { get: function get() { return this.foundation_; }, enumerable: true, configurable: true }); MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { setContent: function setContent(content) { _this.root_.textContent = content; } }; return new MDCTextFieldCharacterCounterFoundation(adapter); }; return MDCTextFieldCharacterCounter; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcCharacterCounter = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MdcCharacterCounter, _super); function MdcCharacterCounter(elementRef) { var _this = _super.call(this, elementRef) || this; _this.elementRef = elementRef; return _this; } /** * @return {?} */ MdcCharacterCounter.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { setContent: (/** * @param {?} content * @return {?} */ function (content) { return _this.elementRef.nativeElement.textContent = content; }) }; return new MDCTextFieldCharacterCounterFoundation(adapter); }; /** * @return {?} */ MdcCharacterCounter.prototype.ngOnDestroy = /** * @return {?} */ function () { this.getDefaultFoundation().destroy(); }; MdcCharacterCounter.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{selector: '[mdcCharacterCounter]', exportAs: 'mdcCharacterCounter', host: { 'class': 'mdc-text-field-character-counter' }, template: '' },] }, ]; /** @nocollapse */ MdcCharacterCounter.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; return MdcCharacterCounter; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_2__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Mixin to augment a directive with updateErrorState method. * For component with `errorState` and need to update `errorState`. * @template T * @param {?} base * @return {?} */ function mixinErrorState(base) { return /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(class_1, _super); function class_1() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var _this = _super.apply(this, args) || this; /** * Whether the component is in an error state. */ _this.errorState = false; _this.required = false; return _this; } /** * @return {?} */ class_1.prototype.updateErrorState = /** * @return {?} */ function () { /** @type {?} */ var oldState = this.errorState; /** @type {?} */ var parent = this._parentFormGroup || this._parentForm; /** @type {?} */ var matcher = this.errorStateMatcher || this._defaultErrorStateMatcher; /** @type {?} */ var control = this.ngControl ? (/** @type {?} */ (this.ngControl.control)) : null; /** @type {?} */ var newState = matcher.isErrorState(control, parent); if (newState !== oldState) { this.errorState = newState; } // Currently there isn't a great way to determine if Validators.required // has been added to the control since form validators are combined into // an aggregate function at initialization. if (control && !this.required) { this.required = control.hasError('required'); } }; return class_1; }(base)); } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Provider that defines how form controls behave with regards to displaying error messages. */ var ErrorStateMatcher = /** @class */ (function () { function ErrorStateMatcher() { } /** * @param {?} control * @param {?} form * @return {?} */ ErrorStateMatcher.prototype.isErrorState = /** * @param {?} control * @param {?} form * @return {?} */ function (control, form) { return !!(control && control.invalid && (control.touched || (form && form.submitted))); }; ErrorStateMatcher.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"], args: [{ providedIn: 'root' },] }, ]; /** @nocollapse */ ErrorStateMatcher.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["defineInjectable"])({ factory: function ErrorStateMatcher_Factory() { return new ErrorStateMatcher(); }, token: ErrorStateMatcher, providedIn: "root" }); return ErrorStateMatcher; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @abstract * @template T */ var /** * @abstract * @template T */ MdcFormFieldControl = /** @class */ (function () { function MdcFormFieldControl() { /** * The value of the control. */ this.value = null; } return MdcFormFieldControl; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcHelperText = /** @class */ (function () { function MdcHelperText(elementRef) { this.elementRef = elementRef; this.characterCounter = false; this._persistent = false; this._validation = false; } Object.defineProperty(MdcHelperText.prototype, "persistent", { get: /** * @return {?} */ function () { return this._persistent; }, set: /** * @param {?} value * @return {?} */ function (value) { this._persistent = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (this._foundation) { this._foundation.setPersistent(this._persistent); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcHelperText.prototype, "validation", { get: /** * @return {?} */ function () { return this._validation; }, set: /** * @param {?} value * @return {?} */ function (value) { this._validation = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (this._foundation) { this._foundation.setValidation(this._validation); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcHelperText.prototype, "foundation", { get: /** * @return {?} */ function () { return this._foundation; }, enumerable: true, configurable: true }); /** Sets the validity of the helper text based on inputIsValid. */ /** * Sets the validity of the helper text based on inputIsValid. * @param {?} inputIsValid * @return {?} */ MdcHelperText.prototype.setValidity = /** * Sets the validity of the helper text based on inputIsValid. * @param {?} inputIsValid * @return {?} */ function (inputIsValid) { this._foundation.setValidity(inputIsValid); }; /** Makes the helper text visible to the screen reader. */ /** * Makes the helper text visible to the screen reader. * @return {?} */ MdcHelperText.prototype.showToScreenReader = /** * Makes the helper text visible to the screen reader. * @return {?} */ function () { this._foundation.showToScreenReader(); }; /** * @param {?} foundation * @return {?} */ MdcHelperText.prototype.init = /** * @param {?} foundation * @return {?} */ function (foundation) { this._foundation = new foundation(this._createAdapter()); this._foundation.setPersistent(this.persistent); this._foundation.setValidation(this.validation); }; /** * @param {?} className * @return {?} */ MdcHelperText.prototype.addHelperTextClass = /** * @param {?} className * @return {?} */ function (className) { (/** @type {?} */ (this._helperTextElement)).nativeElement.classList.add(className + "-helper-text"); }; /** * @private * @return {?} */ MdcHelperText.prototype._createAdapter = /** * @private * @return {?} */ function () { var _this = this; return { addClass: (/** * @param {?} className * @return {?} */ function (className) { return (/** @type {?} */ (_this._helperTextElement)).nativeElement.classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return (/** @type {?} */ (_this._helperTextElement)).nativeElement.classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return (/** @type {?} */ (_this._helperTextElement)).nativeElement.classList.contains(className); }), setAttr: (/** * @param {?} attr * @param {?} value * @return {?} */ function (attr, value) { return (/** @type {?} */ (_this._helperTextElement)).nativeElement.setAttribute(attr, value); }), removeAttr: (/** * @param {?} attr * @return {?} */ function (attr) { return (/** @type {?} */ (_this._helperTextElement)).nativeElement.removeAttribute(attr); }) }; }; MdcHelperText.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{selector: "mdc-helper-text, [mdcHelperText],\n mdc-text-field-helper-text, [mdcTextFieldHelperText], [mdcSelectHelperText]", exportAs: 'mdcHelperText, mdcSelectHelperText', host: { 'class': 'mdc-text-field-helper-line' }, template: "
\n
", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcHelperText.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; MdcHelperText.propDecorators = { id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], persistent: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], validation: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], _helperTextElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewChild"], args: ['helperText',] }], _characterCounterElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewChild"], args: [MdcCharacterCounter,] }] }; return MdcHelperText; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcFormField = /** @class */ (function () { function MdcFormField(_changeDetectorRef, _ngZone, elementRef) { this._changeDetectorRef = _changeDetectorRef; this._ngZone = _ngZone; this.elementRef = elementRef; /** * Emits whenever the component is destroyed. */ this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_3__["Subject"](); this._fluid = false; this._alignEnd = false; } Object.defineProperty(MdcFormField.prototype, "fluid", { get: /** * @return {?} */ function () { return this._fluid; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fluid = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFormField.prototype, "alignEnd", { get: /** * @return {?} */ function () { return this._alignEnd; }, set: /** * @param {?} value * @return {?} */ function (value) { this._alignEnd = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcFormField.prototype.ngAfterContentInit = /** * @return {?} */ function () { var _this = this; if (this._control) { /** @type {?} */ var control = this._control.elementRef.nativeElement; if (control.nextElementSibling) { if (control.nextElementSibling.tagName === 'LABEL') { this.label = control.nextElementSibling; if (this.label && this._control.inputId) { (/** @type {?} */ (this.label)).setAttribute('for', this._control.inputId); this._loadListeners(); } } } } // When assistive elements change, initialize foundation this.assistiveElements.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["startWith"])(null), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(this._destroy)) .subscribe((/** * @return {?} */ function () { (_this.assistiveElements).forEach((/** * @param {?} helperText * @return {?} */ function (helperText) { return _this._initHelperTextFoundation(helperText); })); })); }; /** * @return {?} */ MdcFormField.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); }; /** * @private * @param {?} helperText * @return {?} */ MdcFormField.prototype._initHelperTextFoundation = /** * @private * @param {?} helperText * @return {?} */ function (helperText) { /** @type {?} */ var control = this._control; if (control && control.controlType) { control.helperText = helperText; this._changeDetectorRef.markForCheck(); } }; /** * @private * @return {?} */ MdcFormField.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["fromEvent"])((/** @type {?} */ (_this.label)), 'click').pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(_this._destroy)) .subscribe((/** * @return {?} */ function () { return _this._ngZone.run((/** * @return {?} */ function () { (/** @type {?} */ (_this._control.ripple)).activateRipple(); if (typeof requestAnimationFrame !== 'undefined') { requestAnimationFrame((/** * @return {?} */ function () { return (/** @type {?} */ (_this._control.ripple)).deactivateRipple(); })); } })); })); })); }; MdcFormField.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{selector: 'mdc-form-field', exportAs: 'mdcFormField', host: { '[class.ngx-mdc-form-field--fluid]': 'fluid', '[class.mdc-form-field--align-end]': 'alignEnd' }, template: "\n ", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcFormField.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; MdcFormField.propDecorators = { fluid: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], alignEnd: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], _control: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ContentChild"], args: [MdcFormFieldControl,] }], assistiveElements: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ContentChildren"], args: [MdcHelperText, { descendants: true },] }] }; return MdcFormField; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var FORM_FIELD_DECLARATIONS = [ MdcCharacterCounter, MdcFormField, MdcHelperText ]; var MdcFormFieldModule = /** @class */ (function () { function MdcFormFieldModule() { } MdcFormFieldModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"], args: [{ imports: [_angular_common__WEBPACK_IMPORTED_MODULE_6__["CommonModule"]], exports: [FORM_FIELD_DECLARATIONS], declarations: [FORM_FIELD_DECLARATIONS] },] }, ]; return MdcFormFieldModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=form-field.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/icon-button.es5.js": /*!***************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/icon-button.es5.js ***! \***************************************************************/ /*! exports provided: MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR, MdcIconButton, MdcIconButtonChange, MdcIconButtonModule, MdcIconOn */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR", function() { return MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcIconButton", function() { return MdcIconButton; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcIconButtonChange", function() { return MdcIconButtonChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcIconButtonModule", function() { return MdcIconButtonModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcIconOn", function() { return MdcIconOn; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/icon */ "./node_modules/@angular-mdc/web/esm5/icon.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { ICON_BUTTON_ON: 'mdc-icon-button--on', ROOT: 'mdc-icon-button' }; var strings$1 = { ARIA_PRESSED: 'aria-pressed', CHANGE_EVENT: 'MDCIconButtonToggle:change' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCIconButtonToggleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCIconButtonToggleFoundation, _super); function MDCIconButtonToggleFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, MDCIconButtonToggleFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCIconButtonToggleFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, hasClass: function hasClass() { return false; }, notifyChange: function notifyChange() { return undefined; }, removeClass: function removeClass() { return undefined; }, setAttr: function setAttr() { return undefined; } }; }, enumerable: true, configurable: true }); MDCIconButtonToggleFoundation.prototype.init = function () { this.adapter_.setAttr(strings$1.ARIA_PRESSED, "" + this.isOn()); }; MDCIconButtonToggleFoundation.prototype.handleClick = function () { this.toggle(); this.adapter_.notifyChange({ isOn: this.isOn() }); }; MDCIconButtonToggleFoundation.prototype.isOn = function () { return this.adapter_.hasClass(cssClasses$1.ICON_BUTTON_ON); }; MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) { if (isOn === void 0) { isOn = !this.isOn(); } if (isOn) { this.adapter_.addClass(cssClasses$1.ICON_BUTTON_ON); } else { this.adapter_.removeClass(cssClasses$1.ICON_BUTTON_ON); } this.adapter_.setAttr(strings$1.ARIA_PRESSED, "" + isOn); }; return MDCIconButtonToggleFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$2 = MDCIconButtonToggleFoundation.strings; var MDCIconButtonToggle = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MDCIconButtonToggle, _super); function MDCIconButtonToggle() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ripple_ = _this.createRipple_(); return _this; } MDCIconButtonToggle.attachTo = function (root) { return new MDCIconButtonToggle(root); }; MDCIconButtonToggle.prototype.initialSyncWithDOM = function () { var _this = this; this.handleClick_ = function () { return _this.foundation_.handleClick(); }; this.listen('click', this.handleClick_); }; MDCIconButtonToggle.prototype.destroy = function () { this.unlisten('click', this.handleClick_); this.ripple_.destroy(); _super.prototype.destroy.call(this); }; MDCIconButtonToggle.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, notifyChange: function notifyChange(evtData) { return _this.emit(strings$2.CHANGE_EVENT, evtData); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, setAttr: function setAttr(attrName, attrValue) { return _this.root_.setAttribute(attrName, attrValue); } }; return new MDCIconButtonToggleFoundation(adapter); }; Object.defineProperty(MDCIconButtonToggle.prototype, "ripple", { get: function get() { return this.ripple_; }, enumerable: true, configurable: true }); Object.defineProperty(MDCIconButtonToggle.prototype, "on", { get: function get() { return this.foundation_.isOn(); }, set: function set(isOn) { this.foundation_.toggle(isOn); }, enumerable: true, configurable: true }); MDCIconButtonToggle.prototype.createRipple_ = function () { var ripple = new MDCRipple(this.root_); ripple.unbounded = true; return ripple; }; return MDCIconButtonToggle; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR = { provide: _angular_forms__WEBPACK_IMPORTED_MODULE_4__["NG_VALUE_ACCESSOR"], useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])((/** * @return {?} */ function () { return MdcIconButton; })), multi: true }; /** * Change event object emitted by MdcIconButton. */ var /** * Change event object emitted by MdcIconButton. */ MdcIconButtonChange = /** @class */ (function () { function MdcIconButtonChange(source, value) { this.source = source; this.value = value; } return MdcIconButtonChange; }()); /** @type {?} */ var nextUniqueId = 0; var MdcIconOn = /** @class */ (function () { function MdcIconOn() { } MdcIconOn.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcIconOn]', host: { 'class': 'mdc-icon-button__icon--on' } },] }, ]; return MdcIconOn; }()); var MdcIconButton = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__extends"])(MdcIconButton, _super); function MdcIconButton(_changeDetectorRef, elementRef, ripple) { var _this = _super.call(this, elementRef) || this; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this.ripple = ripple; _this._uniqueId = "mdc-icon-button-" + ++nextUniqueId; _this.id = _this._uniqueId; _this.name = null; _this.icon = null; _this._on = false; _this._disabled = false; _this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Subscription to changes in icons. */ _this._changeSubscription = null; _this._onChange = (/** * @return {?} */ function () { }); _this._onTouched = (/** * @return {?} */ function () { }); return _this; } Object.defineProperty(MdcIconButton.prototype, "inputId", { get: /** * @return {?} */ function () { return "" + (this.id || this._uniqueId); }, enumerable: true, configurable: true }); Object.defineProperty(MdcIconButton.prototype, "on", { get: /** * @return {?} */ function () { return this._on; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setOn(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcIconButton.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setDisabled(value); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcIconButton.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), setAttr: (/** * @param {?} name * @param {?} value * @return {?} */ function (name, value) { return _this._getHostElement().setAttribute(name, value); }), notifyChange: (/** * @param {?} evtData * @return {?} */ function (evtData) { _this.change.emit(new MdcIconButtonChange(_this, evtData.isOn)); _this._onChange(_this._foundation.isOn()); }) }; return new MDCIconButtonToggleFoundation(adapter); }; /** * @return {?} */ MdcIconButton.prototype.ngAfterContentInit = /** * @return {?} */ function () { var _this = this; this._foundation.init(); this._foundation.toggle(this._on || this._foundation.isOn()); this.ripple.init({ surface: this._getHostElement(), unbounded: true }); this._changeDetectorRef.detectChanges(); // When the icons change, re-subscribe this._changeSubscription = this.icons.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["startWith"])(null)).subscribe((/** * @return {?} */ function () { _this.icons.forEach((/** * @param {?} icon * @return {?} */ function (icon) { icon.elementRef.nativeElement.classList.add('mdc-icon-button__icon'); icon.tabIndex = null; icon.role = null; })); })); }; /** * @return {?} */ MdcIconButton.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this._changeSubscription) { this._changeSubscription.unsubscribe(); } this.ripple.destroy(); this._foundation.destroy(); }; /** * @param {?} value * @return {?} */ MdcIconButton.prototype.writeValue = /** * @param {?} value * @return {?} */ function (value) { this._onChange(value); }; /** * @param {?} fn * @return {?} */ MdcIconButton.prototype.registerOnChange = /** * @param {?} fn * @return {?} */ function (fn) { this._onChange = fn; }; /** * @param {?} fn * @return {?} */ MdcIconButton.prototype.registerOnTouched = /** * @param {?} fn * @return {?} */ function (fn) { this._onTouched = fn; }; /** * @param {?=} isOn * @return {?} */ MdcIconButton.prototype.toggle = /** * @param {?=} isOn * @return {?} */ function (isOn) { this.on = isOn ? Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(isOn) : !this.on; this._foundation.toggle(this.on); }; /** * @param {?} on * @return {?} */ MdcIconButton.prototype.setOn = /** * @param {?} on * @return {?} */ function (on) { this._on = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(on); this._foundation.toggle(this.on); this._changeDetectorRef.markForCheck(); }; /** Sets the button disabled state */ /** * Sets the button disabled state * @param {?} disabled * @return {?} */ MdcIconButton.prototype.setDisabled = /** * Sets the button disabled state * @param {?} disabled * @return {?} */ function (disabled) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_7__["toBoolean"])(disabled); this.disabled ? this._getHostElement().setAttribute('disabled', '') : this._getHostElement().removeAttribute('disabled'); this._changeDetectorRef.markForCheck(); }; /** * @return {?} */ MdcIconButton.prototype.handleClick = /** * @return {?} */ function () { if (this.icons.length === 1) { return; } this.on = !this.on; this._foundation.handleClick(); }; /** * @private * @return {?} */ MdcIconButton.prototype._getHostElement = /** * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcIconButton.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdc-icon-button], button[mdcIconButton], a[mdcIconButton]', exportAs: 'mdcIconButton', host: { '[id]': 'id', 'class': 'mdc-icon-button', '[class.mdc-icon-button--on]': 'on', 'attr.aria-pressed': 'false', '(click)': 'handleClick()' }, template: "\n {{icon}}\n ", providers: [ MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR, _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__["MdcRipple"] ], changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcIconButton.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_8__["MdcRipple"] } ]; }; MdcIconButton.propDecorators = { id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], icon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], on: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], change: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], icons: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [_angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIcon"], { descendants: true },] }] }; return MdcIconButton; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var ICON_BUTTON_DECLARATIONS = [ MdcIconButton, MdcIconOn ]; var MdcIconButtonModule = /** @class */ (function () { function MdcIconButtonModule() { } MdcIconButtonModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"], _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIconModule"] ], exports: ICON_BUTTON_DECLARATIONS.concat([ _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIconModule"] ]), declarations: ICON_BUTTON_DECLARATIONS },] }, ]; return MdcIconButtonModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=icon-button.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/icon.es5.js": /*!********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/icon.es5.js ***! \********************************************************/ /*! exports provided: ICON_REGISTRY_PROVIDER, ICON_REGISTRY_PROVIDER_FACTORY, MDC_ICON_LOCATION, MDC_ICON_LOCATION_FACTORY, MdcIcon, MdcIconModule, MdcIconRegistry, MdcMaterialIcons, getMdcIconFailedToSanitizeLiteralError, getMdcIconFailedToSanitizeUrlError, getMdcIconNameNotFoundError, getMdcIconNoHttpProviderError */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ICON_REGISTRY_PROVIDER", function() { return ICON_REGISTRY_PROVIDER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ICON_REGISTRY_PROVIDER_FACTORY", function() { return ICON_REGISTRY_PROVIDER_FACTORY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_ICON_LOCATION", function() { return MDC_ICON_LOCATION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_ICON_LOCATION_FACTORY", function() { return MDC_ICON_LOCATION_FACTORY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcIcon", function() { return MdcIcon; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcIconModule", function() { return MdcIconModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcIconRegistry", function() { return MdcIconRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMaterialIcons", function() { return MdcMaterialIcons; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMdcIconFailedToSanitizeLiteralError", function() { return getMdcIconFailedToSanitizeLiteralError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMdcIconFailedToSanitizeUrlError", function() { return getMdcIconFailedToSanitizeUrlError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMdcIconNameNotFoundError", function() { return getMdcIconNameNotFoundError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMdcIconNoHttpProviderError", function() { return getMdcIconNoHttpProviderError; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js"); /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcMaterialIcons = /** @class */ (function () { function MdcMaterialIcons() { } MdcMaterialIcons.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[materialIcons]', host: { 'class': 'material-icons' } },] }, ]; return MdcMaterialIcons; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Returns an exception to be thrown in the case when attempting to * load an icon with a name that cannot be found. * @param {?} iconName * @return {?} */ function getMdcIconNameNotFoundError(iconName) { return Error("Unable to find icon with the name \"" + iconName + "\""); } /** * Returns an exception to be thrown when the consumer attempts to use * `` without including \@angular/common/http. * \@docs-private * @return {?} */ function getMdcIconNoHttpProviderError() { return Error('Could not find HttpClient provider for use with Angular Material icons. ' + 'Please include the HttpClientModule from @angular/common/http in your ' + 'app imports.'); } /** * Returns an exception to be thrown when a URL couldn't be sanitized. * \@docs-private * @param {?} url URL that was attempted to be sanitized. * @return {?} */ function getMdcIconFailedToSanitizeUrlError(url) { return Error("The URL provided to MatIconRegistry was not trusted as a resource URL " + ("via Angular's DomSanitizer. Attempted URL was \"" + url + "\".")); } /** * Returns an exception to be thrown when a HTML string couldn't be sanitized. * \@docs-private * @param {?} literal HTML that was attempted to be sanitized. * @return {?} */ function getMdcIconFailedToSanitizeLiteralError(literal) { return Error("The literal provided to MatIconRegistry was not trusted as safe HTML by " + ("Angular's DomSanitizer. Attempted literal was \"" + literal + "\".")); } /** * Configuration for an icon, including the URL and possibly the cached SVG element. * \@docs-private */ var /** * Configuration for an icon, including the URL and possibly the cached SVG element. * \@docs-private */ SvgIconConfig = /** @class */ (function () { function SvgIconConfig(data) { this.url = null; this.svgElement = null; // Note that we can't use `instanceof SVGElement` here, // because it'll break during server-side rendering. if (!!((/** @type {?} */ (data))).nodeName) { this.svgElement = (/** @type {?} */ (data)); } else { this.url = (/** @type {?} */ (data)); } } return SvgIconConfig; }()); /** * Service to register and display icons used by the `` component. * - Registers icon URLs by namespace and name. * - Registers icon set URLs by namespace. * - Registers aliases for CSS classes, for use with icon fonts. * - Loads icons from URLs and extracts individual icons from icon sets. */ var MdcIconRegistry = /** @class */ (function () { function MdcIconRegistry(_httpClient, _sanitizer, document) { this._httpClient = _httpClient; this._sanitizer = _sanitizer; /** * URLs and cached SVG elements for individual icons. Keys are of the format "[namespace]:[icon]". */ this._svgIconConfigs = new Map(); /** * SvgIconConfig objects and cached SVG elements for icon sets, keyed by namespace. * Multiple icon sets can be registered under the same namespace. */ this._iconSetConfigs = new Map(); /** * Cache for icons loaded by direct URLs. */ this._cachedIconsByUrl = new Map(); /** * In-progress icon fetches. Used to coalesce multiple requests to the same URL. */ this._inProgressUrlFetches = new Map(); /** * Map from font identifiers to their CSS class names. Used for icon fonts. */ this._fontCssClassesByAlias = new Map(); /** * The CSS classes to apply when an `` component has no icon name, url, or font specified. * The default 'material-icons' value assumes that the material icon font has been loaded as * described at http://google.github.io/material-design-icons/#icon-font-for-the-web */ this._defaultFontSetClass = ['material-icons']; this._document = document; } /** * Registers an icon by URL in the default namespace. * @param iconName Name under which the icon should be registered. * @param url */ /** * Registers an icon by URL in the default namespace. * @template THIS * @this {THIS} * @param {?} iconName Name under which the icon should be registered. * @param {?} url * @return {THIS} */ MdcIconRegistry.prototype.addSvgIcon = /** * Registers an icon by URL in the default namespace. * @template THIS * @this {THIS} * @param {?} iconName Name under which the icon should be registered. * @param {?} url * @return {THIS} */ function (iconName, url) { return (/** @type {?} */ (this)).addSvgIconInNamespace('', iconName, url); }; /** * Registers an icon using an HTML string in the default namespace. * @param iconName Name under which the icon should be registered. * @param literal SVG source of the icon. */ /** * Registers an icon using an HTML string in the default namespace. * @template THIS * @this {THIS} * @param {?} iconName Name under which the icon should be registered. * @param {?} literal SVG source of the icon. * @return {THIS} */ MdcIconRegistry.prototype.addSvgIconLiteral = /** * Registers an icon using an HTML string in the default namespace. * @template THIS * @this {THIS} * @param {?} iconName Name under which the icon should be registered. * @param {?} literal SVG source of the icon. * @return {THIS} */ function (iconName, literal) { return (/** @type {?} */ (this)).addSvgIconLiteralInNamespace('', iconName, literal); }; /** * Registers an icon by URL in the specified namespace. * @param namespace Namespace in which the icon should be registered. * @param iconName Name under which the icon should be registered. * @param url */ /** * Registers an icon by URL in the specified namespace. * @template THIS * @this {THIS} * @param {?} namespace Namespace in which the icon should be registered. * @param {?} iconName Name under which the icon should be registered. * @param {?} url * @return {THIS} */ MdcIconRegistry.prototype.addSvgIconInNamespace = /** * Registers an icon by URL in the specified namespace. * @template THIS * @this {THIS} * @param {?} namespace Namespace in which the icon should be registered. * @param {?} iconName Name under which the icon should be registered. * @param {?} url * @return {THIS} */ function (namespace, iconName, url) { return (/** @type {?} */ (this))._addSvgIconConfig(namespace, iconName, new SvgIconConfig(url)); }; /** * Registers an icon using an HTML string in the specified namespace. * @param namespace Namespace in which the icon should be registered. * @param iconName Name under which the icon should be registered. * @param literal SVG source of the icon. */ /** * Registers an icon using an HTML string in the specified namespace. * @template THIS * @this {THIS} * @param {?} namespace Namespace in which the icon should be registered. * @param {?} iconName Name under which the icon should be registered. * @param {?} literal SVG source of the icon. * @return {THIS} */ MdcIconRegistry.prototype.addSvgIconLiteralInNamespace = /** * Registers an icon using an HTML string in the specified namespace. * @template THIS * @this {THIS} * @param {?} namespace Namespace in which the icon should be registered. * @param {?} iconName Name under which the icon should be registered. * @param {?} literal SVG source of the icon. * @return {THIS} */ function (namespace, iconName, literal) { /** @type {?} */ var sanitizedLiteral = (/** @type {?} */ (this))._sanitizer.sanitize(_angular_core__WEBPACK_IMPORTED_MODULE_0__["SecurityContext"].HTML, literal); if (!sanitizedLiteral) { throw getMdcIconFailedToSanitizeLiteralError(literal); } /** @type {?} */ var svgElement = (/** @type {?} */ (this))._createSvgElementForSingleIcon(sanitizedLiteral); return (/** @type {?} */ (this))._addSvgIconConfig(namespace, iconName, new SvgIconConfig(svgElement)); }; /** * Registers an icon set by URL in the default namespace. * @param url */ /** * Registers an icon set by URL in the default namespace. * @template THIS * @this {THIS} * @param {?} url * @return {THIS} */ MdcIconRegistry.prototype.addSvgIconSet = /** * Registers an icon set by URL in the default namespace. * @template THIS * @this {THIS} * @param {?} url * @return {THIS} */ function (url) { return (/** @type {?} */ (this)).addSvgIconSetInNamespace('', url); }; /** * Registers an icon set using an HTML string in the default namespace. * @param literal SVG source of the icon set. */ /** * Registers an icon set using an HTML string in the default namespace. * @template THIS * @this {THIS} * @param {?} literal SVG source of the icon set. * @return {THIS} */ MdcIconRegistry.prototype.addSvgIconSetLiteral = /** * Registers an icon set using an HTML string in the default namespace. * @template THIS * @this {THIS} * @param {?} literal SVG source of the icon set. * @return {THIS} */ function (literal) { return (/** @type {?} */ (this)).addSvgIconSetLiteralInNamespace('', literal); }; /** * Registers an icon set by URL in the specified namespace. * @param namespace Namespace in which to register the icon set. * @param url */ /** * Registers an icon set by URL in the specified namespace. * @template THIS * @this {THIS} * @param {?} namespace Namespace in which to register the icon set. * @param {?} url * @return {THIS} */ MdcIconRegistry.prototype.addSvgIconSetInNamespace = /** * Registers an icon set by URL in the specified namespace. * @template THIS * @this {THIS} * @param {?} namespace Namespace in which to register the icon set. * @param {?} url * @return {THIS} */ function (namespace, url) { return (/** @type {?} */ (this))._addSvgIconSetConfig(namespace, new SvgIconConfig(url)); }; /** * Registers an icon set using an HTML string in the specified namespace. * @param namespace Namespace in which to register the icon set. * @param literal SVG source of the icon set. */ /** * Registers an icon set using an HTML string in the specified namespace. * @template THIS * @this {THIS} * @param {?} namespace Namespace in which to register the icon set. * @param {?} literal SVG source of the icon set. * @return {THIS} */ MdcIconRegistry.prototype.addSvgIconSetLiteralInNamespace = /** * Registers an icon set using an HTML string in the specified namespace. * @template THIS * @this {THIS} * @param {?} namespace Namespace in which to register the icon set. * @param {?} literal SVG source of the icon set. * @return {THIS} */ function (namespace, literal) { /** @type {?} */ var sanitizedLiteral = (/** @type {?} */ (this))._sanitizer.sanitize(_angular_core__WEBPACK_IMPORTED_MODULE_0__["SecurityContext"].HTML, literal); if (!sanitizedLiteral) { throw getMdcIconFailedToSanitizeLiteralError(literal); } /** @type {?} */ var svgElement = (/** @type {?} */ (this))._svgElementFromString(sanitizedLiteral); return (/** @type {?} */ (this))._addSvgIconSetConfig(namespace, new SvgIconConfig(svgElement)); }; /** * Defines an alias for a CSS class name to be used for icon fonts. Creating an mdcIcon * component with the alias as the fontSet input will cause the class name to be applied * to the `` element. * * @param alias Alias for the font. * @param className Class name override to be used instead of the alias. */ /** * Defines an alias for a CSS class name to be used for icon fonts. Creating an mdcIcon * component with the alias as the fontSet input will cause the class name to be applied * to the `` element. * * @template THIS * @this {THIS} * @param {?} alias Alias for the font. * @param {?=} className Class name override to be used instead of the alias. * @return {THIS} */ MdcIconRegistry.prototype.registerFontClassAlias = /** * Defines an alias for a CSS class name to be used for icon fonts. Creating an mdcIcon * component with the alias as the fontSet input will cause the class name to be applied * to the `` element. * * @template THIS * @this {THIS} * @param {?} alias Alias for the font. * @param {?=} className Class name override to be used instead of the alias. * @return {THIS} */ function (alias, className) { if (className === void 0) { className = alias; } (/** @type {?} */ (this))._fontCssClassesByAlias.set(alias, className); return (/** @type {?} */ (this)); }; /** * Returns the CSS class name associated with the alias by a previous call to * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified. */ /** * Returns the CSS class name associated with the alias by a previous call to * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified. * @param {?} alias * @return {?} */ MdcIconRegistry.prototype.classNameForFontAlias = /** * Returns the CSS class name associated with the alias by a previous call to * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified. * @param {?} alias * @return {?} */ function (alias) { return this._fontCssClassesByAlias.get(alias) || alias; }; /** * Sets the CSS class name to be used for icon fonts when an `` component does not * have a fontSet input value, and is not loading an icon by name or URL. * * @param className */ /** * Sets the CSS class name to be used for icon fonts when an `` component does not * have a fontSet input value, and is not loading an icon by name or URL. * * @template THIS * @this {THIS} * @param {...?} classNames * @return {THIS} */ MdcIconRegistry.prototype.setDefaultFontSetClass = /** * Sets the CSS class name to be used for icon fonts when an `` component does not * have a fontSet input value, and is not loading an icon by name or URL. * * @template THIS * @this {THIS} * @param {...?} classNames * @return {THIS} */ function () { var classNames = []; for (var _i = 0; _i < arguments.length; _i++) { classNames[_i] = arguments[_i]; } (/** @type {?} */ (this))._defaultFontSetClass = classNames; return (/** @type {?} */ (this)); }; /** * Returns the CSS class name to be used for icon fonts when an `` component does not * have a fontSet input value, and is not loading an icon by name or URL. */ /** * Returns the CSS class name to be used for icon fonts when an `` component does not * have a fontSet input value, and is not loading an icon by name or URL. * @return {?} */ MdcIconRegistry.prototype.getDefaultFontSetClass = /** * Returns the CSS class name to be used for icon fonts when an `` component does not * have a fontSet input value, and is not loading an icon by name or URL. * @return {?} */ function () { return this._defaultFontSetClass; }; /** * Returns an Observable that produces the icon (as an `` DOM element) from the given URL. * The response from the URL may be cached so this will not always cause an HTTP request, but * the produced element will always be a new copy of the originally fetched icon. (That is, * it will not contain any modifications made to elements previously returned). * * @param safeUrl URL from which to fetch the SVG icon. */ /** * Returns an Observable that produces the icon (as an `` DOM element) from the given URL. * The response from the URL may be cached so this will not always cause an HTTP request, but * the produced element will always be a new copy of the originally fetched icon. (That is, * it will not contain any modifications made to elements previously returned). * * @param {?} safeUrl URL from which to fetch the SVG icon. * @return {?} */ MdcIconRegistry.prototype.getSvgIconFromUrl = /** * Returns an Observable that produces the icon (as an `` DOM element) from the given URL. * The response from the URL may be cached so this will not always cause an HTTP request, but * the produced element will always be a new copy of the originally fetched icon. (That is, * it will not contain any modifications made to elements previously returned). * * @param {?} safeUrl URL from which to fetch the SVG icon. * @return {?} */ function (safeUrl) { var _this = this; /** @type {?} */ var url = this._sanitizer.sanitize(_angular_core__WEBPACK_IMPORTED_MODULE_0__["SecurityContext"].RESOURCE_URL, safeUrl); if (!url) { throw getMdcIconFailedToSanitizeUrlError(safeUrl); } /** @type {?} */ var cachedIcon = this._cachedIconsByUrl.get(url); if (cachedIcon) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_6__["of"])(cloneSvg(cachedIcon)); } return this._loadSvgIconFromConfig(new SvgIconConfig(safeUrl)).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["tap"])((/** * @param {?} svg * @return {?} */ function (svg) { return _this._cachedIconsByUrl.set((/** @type {?} */ (url)), svg); })), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["map"])((/** * @param {?} svg * @return {?} */ function (svg) { return cloneSvg(svg); }))); }; /** * Returns an Observable that produces the icon (as an `` DOM element) with the given name * and namespace. The icon must have been previously registered with addIcon or addIconSet; * if not, the Observable will throw an error. * * @param name Name of the icon to be retrieved. * @param namespace Namespace in which to look for the icon. */ /** * Returns an Observable that produces the icon (as an `` DOM element) with the given name * and namespace. The icon must have been previously registered with addIcon or addIconSet; * if not, the Observable will throw an error. * * @param {?} name Name of the icon to be retrieved. * @param {?=} namespace Namespace in which to look for the icon. * @return {?} */ MdcIconRegistry.prototype.getNamedSvgIcon = /** * Returns an Observable that produces the icon (as an `` DOM element) with the given name * and namespace. The icon must have been previously registered with addIcon or addIconSet; * if not, the Observable will throw an error. * * @param {?} name Name of the icon to be retrieved. * @param {?=} namespace Namespace in which to look for the icon. * @return {?} */ function (name, namespace) { if (namespace === void 0) { namespace = ''; } // Return (copy of) cached icon if possible. /** @type {?} */ var key = iconKey(namespace, name); /** @type {?} */ var config = this._svgIconConfigs.get(key); if (config) { return this._getSvgFromConfig(config); } // See if we have any icon sets registered for the namespace. /** @type {?} */ var iconSetConfigs = this._iconSetConfigs.get(namespace); if (iconSetConfigs) { return this._getSvgFromIconSetConfigs(name, iconSetConfigs); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_6__["throwError"])(getMdcIconNameNotFoundError(key)); }; /** * @return {?} */ MdcIconRegistry.prototype.ngOnDestroy = /** * @return {?} */ function () { this._svgIconConfigs.clear(); this._iconSetConfigs.clear(); this._cachedIconsByUrl.clear(); }; /** * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not. */ /** * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not. * @private * @param {?} config * @return {?} */ MdcIconRegistry.prototype._getSvgFromConfig = /** * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not. * @private * @param {?} config * @return {?} */ function (config) { if (config.svgElement) { // We already have the SVG element for this icon, return a copy. return Object(rxjs__WEBPACK_IMPORTED_MODULE_6__["of"])(cloneSvg(config.svgElement)); } else { // Fetch the icon from the config's URL, cache it, and return a copy. return this._loadSvgIconFromConfig(config).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["tap"])((/** * @param {?} svg * @return {?} */ function (svg) { return config.svgElement = svg; })), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["map"])((/** * @param {?} svg * @return {?} */ function (svg) { return cloneSvg(svg); }))); } }; /** * Attempts to find an icon with the specified name in any of the SVG icon sets. * First searches the available cached icons for a nested element with a matching name, and * if found copies the element to a new `` element. If not found, fetches all icon sets * that have not been cached, and searches again after all fetches are completed. * The returned Observable produces the SVG element if possible, and throws * an error if no icon with the specified name can be found. */ /** * Attempts to find an icon with the specified name in any of the SVG icon sets. * First searches the available cached icons for a nested element with a matching name, and * if found copies the element to a new `` element. If not found, fetches all icon sets * that have not been cached, and searches again after all fetches are completed. * The returned Observable produces the SVG element if possible, and throws * an error if no icon with the specified name can be found. * @private * @param {?} name * @param {?} iconSetConfigs * @return {?} */ MdcIconRegistry.prototype._getSvgFromIconSetConfigs = /** * Attempts to find an icon with the specified name in any of the SVG icon sets. * First searches the available cached icons for a nested element with a matching name, and * if found copies the element to a new `` element. If not found, fetches all icon sets * that have not been cached, and searches again after all fetches are completed. * The returned Observable produces the SVG element if possible, and throws * an error if no icon with the specified name can be found. * @private * @param {?} name * @param {?} iconSetConfigs * @return {?} */ function (name, iconSetConfigs) { var _this = this; // For all the icon set SVG elements we've fetched, see if any contain an icon with the // requested name. /** @type {?} */ var namedIcon = this._extractIconWithNameFromAnySet(name, iconSetConfigs); if (namedIcon) { // We could cache namedIcon in _svgIconConfigs, but since we have to make a copy every // time anyway, there's probably not much advantage compared to just always extracting // it from the icon set. return Object(rxjs__WEBPACK_IMPORTED_MODULE_6__["of"])(namedIcon); } // Not found in any cached icon sets. If there are icon sets with URLs that we haven't // fetched, fetch them now and look for iconName in the results. /** @type {?} */ var iconSetFetchRequests = iconSetConfigs .filter((/** * @param {?} iconSetConfig * @return {?} */ function (iconSetConfig) { return !iconSetConfig.svgElement; })) .map((/** * @param {?} iconSetConfig * @return {?} */ function (iconSetConfig) { return _this._loadSvgIconSetFromConfig(iconSetConfig).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["catchError"])((/** * @param {?} err * @return {?} */ function (err) { /** @type {?} */ var url = _this._sanitizer.sanitize(_angular_core__WEBPACK_IMPORTED_MODULE_0__["SecurityContext"].RESOURCE_URL, iconSetConfig.url); // Swallow errors fetching individual URLs so the // combined Observable won't necessarily fail. console.error("Loading icon set URL: " + url + " failed: " + err.message); return Object(rxjs__WEBPACK_IMPORTED_MODULE_6__["of"])(null); }))); })); // Fetch all the icon set URLs. When the requests complete, every IconSet should have a // cached SVG element (unless the request failed), and we can check again for the icon. return Object(rxjs__WEBPACK_IMPORTED_MODULE_6__["forkJoin"])(iconSetFetchRequests).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["map"])((/** * @return {?} */ function () { /** @type {?} */ var foundIcon = _this._extractIconWithNameFromAnySet(name, iconSetConfigs); if (!foundIcon) { throw getMdcIconNameNotFoundError(name); } return foundIcon; }))); }; /** * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id" * tag matches the specified name. If found, copies the nested element to a new SVG element and * returns it. Returns null if no matching element is found. */ /** * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id" * tag matches the specified name. If found, copies the nested element to a new SVG element and * returns it. Returns null if no matching element is found. * @private * @param {?} iconName * @param {?} iconSetConfigs * @return {?} */ MdcIconRegistry.prototype._extractIconWithNameFromAnySet = /** * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id" * tag matches the specified name. If found, copies the nested element to a new SVG element and * returns it. Returns null if no matching element is found. * @private * @param {?} iconName * @param {?} iconSetConfigs * @return {?} */ function (iconName, iconSetConfigs) { // Iterate backwards, so icon sets added later have precedence. for (var i = iconSetConfigs.length - 1; i >= 0; i--) { /** @type {?} */ var config = iconSetConfigs[i]; if (config.svgElement) { /** @type {?} */ var foundIcon = this._extractSvgIconFromSet(config.svgElement, iconName); if (foundIcon) { return foundIcon; } } } return null; }; /** * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element * from it. */ /** * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element * from it. * @private * @param {?} config * @return {?} */ MdcIconRegistry.prototype._loadSvgIconFromConfig = /** * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element * from it. * @private * @param {?} config * @return {?} */ function (config) { var _this = this; return this._fetchUrl(config.url) .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["map"])((/** * @param {?} svgText * @return {?} */ function (svgText) { return _this._createSvgElementForSingleIcon(svgText); }))); }; /** * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element * from it. */ /** * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element * from it. * @private * @param {?} config * @return {?} */ MdcIconRegistry.prototype._loadSvgIconSetFromConfig = /** * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element * from it. * @private * @param {?} config * @return {?} */ function (config) { var _this = this; // If the SVG for this icon set has already been parsed, do nothing. if (config.svgElement) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_6__["of"])(config.svgElement); } return this._fetchUrl(config.url).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["map"])((/** * @param {?} svgText * @return {?} */ function (svgText) { // It is possible that the icon set was parsed and cached by an earlier request, so parsing // only needs to occur if the cache is yet unset. if (!config.svgElement) { config.svgElement = _this._svgElementFromString(svgText); } return config.svgElement; }))); }; /** * Creates a DOM element from the given SVG string, and adds default attributes. */ /** * Creates a DOM element from the given SVG string, and adds default attributes. * @private * @param {?} responseText * @return {?} */ MdcIconRegistry.prototype._createSvgElementForSingleIcon = /** * Creates a DOM element from the given SVG string, and adds default attributes. * @private * @param {?} responseText * @return {?} */ function (responseText) { /** @type {?} */ var svg = this._svgElementFromString(responseText); this._setSvgAttributes(svg); return svg; }; /** * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id" * tag matches the specified name. If found, copies the nested element to a new SVG element and * returns it. Returns null if no matching element is found. */ /** * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id" * tag matches the specified name. If found, copies the nested element to a new SVG element and * returns it. Returns null if no matching element is found. * @private * @param {?} iconSet * @param {?} iconName * @return {?} */ MdcIconRegistry.prototype._extractSvgIconFromSet = /** * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id" * tag matches the specified name. If found, copies the nested element to a new SVG element and * returns it. Returns null if no matching element is found. * @private * @param {?} iconSet * @param {?} iconName * @return {?} */ function (iconSet, iconName) { /** @type {?} */ var iconSource = iconSet.querySelector('#' + iconName); if (!iconSource) { return null; } // Clone the element and remove the ID to prevent multiple elements from being added // to the page with the same ID. /** @type {?} */ var iconElement = (/** @type {?} */ (iconSource.cloneNode(true))); iconElement.removeAttribute('id'); // If the icon node is itself an node, clone and return it directly. If not, set it as // the content of a new node. if (iconElement.nodeName.toLowerCase() === 'svg') { return this._setSvgAttributes((/** @type {?} */ (iconElement))); } // If the node is a , it won't be rendered so we have to convert it into . Note // that the same could be achieved by referring to it via , however the // tag is problematic on Firefox, because it needs to include the current page path. if (iconElement.nodeName.toLowerCase() === 'symbol') { return this._setSvgAttributes(this._toSvgElement(iconElement)); } // createElement('SVG') doesn't work as expected; the DOM ends up with // the correct nodes, but the SVG content doesn't render. Instead we // have to create an empty SVG node using innerHTML and append its content. // Elements created using DOMParser.parseFromString have the same problem. // http://stackoverflow.com/questions/23003278/svg-innerhtml-in-firefox-can-not-display /** @type {?} */ var svg = this._svgElementFromString(''); // Clone the node so we don't remove it from the parent icon set element. svg.appendChild(iconElement); return this._setSvgAttributes(svg); }; /** * Creates a DOM element from the given SVG string. */ /** * Creates a DOM element from the given SVG string. * @private * @param {?} str * @return {?} */ MdcIconRegistry.prototype._svgElementFromString = /** * Creates a DOM element from the given SVG string. * @private * @param {?} str * @return {?} */ function (str) { /** @type {?} */ var div = this._document.createElement('DIV'); div.innerHTML = str; /** @type {?} */ var svg = (/** @type {?} */ (div.querySelector('svg'))); if (!svg) { throw Error(' tag not found'); } else { /** @type {?} */ var viewBox = svg.getAttribute('viewBox'); if (viewBox) { svg.setAttribute('viewBox', viewBox); } } return svg; }; /** * Converts an element into an SVG node by cloning all of its children. */ /** * Converts an element into an SVG node by cloning all of its children. * @private * @param {?} element * @return {?} */ MdcIconRegistry.prototype._toSvgElement = /** * Converts an element into an SVG node by cloning all of its children. * @private * @param {?} element * @return {?} */ function (element) { /** @type {?} */ var svg = this._svgElementFromString(''); for (var i = 0; i < element.childNodes.length; i++) { if (element.childNodes[i].nodeType === this._document.ELEMENT_NODE) { svg.appendChild(element.childNodes[i].cloneNode(true)); } } return svg; }; /** * Sets the default attributes for an SVG element to be used as an icon. */ /** * Sets the default attributes for an SVG element to be used as an icon. * @private * @param {?} svg * @return {?} */ MdcIconRegistry.prototype._setSvgAttributes = /** * Sets the default attributes for an SVG element to be used as an icon. * @private * @param {?} svg * @return {?} */ function (svg) { svg.setAttribute('fit', ''); svg.setAttribute('height', '100%'); svg.setAttribute('width', '100%'); svg.setAttribute('preserveAspectRatio', 'xMidYMid meet'); svg.setAttribute('focusable', 'false'); // Disable IE11 default behavior to make SVGs focusable. return svg; }; /** * Returns an Observable which produces the string contents of the given URL. Results may be * cached, so future calls with the same URL may not cause another HTTP request. */ /** * Returns an Observable which produces the string contents of the given URL. Results may be * cached, so future calls with the same URL may not cause another HTTP request. * @private * @param {?} safeUrl * @return {?} */ MdcIconRegistry.prototype._fetchUrl = /** * Returns an Observable which produces the string contents of the given URL. Results may be * cached, so future calls with the same URL may not cause another HTTP request. * @private * @param {?} safeUrl * @return {?} */ function (safeUrl) { var _this = this; if (!this._httpClient) { throw getMdcIconNoHttpProviderError(); } if (safeUrl == null) { throw Error("Cannot fetch icon from URL \"" + safeUrl + "\"."); } /** @type {?} */ var url = this._sanitizer.sanitize(_angular_core__WEBPACK_IMPORTED_MODULE_0__["SecurityContext"].RESOURCE_URL, safeUrl); if (!url) { throw getMdcIconFailedToSanitizeUrlError(safeUrl); } // Store in-progress fetches to avoid sending a duplicate request for a URL when there is // already a request in progress for that URL. It's necessary to call share() on the // Observable returned by http.get() so that multiple subscribers don't cause multiple XHRs. /** @type {?} */ var inProgressFetch = this._inProgressUrlFetches.get(url); if (inProgressFetch) { return inProgressFetch; } // TODO(jelbourn): for some reason, the `finalize` operator "loses" the generic type on the // Observable. Figure out why and fix it. /** @type {?} */ var req = this._httpClient.get(url, { responseType: 'text' }).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["finalize"])((/** * @return {?} */ function () { return _this._inProgressUrlFetches.delete(url); })), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["share"])()); this._inProgressUrlFetches.set(url, req); return req; }; /** * Registers an icon config by name in the specified namespace. * @param namespace Namespace in which to register the icon config. * @param iconName Name under which to register the config. * @param config Config to be registered. */ /** * Registers an icon config by name in the specified namespace. * @private * @template THIS * @this {THIS} * @param {?} namespace Namespace in which to register the icon config. * @param {?} iconName Name under which to register the config. * @param {?} config Config to be registered. * @return {THIS} */ MdcIconRegistry.prototype._addSvgIconConfig = /** * Registers an icon config by name in the specified namespace. * @private * @template THIS * @this {THIS} * @param {?} namespace Namespace in which to register the icon config. * @param {?} iconName Name under which to register the config. * @param {?} config Config to be registered. * @return {THIS} */ function (namespace, iconName, config) { (/** @type {?} */ (this))._svgIconConfigs.set(iconKey(namespace, iconName), config); return (/** @type {?} */ (this)); }; /** * Registers an icon set config in the specified namespace. * @param namespace Namespace in which to register the icon config. * @param config Config to be registered. */ /** * Registers an icon set config in the specified namespace. * @private * @template THIS * @this {THIS} * @param {?} namespace Namespace in which to register the icon config. * @param {?} config Config to be registered. * @return {THIS} */ MdcIconRegistry.prototype._addSvgIconSetConfig = /** * Registers an icon set config in the specified namespace. * @private * @template THIS * @this {THIS} * @param {?} namespace Namespace in which to register the icon config. * @param {?} config Config to be registered. * @return {THIS} */ function (namespace, config) { /** @type {?} */ var configNamespace = (/** @type {?} */ (this))._iconSetConfigs.get(namespace); if (configNamespace) { configNamespace.push(config); } else { (/** @type {?} */ (this))._iconSetConfigs.set(namespace, [config]); } return (/** @type {?} */ (this)); }; MdcIconRegistry.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"], args: [{ providedIn: 'root' },] }, ]; /** @nocollapse */ MdcIconRegistry.ctorParameters = function () { return [ { type: _angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HttpClient"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_platform_browser__WEBPACK_IMPORTED_MODULE_5__["DomSanitizer"] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_2__["DOCUMENT"],] }] } ]; }; /** @nocollapse */ MdcIconRegistry.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["defineInjectable"])({ factory: function MdcIconRegistry_Factory() { return new MdcIconRegistry(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HttpClient"], 8), Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_5__["DomSanitizer"]), Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_common__WEBPACK_IMPORTED_MODULE_2__["DOCUMENT"], 8)); }, token: MdcIconRegistry, providedIn: "root" }); return MdcIconRegistry; }()); /** * \@docs-private * @param {?} parentRegistry * @param {?} httpClient * @param {?} sanitizer * @param {?=} document * @return {?} */ function ICON_REGISTRY_PROVIDER_FACTORY(parentRegistry, httpClient, sanitizer, document) { return parentRegistry || new MdcIconRegistry(httpClient, sanitizer, document); } /** * \@docs-private * @type {?} */ var ICON_REGISTRY_PROVIDER = { // If there is already an MdcIconRegistry available, use that. Otherwise, provide a new one. provide: MdcIconRegistry, deps: [ [new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_0__["SkipSelf"](), MdcIconRegistry], [new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"](), _angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HttpClient"]], _angular_platform_browser__WEBPACK_IMPORTED_MODULE_5__["DomSanitizer"], [new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"](), (/** @type {?} */ (_angular_common__WEBPACK_IMPORTED_MODULE_2__["DOCUMENT"]))], ], useFactory: ICON_REGISTRY_PROVIDER_FACTORY, }; /** * Clones an SVGElement while preserving type information. * @param {?} svg * @return {?} */ function cloneSvg(svg) { return (/** @type {?} */ (svg.cloneNode(true))); } /** * Returns the cache key to use for an icon namespace and name. * @param {?} namespace * @param {?} name * @return {?} */ function iconKey(namespace, name) { return namespace + ':' + name; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @return {?} */ function MDC_ICON_LOCATION_FACTORY() { /** @type {?} */ var _document = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_common__WEBPACK_IMPORTED_MODULE_2__["DOCUMENT"]); /** @type {?} */ var _location = _document ? _document.location : null; return { // Note that this needs to be a function, rather than a property, because Angular // will only resolve it once, but we want the current path on each call. getPathname: (/** * @return {?} */ function () { return _location ? (_location.pathname + _location.search) : ''; }) }; } /** * Injection token used to provide the current location to `MdcIcon`. * Used to handle server-side rendering and to stub out during unit tests. * @type {?} */ var MDC_ICON_LOCATION = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('mdc-icon-location', { providedIn: 'root', factory: MDC_ICON_LOCATION_FACTORY }); /** * SVG attributes that accept a FuncIRI (e.g. `url()`). * @type {?} */ var funcIriAttributes = [ 'clip-path', 'color-profile', 'src', 'cursor', 'fill', 'filter', 'marker', 'marker-start', 'marker-mid', 'marker-end', 'mask', 'stroke' ]; var ɵ0 = /** * @param {?} attr * @return {?} */ function (attr) { return "[" + attr + "]"; }; /** * Selector that can be used to find all elements that are using a `FuncIRI`. * @type {?} */ var funcIriAttributeSelector = funcIriAttributes.map((ɵ0)).join(', '); /** * Regex that can be used to extract the id out of a FuncIRI. * @type {?} */ var funcIriPattern = /^url\(['"]?#(.*?)['"]?\)$/; var MdcIcon = /** @class */ (function () { function MdcIcon(elementRef, _iconRegistry, ariaHidden, _location) { this.elementRef = elementRef; this._iconRegistry = _iconRegistry; this._location = _location; this._previousFontSetClass = []; this._inline = false; this.role = 'img'; this.tabIndex = null; this._fontSet = ''; this._fontIcon = ''; this._clickable = false; if (!ariaHidden) { this._getHostElement().setAttribute('aria-hidden', 'true'); } } Object.defineProperty(MdcIcon.prototype, "inline", { /** * Whether the icon should be inlined, automatically sizing the icon to match the font size of * the element the icon is contained in. */ get: /** * Whether the icon should be inlined, automatically sizing the icon to match the font size of * the element the icon is contained in. * @return {?} */ function () { return this._inline; }, set: /** * @param {?} inline * @return {?} */ function (inline) { this._inline = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(inline); }, enumerable: true, configurable: true }); Object.defineProperty(MdcIcon.prototype, "fontSet", { /** Font set that the icon is a part of. */ get: /** * Font set that the icon is a part of. * @return {?} */ function () { return this._fontSet; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fontSet = this._cleanupFontValue(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcIcon.prototype, "fontIcon", { /** Name of an icon within a font set. */ get: /** * Name of an icon within a font set. * @return {?} */ function () { return this._fontIcon; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fontIcon = this._cleanupFontValue(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcIcon.prototype, "clickable", { get: /** * @return {?} */ function () { return this._clickable; }, set: /** * @param {?} value * @return {?} */ function (value) { this._clickable = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(value); if (this._clickable) { this.tabIndex = 0; this.role = 'button'; } else { this.tabIndex = null; this.role = null; } }, enumerable: true, configurable: true }); /** * @return {?} */ MdcIcon.prototype.ngAfterViewChecked = /** * @return {?} */ function () { /** @type {?} */ var cachedElements = this._elementsWithExternalReferences; if (cachedElements && this._location && cachedElements.size) { /** @type {?} */ var newPath = this._location.getPathname(); // We need to check whether the URL has changed on each change detection since // the browser doesn't have an API that will let us react on link clicks and // we can't depend on the Angular router. The references need to be updated, // because while most browsers don't care whether the URL is correct after // the first render, Safari will break if the user navigates to a different // page and the SVG isn't re-rendered. if (newPath !== this._previousPath) { this._previousPath = newPath; this._prependPathToReferences(newPath); } } }; /** * @return {?} */ MdcIcon.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this._elementsWithExternalReferences) { this._elementsWithExternalReferences.clear(); } }; /** * Splits an svgIcon binding value into its icon set and icon name components. * Returns a 2-element array of [(icon set), (icon name)]. * The separator for the two fields is ':'. If there is no separator, an empty * string is returned for the icon set and the entire value is returned for * the icon name. If the argument is falsy, returns an array of two empty strings. * Throws an error if the name contains two or more ':' separators. * Examples: * `'social:cake' -> ['social', 'cake'] * 'penguin' -> ['', 'penguin'] * null -> ['', ''] * 'a:b:c' -> (throws Error)` */ /** * Splits an svgIcon binding value into its icon set and icon name components. * Returns a 2-element array of [(icon set), (icon name)]. * The separator for the two fields is ':'. If there is no separator, an empty * string is returned for the icon set and the entire value is returned for * the icon name. If the argument is falsy, returns an array of two empty strings. * Throws an error if the name contains two or more ':' separators. * Examples: * `'social:cake' -> ['social', 'cake'] * 'penguin' -> ['', 'penguin'] * null -> ['', ''] * 'a:b:c' -> (throws Error)` * @private * @param {?} iconName * @return {?} */ MdcIcon.prototype._splitIconName = /** * Splits an svgIcon binding value into its icon set and icon name components. * Returns a 2-element array of [(icon set), (icon name)]. * The separator for the two fields is ':'. If there is no separator, an empty * string is returned for the icon set and the entire value is returned for * the icon name. If the argument is falsy, returns an array of two empty strings. * Throws an error if the name contains two or more ':' separators. * Examples: * `'social:cake' -> ['social', 'cake'] * 'penguin' -> ['', 'penguin'] * null -> ['', ''] * 'a:b:c' -> (throws Error)` * @private * @param {?} iconName * @return {?} */ function (iconName) { if (!iconName) { return ['', '']; } /** @type {?} */ var parts = iconName.split(':'); switch (parts.length) { case 1: return ['', parts[0]]; // Use default namespace. case 2: return (/** @type {?} */ (parts)); default: throw Error("Invalid icon name: \"" + iconName + "\""); } }; /** * @param {?} changes * @return {?} */ MdcIcon.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { var _this = this; // Only update the inline SVG icon if the inputs changed, to avoid unnecessary DOM operations. /** @type {?} */ var svgIconChanges = changes['svgIcon']; if (svgIconChanges) { if (this.svgIcon) { var _a = this._splitIconName(this.svgIcon), namespace = _a[0], iconName = _a[1]; this._iconRegistry.getNamedSvgIcon(iconName, namespace).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["take"])(1)).subscribe((/** * @param {?} svg * @return {?} */ function (svg) { return _this._setSvgElement(svg); }), (/** * @param {?} err * @return {?} */ function (err) { return console.log("Error retrieving icon: " + err.message); })); } else if (svgIconChanges.previousValue) { this._clearSvgElement(); } } if (this._usingFontIcon()) { this._updateFontIconClasses(); } }; /** * @return {?} */ MdcIcon.prototype.ngOnInit = /** * @return {?} */ function () { // Update font classes because ngOnChanges won't be called if none of the inputs are present, // e.g. arrow In this case we need to add a CSS class for the default font. if (this._usingFontIcon()) { this._updateFontIconClasses(); } }; /** * @private * @return {?} */ MdcIcon.prototype._usingFontIcon = /** * @private * @return {?} */ function () { return !this.svgIcon; }; /** * @private * @param {?} svg * @return {?} */ MdcIcon.prototype._setSvgElement = /** * @private * @param {?} svg * @return {?} */ function (svg) { this._clearSvgElement(); // Workaround for IE11 and Edge ignoring `style` tags inside dynamically-created SVGs. // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10898469/ // Do this before inserting the element into the DOM, in order to avoid a style recalculation. /** @type {?} */ var styleTags = (/** @type {?} */ (svg.querySelectorAll('style'))); for (var i = 0; i < styleTags.length; i++) { styleTags[i].textContent += ' '; } // Note: we do this fix here, rather than the icon registry, because the // references have to point to the URL at the time that the icon was created. if (this._location) { /** @type {?} */ var path = this._location.getPathname(); this._previousPath = path; this._cacheChildrenWithExternalReferences(svg); this._prependPathToReferences(path); } this._getHostElement().appendChild(svg); }; /** * @private * @return {?} */ MdcIcon.prototype._clearSvgElement = /** * @private * @return {?} */ function () { /** @type {?} */ var layoutElement = this._getHostElement(); /** @type {?} */ var childCount = layoutElement.childNodes.length; if (this._elementsWithExternalReferences) { this._elementsWithExternalReferences.clear(); } // Remove existing non-element child nodes and SVGs, and add the new SVG element. Note that // we can't use innerHTML, because IE will throw if the element has a data binding. while (childCount--) { /** @type {?} */ var child = layoutElement.childNodes[childCount]; // 1 corresponds to Node.ELEMENT_NODE. We remove all non-element nodes in order to get rid // of any loose text nodes, as well as any SVG elements in order to remove any old icons. if (child.nodeType !== 1 || child.nodeName.toLowerCase() === 'svg') { layoutElement.removeChild(child); } } }; /** * @private * @return {?} */ MdcIcon.prototype._updateFontIconClasses = /** * @private * @return {?} */ function () { if (!this._usingFontIcon()) { return; } /** @type {?} */ var elem = this._getHostElement(); /** @type {?} */ var fontSetClasses = this.fontSet ? [this._iconRegistry.classNameForFontAlias(this.fontSet)] : this._iconRegistry.getDefaultFontSetClass(); (/** @type {?} */ (this._previousFontSetClass)).forEach((/** * @param {?} className * @return {?} */ function (className) { return elem.classList.remove(className); })); fontSetClasses.forEach((/** * @param {?} className * @return {?} */ function (className) { return elem.classList.add(className); })); this._previousFontSetClass = fontSetClasses; if (this.fontIcon !== this._previousFontIconClass) { if (this._previousFontIconClass) { elem.classList.remove(this._previousFontIconClass); } if (this.fontIcon) { elem.classList.add(this.fontIcon); } this._previousFontIconClass = this.fontIcon; } }; /** * Cleans up a value to be used as a fontIcon or fontSet. * Since the value ends up being assigned as a CSS class, we * have to trim the value and omit space-separated values. */ /** * Cleans up a value to be used as a fontIcon or fontSet. * Since the value ends up being assigned as a CSS class, we * have to trim the value and omit space-separated values. * @private * @param {?} value * @return {?} */ MdcIcon.prototype._cleanupFontValue = /** * Cleans up a value to be used as a fontIcon or fontSet. * Since the value ends up being assigned as a CSS class, we * have to trim the value and omit space-separated values. * @private * @param {?} value * @return {?} */ function (value) { return typeof value === 'string' ? value.trim().split(' ')[0] : value; }; /** * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI` * reference. This is required because WebKit browsers require references to be prefixed with * the current path, if the page has a `base` tag. */ /** * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI` * reference. This is required because WebKit browsers require references to be prefixed with * the current path, if the page has a `base` tag. * @private * @param {?} path * @return {?} */ MdcIcon.prototype._prependPathToReferences = /** * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI` * reference. This is required because WebKit browsers require references to be prefixed with * the current path, if the page has a `base` tag. * @private * @param {?} path * @return {?} */ function (path) { /** @type {?} */ var elements = this._elementsWithExternalReferences; if (elements) { elements.forEach((/** * @param {?} attrs * @param {?} element * @return {?} */ function (attrs, element) { attrs.forEach((/** * @param {?} attr * @return {?} */ function (attr) { element.setAttribute(attr.name, "url('" + path + "#" + attr.value + "')"); })); })); } }; /** * Caches the children of an SVG element that have `url()` * references that we need to prefix with the current path. */ /** * Caches the children of an SVG element that have `url()` * references that we need to prefix with the current path. * @private * @param {?} element * @return {?} */ MdcIcon.prototype._cacheChildrenWithExternalReferences = /** * Caches the children of an SVG element that have `url()` * references that we need to prefix with the current path. * @private * @param {?} element * @return {?} */ function (element) { /** @type {?} */ var elementsWithFuncIri = element.querySelectorAll(funcIriAttributeSelector); /** @type {?} */ var elements = this._elementsWithExternalReferences = this._elementsWithExternalReferences || new Map(); var _loop_1 = function (i) { funcIriAttributes.forEach((/** * @param {?} attr * @return {?} */ function (attr) { /** @type {?} */ var elementWithReference = elementsWithFuncIri[i]; /** @type {?} */ var value = elementWithReference.getAttribute(attr); /** @type {?} */ var match = value ? value.match(funcIriPattern) : null; if (match) { /** @type {?} */ var attributes = elements.get(elementWithReference); if (!attributes) { attributes = []; elements.set(elementWithReference, attributes); } (/** @type {?} */ (attributes)).push({ name: attr, value: match[1] }); } })); }; for (var i = 0; i < elementsWithFuncIri.length; i++) { _loop_1(i); } }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @protected * @return {?} */ MdcIcon.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @protected * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcIcon.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-icon, [mdcIcon]', exportAs: 'mdcIcon', host: { '[attr.role]': 'role', '[attr.tabindex]': 'tabIndex', 'class': 'ngx-mdc-icon', '[class.ngx-mdc-icon--clickable]': 'clickable', '[class.ngx-mdc-icon--inline]': 'inline' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcIcon.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: MdcIconRegistry }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Attribute"], args: ['aria-hidden',] }] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [MDC_ICON_LOCATION,] }] } ]; }; MdcIcon.propDecorators = { inline: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], svgIcon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], role: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], tabIndex: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fontSet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fontIcon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], clickable: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcIcon; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var ICON_DECLARATIONS = [ MdcIcon, MdcMaterialIcons ]; var MdcIconModule = /** @class */ (function () { function MdcIconModule() { } MdcIconModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: ICON_DECLARATIONS, declarations: ICON_DECLARATIONS },] }, ]; return MdcIconModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=icon.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/image-list.es5.js": /*!**************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/image-list.es5.js ***! \**************************************************************/ /*! exports provided: MdcImageList, MdcImageListImage, MdcImageListImageAspect, MdcImageListItem, MdcImageListLabel, MdcImageListModule, MdcImageListSupporting */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcImageList", function() { return MdcImageList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcImageListImage", function() { return MdcImageListImage; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcImageListImageAspect", function() { return MdcImageListImageAspect; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcImageListItem", function() { return MdcImageListItem; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcImageListLabel", function() { return MdcImageListLabel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcImageListModule", function() { return MdcImageListModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcImageListSupporting", function() { return MdcImageListSupporting; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcImageListItem = /** @class */ (function () { function MdcImageListItem(elementRef) { this.elementRef = elementRef; } MdcImageListItem.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcImageListItem], mdc-image-list-item', exportAs: 'mdcImageListItem', host: { 'class': 'mdc-image-list__item' } },] }, ]; /** @nocollapse */ MdcImageListItem.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcImageListItem; }()); var MdcImageListImageAspect = /** @class */ (function () { function MdcImageListImageAspect(elementRef) { this.elementRef = elementRef; } MdcImageListImageAspect.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdcImageListImageAspect], mdc-image-list-image-aspect', exportAs: 'mdcImageListImageAspect', template: "\n
\n \n
\n ", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcImageListImageAspect.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcImageListImageAspect; }()); var MdcImageListImage = /** @class */ (function () { function MdcImageListImage(elementRef) { this.elementRef = elementRef; } MdcImageListImage.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcImageListImage], mdc-image-list-image', exportAs: 'mdcImageListImage', host: { 'class': 'mdc-image-list__image' } },] }, ]; /** @nocollapse */ MdcImageListImage.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcImageListImage; }()); var MdcImageListSupporting = /** @class */ (function () { function MdcImageListSupporting(elementRef) { this.elementRef = elementRef; } MdcImageListSupporting.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcImageListSupporting], mdc-image-list-supporting', exportAs: 'mdcImageListSupporting', host: { 'class': 'mdc-image-list__supporting' } },] }, ]; /** @nocollapse */ MdcImageListSupporting.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcImageListSupporting; }()); var MdcImageListLabel = /** @class */ (function () { function MdcImageListLabel(elementRef) { this.elementRef = elementRef; } MdcImageListLabel.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcImageListLabel], mdc-image-list-label', exportAs: 'mdcImageListLabel', host: { 'class': 'mdc-image-list__label' } },] }, ]; /** @nocollapse */ MdcImageListLabel.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcImageListLabel; }()); var MdcImageList = /** @class */ (function () { function MdcImageList(elementRef) { this.elementRef = elementRef; this._masonry = false; this._textProtection = false; } Object.defineProperty(MdcImageList.prototype, "masonry", { get: /** * @return {?} */ function () { return this._masonry; }, set: /** * @param {?} value * @return {?} */ function (value) { this._masonry = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcImageList.prototype, "textProtection", { get: /** * @return {?} */ function () { return this._textProtection; }, set: /** * @param {?} value * @return {?} */ function (value) { this._textProtection = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_1__["toBoolean"])(value); }, enumerable: true, configurable: true }); MdcImageList.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdc-image-list], mdc-image-list', exportAs: 'mdcImageList', host: { 'class': 'mdc-image-list', '[class.mdc-image-list--masonry]': 'masonry', '[class.mdc-image-list--with-text-protection]': 'textProtection' }, template: '', changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcImageList.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcImageList.propDecorators = { masonry: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], textProtection: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcImageList; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var IMAGE_LIST_DECLARATIONS = [ MdcImageList, MdcImageListImage, MdcImageListImageAspect, MdcImageListItem, MdcImageListLabel, MdcImageListSupporting ]; var MdcImageListModule = /** @class */ (function () { function MdcImageListModule() { } MdcImageListModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: IMAGE_LIST_DECLARATIONS, declarations: IMAGE_LIST_DECLARATIONS, },] }, ]; return MdcImageListModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=image-list.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/line-ripple.es5.js": /*!***************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/line-ripple.es5.js ***! \***************************************************************/ /*! exports provided: MdcLineRipple, MdcLineRippleModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcLineRipple", function() { return MdcLineRipple; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcLineRippleModule", function() { return MdcLineRippleModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active', LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCLineRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCLineRippleFoundation, _super); function MDCLineRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, MDCLineRippleFoundation.defaultAdapter, adapter)) || this; _this.transitionEndHandler_ = function (evt) { return _this.handleTransitionEnd(evt); }; return _this; } Object.defineProperty(MDCLineRippleFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", { /** * See {@link MDCLineRippleAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setStyle: function setStyle() { return undefined; }, registerEventHandler: function registerEventHandler() { return undefined; }, deregisterEventHandler: function deregisterEventHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCLineRippleFoundation.prototype.init = function () { this.adapter_.registerEventHandler('transitionend', this.transitionEndHandler_); }; MDCLineRippleFoundation.prototype.destroy = function () { this.adapter_.deregisterEventHandler('transitionend', this.transitionEndHandler_); }; MDCLineRippleFoundation.prototype.activate = function () { this.adapter_.removeClass(cssClasses.LINE_RIPPLE_DEACTIVATING); this.adapter_.addClass(cssClasses.LINE_RIPPLE_ACTIVE); }; MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) { this.adapter_.setStyle('transform-origin', xCoordinate + "px center"); }; MDCLineRippleFoundation.prototype.deactivate = function () { this.adapter_.addClass(cssClasses.LINE_RIPPLE_DEACTIVATING); }; MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) { // Wait for the line ripple to be either transparent or opaque // before emitting the animation end event var isDeactivating = this.adapter_.hasClass(cssClasses.LINE_RIPPLE_DEACTIVATING); if (evt.propertyName === 'opacity') { if (isDeactivating) { this.adapter_.removeClass(cssClasses.LINE_RIPPLE_ACTIVE); this.adapter_.removeClass(cssClasses.LINE_RIPPLE_DEACTIVATING); } } }; return MDCLineRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCLineRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCLineRipple, _super); function MDCLineRipple() { return _super !== null && _super.apply(this, arguments) || this; } MDCLineRipple.attachTo = function (root) { return new MDCLineRipple(root); }; /** * Activates the line ripple */ MDCLineRipple.prototype.activate = function () { this.foundation_.activate(); }; /** * Deactivates the line ripple */ MDCLineRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. */ MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) { this.foundation_.setRippleCenter(xCoordinate); }; MDCLineRipple.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, setStyle: function setStyle(propertyName, value) { return _this.root_.style.setProperty(propertyName, value); }, registerEventHandler: function registerEventHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterEventHandler: function deregisterEventHandler(evtType, handler) { return _this.unlisten(evtType, handler); } }; // tslint:enable:object-literal-sort-keys return new MDCLineRippleFoundation(adapter); }; return MDCLineRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcLineRipple = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MdcLineRipple, _super); function MdcLineRipple(_ngZone, elementRef) { var _this = _super.call(this, elementRef) || this; _this._ngZone = _ngZone; _this.elementRef = elementRef; /** * Emits whenever the component is destroyed. */ _this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); return _this; } /** * @return {?} */ MdcLineRipple.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), setStyle: (/** * @param {?} propertyName * @param {?} value * @return {?} */ function (propertyName, value) { return _this._getHostElement().style.setProperty(propertyName, value); }), registerEventHandler: (/** * @return {?} */ function () { }), deregisterEventHandler: (/** * @return {?} */ function () { }) }; return new MDCLineRippleFoundation(adapter); }; /** * @return {?} */ MdcLineRipple.prototype.ngOnInit = /** * @return {?} */ function () { this._loadListeners(); }; /** * @return {?} */ MdcLineRipple.prototype.destroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); }; /** * @return {?} */ MdcLineRipple.prototype.ngOnDestroy = /** * @return {?} */ function () { this.destroy(); }; /** Activates the line ripple */ /** * Activates the line ripple * @return {?} */ MdcLineRipple.prototype.activate = /** * Activates the line ripple * @return {?} */ function () { this._foundation.activate(); }; /** Deactivates the line ripple */ /** * Deactivates the line ripple * @return {?} */ MdcLineRipple.prototype.deactivate = /** * Deactivates the line ripple * @return {?} */ function () { this._foundation.deactivate(); }; /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. */ /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. * @param {?} xCoordinate * @return {?} */ MdcLineRipple.prototype.setRippleCenter = /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. * @param {?} xCoordinate * @return {?} */ function (xCoordinate) { this._foundation.setRippleCenter(xCoordinate); }; /** * @private * @return {?} */ MdcLineRipple.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["fromEvent"])(_this._getHostElement(), 'transitionend') .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(_this._destroy), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])((/** * @param {?} e * @return {?} */ function (e) { return e.target === _this._getHostElement(); }))) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleTransitionEnd(evt); })); })); })); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcLineRipple.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcLineRipple.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcLineRipple], mdc-line-ripple', exportAs: 'mdcLineRipple', host: { 'class': 'mdc-line-ripple' } },] }, ]; /** @nocollapse */ MdcLineRipple.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcLineRipple; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcLineRippleModule = /** @class */ (function () { function MdcLineRippleModule() { } MdcLineRippleModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: [MdcLineRipple], declarations: [MdcLineRipple] },] }, ]; return MdcLineRippleModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=line-ripple.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/linear-progress.es5.js": /*!*******************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/linear-progress.es5.js ***! \*******************************************************************/ /*! exports provided: MdcLinearProgress, MdcLinearProgressModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcLinearProgress", function() { return MdcLinearProgress; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcLinearProgressModule", function() { return MdcLinearProgressModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssPropertyNameMap = { animation: { prefixed: '-webkit-animation', standard: 'animation' }, transform: { prefixed: '-webkit-transform', standard: 'transform' }, transition: { prefixed: '-webkit-transition', standard: 'transition' } }; function isWindow(windowObj) { return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; } function getCorrectPropertyName(windowObj, cssProperty) { if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { var el = windowObj.document.createElement('div'); var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed; var isStandard = standard in el.style; return isStandard ? standard : prefixed; } return cssProperty; } /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { CLOSED_CLASS: 'mdc-linear-progress--closed', INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate', REVERSED_CLASS: 'mdc-linear-progress--reversed' }; var strings = { BUFFER_SELECTOR: '.mdc-linear-progress__buffer', PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar' }; /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCLinearProgressFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCLinearProgressFoundation, _super); function MDCLinearProgressFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, MDCLinearProgressFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgressFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, getBuffer: function getBuffer() { return null; }, getPrimaryBar: function getPrimaryBar() { return null; }, hasClass: function hasClass() { return false; }, removeClass: function removeClass() { return undefined; }, setStyle: function setStyle() { return undefined; } }; }, enumerable: true, configurable: true }); MDCLinearProgressFoundation.prototype.init = function () { this.isDeterminate_ = !this.adapter_.hasClass(cssClasses.INDETERMINATE_CLASS); this.isReversed_ = this.adapter_.hasClass(cssClasses.REVERSED_CLASS); this.progress_ = 0; }; MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) { this.isDeterminate_ = isDeterminate; if (this.isDeterminate_) { this.adapter_.removeClass(cssClasses.INDETERMINATE_CLASS); this.setScale_(this.adapter_.getPrimaryBar(), this.progress_); } else { this.adapter_.addClass(cssClasses.INDETERMINATE_CLASS); this.setScale_(this.adapter_.getPrimaryBar(), 1); this.setScale_(this.adapter_.getBuffer(), 1); } }; MDCLinearProgressFoundation.prototype.setProgress = function (value) { this.progress_ = value; if (this.isDeterminate_) { this.setScale_(this.adapter_.getPrimaryBar(), value); } }; MDCLinearProgressFoundation.prototype.setBuffer = function (value) { if (this.isDeterminate_) { this.setScale_(this.adapter_.getBuffer(), value); } }; MDCLinearProgressFoundation.prototype.setReverse = function (isReversed) { this.isReversed_ = isReversed; if (this.isReversed_) { this.adapter_.addClass(cssClasses.REVERSED_CLASS); } else { this.adapter_.removeClass(cssClasses.REVERSED_CLASS); } }; MDCLinearProgressFoundation.prototype.open = function () { this.adapter_.removeClass(cssClasses.CLOSED_CLASS); }; MDCLinearProgressFoundation.prototype.close = function () { this.adapter_.addClass(cssClasses.CLOSED_CLASS); }; MDCLinearProgressFoundation.prototype.setScale_ = function (el, scaleValue) { if (!el) { return; } var value = "scaleX(" + scaleValue + ")"; this.adapter_.setStyle(el, getCorrectPropertyName(window, 'transform'), value); }; return MDCLinearProgressFoundation; }(MDCFoundation); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCLinearProgress = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCLinearProgress, _super); function MDCLinearProgress() { return _super !== null && _super.apply(this, arguments) || this; } MDCLinearProgress.attachTo = function (root) { return new MDCLinearProgress(root); }; Object.defineProperty(MDCLinearProgress.prototype, "determinate", { set: function set(value) { this.foundation_.setDeterminate(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgress.prototype, "progress", { set: function set(value) { this.foundation_.setProgress(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgress.prototype, "buffer", { set: function set(value) { this.foundation_.setBuffer(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgress.prototype, "reverse", { set: function set(value) { this.foundation_.setReverse(value); }, enumerable: true, configurable: true }); MDCLinearProgress.prototype.open = function () { this.foundation_.open(); }; MDCLinearProgress.prototype.close = function () { this.foundation_.close(); }; MDCLinearProgress.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, getBuffer: function getBuffer() { return _this.root_.querySelector(MDCLinearProgressFoundation.strings.BUFFER_SELECTOR); }, getPrimaryBar: function getPrimaryBar() { return _this.root_.querySelector(MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, setStyle: function setStyle(el, styleProperty, value) { return el.style.setProperty(styleProperty, value); } }; return new MDCLinearProgressFoundation(adapter); }; return MDCLinearProgress; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcLinearProgress = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MdcLinearProgress, _super); function MdcLinearProgress(_changeDetectorRef, elementRef) { var _this = _super.call(this, elementRef) || this; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this._open = true; _this._determinate = false; _this._reversed = false; _this.secondary = false; _this._progress = 0; _this._buffer = 0; return _this; } Object.defineProperty(MdcLinearProgress.prototype, "open", { get: /** * @return {?} */ function () { return this._open; }, set: /** * @param {?} value * @return {?} */ function (value) { if (this._open !== value) { this._open = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(value); this._open ? this._foundation.open() : this._foundation.close(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcLinearProgress.prototype, "determinate", { get: /** * @return {?} */ function () { return this._determinate; }, set: /** * @param {?} value * @return {?} */ function (value) { this._determinate = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(value); this._foundation.setDeterminate(this._determinate); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcLinearProgress.prototype, "reversed", { get: /** * @return {?} */ function () { return this._reversed; }, set: /** * @param {?} value * @return {?} */ function (value) { this._reversed = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toBoolean"])(value); this._foundation.setReverse(this._reversed); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcLinearProgress.prototype, "progress", { get: /** * @return {?} */ function () { return this._progress; }, set: /** * @param {?} value * @return {?} */ function (value) { this._progress = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toNumber"])(value); this._foundation.setProgress(this._progress); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcLinearProgress.prototype, "buffer", { get: /** * @return {?} */ function () { return this._buffer; }, set: /** * @param {?} value * @return {?} */ function (value) { this._buffer = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_3__["toNumber"])(value); this._foundation.setBuffer(this._buffer); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcLinearProgress.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), getPrimaryBar: (/** * @return {?} */ function () { return _this._getHostElement().querySelector('.mdc-linear-progress__primary-bar'); }), getBuffer: (/** * @return {?} */ function () { return _this._getHostElement().querySelector('.mdc-linear-progress__buffer'); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), setStyle: (/** * @param {?} el * @param {?} styleProperty * @param {?} value * @return {?} */ function (el, styleProperty, value) { return el.style.setProperty(styleProperty, value); }) }; return new MDCLinearProgressFoundation(adapter); }; /** * @return {?} */ MdcLinearProgress.prototype.ngOnInit = /** * @return {?} */ function () { this._foundation.init(); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcLinearProgress.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcLinearProgress.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-linear-progress', exportAs: 'mdcLinearProgress', host: { 'role': 'progressbar', 'class': 'mdc-linear-progress', '[class.mdc-linear-progress--secondary]': 'secondary', '[class.mdc-linear-progress--indeterminate]': '!determinate' }, template: "\n
\n
\n
\n \n
\n
\n \n
\n ", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcLinearProgress.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcLinearProgress.propDecorators = { open: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], determinate: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], reversed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], secondary: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], progress: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], buffer: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcLinearProgress; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_2__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcLinearProgressModule = /** @class */ (function () { function MdcLinearProgressModule() { } MdcLinearProgressModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: [MdcLinearProgress], declarations: [MdcLinearProgress] },] }, ]; return MdcLinearProgressModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=linear-progress.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/list.es5.js": /*!********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/list.es5.js ***! \********************************************************/ /*! exports provided: MDC_LIST_PARENT_COMPONENT, MdcList, MdcListDivider, MdcListGroup, MdcListGroupSubheader, MdcListItem, MdcListItemChange, MdcListItemGraphic, MdcListItemMeta, MdcListItemSecondary, MdcListItemText, MdcListModule, MdcListSelectionChange */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_LIST_PARENT_COMPONENT", function() { return MDC_LIST_PARENT_COMPONENT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcList", function() { return MdcList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListDivider", function() { return MdcListDivider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListGroup", function() { return MdcListGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListGroupSubheader", function() { return MdcListGroupSubheader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListItem", function() { return MdcListItem; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListItemChange", function() { return MdcListItemChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListItemGraphic", function() { return MdcListItemGraphic; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListItemMeta", function() { return MdcListItemMeta; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListItemSecondary", function() { return MdcListItemSecondary; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListItemText", function() { return MdcListItemText; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListModule", function() { return MdcListModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcListSelectionChange", function() { return MdcListSelectionChange; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Change event that is fired whenever the selected state of an option changes. */ var /** * Change event that is fired whenever the selected state of an option changes. */ MdcListSelectionChange = /** @class */ (function () { function MdcListSelectionChange(source) { this.source = source; } return MdcListSelectionChange; }()); /** * Injection token used to provide the parent MdcList component to MdcListItem. * @type {?} */ var MDC_LIST_PARENT_COMPONENT = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('MDC_LIST_PARENT_COMPONENT'); /** @type {?} */ var uniqueIdCounter = 0; var MdcListItemGraphic = /** @class */ (function () { function MdcListItemGraphic(elementRef) { this.elementRef = elementRef; } MdcListItemGraphic.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: '[mdcListItemGraphic], mdc-list-item-graphic', exportAs: 'mdcListItemGraphic', host: { 'role': 'presentation', 'class': 'mdc-list-item__graphic', '[attr.aria-hidden]': 'true' } },] }, ]; /** @nocollapse */ MdcListItemGraphic.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; return MdcListItemGraphic; }()); var MdcListItemMeta = /** @class */ (function () { function MdcListItemMeta(elementRef) { this.elementRef = elementRef; } MdcListItemMeta.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: '[mdcListItemMeta], mdc-list-item-meta', exportAs: 'mdcListItemMeta', host: { 'class': 'mdc-list-item__meta' } },] }, ]; /** @nocollapse */ MdcListItemMeta.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; return MdcListItemMeta; }()); var MdcListItemText = /** @class */ (function () { function MdcListItemText(elementRef) { this.elementRef = elementRef; } MdcListItemText.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{selector: '[mdcListItemText], mdc-list-item-text', exportAs: 'mdcListItemText', host: { 'class': 'mdc-list-item__text' }, template: "\n \n \n {{secondaryText}}\n ", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcListItemText.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; MdcListItemText.propDecorators = { secondaryText: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }] }; return MdcListItemText; }()); var MdcListItemSecondary = /** @class */ (function () { function MdcListItemSecondary(elementRef) { this.elementRef = elementRef; } MdcListItemSecondary.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: '[mdcListItemSecondary], mdc-list-item-secondary', exportAs: 'mdcListItemSecondary', host: { 'class': 'mdc-list-item__secondary-text' } },] }, ]; /** @nocollapse */ MdcListItemSecondary.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; return MdcListItemSecondary; }()); var MdcListItem = /** @class */ (function () { function MdcListItem(ripple, _changeDetectorRef, elementRef, _parent) { this.ripple = ripple; this._changeDetectorRef = _changeDetectorRef; this.elementRef = elementRef; this._parent = _parent; this._id = "mdc-list-item-" + uniqueIdCounter++; this.tabIndex = -1; this._selected = false; this._activated = false; this._disabled = false; this.selectionChange = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"](); } Object.defineProperty(MdcListItem.prototype, "id", { /** The unique ID of the list item. */ get: /** * The unique ID of the list item. * @return {?} */ function () { return this._id; }, enumerable: true, configurable: true }); Object.defineProperty(MdcListItem.prototype, "selected", { /** Whether the list item is selected. */ get: /** * Whether the list item is selected. * @return {?} */ function () { return this._selected; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (newValue !== this._selected) { this._selected = newValue; this._changeDetectorRef.markForCheck(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcListItem.prototype, "activated", { /** Whether the list item is activated. */ get: /** * Whether the list item is activated. * @return {?} */ function () { return this._activated; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (newValue !== this._activated) { this._activated = newValue; this._changeDetectorRef.markForCheck(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcListItem.prototype, "disabled", { /** Whether the list item is disabled. */ get: /** * Whether the list item is disabled. * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (newValue !== this._disabled) { this._disabled = newValue; this._changeDetectorRef.markForCheck(); } }, enumerable: true, configurable: true }); /** * @return {?} */ MdcListItem.prototype.ngOnInit = /** * @return {?} */ function () { this._initRipple(); }; /** * @return {?} */ MdcListItem.prototype.ngOnDestroy = /** * @return {?} */ function () { this.ripple.destroy(); }; /** * @private * @return {?} */ MdcListItem.prototype._initRipple = /** * @private * @return {?} */ function () { var _this = this; this.ripple.init({ surface: this.elementRef.nativeElement }, Object.assign(this.ripple.createAdapter(), { isSurfaceDisabled: (/** * @return {?} */ function () { return _this._disabled || _this._parent.disableRipple; }) })); }; /** * @return {?} */ MdcListItem.prototype.focus = /** * @return {?} */ function () { this.getListItemElement().focus(); }; /** * @param {?} role * @return {?} */ MdcListItem.prototype.setRole = /** * @param {?} role * @return {?} */ function (role) { this.getListItemElement().setAttribute('role', role); }; /** * @return {?} */ MdcListItem.prototype.getListItemElement = /** * @return {?} */ function () { return this.elementRef.nativeElement; }; /** * @param {?} evt * @return {?} */ MdcListItem.prototype._onKeydown = /** * @param {?} evt * @return {?} */ function (evt) { if (evt.keyCode === _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["ENTER"] || evt.keyCode === _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["SPACE"]) { this._emitChangeEvent(); } }; /** Emits a change event if the selected state of an option changed. */ /** * Emits a change event if the selected state of an option changed. * @return {?} */ MdcListItem.prototype._emitChangeEvent = /** * Emits a change event if the selected state of an option changed. * @return {?} */ function () { if (this._disabled) { return; } this.selectionChange.emit(new MdcListSelectionChange(this)); }; MdcListItem.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{selector: 'mdc-list-item, a[mdc-list-item]', exportAs: 'mdcListItem', host: { 'role': 'listitem', '[id]': 'id', '[tabIndex]': 'tabIndex', 'class': 'mdc-list-item', '[class.mdc-list-item--selected]': 'selected', '[class.mdc-list-item--activated]': 'activated', '[class.mdc-list-item--disabled]': 'disabled', '(click)': '_emitChangeEvent()', '(keydown)': '_onKeydown($event)' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"].OnPush, providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_6__["MdcRipple"]] },] }, ]; /** @nocollapse */ MdcListItem.ctorParameters = function () { return [ { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_6__["MdcRipple"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [MDC_LIST_PARENT_COMPONENT,] }] } ]; }; MdcListItem.propDecorators = { value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], tabIndex: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], selected: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], activated: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], selectionChange: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"] }] }; return MdcListItem; }()); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated', LIST_ITEM_CLASS: 'mdc-list-item', LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected', ROOT: 'mdc-list' }; var strings = { ACTION_EVENT: 'MDCList:action', ARIA_CHECKED: 'aria-checked', ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]', ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]', ARIA_CURRENT: 'aria-current', ARIA_ORIENTATION: 'aria-orientation', ARIA_ORIENTATION_HORIZONTAL: 'horizontal', ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]', ARIA_SELECTED: 'aria-selected', CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled)', CHECKBOX_SELECTOR: 'input[type="checkbox"]:not(:disabled)', CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a\n ", ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)', FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a,\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled)\n ", RADIO_SELECTOR: 'input[type="radio"]:not(:disabled)' }; var numbers = { UNSET_INDEX: -1 }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. */ function closest(element, selector) { if (element.closest) { return element.closest(selector); } var el = element; while (el) { if (matches(el, selector)) { return el; } el = el.parentElement; } return null; } function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select']; function isNumberArray(selectedIndex) { return selectedIndex instanceof Array; } var MDCListFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MDCListFoundation, _super); function MDCListFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, MDCListFoundation.defaultAdapter, adapter)) || this; _this.wrapFocus_ = false; _this.isVertical_ = true; _this.isSingleSelectionList_ = false; _this.selectedIndex_ = numbers.UNSET_INDEX; _this.focusedItemIndex_ = numbers.UNSET_INDEX; _this.useActivatedClass_ = false; _this.ariaCurrentAttrValue_ = null; _this.isCheckboxList_ = false; _this.isRadioList_ = false; return _this; } Object.defineProperty(MDCListFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "defaultAdapter", { get: function get() { return { addClassForElementIndex: function addClassForElementIndex() { return undefined; }, focusItemAtIndex: function focusItemAtIndex() { return undefined; }, getAttributeForElementIndex: function getAttributeForElementIndex() { return null; }, getFocusedElementIndex: function getFocusedElementIndex() { return 0; }, getListItemCount: function getListItemCount() { return 0; }, hasCheckboxAtIndex: function hasCheckboxAtIndex() { return false; }, hasRadioAtIndex: function hasRadioAtIndex() { return false; }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() { return false; }, isFocusInsideList: function isFocusInsideList() { return false; }, notifyAction: function notifyAction() { return undefined; }, removeClassForElementIndex: function removeClassForElementIndex() { return undefined; }, setAttributeForElementIndex: function setAttributeForElementIndex() { return undefined; }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() { return undefined; }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren() { return undefined; } }; }, enumerable: true, configurable: true }); MDCListFoundation.prototype.layout = function () { if (this.adapter_.getListItemCount() === 0) { return; } if (this.adapter_.hasCheckboxAtIndex(0)) { this.isCheckboxList_ = true; } else if (this.adapter_.hasRadioAtIndex(0)) { this.isRadioList_ = true; } }; /** * Sets the private wrapFocus_ variable. */ MDCListFoundation.prototype.setWrapFocus = function (value) { this.wrapFocus_ = value; }; /** * Sets the isVertical_ private variable. */ MDCListFoundation.prototype.setVerticalOrientation = function (value) { this.isVertical_ = value; }; /** * Sets the isSingleSelectionList_ private variable. */ MDCListFoundation.prototype.setSingleSelection = function (value) { this.isSingleSelectionList_ = value; }; /** * Sets the useActivatedClass_ private variable. */ MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) { this.useActivatedClass_ = useActivated; }; MDCListFoundation.prototype.getSelectedIndex = function () { return this.selectedIndex_; }; MDCListFoundation.prototype.setSelectedIndex = function (index) { if (!this.isIndexValid_(index)) { return; } if (this.isCheckboxList_) { this.setCheckboxAtIndex_(index); } else if (this.isRadioList_) { this.setRadioAtIndex_(index); } else { this.setSingleSelectionAtIndex_(index); } }; /** * Focus in handler for the list items. */ MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) { if (listItemIndex >= 0) { this.adapter_.setTabIndexForListItemChildren(listItemIndex, '0'); } }; /** * Focus out handler for the list items. */ MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) { var _this = this; if (listItemIndex >= 0) { this.adapter_.setTabIndexForListItemChildren(listItemIndex, '-1'); } /** * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus * is moved to next element. */ setTimeout(function () { if (!_this.adapter_.isFocusInsideList()) { _this.setTabindexToFirstSelectedItem_(); } }, 0); }; /** * Key handler for the list. */ MDCListFoundation.prototype.handleKeydown = function (evt, isRootListItem, listItemIndex) { var arrowLeft = evt.key === 'ArrowLeft' || evt.keyCode === 37; var arrowUp = evt.key === 'ArrowUp' || evt.keyCode === 38; var arrowRight = evt.key === 'ArrowRight' || evt.keyCode === 39; var arrowDown = evt.key === 'ArrowDown' || evt.keyCode === 40; var isHome = evt.key === 'Home' || evt.keyCode === 36; var isEnd = evt.key === 'End' || evt.keyCode === 35; var isEnter = evt.key === 'Enter' || evt.keyCode === 13; var isSpace = evt.key === 'Space' || evt.keyCode === 32; var currentIndex = this.adapter_.getFocusedElementIndex(); var nextIndex = numbers.UNSET_INDEX; if (currentIndex === numbers.UNSET_INDEX) { currentIndex = listItemIndex; if (currentIndex < 0) { // If this event doesn't have a mdc-list-item ancestor from the // current list (not from a sublist), return early. return; } } if (this.isVertical_ && arrowDown || !this.isVertical_ && arrowRight) { this.preventDefaultEvent_(evt); nextIndex = this.focusNextElement(currentIndex); } else if (this.isVertical_ && arrowUp || !this.isVertical_ && arrowLeft) { this.preventDefaultEvent_(evt); nextIndex = this.focusPrevElement(currentIndex); } else if (isHome) { this.preventDefaultEvent_(evt); nextIndex = this.focusFirstElement(); } else if (isEnd) { this.preventDefaultEvent_(evt); nextIndex = this.focusLastElement(); } else if (isEnter || isSpace) { if (isRootListItem) { // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event. var target = evt.target; if (target && target.tagName === 'A' && isEnter) { return; } this.preventDefaultEvent_(evt); if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(currentIndex); } this.adapter_.notifyAction(currentIndex); } } this.focusedItemIndex_ = currentIndex; if (nextIndex >= 0) { this.setTabindexAtIndex_(nextIndex); this.focusedItemIndex_ = nextIndex; } }; /** * Click handler for the list. */ MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) { if (index === numbers.UNSET_INDEX) { return; } if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(index, toggleCheckbox); } this.adapter_.notifyAction(index); this.setTabindexAtIndex_(index); this.focusedItemIndex_ = index; }; /** * Focuses the next element on the list. */ MDCListFoundation.prototype.focusNextElement = function (index) { var count = this.adapter_.getListItemCount(); var nextIndex = index + 1; if (nextIndex >= count) { if (this.wrapFocus_) { nextIndex = 0; } else { // Return early because last item is already focused. return index; } } this.adapter_.focusItemAtIndex(nextIndex); return nextIndex; }; /** * Focuses the previous element on the list. */ MDCListFoundation.prototype.focusPrevElement = function (index) { var prevIndex = index - 1; if (prevIndex < 0) { if (this.wrapFocus_) { prevIndex = this.adapter_.getListItemCount() - 1; } else { // Return early because first item is already focused. return index; } } this.adapter_.focusItemAtIndex(prevIndex); return prevIndex; }; MDCListFoundation.prototype.focusFirstElement = function () { this.adapter_.focusItemAtIndex(0); return 0; }; MDCListFoundation.prototype.focusLastElement = function () { var lastIndex = this.adapter_.getListItemCount() - 1; this.adapter_.focusItemAtIndex(lastIndex); return lastIndex; }; /** * Ensures that preventDefault is only called if the containing element doesn't * consume the event, and it will cause an unintended scroll. */ MDCListFoundation.prototype.preventDefaultEvent_ = function (evt) { var target = evt.target; var tagName = ("" + target.tagName).toLowerCase(); if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) { evt.preventDefault(); } }; MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) { if (this.selectedIndex_ === index) { return; } var selectedClassName = cssClasses.LIST_ITEM_SELECTED_CLASS; if (this.useActivatedClass_) { selectedClassName = cssClasses.LIST_ITEM_ACTIVATED_CLASS; } if (this.selectedIndex_ !== numbers.UNSET_INDEX) { this.adapter_.removeClassForElementIndex(this.selectedIndex_, selectedClassName); } this.adapter_.addClassForElementIndex(index, selectedClassName); this.setAriaForSingleSelectionAtIndex_(index); this.selectedIndex_ = index; }; /** * Sets aria attribute for single selection at given index. */ MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) { // Detect the presence of aria-current and get the value only during list initialization when it is in unset state. if (this.selectedIndex_ === numbers.UNSET_INDEX) { this.ariaCurrentAttrValue_ = this.adapter_.getAttributeForElementIndex(index, strings.ARIA_CURRENT); } var isAriaCurrent = this.ariaCurrentAttrValue_ !== null; var ariaAttribute = isAriaCurrent ? strings.ARIA_CURRENT : strings.ARIA_SELECTED; if (this.selectedIndex_ !== numbers.UNSET_INDEX) { this.adapter_.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false'); } var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true'; this.adapter_.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue); }; /** * Toggles radio at give index. Radio doesn't change the checked state if it is already checked. */ MDCListFoundation.prototype.setRadioAtIndex_ = function (index) { this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, true); if (this.selectedIndex_ !== numbers.UNSET_INDEX) { this.adapter_.setAttributeForElementIndex(this.selectedIndex_, strings.ARIA_CHECKED, 'false'); } this.adapter_.setAttributeForElementIndex(index, strings.ARIA_CHECKED, 'true'); this.selectedIndex_ = index; }; MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) { for (var i = 0; i < this.adapter_.getListItemCount(); i++) { var isChecked = false; if (index.indexOf(i) >= 0) { isChecked = true; } this.adapter_.setCheckedCheckboxOrRadioAtIndex(i, isChecked); this.adapter_.setAttributeForElementIndex(i, strings.ARIA_CHECKED, isChecked ? 'true' : 'false'); } this.selectedIndex_ = index; }; MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) { if (this.focusedItemIndex_ === numbers.UNSET_INDEX && index !== 0) { // If no list item was selected set first list item's tabindex to -1. // Generally, tabindex is set to 0 on first list item of list that has no preselected items. this.adapter_.setAttributeForElementIndex(0, 'tabindex', '-1'); } else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) { this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_, 'tabindex', '-1'); } this.adapter_.setAttributeForElementIndex(index, 'tabindex', '0'); }; /** * @return Return true if it is single selectin list, checkbox list or radio list. */ MDCListFoundation.prototype.isSelectableList_ = function () { return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_; }; MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () { var targetIndex = 0; if (this.isSelectableList_()) { if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== numbers.UNSET_INDEX) { targetIndex = this.selectedIndex_; } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) { targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { return Math.min(currentIndex, minIndex); }); } } this.setTabindexAtIndex_(targetIndex); }; MDCListFoundation.prototype.isIndexValid_ = function (index) { var _this = this; if (index instanceof Array) { if (!this.isCheckboxList_) { throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list'); } if (index.length === 0) { return true; } else { return index.some(function (i) { return _this.isIndexInRange_(i); }); } } else if (typeof index === 'number') { if (this.isCheckboxList_) { throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index); } return this.isIndexInRange_(index); } else { return false; } }; MDCListFoundation.prototype.isIndexInRange_ = function (index) { var listSize = this.adapter_.getListItemCount(); return index >= 0 && index < listSize; }; MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) { if (toggleCheckbox === void 0) { toggleCheckbox = true; } if (this.isCheckboxList_) { this.toggleCheckboxAtIndex_(index, toggleCheckbox); } else { this.setSelectedIndex(index); } }; MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) { var isChecked = this.adapter_.isCheckboxCheckedAtIndex(index); if (toggleCheckbox) { isChecked = !isChecked; this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, isChecked); } this.adapter_.setAttributeForElementIndex(index, strings.ARIA_CHECKED, isChecked ? 'true' : 'false'); // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value. var selectedIndexes = this.selectedIndex_ === numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice(); if (isChecked) { selectedIndexes.push(index); } else { selectedIndexes = selectedIndexes.filter(function (i) { return i !== index; }); } this.selectedIndex_ = selectedIndexes; }; return MDCListFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCList = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MDCList, _super); function MDCList() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCList.prototype, "vertical", { set: function set(value) { this.foundation_.setVerticalOrientation(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "listElements", { get: function get() { return [].slice.call(this.root_.querySelectorAll(strings.ENABLED_ITEMS_SELECTOR)); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "wrapFocus", { set: function set(value) { this.foundation_.setWrapFocus(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "singleSelection", { set: function set(isSingleSelectionList) { this.foundation_.setSingleSelection(isSingleSelectionList); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "selectedIndex", { get: function get() { return this.foundation_.getSelectedIndex(); }, set: function set(index) { this.foundation_.setSelectedIndex(index); }, enumerable: true, configurable: true }); MDCList.attachTo = function (root) { return new MDCList(root); }; MDCList.prototype.initialSyncWithDOM = function () { this.handleClick_ = this.handleClickEvent_.bind(this); this.handleKeydown_ = this.handleKeydownEvent_.bind(this); this.focusInEventListener_ = this.handleFocusInEvent_.bind(this); this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this); this.listen('keydown', this.handleKeydown_); this.listen('click', this.handleClick_); this.listen('focusin', this.focusInEventListener_); this.listen('focusout', this.focusOutEventListener_); this.layout(); this.initializeListType(); }; MDCList.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten('click', this.handleClick_); this.unlisten('focusin', this.focusInEventListener_); this.unlisten('focusout', this.focusOutEventListener_); }; MDCList.prototype.layout = function () { var direction = this.root_.getAttribute(strings.ARIA_ORIENTATION); this.vertical = direction !== strings.ARIA_ORIENTATION_HORIZONTAL; // List items need to have at least tabindex=-1 to be focusable. [].slice.call(this.root_.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (el) { el.setAttribute('tabindex', '-1'); }); // Child button/a elements are not tabbable until the list item is focused. [].slice.call(this.root_.querySelectorAll(strings.FOCUSABLE_CHILD_ELEMENTS)).forEach(function (el) { return el.setAttribute('tabindex', '-1'); }); this.foundation_.layout(); }; /** * Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio. */ MDCList.prototype.initializeListType = function () { var _this = this; var checkboxListItems = this.root_.querySelectorAll(strings.ARIA_ROLE_CHECKBOX_SELECTOR); var singleSelectedListItem = this.root_.querySelector("\n ." + cssClasses.LIST_ITEM_ACTIVATED_CLASS + ",\n ." + cssClasses.LIST_ITEM_SELECTED_CLASS + "\n "); var radioSelectedListItem = this.root_.querySelector(strings.ARIA_CHECKED_RADIO_SELECTOR); if (checkboxListItems.length) { var preselectedItems = this.root_.querySelectorAll(strings.ARIA_CHECKED_CHECKBOX_SELECTOR); this.selectedIndex = [].map.call(preselectedItems, function (listItem) { return _this.listElements.indexOf(listItem); }); } else if (singleSelectedListItem) { if (singleSelectedListItem.classList.contains(cssClasses.LIST_ITEM_ACTIVATED_CLASS)) { this.foundation_.setUseActivatedClass(true); } this.singleSelection = true; this.selectedIndex = this.listElements.indexOf(singleSelectedListItem); } else if (radioSelectedListItem) { this.selectedIndex = this.listElements.indexOf(radioSelectedListItem); } }; MDCList.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClassForElementIndex: function addClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.add(className); } }, focusItemAtIndex: function focusItemAtIndex(index) { var element = _this.listElements[index]; if (element) { element.focus(); } }, getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) { return _this.listElements[index].getAttribute(attr); }, getFocusedElementIndex: function getFocusedElementIndex() { return _this.listElements.indexOf(document.activeElement); }, getListItemCount: function getListItemCount() { return _this.listElements.length; }, hasCheckboxAtIndex: function hasCheckboxAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(strings.CHECKBOX_SELECTOR); }, hasRadioAtIndex: function hasRadioAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(strings.RADIO_SELECTOR); }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(strings.CHECKBOX_SELECTOR); return toggleEl.checked; }, isFocusInsideList: function isFocusInsideList() { return _this.root_.contains(document.activeElement); }, notifyAction: function notifyAction(index) { _this.emit(strings.ACTION_EVENT, { index: index }, /** shouldBubble */ true); }, removeClassForElementIndex: function removeClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.remove(className); } }, setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { var element = _this.listElements[index]; if (element) { element.setAttribute(attr, value); } }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(strings.CHECKBOX_RADIO_SELECTOR); toggleEl.checked = isChecked; var event = document.createEvent('Event'); event.initEvent('change', true, true); toggleEl.dispatchEvent(event); }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { var element = _this.listElements[listItemIndex]; var listItemChildren = [].slice.call(element.querySelectorAll(strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)); listItemChildren.forEach(function (el) { return el.setAttribute('tabindex', tabIndexValue); }); } }; return new MDCListFoundation(adapter); }; /** * Used to figure out which list item this event is targetting. Or returns -1 if * there is no list item */ MDCList.prototype.getListItemIndex_ = function (evt) { var eventTarget = evt.target; var nearestParent = closest(eventTarget, "." + cssClasses.LIST_ITEM_CLASS + ", ." + cssClasses.ROOT); // Get the index of the element if it is a list item. if (nearestParent && matches(nearestParent, "." + cssClasses.LIST_ITEM_CLASS)) { return this.listElements.indexOf(nearestParent); } return -1; }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusInEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation_.handleFocusIn(evt, index); }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusOutEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation_.handleFocusOut(evt, index); }; /** * Used to figure out which element was focused when keydown event occurred before sending the event to the * foundation. */ MDCList.prototype.handleKeydownEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; if (index >= 0) { this.foundation_.handleKeydown(evt, target.classList.contains(cssClasses.LIST_ITEM_CLASS), index); } }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleClickEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events. var toggleCheckbox = !matches(target, strings.CHECKBOX_RADIO_SELECTOR); this.foundation_.handleClick(index, toggleCheckbox); }; return MDCList; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Change event that is being fired whenever the selected state of an option changes. */ var /** * Change event that is being fired whenever the selected state of an option changes. */ MdcListItemChange = /** @class */ (function () { function MdcListItemChange(source, option) { this.source = source; this.option = option; } return MdcListItemChange; }()); var MdcListGroup = /** @class */ (function () { function MdcListGroup(elementRef) { this.elementRef = elementRef; } MdcListGroup.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{selector: '[mdcListGroup], mdc-list-group', exportAs: 'mdcListGroup', host: { 'class': 'mdc-list-group' }, template: "\n

{{subheader}}

\n ", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcListGroup.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; MdcListGroup.propDecorators = { subheader: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }] }; return MdcListGroup; }()); var MdcListGroupSubheader = /** @class */ (function () { function MdcListGroupSubheader(elementRef) { this.elementRef = elementRef; } MdcListGroupSubheader.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: '[mdcListGroupSubheader], mdc-list-group-subheader', exportAs: 'mdcListGroupSubheader', host: { 'class': 'mdc-list-group__subheader' } },] }, ]; /** @nocollapse */ MdcListGroupSubheader.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; return MdcListGroupSubheader; }()); var MdcList = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MdcList, _super); function MdcList(_platform, _changeDetectorRef, elementRef) { var _this = _super.call(this, elementRef) || this; _this._platform = _platform; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this._twoLine = false; _this._dense = false; _this._border = false; _this._avatar = false; _this._interactive = true; _this._disableRipple = false; _this._useActivatedClass = false; _this._useSelectedClass = false; _this._verticalOrientation = true; _this._wrapFocus = false; /** * Emits a change event whenever the selected state of an option changes. */ _this.selectionChange = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"](); /** * Emits an event for keyboard and mouse actions. */ _this.actionEvent = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"](); /** * Subscription to changes in list items. */ _this._changeSubscription = null; /** * Subscription to selection events in list items. */ _this.itemSelectionSubscription = null; return _this; } Object.defineProperty(MdcList.prototype, "twoLine", { get: /** * @return {?} */ function () { return this._twoLine; }, set: /** * @param {?} value * @return {?} */ function (value) { this._twoLine = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "dense", { get: /** * @return {?} */ function () { return this._dense; }, set: /** * @param {?} value * @return {?} */ function (value) { this._dense = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "border", { get: /** * @return {?} */ function () { return this._border; }, set: /** * @param {?} value * @return {?} */ function (value) { this._border = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "avatar", { get: /** * @return {?} */ function () { return this._avatar; }, set: /** * @param {?} value * @return {?} */ function (value) { this._avatar = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "interactive", { get: /** * @return {?} */ function () { return this._interactive; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (newValue !== this._interactive) { this._interactive = newValue; } }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "disableRipple", { get: /** * @return {?} */ function () { return this._disableRipple; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (newValue !== this._disableRipple) { this._disableRipple = newValue; } }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "singleSelection", { get: /** * @return {?} */ function () { return this._singleSelection; }, set: /** * @param {?} value * @return {?} */ function (value) { if (value !== undefined) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (newValue !== this._singleSelection) { this._singleSelection = newValue; this._foundation.setSingleSelection(this._singleSelection); if (this.getSelectedIndex() > -1) { this.setSelectedIndex(this.getSelectedIndex()); } this._changeDetectorRef.markForCheck(); } } }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "useActivatedClass", { get: /** * @return {?} */ function () { return this._useActivatedClass; }, set: /** * @param {?} value * @return {?} */ function (value) { this._useActivatedClass = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); this._foundation.setUseActivatedClass(this._useActivatedClass); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "useSelectedClass", { get: /** * @return {?} */ function () { return this._useSelectedClass; }, set: /** * @param {?} value * @return {?} */ function (value) { this._useSelectedClass = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "verticalOrientation", { get: /** * @return {?} */ function () { return this._verticalOrientation; }, set: /** * @param {?} value * @return {?} */ function (value) { this._verticalOrientation = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); this._foundation.setVerticalOrientation(this._verticalOrientation); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "wrapFocus", { get: /** * @return {?} */ function () { return this._wrapFocus; }, set: /** * @param {?} value * @return {?} */ function (value) { this._wrapFocus = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); this._foundation.setWrapFocus(this._wrapFocus); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcList.prototype, "listItemSelections", { /** Combined stream of all of the list item selection events. */ get: /** * Combined stream of all of the list item selection events. * @return {?} */ function () { return rxjs__WEBPACK_IMPORTED_MODULE_2__["merge"].apply(void 0, this.items.map((/** * @param {?} item * @return {?} */ function (item) { return item.selectionChange; }))); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcList.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { getListItemCount: (/** * @return {?} */ function () { return _this.items.length; }), getFocusedElementIndex: (/** * @return {?} */ function () { if (!_this._platform.isBrowser && (/** @type {?} */ (document.activeElement))) { return -1; } return _this.items.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.getListItemElement() === (/** @type {?} */ (document.activeElement)); })) || -1; }), setAttributeForElementIndex: (/** * @param {?} index * @param {?} attr * @param {?} value * @return {?} */ function (index, attr, value) { /** @type {?} */ var item = _this.getListItemByIndex(index); if (item) { item.getListItemElement().setAttribute(attr, value); } }), addClassForElementIndex: (/** * @param {?} index * @param {?} className * @return {?} */ function (index, className) { return _this.items.toArray()[index].getListItemElement().classList.add(className); }), removeClassForElementIndex: (/** * @param {?} index * @param {?} className * @return {?} */ function (index, className) { /** @type {?} */ var item = _this.getListItemByIndex(index); if (item) { item.getListItemElement().classList.remove(className); } }), getAttributeForElementIndex: (/** * @param {?} index * @param {?} attr * @return {?} */ function (index, attr) { return _this.items.toArray()[index].getListItemElement().getAttribute(attr); }), focusItemAtIndex: (/** * @param {?} index * @return {?} */ function (index) { return _this.focusItemAtIndex(index); }), setTabIndexForListItemChildren: (/** * @param {?} listItemIndex * @param {?} tabIndexValue * @return {?} */ function (listItemIndex, tabIndexValue) { /** @type {?} */ var listItemChildren = [].slice.call(_this.items.toArray()[listItemIndex].getListItemElement() .querySelectorAll(strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)); listItemChildren.forEach((/** * @param {?} ele * @return {?} */ function (ele) { return ele.setAttribute('tabindex', "" + tabIndexValue); })); }), hasCheckboxAtIndex: (/** * @param {?} index * @return {?} */ function (index) { /** @type {?} */ var listItem = _this.items.toArray()[index].getListItemElement(); return !!listItem.querySelector(strings.CHECKBOX_SELECTOR); }), hasRadioAtIndex: (/** * @param {?} index * @return {?} */ function (index) { /** @type {?} */ var listItem = _this.items.toArray()[index].getListItemElement(); return !!listItem.querySelector(strings.RADIO_SELECTOR); }), isCheckboxCheckedAtIndex: (/** * @param {?} index * @return {?} */ function (index) { /** @type {?} */ var listItem = _this.items.toArray()[index].getListItemElement(); /** @type {?} */ var toggleEl = listItem.querySelector(strings.CHECKBOX_SELECTOR); return (/** @type {?} */ (toggleEl)).checked; }), setCheckedCheckboxOrRadioAtIndex: (/** * @param {?} index * @param {?} isChecked * @return {?} */ function (index, isChecked) { /** @type {?} */ var listItem = _this.items.toArray()[index].getListItemElement(); /** @type {?} */ var toggleEl = listItem.querySelector(strings.CHECKBOX_RADIO_SELECTOR); (/** @type {?} */ (toggleEl)).checked = isChecked; if (_this._platform.isBrowser) { /** @type {?} */ var event_1 = document.createEvent('Event'); event_1.initEvent('change', true, true); (/** @type {?} */ (toggleEl)).dispatchEvent(event_1); } }), isFocusInsideList: (/** * @return {?} */ function () { return _this._platform.isBrowser ? _this.elementRef.nativeElement.contains(document.activeElement) : false; }), notifyAction: (/** * @param {?} index * @return {?} */ function (index) { _this.actionEvent.emit({ index: index }); }) }; return new MDCListFoundation(adapter); }; /** * @return {?} */ MdcList.prototype.ngAfterViewInit = /** * @return {?} */ function () { var _this = this; this._foundation.init(); this._foundation.layout(); // When list items change, re-subscribe this._changeSubscription = this.items.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["startWith"])(null)) .subscribe((/** * @return {?} */ function () { if (_this.items.length) { _this._resetListItems(); } })); }; /** * @return {?} */ MdcList.prototype.ngOnDestroy = /** * @return {?} */ function () { this._dropSubscriptions(); if (this._changeSubscription) { this._changeSubscription.unsubscribe(); } this._foundation.destroy(); }; /** * @param {?} index * @return {?} */ MdcList.prototype.setSelectedIndex = /** * @param {?} index * @return {?} */ function (index) { this.reset(); this._foundation.setSelectedIndex(index); if (index === -1) { return; } /** @type {?} */ var selectedItem = this.items.toArray()[index]; if (selectedItem) { this._applySelectionState(selectedItem); } }; /** * @param {?} value * @return {?} */ MdcList.prototype.setSelectedValue = /** * @param {?} value * @return {?} */ function (value) { this.reset(); if (value === null) { return; } /** @type {?} */ var selectedItem = this.getListItemByValue(value); this._foundation.setSelectedIndex(this.getListItemIndexByValue(value)); if (selectedItem) { this._applySelectionState(selectedItem); } }; /** * @return {?} */ MdcList.prototype.getSelectedItem = /** * @return {?} */ function () { return this.items ? this.items.toArray().find((/** * @param {?} _ * @return {?} */ function (_) { return _.selected || _.activated; })) : undefined; }; /** * @return {?} */ MdcList.prototype.getSelectedIndex = /** * @return {?} */ function () { return this.items ? this.items.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.selected || _.activated; })) : -1; }; /** * @return {?} */ MdcList.prototype.getSelectedValue = /** * @return {?} */ function () { /** @type {?} */ var item = this.items ? this.items.find((/** * @param {?} _ * @return {?} */ function (_) { return _.selected; })) : null; return item && item.value ? item.value : null; }; /** * @return {?} */ MdcList.prototype.getSelectedText = /** * @return {?} */ function () { /** @type {?} */ var selectedItem = this.getSelectedItem(); return selectedItem && selectedItem.getListItemElement().textContent || ''; }; /** * @param {?} value * @return {?} */ MdcList.prototype.getListItemByValue = /** * @param {?} value * @return {?} */ function (value) { return this.items ? this.items.toArray().find((/** * @param {?} _ * @return {?} */ function (_) { return _.value === value; })) : undefined; }; /** * @param {?} index * @return {?} */ MdcList.prototype.getListItemByIndex = /** * @param {?} index * @return {?} */ function (index) { return this.items ? this.items.toArray()[index] : undefined; }; /** * @param {?} value * @return {?} */ MdcList.prototype.getListItemIndexByValue = /** * @param {?} value * @return {?} */ function (value) { return this.items ? this.items.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.value === value; })) : -1; }; /** * @param {?} index * @return {?} */ MdcList.prototype.focusItemAtIndex = /** * @param {?} index * @return {?} */ function (index) { this.items.toArray()[index].getListItemElement().focus(); }; /** * @return {?} */ MdcList.prototype.focusFirstElement = /** * @return {?} */ function () { return this._foundation.focusFirstElement(); }; /** * @return {?} */ MdcList.prototype.focusLastElement = /** * @return {?} */ function () { return this._foundation.focusLastElement(); }; /** * @param {?} index * @return {?} */ MdcList.prototype.focusNextElement = /** * @param {?} index * @return {?} */ function (index) { return this._foundation.focusNextElement(index); }; /** * @param {?} index * @return {?} */ MdcList.prototype.focusPrevElement = /** * @param {?} index * @return {?} */ function (index) { return this._foundation.focusPrevElement(index); }; /** * @param {?} role * @return {?} */ MdcList.prototype.setRole = /** * @param {?} role * @return {?} */ function (role) { this._getHostElement().setAttribute('role', role); }; /** * @return {?} */ MdcList.prototype.reset = /** * @return {?} */ function () { this.items.forEach((/** * @param {?} _ * @return {?} */ function (_) { _.selected = false; _.activated = false; })); }; /** * @private * @param {?} item * @return {?} */ MdcList.prototype._applySelectionState = /** * @private * @param {?} item * @return {?} */ function (item) { if (this.useActivatedClass) { item.activated = true; } else if (this.useSelectedClass) { item.selected = true; } }; /** * @private * @return {?} */ MdcList.prototype._resetListItems = /** * @private * @return {?} */ function () { this._dropSubscriptions(); this._listenForListItemSelection(); }; /** * @private * @return {?} */ MdcList.prototype._dropSubscriptions = /** * @private * @return {?} */ function () { if (this.itemSelectionSubscription) { this.itemSelectionSubscription.unsubscribe(); this.itemSelectionSubscription = null; } }; /** Listens to selected events on each list item. */ /** * Listens to selected events on each list item. * @private * @return {?} */ MdcList.prototype._listenForListItemSelection = /** * Listens to selected events on each list item. * @private * @return {?} */ function () { var _this = this; this.itemSelectionSubscription = this.listItemSelections.subscribe((/** * @param {?} event * @return {?} */ function (event) { if (_this.singleSelection) { _this.items.filter((/** * @param {?} _ * @return {?} */ function (_) { return _.id !== event.source.id && (_.activated || _.selected); })) .forEach((/** * @param {?} _ * @return {?} */ function (_) { _.selected = false; _.activated = false; })); } _this._applySelectionState(event.source); if (!_this.singleSelection) { event.source.ripple.handleBlur(); } _this.selectionChange.emit(new MdcListItemChange(_this, event.source)); })); }; /** * @param {?} evt * @return {?} */ MdcList.prototype._onFocusIn = /** * @param {?} evt * @return {?} */ function (evt) { /** @type {?} */ var index = this._getListItemIndexByEvent(evt); this._foundation.handleFocusIn(evt, index); }; /** * @param {?} evt * @return {?} */ MdcList.prototype._onFocusOut = /** * @param {?} evt * @return {?} */ function (evt) { /** @type {?} */ var index = this._getListItemIndexByEvent(evt); if (index >= 0) { this._foundation.handleFocusOut(evt, index); } }; /** * @param {?} evt * @return {?} */ MdcList.prototype._onKeydown = /** * @param {?} evt * @return {?} */ function (evt) { /** @type {?} */ var index = this._getListItemIndexByEvent(evt); if (index >= 0) { this._foundation.handleKeydown(evt, ((/** @type {?} */ (evt.target))).classList.contains(cssClasses.LIST_ITEM_CLASS), index); } }; /** * @param {?} evt * @return {?} */ MdcList.prototype._handleClickEvent = /** * @param {?} evt * @return {?} */ function (evt) { /** @type {?} */ var index = this._getListItemIndexByEvent(evt); /** @type {?} */ var target = (/** @type {?} */ (evt.target)); /** @type {?} */ var listItem = this._getListItemByEventTarget((/** @type {?} */ (evt.target))); if (listItem && listItem.disabled) { return; } // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events. /** @type {?} */ var toggleCheckbox = !matches(target, strings.CHECKBOX_RADIO_SELECTOR); this._foundation.handleClick(index, toggleCheckbox); }; /** * @private * @param {?} target * @return {?} */ MdcList.prototype._getListItemByEventTarget = /** * @private * @param {?} target * @return {?} */ function (target) { return this.items.toArray().find((/** * @param {?} _ * @return {?} */ function (_) { return _.getListItemElement() === target; })); }; /** * @private * @param {?} evt * @return {?} */ MdcList.prototype._getListItemIndexByEvent = /** * @private * @param {?} evt * @return {?} */ function (evt) { return this.items.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.getListItemElement() === evt.target; })); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcList.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcList.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{selector: 'mdc-list', exportAs: 'mdcList', host: { 'role': 'list', 'class': 'mdc-list', '[attr.aria-orientation]': 'verticalOrientation ? "vertical" : "horizontal"', '[class.mdc-list--dense]': 'dense', '[class.mdc-list--avatar-list]': 'avatar', '[class.ngx-mdc-list--border]': 'border', '[class.mdc-list--non-interactive]': '!interactive', '[class.mdc-list--two-line]': 'twoLine', '(click)': '_handleClickEvent($event)', '(keydown)': '_onKeydown($event)', '(focusin)': '_onFocusIn($event)', '(focusout)': '_onFocusOut($event)' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"].OnPush, providers: [{ provide: MDC_LIST_PARENT_COMPONENT, useExisting: MdcList }] },] }, ]; /** @nocollapse */ MdcList.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; MdcList.propDecorators = { twoLine: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], dense: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], border: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], avatar: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], interactive: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], disableRipple: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], singleSelection: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], useActivatedClass: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], useSelectedClass: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], verticalOrientation: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], wrapFocus: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], items: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ContentChildren"], args: [MdcListItem, { descendants: true },] }], selectionChange: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"] }], actionEvent: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"] }] }; return MdcList; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcListDivider = /** @class */ (function () { function MdcListDivider(elementRef) { this.elementRef = elementRef; this._inset = false; this._padded = false; } Object.defineProperty(MdcListDivider.prototype, "inset", { get: /** * @return {?} */ function () { return this._inset; }, set: /** * @param {?} value * @return {?} */ function (value) { this._inset = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcListDivider.prototype, "padded", { get: /** * @return {?} */ function () { return this._padded; }, set: /** * @param {?} value * @return {?} */ function (value) { this._padded = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); MdcListDivider.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{selector: '[mdcListDivider], mdc-list-divider', exportAs: 'mdcListDivider', host: { 'role': 'separator', 'class': 'mdc-list-divider', '[class.mdc-list-divider--inset]': 'inset', '[class.mdc-list-divider--padded]': 'padded' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcListDivider.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] } ]; }; MdcListDivider.propDecorators = { inset: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], padded: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }] }; return MdcListDivider; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var LIST_DECLARATIONS = [ MdcList, MdcListDivider, MdcListGroup, MdcListGroupSubheader, MdcListItem, MdcListItemGraphic, MdcListItemMeta, MdcListItemSecondary, MdcListItemText ]; var MdcListModule = /** @class */ (function () { function MdcListModule() { } MdcListModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"], args: [{ imports: [_angular_common__WEBPACK_IMPORTED_MODULE_7__["CommonModule"]], exports: LIST_DECLARATIONS, declarations: LIST_DECLARATIONS, },] }, ]; return MdcListModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=list.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/menu-surface.es5.js": /*!****************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/menu-surface.es5.js ***! \****************************************************************/ /*! exports provided: MdcMenuSurface, MdcMenuSurfaceAnchor, MdcMenuSurfaceBase, MdcMenuSurfaceModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSurface", function() { return MdcMenuSurface; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSurfaceAnchor", function() { return MdcMenuSurfaceAnchor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSurfaceBase", function() { return MdcMenuSurfaceBase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSurfaceModule", function() { return MdcMenuSurfaceModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cachedCssTransformPropertyName_; /** * Returns the name of the correct transform property to use on the current browser. */ function getTransformPropertyName(globalObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } if (cachedCssTransformPropertyName_ === undefined || forceRefresh) { var el = globalObj.document.createElement('div'); cachedCssTransformPropertyName_ = 'transform' in el.style ? 'transform' : 'webkitTransform'; } return cachedCssTransformPropertyName_; } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { ANCHOR: 'mdc-menu-surface--anchor', ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed', ANIMATING_OPEN: 'mdc-menu-surface--animating-open', FIXED: 'mdc-menu-surface--fixed', OPEN: 'mdc-menu-surface--open', ROOT: 'mdc-menu-surface' }; // tslint:disable:object-literal-sort-keys var strings = { CLOSED_EVENT: 'MDCMenuSurface:closed', OPENED_EVENT: 'MDCMenuSurface:opened', 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(', ') }; // tslint:enable:object-literal-sort-keys var numbers = { /** Total duration of menu-surface open animation. */ TRANSITION_OPEN_DURATION: 120, /** Total duration of menu-surface close animation. */ TRANSITION_CLOSE_DURATION: 75, /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */ MARGIN_TO_EDGE: 32, /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */ ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67 }; /** * Enum for bits in the {@see Corner) bitmap. */ var CornerBit; (function (CornerBit) { CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM"; CornerBit[CornerBit["CENTER"] = 2] = "CENTER"; CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT"; CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL"; })(CornerBit || (CornerBit = {})); /** * Enum for representing an element corner for positioning the menu-surface. * * The START constants map to LEFT if element directionality is left * to right and RIGHT if the directionality is right to left. * Likewise END maps to RIGHT or LEFT depending on the directionality. */ var Corner; (function (Corner) { Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT"; Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT"; Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT"; Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT"; Corner[Corner["TOP_START"] = 8] = "TOP_START"; Corner[Corner["TOP_END"] = 12] = "TOP_END"; Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START"; Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END"; })(Corner || (Corner = {})); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenuSurfaceFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCMenuSurfaceFoundation, _super); function MDCMenuSurfaceFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, MDCMenuSurfaceFoundation.defaultAdapter, adapter)) || this; _this.isOpen_ = false; _this.isQuickOpen_ = false; _this.isHoistedElement_ = false; _this.isFixedPosition_ = false; _this.openAnimationEndTimerId_ = 0; _this.closeAnimationEndTimerId_ = 0; _this.animationRequestId_ = 0; _this.anchorCorner_ = Corner.TOP_START; _this.anchorMargin_ = { top: 0, right: 0, bottom: 0, left: 0 }; _this.position_ = { x: 0, y: 0 }; return _this; } Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", { get: function get() { return Corner; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", { /** * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, hasAnchor: function hasAnchor() { return false; }, isElementInContainer: function isElementInContainer() { return false; }, isFocused: function isFocused() { return false; }, isFirstElementFocused: function isFirstElementFocused() { return false; }, isLastElementFocused: function isLastElementFocused() { return false; }, isRtl: function isRtl() { return false; }, getInnerDimensions: function getInnerDimensions() { return { height: 0, width: 0 }; }, getAnchorDimensions: function getAnchorDimensions() { return null; }, getWindowDimensions: function getWindowDimensions() { return { height: 0, width: 0 }; }, getBodyDimensions: function getBodyDimensions() { return { height: 0, width: 0 }; }, getWindowScroll: function getWindowScroll() { return { x: 0, y: 0 }; }, setPosition: function setPosition() { return undefined; }, setMaxHeight: function setMaxHeight() { return undefined; }, setTransformOrigin: function setTransformOrigin() { return undefined; }, saveFocus: function saveFocus() { return undefined; }, restoreFocus: function restoreFocus() { return undefined; }, focusFirstElement: function focusFirstElement() { return undefined; }, focusLastElement: function focusLastElement() { return undefined; }, notifyClose: function notifyClose() { return undefined; }, notifyOpen: function notifyOpen() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCMenuSurfaceFoundation.prototype.init = function () { var _a = MDCMenuSurfaceFoundation.cssClasses, ROOT = _a.ROOT, OPEN = _a.OPEN; if (!this.adapter_.hasClass(ROOT)) { throw new Error(ROOT + " class required in root element."); } if (this.adapter_.hasClass(OPEN)) { this.isOpen_ = true; } }; MDCMenuSurfaceFoundation.prototype.destroy = function () { clearTimeout(this.openAnimationEndTimerId_); clearTimeout(this.closeAnimationEndTimerId_); // Cancel any currently running animations. cancelAnimationFrame(this.animationRequestId_); }; /** * @param corner Default anchor corner alignment of top-left menu surface corner. */ MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) { this.anchorCorner_ = corner; }; /** * @param margin Set of margin values from anchor. */ MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) { this.anchorMargin_.top = margin.top || 0; this.anchorMargin_.right = margin.right || 0; this.anchorMargin_.bottom = margin.bottom || 0; this.anchorMargin_.left = margin.left || 0; }; /** Used to indicate if the menu-surface is hoisted to the body. */ MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) { this.isHoistedElement_ = isHoisted; }; /** Used to set the menu-surface calculations based on a fixed position menu. */ MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) { this.isFixedPosition_ = isFixedPosition; }; /** Sets the menu-surface position on the page. */ MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) { this.position_.x = this.isFinite_(x) ? x : 0; this.position_.y = this.isFinite_(y) ? y : 0; }; MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) { this.isQuickOpen_ = quickOpen; }; MDCMenuSurfaceFoundation.prototype.isOpen = function () { return this.isOpen_; }; /** * Open the menu surface. */ MDCMenuSurfaceFoundation.prototype.open = function () { var _this = this; this.adapter_.saveFocus(); if (!this.isQuickOpen_) { this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); } this.animationRequestId_ = requestAnimationFrame(function () { _this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); _this.dimensions_ = _this.adapter_.getInnerDimensions(); _this.autoPosition_(); if (_this.isQuickOpen_) { _this.adapter_.notifyOpen(); } else { _this.openAnimationEndTimerId_ = setTimeout(function () { _this.openAnimationEndTimerId_ = 0; _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); _this.adapter_.notifyOpen(); }, numbers.TRANSITION_OPEN_DURATION); } }); this.isOpen_ = true; }; /** * Closes the menu surface. */ MDCMenuSurfaceFoundation.prototype.close = function () { var _this = this; if (!this.isQuickOpen_) { this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); } requestAnimationFrame(function () { _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); if (_this.isQuickOpen_) { _this.adapter_.notifyClose(); } else { _this.closeAnimationEndTimerId_ = setTimeout(function () { _this.closeAnimationEndTimerId_ = 0; _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); _this.adapter_.notifyClose(); }, numbers.TRANSITION_CLOSE_DURATION); } }); this.isOpen_ = false; this.maybeRestoreFocus_(); }; /** Handle clicks and close if not within menu-surface element. */ MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) { var el = evt.target; if (this.adapter_.isElementInContainer(el)) { return; } this.close(); }; /** Handle keys that close the surface. */ MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) { var keyCode = evt.keyCode, key = evt.key, shiftKey = evt.shiftKey; var isEscape = key === 'Escape' || keyCode === 27; var isTab = key === 'Tab' || keyCode === 9; if (isEscape) { this.close(); } else if (isTab) { if (this.adapter_.isLastElementFocused() && !shiftKey) { this.adapter_.focusFirstElement(); evt.preventDefault(); } else if (this.adapter_.isFirstElementFocused() && shiftKey) { this.adapter_.focusLastElement(); evt.preventDefault(); } } }; MDCMenuSurfaceFoundation.prototype.autoPosition_ = function () { var _a; // Compute measurements for autoposition methods reuse. this.measurements_ = this.getAutoLayoutMeasurements_(); var corner = this.getOriginCorner_(); var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight_(corner); var verticalAlignment = this.hasBit_(corner, CornerBit.BOTTOM) ? 'bottom' : 'top'; var horizontalAlignment = this.hasBit_(corner, CornerBit.RIGHT) ? 'right' : 'left'; var horizontalOffset = this.getHorizontalOriginOffset_(corner); var verticalOffset = this.getVerticalOriginOffset_(corner); var _b = this.measurements_, anchorSize = _b.anchorSize, surfaceSize = _b.surfaceSize; var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a); // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner. if (anchorSize.width / surfaceSize.width > numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) { horizontalAlignment = 'center'; } // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element if (this.isHoistedElement_ || this.isFixedPosition_) { this.adjustPositionForHoistedElement_(position); } this.adapter_.setTransformOrigin(horizontalAlignment + " " + verticalAlignment); this.adapter_.setPosition(position); this.adapter_.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : ''); }; /** * @return Measurements used to position menu surface popup. */ MDCMenuSurfaceFoundation.prototype.getAutoLayoutMeasurements_ = function () { var anchorRect = this.adapter_.getAnchorDimensions(); var bodySize = this.adapter_.getBodyDimensions(); var viewportSize = this.adapter_.getWindowDimensions(); var windowScroll = this.adapter_.getWindowScroll(); if (!anchorRect) { // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together anchorRect = { top: this.position_.y, right: this.position_.x, bottom: this.position_.y, left: this.position_.x, width: 0, height: 0 }; // tslint:enable:object-literal-sort-keys } return { anchorSize: anchorRect, bodySize: bodySize, surfaceSize: this.dimensions_, viewportDistance: { // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together top: anchorRect.top, right: viewportSize.width - anchorRect.right, bottom: viewportSize.height - anchorRect.bottom, left: anchorRect.left }, viewportSize: viewportSize, windowScroll: windowScroll }; }; /** * Computes the corner of the anchor from which to animate and position the menu surface. */ MDCMenuSurfaceFoundation.prototype.getOriginCorner_ = function () { // Defaults: open from the top left. var corner = Corner.TOP_LEFT; var _a = this.measurements_, viewportDistance = _a.viewportDistance, anchorSize = _a.anchorSize, surfaceSize = _a.surfaceSize; var isBottomAligned = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var availableTop = isBottomAligned ? viewportDistance.top + anchorSize.height + this.anchorMargin_.bottom : viewportDistance.top + this.anchorMargin_.top; var availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom : viewportDistance.bottom + anchorSize.height - this.anchorMargin_.top; var topOverflow = surfaceSize.height - availableTop; var bottomOverflow = surfaceSize.height - availableBottom; if (bottomOverflow > 0 && topOverflow < bottomOverflow) { corner = this.setBit_(corner, CornerBit.BOTTOM); } var isRtl = this.adapter_.isRtl(); var isFlipRtl = this.hasBit_(this.anchorCorner_, CornerBit.FLIP_RTL); var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.RIGHT); var isAlignedRight = avoidHorizontalOverlap && !isRtl || !avoidHorizontalOverlap && isFlipRtl && isRtl; var availableLeft = isAlignedRight ? viewportDistance.left + anchorSize.width + this.anchorMargin_.right : viewportDistance.left + this.anchorMargin_.left; var availableRight = isAlignedRight ? viewportDistance.right - this.anchorMargin_.right : viewportDistance.right + anchorSize.width - this.anchorMargin_.left; var leftOverflow = surfaceSize.width - availableLeft; var rightOverflow = surfaceSize.width - availableRight; if (leftOverflow < 0 && isAlignedRight && isRtl || avoidHorizontalOverlap && !isAlignedRight && leftOverflow < 0 || rightOverflow > 0 && leftOverflow < rightOverflow) { corner = this.setBit_(corner, CornerBit.RIGHT); } return corner; }; /** * @param corner Origin corner of the menu surface. * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set. */ MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight_ = function (corner) { var viewportDistance = this.measurements_.viewportDistance; var maxHeight = 0; var isBottomAligned = this.hasBit_(corner, CornerBit.BOTTOM); var isBottomAnchored = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE; // When maximum height is not specified, it is handled from CSS. if (isBottomAligned) { maxHeight = viewportDistance.top + this.anchorMargin_.top - MARGIN_TO_EDGE; if (!isBottomAnchored) { maxHeight += this.measurements_.anchorSize.height; } } else { maxHeight = viewportDistance.bottom - this.anchorMargin_.bottom + this.measurements_.anchorSize.height - MARGIN_TO_EDGE; if (isBottomAnchored) { maxHeight -= this.measurements_.anchorSize.height; } } return maxHeight; }; /** * @param corner Origin corner of the menu surface. * @return Horizontal offset of menu surface origin corner from corresponding anchor corner. */ MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset_ = function (corner) { var anchorSize = this.measurements_.anchorSize; // isRightAligned corresponds to using the 'right' property on the surface. var isRightAligned = this.hasBit_(corner, CornerBit.RIGHT); var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.RIGHT); if (isRightAligned) { var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.left : this.anchorMargin_.right; // For hoisted or fixed elements, adjust the offset by the difference between viewport width and body width so // when we calculate the right value (`adjustPositionForHoistedElement_`) based on the element position, // the right property is correct. if (this.isHoistedElement_ || this.isFixedPosition_) { return rightOffset - (this.measurements_.viewportSize.width - this.measurements_.bodySize.width); } return rightOffset; } return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.right : this.anchorMargin_.left; }; /** * @param corner Origin corner of the menu surface. * @return Vertical offset of menu surface origin corner from corresponding anchor corner. */ MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset_ = function (corner) { var anchorSize = this.measurements_.anchorSize; var isBottomAligned = this.hasBit_(corner, CornerBit.BOTTOM); var avoidVerticalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var y = 0; if (isBottomAligned) { y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin_.top : -this.anchorMargin_.bottom; } else { y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin_.bottom : this.anchorMargin_.top; } return y; }; /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */ MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement_ = function (position) { var e_1, _a; var _b = this.measurements_, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance; var props = Object.keys(position); try { for (var props_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__values"])(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) { var prop = props_1_1.value; var value = position[prop] || 0; // Hoisted surfaces need to have the anchor elements location on the page added to the // position properties for proper alignment on the body. value += viewportDistance[prop]; // Surfaces that are absolutely positioned need to have additional calculations for scroll // and bottom positioning. if (!this.isFixedPosition_) { if (prop === 'top') { value += windowScroll.y; } else if (prop === 'bottom') { value -= windowScroll.y; } else if (prop === 'left') { value += windowScroll.x; } else { // prop === 'right' value -= windowScroll.x; } } position[prop] = value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1); } finally { if (e_1) throw e_1.error; } } }; /** * The last focused element when the menu surface was opened should regain focus, if the user is * focused on or within the menu surface when it is closed. */ MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus_ = function () { var isRootFocused = this.adapter_.isFocused(); var childHasFocus = document.activeElement && this.adapter_.isElementInContainer(document.activeElement); if (isRootFocused || childHasFocus) { this.adapter_.restoreFocus(); } }; MDCMenuSurfaceFoundation.prototype.hasBit_ = function (corner, bit) { return Boolean(corner & bit); // tslint:disable-line:no-bitwise }; MDCMenuSurfaceFoundation.prototype.setBit_ = function (corner, bit) { return corner | bit; // tslint:disable-line:no-bitwise }; /** * isFinite that doesn't force conversion to number type. * Equivalent to Number.isFinite in ES2015, which is not supported in IE. */ MDCMenuSurfaceFoundation.prototype.isFinite_ = function (num) { return typeof num === 'number' && isFinite(num); }; return MDCMenuSurfaceFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenuSurface = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCMenuSurface, _super); function MDCMenuSurface() { return _super !== null && _super.apply(this, arguments) || this; } MDCMenuSurface.attachTo = function (root) { return new MDCMenuSurface(root); }; MDCMenuSurface.prototype.initialSyncWithDOM = function () { var _this = this; var parentEl = this.root_.parentElement; this.anchorElement = parentEl && parentEl.classList.contains(cssClasses.ANCHOR) ? parentEl : null; if (this.root_.classList.contains(cssClasses.FIXED)) { this.setFixedPosition(true); } this.handleKeydown_ = function (evt) { return _this.foundation_.handleKeydown(evt); }; this.handleBodyClick_ = function (evt) { return _this.foundation_.handleBodyClick(evt); }; this.registerBodyClickListener_ = function () { return document.body.addEventListener('click', _this.handleBodyClick_); }; this.deregisterBodyClickListener_ = function () { return document.body.removeEventListener('click', _this.handleBodyClick_); }; this.listen('keydown', this.handleKeydown_); this.listen(strings.OPENED_EVENT, this.registerBodyClickListener_); this.listen(strings.CLOSED_EVENT, this.deregisterBodyClickListener_); }; MDCMenuSurface.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten(strings.OPENED_EVENT, this.registerBodyClickListener_); this.unlisten(strings.CLOSED_EVENT, this.deregisterBodyClickListener_); _super.prototype.destroy.call(this); }; Object.defineProperty(MDCMenuSurface.prototype, "open", { get: function get() { return this.foundation_.isOpen(); }, set: function set(value) { if (value) { var focusableElements = this.root_.querySelectorAll(strings.FOCUSABLE_ELEMENTS); this.firstFocusableElement_ = focusableElements[0]; this.lastFocusableElement_ = focusableElements[focusableElements.length - 1]; this.foundation_.open(); } else { this.foundation_.close(); } }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", { set: function set(quickOpen) { this.foundation_.setQuickOpen(quickOpen); }, enumerable: true, configurable: true }); /** * Removes the menu-surface from it's current location and appends it to the * body to overcome any overflow:hidden issues. */ MDCMenuSurface.prototype.hoistMenuToBody = function () { document.body.appendChild(this.root_); this.setIsHoisted(true); }; /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) { this.foundation_.setIsHoisted(isHoisted); }; /** Sets the element that the menu-surface is anchored to. */ MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) { this.anchorElement = element; }; /** Sets the menu-surface to position: fixed. */ MDCMenuSurface.prototype.setFixedPosition = function (isFixed) { if (isFixed) { this.root_.classList.add(cssClasses.FIXED); } else { this.root_.classList.remove(cssClasses.FIXED); } this.foundation_.setFixedPosition(isFixed); }; /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */ MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) { this.foundation_.setAbsolutePosition(x, y); this.setIsHoisted(true); }; /** * @param corner Default anchor corner alignment of top-left surface corner. */ MDCMenuSurface.prototype.setAnchorCorner = function (corner) { this.foundation_.setAnchorCorner(corner); }; MDCMenuSurface.prototype.setAnchorMargin = function (margin) { this.foundation_.setAnchorMargin(margin); }; MDCMenuSurface.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, hasAnchor: function hasAnchor() { return !!_this.anchorElement; }, notifyClose: function notifyClose() { return _this.emit(MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {}); }, notifyOpen: function notifyOpen() { return _this.emit(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {}); }, isElementInContainer: function isElementInContainer(el) { return _this.root_.contains(el); }, isRtl: function isRtl() { return getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl'; }, setTransformOrigin: function setTransformOrigin(origin) { var propertyName = getTransformPropertyName(window) + "-origin"; _this.root_.style.setProperty(propertyName, origin); }, isFocused: function isFocused() { return document.activeElement === _this.root_; }, saveFocus: function saveFocus() { _this.previousFocus_ = document.activeElement; }, restoreFocus: function restoreFocus() { if (_this.root_.contains(document.activeElement)) { if (_this.previousFocus_ && _this.previousFocus_.focus) { _this.previousFocus_.focus(); } } }, isFirstElementFocused: function isFirstElementFocused() { return _this.firstFocusableElement_ ? _this.firstFocusableElement_ === document.activeElement : false; }, isLastElementFocused: function isLastElementFocused() { return _this.lastFocusableElement_ ? _this.lastFocusableElement_ === document.activeElement : false; }, focusFirstElement: function focusFirstElement() { return _this.firstFocusableElement_ && _this.firstFocusableElement_.focus && _this.firstFocusableElement_.focus(); }, focusLastElement: function focusLastElement() { return _this.lastFocusableElement_ && _this.lastFocusableElement_.focus && _this.lastFocusableElement_.focus(); }, getInnerDimensions: function getInnerDimensions() { return { width: _this.root_.offsetWidth, height: _this.root_.offsetHeight }; }, getAnchorDimensions: function getAnchorDimensions() { return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null; }, getWindowDimensions: function getWindowDimensions() { return { width: window.innerWidth, height: window.innerHeight }; }, getBodyDimensions: function getBodyDimensions() { return { width: document.body.clientWidth, height: document.body.clientHeight }; }, getWindowScroll: function getWindowScroll() { return { x: window.pageXOffset, y: window.pageYOffset }; }, setPosition: function setPosition(position) { _this.root_.style.left = 'left' in position ? position.left + "px" : ''; _this.root_.style.right = 'right' in position ? position.right + "px" : ''; _this.root_.style.top = 'top' in position ? position.top + "px" : ''; _this.root_.style.bottom = 'bottom' in position ? position.bottom + "px" : ''; }, setMaxHeight: function setMaxHeight(height) { _this.root_.style.maxHeight = height; } }; // tslint:enable:object-literal-sort-keys return new MDCMenuSurfaceFoundation(adapter); }; return MDCMenuSurface; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var ANCHOR_CORNER_MAP = { topEnd: Corner.TOP_END, topStart: Corner.TOP_START, bottomEnd: Corner.BOTTOM_END, bottomStart: Corner.BOTTOM_START }; /** * @abstract */ var MdcMenuSurfaceBase = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MdcMenuSurfaceBase, _super); function MdcMenuSurfaceBase(changeDetectorRef, platform, _ngZone, elementRef) { var _this = _super.call(this, elementRef) || this; _this.changeDetectorRef = changeDetectorRef; _this.platform = platform; _this._ngZone = _ngZone; _this.elementRef = elementRef; /** * Emits whenever the component is destroyed. */ _this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); _this._previousFocus = null; _this._firstFocusableElement = null; _this._lastFocusableElement = null; _this._open = false; _this._anchorElement = null; _this._anchorCorner = 'topStart'; _this._quickOpen = false; _this._fixed = false; _this._coordinates = { x: 0, y: 0 }; _this._anchorMargin = {}; _this._hoistToBody = false; /** * Emits an event whenever the menu surface is opened. */ _this.opened = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Emits an event whenever the menu surface is closed. */ _this.closed = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Subscription to interaction events in menu-surface. */ _this._windowClickSubscription = null; return _this; } Object.defineProperty(MdcMenuSurfaceBase.prototype, "open", { get: /** * @return {?} */ function () { return this._open; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (newValue !== this._open) { this._open = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); this.setOpen(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcMenuSurfaceBase.prototype, "anchorElement", { get: /** * @return {?} */ function () { return this._anchorElement; }, set: /** * @param {?} element * @return {?} */ function (element) { this._anchorElement = element; }, enumerable: true, configurable: true }); Object.defineProperty(MdcMenuSurfaceBase.prototype, "anchorCorner", { get: /** * @return {?} */ function () { return this._anchorCorner; }, set: /** * @param {?} value * @return {?} */ function (value) { this._anchorCorner = value || 'topStart'; this._foundation.setAnchorCorner(ANCHOR_CORNER_MAP[this._anchorCorner]); }, enumerable: true, configurable: true }); Object.defineProperty(MdcMenuSurfaceBase.prototype, "quickOpen", { get: /** * @return {?} */ function () { return this._quickOpen; }, set: /** * @param {?} value * @return {?} */ function (value) { this._quickOpen = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); this._foundation.setQuickOpen(this._quickOpen); }, enumerable: true, configurable: true }); Object.defineProperty(MdcMenuSurfaceBase.prototype, "fixed", { get: /** * @return {?} */ function () { return this._fixed; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fixed = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); this._fixed ? this._getHostElement().classList.add('mdc-menu-surface--fixed') : this._getHostElement().classList.remove('mdc-menu-surface--fixed'); this._foundation.setFixedPosition(this._fixed); }, enumerable: true, configurable: true }); Object.defineProperty(MdcMenuSurfaceBase.prototype, "coordinates", { get: /** * @return {?} */ function () { return this._coordinates; }, set: /** * @param {?} value * @return {?} */ function (value) { this._coordinates = value; this._foundation.setAbsolutePosition(value.x, value.y); }, enumerable: true, configurable: true }); Object.defineProperty(MdcMenuSurfaceBase.prototype, "anchorMargin", { get: /** * @return {?} */ function () { return this._anchorMargin; }, set: /** * @param {?} value * @return {?} */ function (value) { this._anchorMargin = value; this._foundation.setAnchorMargin(this._anchorMargin); }, enumerable: true, configurable: true }); Object.defineProperty(MdcMenuSurfaceBase.prototype, "hoistToBody", { get: /** * @return {?} */ function () { return this._hoistToBody; }, set: /** * @param {?} value * @return {?} */ function (value) { this._hoistToBody = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (this._hoistToBody) { this.setHoistToBody(); } }, enumerable: true, configurable: true }); /** * @return {?} */ MdcMenuSurfaceBase.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), hasAnchor: (/** * @return {?} */ function () { return !!_this.anchorElement; }), notifyClose: (/** * @return {?} */ function () { _this.closed.emit(); _this._deregisterWindowClickListener(); }), notifyOpen: (/** * @return {?} */ function () { _this.opened.emit(); _this._registerWindowClickListener(); }), isElementInContainer: (/** * @param {?} el * @return {?} */ function (el) { return _this._getHostElement() === el || _this._getHostElement().contains(el); }), isRtl: (/** * @return {?} */ function () { if (!_this.platform.isBrowser) { return false; } return window.getComputedStyle(_this._getHostElement()).getPropertyValue('direction') === 'rtl'; }), setTransformOrigin: (/** * @param {?} origin * @return {?} */ function (origin) { if (!_this.platform.isBrowser) { return; } _this._getHostElement().style[(/** @type {?} */ (getTransformPropertyName(window) + "-origin"))] = origin; }), isFocused: (/** * @return {?} */ function () { return _this.platform.isBrowser ? (/** @type {?} */ (document.activeElement)) === _this._getHostElement() : false; }), saveFocus: (/** * @return {?} */ function () { if (!_this.platform.isBrowser) { return; } _this._previousFocus = (/** @type {?} */ (document.activeElement)); }), restoreFocus: (/** * @return {?} */ function () { if (!_this.platform.isBrowser) { return; } if (_this._getHostElement().contains((/** @type {?} */ (document.activeElement)))) { if (_this._previousFocus && ((/** @type {?} */ (_this._previousFocus))).focus) { ((/** @type {?} */ (_this._previousFocus))).focus(); } } }), isFirstElementFocused: (/** * @return {?} */ function () { if (!_this.platform.isBrowser) { return false; } return _this._firstFocusableElement ? _this._firstFocusableElement === document.activeElement : false; }), isLastElementFocused: (/** * @return {?} */ function () { if (!_this.platform.isBrowser) { return false; } return _this._lastFocusableElement ? _this._lastFocusableElement === document.activeElement : false; }), focusFirstElement: (/** * @return {?} */ function () { if (!_this.platform.isBrowser) { return; } if (_this._firstFocusableElement) { ((/** @type {?} */ (_this._firstFocusableElement))).focus(); } }), focusLastElement: (/** * @return {?} */ function () { if (!_this.platform.isBrowser) { return; } if (_this._lastFocusableElement) { ((/** @type {?} */ (_this._lastFocusableElement))).focus(); } }), getInnerDimensions: (/** * @return {?} */ function () { return { width: _this._getHostElement().offsetWidth, height: _this._getHostElement().offsetHeight }; }), getAnchorDimensions: (/** * @return {?} */ function () { if (!_this.platform.isBrowser || !_this.anchorElement) { return null; } return (/** @type {?} */ (_this._anchorElement)).getBoundingClientRect(); }), getWindowDimensions: (/** * @return {?} */ function () { return { width: _this.platform.isBrowser ? window.innerWidth : 0, height: _this.platform.isBrowser ? window.innerHeight : 0 }; }), getBodyDimensions: (/** * @return {?} */ function () { return { width: _this.platform.isBrowser ? (/** @type {?} */ (document.body)).clientWidth : 0, height: _this.platform.isBrowser ? (/** @type {?} */ (document.body)).clientHeight : 0 }; }), getWindowScroll: (/** * @return {?} */ function () { return { x: _this.platform.isBrowser ? window.pageXOffset : 0, y: _this.platform.isBrowser ? window.pageYOffset : 0 }; }), setPosition: (/** * @param {?} position * @return {?} */ function (position) { _this._getHostElement().style.left = 'left' in position ? position.left + "px" : ''; _this._getHostElement().style.right = 'right' in position ? position.right + "px" : ''; _this._getHostElement().style.top = 'top' in position ? position.top + "px" : ''; _this._getHostElement().style.bottom = 'bottom' in position ? position.bottom + "px" : ''; }), setMaxHeight: (/** * @param {?} height * @return {?} */ function (height) { return _this._getHostElement().style.maxHeight = height; }) }; return new MDCMenuSurfaceFoundation(adapter); }; /** * @protected * @return {?} */ MdcMenuSurfaceBase.prototype.initMenuSurface = /** * @protected * @return {?} */ function () { this._foundation.init(); this._registerKeydownListener(); }; /** * @protected * @return {?} */ MdcMenuSurfaceBase.prototype.destroyMenuSurface = /** * @protected * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); this._deregisterWindowClickListener(); // add platform check due to use of cancelAnimationFrame inside destroy() if (this.platform.isBrowser) { this._foundation.destroy(); } if (this.hoistToBody) { (/** @type {?} */ (document.body)).removeChild(this._getHostElement()); } }; /** * @protected * @return {?} */ MdcMenuSurfaceBase.prototype.setOpen = /** * @protected * @return {?} */ function () { if (this._open) { /** @type {?} */ var focusableElements = this._getHostElement().querySelectorAll(strings.FOCUSABLE_ELEMENTS); this._firstFocusableElement = focusableElements.length > 0 ? focusableElements[0] : null; this._lastFocusableElement = focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : null; this._foundation.open(); } else { this._foundation.close(); } }; /** * Removes the menu-surface from it's current location and appends it to the * body to overcome any overflow:hidden issues. */ /** * Removes the menu-surface from it's current location and appends it to the * body to overcome any overflow:hidden issues. * @protected * @return {?} */ MdcMenuSurfaceBase.prototype.setHoistToBody = /** * Removes the menu-surface from it's current location and appends it to the * body to overcome any overflow:hidden issues. * @protected * @return {?} */ function () { if (!this.platform.isBrowser) { return; } /** @type {?} */ var parentEl = this._getHostElement().parentElement; if (parentEl) { (/** @type {?} */ (document.body)).appendChild(parentEl.removeChild(this._getHostElement())); this._foundation.setIsHoisted(true); } }; /** * @private * @return {?} */ MdcMenuSurfaceBase.prototype._registerKeydownListener = /** * @private * @return {?} */ function () { var _this = this; this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["fromEvent"])(_this._getHostElement(), 'keydown').pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(_this._destroy)) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleKeydown(evt); })); })); })); }; /** * @private * @return {?} */ MdcMenuSurfaceBase.prototype._registerWindowClickListener = /** * @private * @return {?} */ function () { var _this = this; if (!this.platform.isBrowser) { return; } this._windowClickSubscription = this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["fromEvent"])(window, 'click') .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._ngZone.run((/** * @return {?} */ function () { _this._foundation.handleBodyClick(evt); _this._open = _this._foundation.isOpen(); })); })); })); }; /** * @private * @return {?} */ MdcMenuSurfaceBase.prototype._deregisterWindowClickListener = /** * @private * @return {?} */ function () { if (this._windowClickSubscription) { this._windowClickSubscription.unsubscribe(); } }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @protected * @return {?} */ MdcMenuSurfaceBase.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @protected * @return {?} */ function () { return this.elementRef.nativeElement; }; /** @nocollapse */ MdcMenuSurfaceBase.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcMenuSurfaceBase.propDecorators = { open: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], anchorElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], anchorCorner: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], quickOpen: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fixed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], coordinates: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], anchorMargin: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], hoistToBody: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], opened: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], closed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }] }; return MdcMenuSurfaceBase; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcMenuSurface = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MdcMenuSurface, _super); function MdcMenuSurface() { return _super !== null && _super.apply(this, arguments) || this; } /** * @return {?} */ MdcMenuSurface.prototype.ngOnInit = /** * @return {?} */ function () { this.initMenuSurface(); }; /** * @return {?} */ MdcMenuSurface.prototype.ngOnDestroy = /** * @return {?} */ function () { this.destroyMenuSurface(); }; MdcMenuSurface.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-menu-surface', exportAs: 'mdcMenuSurface', host: { 'class': 'mdc-menu-surface' }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; return MdcMenuSurface; }(MdcMenuSurfaceBase)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcMenuSurfaceAnchor = /** @class */ (function () { function MdcMenuSurfaceAnchor(elementRef) { this.elementRef = elementRef; } MdcMenuSurfaceAnchor.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcMenuSurfaceAnchor], mdc-menu-surface-anchor', host: { 'class': 'mdc-menu-surface--anchor' } },] }, ]; /** @nocollapse */ MdcMenuSurfaceAnchor.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcMenuSurfaceAnchor; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var MENU_SURFACE_DECLARATIONS = [ MdcMenuSurface, MdcMenuSurfaceAnchor ]; var MdcMenuSurfaceModule = /** @class */ (function () { function MdcMenuSurfaceModule() { } MdcMenuSurfaceModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: [MENU_SURFACE_DECLARATIONS], declarations: [MENU_SURFACE_DECLARATIONS] },] }, ]; return MdcMenuSurfaceModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=menu-surface.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/menu.es5.js": /*!********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/menu.es5.js ***! \********************************************************/ /*! exports provided: MdcMenu, MdcMenuModule, MdcMenuSelectedEvent, MdcMenuSelectionGroup, MdcMenuSelectionGroupIcon */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenu", function() { return MdcMenu; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenuModule", function() { return MdcMenuModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSelectedEvent", function() { return MdcMenuSelectedEvent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSelectionGroup", function() { return MdcMenuSelectionGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSelectionGroupIcon", function() { return MdcMenuSelectionGroupIcon; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/menu-surface */ "./node_modules/@angular-mdc/web/esm5/menu-surface.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/list */ "./node_modules/@angular-mdc/web/esm5/list.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { ANCHOR: 'mdc-menu-surface--anchor', ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed', ANIMATING_OPEN: 'mdc-menu-surface--animating-open', FIXED: 'mdc-menu-surface--fixed', OPEN: 'mdc-menu-surface--open', ROOT: 'mdc-menu-surface' }; // tslint:disable:object-literal-sort-keys var strings = { CLOSED_EVENT: 'MDCMenuSurface:closed', OPENED_EVENT: 'MDCMenuSurface:opened', 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(', ') }; // tslint:enable:object-literal-sort-keys var numbers = { /** Total duration of menu-surface open animation. */ TRANSITION_OPEN_DURATION: 120, /** Total duration of menu-surface close animation. */ TRANSITION_CLOSE_DURATION: 75, /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */ MARGIN_TO_EDGE: 32, /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */ ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67 }; /** * Enum for bits in the {@see Corner) bitmap. */ var CornerBit; (function (CornerBit) { CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM"; CornerBit[CornerBit["CENTER"] = 2] = "CENTER"; CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT"; CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL"; })(CornerBit || (CornerBit = {})); /** * Enum for representing an element corner for positioning the menu-surface. * * The START constants map to LEFT if element directionality is left * to right and RIGHT if the directionality is right to left. * Likewise END maps to RIGHT or LEFT depending on the directionality. */ var Corner; (function (Corner) { Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT"; Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT"; Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT"; Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT"; Corner[Corner["TOP_START"] = 8] = "TOP_START"; Corner[Corner["TOP_END"] = 12] = "TOP_END"; Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START"; Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END"; })(Corner || (Corner = {})); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. */ function closest(element, selector) { if (element.closest) { return element.closest(selector); } var el = element; while (el) { if (matches(el, selector)) { return el; } el = el.parentElement; } return null; } function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated', LIST_ITEM_CLASS: 'mdc-list-item', LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected', ROOT: 'mdc-list' }; var strings$1 = { ACTION_EVENT: 'MDCList:action', ARIA_CHECKED: 'aria-checked', ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]', ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]', ARIA_CURRENT: 'aria-current', ARIA_ORIENTATION: 'aria-orientation', ARIA_ORIENTATION_HORIZONTAL: 'horizontal', ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]', ARIA_SELECTED: 'aria-selected', CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled)', CHECKBOX_SELECTOR: 'input[type="checkbox"]:not(:disabled)', CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses$1.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$1.LIST_ITEM_CLASS + " a\n ", ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)', FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses$1.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$1.LIST_ITEM_CLASS + " a,\n ." + cssClasses$1.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses$1.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled)\n ", RADIO_SELECTOR: 'input[type="radio"]:not(:disabled)' }; var numbers$1 = { UNSET_INDEX: -1 }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select']; function isNumberArray(selectedIndex) { return selectedIndex instanceof Array; } var MDCListFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCListFoundation, _super); function MDCListFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCListFoundation.defaultAdapter, adapter)) || this; _this.wrapFocus_ = false; _this.isVertical_ = true; _this.isSingleSelectionList_ = false; _this.selectedIndex_ = numbers$1.UNSET_INDEX; _this.focusedItemIndex_ = numbers$1.UNSET_INDEX; _this.useActivatedClass_ = false; _this.ariaCurrentAttrValue_ = null; _this.isCheckboxList_ = false; _this.isRadioList_ = false; return _this; } Object.defineProperty(MDCListFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "numbers", { get: function get() { return numbers$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "defaultAdapter", { get: function get() { return { addClassForElementIndex: function addClassForElementIndex() { return undefined; }, focusItemAtIndex: function focusItemAtIndex() { return undefined; }, getAttributeForElementIndex: function getAttributeForElementIndex() { return null; }, getFocusedElementIndex: function getFocusedElementIndex() { return 0; }, getListItemCount: function getListItemCount() { return 0; }, hasCheckboxAtIndex: function hasCheckboxAtIndex() { return false; }, hasRadioAtIndex: function hasRadioAtIndex() { return false; }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() { return false; }, isFocusInsideList: function isFocusInsideList() { return false; }, notifyAction: function notifyAction() { return undefined; }, removeClassForElementIndex: function removeClassForElementIndex() { return undefined; }, setAttributeForElementIndex: function setAttributeForElementIndex() { return undefined; }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() { return undefined; }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren() { return undefined; } }; }, enumerable: true, configurable: true }); MDCListFoundation.prototype.layout = function () { if (this.adapter_.getListItemCount() === 0) { return; } if (this.adapter_.hasCheckboxAtIndex(0)) { this.isCheckboxList_ = true; } else if (this.adapter_.hasRadioAtIndex(0)) { this.isRadioList_ = true; } }; /** * Sets the private wrapFocus_ variable. */ MDCListFoundation.prototype.setWrapFocus = function (value) { this.wrapFocus_ = value; }; /** * Sets the isVertical_ private variable. */ MDCListFoundation.prototype.setVerticalOrientation = function (value) { this.isVertical_ = value; }; /** * Sets the isSingleSelectionList_ private variable. */ MDCListFoundation.prototype.setSingleSelection = function (value) { this.isSingleSelectionList_ = value; }; /** * Sets the useActivatedClass_ private variable. */ MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) { this.useActivatedClass_ = useActivated; }; MDCListFoundation.prototype.getSelectedIndex = function () { return this.selectedIndex_; }; MDCListFoundation.prototype.setSelectedIndex = function (index) { if (!this.isIndexValid_(index)) { return; } if (this.isCheckboxList_) { this.setCheckboxAtIndex_(index); } else if (this.isRadioList_) { this.setRadioAtIndex_(index); } else { this.setSingleSelectionAtIndex_(index); } }; /** * Focus in handler for the list items. */ MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) { if (listItemIndex >= 0) { this.adapter_.setTabIndexForListItemChildren(listItemIndex, '0'); } }; /** * Focus out handler for the list items. */ MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) { var _this = this; if (listItemIndex >= 0) { this.adapter_.setTabIndexForListItemChildren(listItemIndex, '-1'); } /** * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus * is moved to next element. */ setTimeout(function () { if (!_this.adapter_.isFocusInsideList()) { _this.setTabindexToFirstSelectedItem_(); } }, 0); }; /** * Key handler for the list. */ MDCListFoundation.prototype.handleKeydown = function (evt, isRootListItem, listItemIndex) { var arrowLeft = evt.key === 'ArrowLeft' || evt.keyCode === 37; var arrowUp = evt.key === 'ArrowUp' || evt.keyCode === 38; var arrowRight = evt.key === 'ArrowRight' || evt.keyCode === 39; var arrowDown = evt.key === 'ArrowDown' || evt.keyCode === 40; var isHome = evt.key === 'Home' || evt.keyCode === 36; var isEnd = evt.key === 'End' || evt.keyCode === 35; var isEnter = evt.key === 'Enter' || evt.keyCode === 13; var isSpace = evt.key === 'Space' || evt.keyCode === 32; var currentIndex = this.adapter_.getFocusedElementIndex(); var nextIndex = numbers$1.UNSET_INDEX; if (currentIndex === numbers$1.UNSET_INDEX) { currentIndex = listItemIndex; if (currentIndex < 0) { // If this event doesn't have a mdc-list-item ancestor from the // current list (not from a sublist), return early. return; } } if (this.isVertical_ && arrowDown || !this.isVertical_ && arrowRight) { this.preventDefaultEvent_(evt); nextIndex = this.focusNextElement(currentIndex); } else if (this.isVertical_ && arrowUp || !this.isVertical_ && arrowLeft) { this.preventDefaultEvent_(evt); nextIndex = this.focusPrevElement(currentIndex); } else if (isHome) { this.preventDefaultEvent_(evt); nextIndex = this.focusFirstElement(); } else if (isEnd) { this.preventDefaultEvent_(evt); nextIndex = this.focusLastElement(); } else if (isEnter || isSpace) { if (isRootListItem) { // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event. var target = evt.target; if (target && target.tagName === 'A' && isEnter) { return; } this.preventDefaultEvent_(evt); if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(currentIndex); } this.adapter_.notifyAction(currentIndex); } } this.focusedItemIndex_ = currentIndex; if (nextIndex >= 0) { this.setTabindexAtIndex_(nextIndex); this.focusedItemIndex_ = nextIndex; } }; /** * Click handler for the list. */ MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) { if (index === numbers$1.UNSET_INDEX) { return; } if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(index, toggleCheckbox); } this.adapter_.notifyAction(index); this.setTabindexAtIndex_(index); this.focusedItemIndex_ = index; }; /** * Focuses the next element on the list. */ MDCListFoundation.prototype.focusNextElement = function (index) { var count = this.adapter_.getListItemCount(); var nextIndex = index + 1; if (nextIndex >= count) { if (this.wrapFocus_) { nextIndex = 0; } else { // Return early because last item is already focused. return index; } } this.adapter_.focusItemAtIndex(nextIndex); return nextIndex; }; /** * Focuses the previous element on the list. */ MDCListFoundation.prototype.focusPrevElement = function (index) { var prevIndex = index - 1; if (prevIndex < 0) { if (this.wrapFocus_) { prevIndex = this.adapter_.getListItemCount() - 1; } else { // Return early because first item is already focused. return index; } } this.adapter_.focusItemAtIndex(prevIndex); return prevIndex; }; MDCListFoundation.prototype.focusFirstElement = function () { this.adapter_.focusItemAtIndex(0); return 0; }; MDCListFoundation.prototype.focusLastElement = function () { var lastIndex = this.adapter_.getListItemCount() - 1; this.adapter_.focusItemAtIndex(lastIndex); return lastIndex; }; /** * Ensures that preventDefault is only called if the containing element doesn't * consume the event, and it will cause an unintended scroll. */ MDCListFoundation.prototype.preventDefaultEvent_ = function (evt) { var target = evt.target; var tagName = ("" + target.tagName).toLowerCase(); if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) { evt.preventDefault(); } }; MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) { if (this.selectedIndex_ === index) { return; } var selectedClassName = cssClasses$1.LIST_ITEM_SELECTED_CLASS; if (this.useActivatedClass_) { selectedClassName = cssClasses$1.LIST_ITEM_ACTIVATED_CLASS; } if (this.selectedIndex_ !== numbers$1.UNSET_INDEX) { this.adapter_.removeClassForElementIndex(this.selectedIndex_, selectedClassName); } this.adapter_.addClassForElementIndex(index, selectedClassName); this.setAriaForSingleSelectionAtIndex_(index); this.selectedIndex_ = index; }; /** * Sets aria attribute for single selection at given index. */ MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) { // Detect the presence of aria-current and get the value only during list initialization when it is in unset state. if (this.selectedIndex_ === numbers$1.UNSET_INDEX) { this.ariaCurrentAttrValue_ = this.adapter_.getAttributeForElementIndex(index, strings$1.ARIA_CURRENT); } var isAriaCurrent = this.ariaCurrentAttrValue_ !== null; var ariaAttribute = isAriaCurrent ? strings$1.ARIA_CURRENT : strings$1.ARIA_SELECTED; if (this.selectedIndex_ !== numbers$1.UNSET_INDEX) { this.adapter_.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false'); } var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true'; this.adapter_.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue); }; /** * Toggles radio at give index. Radio doesn't change the checked state if it is already checked. */ MDCListFoundation.prototype.setRadioAtIndex_ = function (index) { this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, true); if (this.selectedIndex_ !== numbers$1.UNSET_INDEX) { this.adapter_.setAttributeForElementIndex(this.selectedIndex_, strings$1.ARIA_CHECKED, 'false'); } this.adapter_.setAttributeForElementIndex(index, strings$1.ARIA_CHECKED, 'true'); this.selectedIndex_ = index; }; MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) { for (var i = 0; i < this.adapter_.getListItemCount(); i++) { var isChecked = false; if (index.indexOf(i) >= 0) { isChecked = true; } this.adapter_.setCheckedCheckboxOrRadioAtIndex(i, isChecked); this.adapter_.setAttributeForElementIndex(i, strings$1.ARIA_CHECKED, isChecked ? 'true' : 'false'); } this.selectedIndex_ = index; }; MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) { if (this.focusedItemIndex_ === numbers$1.UNSET_INDEX && index !== 0) { // If no list item was selected set first list item's tabindex to -1. // Generally, tabindex is set to 0 on first list item of list that has no preselected items. this.adapter_.setAttributeForElementIndex(0, 'tabindex', '-1'); } else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) { this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_, 'tabindex', '-1'); } this.adapter_.setAttributeForElementIndex(index, 'tabindex', '0'); }; /** * @return Return true if it is single selectin list, checkbox list or radio list. */ MDCListFoundation.prototype.isSelectableList_ = function () { return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_; }; MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () { var targetIndex = 0; if (this.isSelectableList_()) { if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== numbers$1.UNSET_INDEX) { targetIndex = this.selectedIndex_; } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) { targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { return Math.min(currentIndex, minIndex); }); } } this.setTabindexAtIndex_(targetIndex); }; MDCListFoundation.prototype.isIndexValid_ = function (index) { var _this = this; if (index instanceof Array) { if (!this.isCheckboxList_) { throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list'); } if (index.length === 0) { return true; } else { return index.some(function (i) { return _this.isIndexInRange_(i); }); } } else if (typeof index === 'number') { if (this.isCheckboxList_) { throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index); } return this.isIndexInRange_(index); } else { return false; } }; MDCListFoundation.prototype.isIndexInRange_ = function (index) { var listSize = this.adapter_.getListItemCount(); return index >= 0 && index < listSize; }; MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) { if (toggleCheckbox === void 0) { toggleCheckbox = true; } if (this.isCheckboxList_) { this.toggleCheckboxAtIndex_(index, toggleCheckbox); } else { this.setSelectedIndex(index); } }; MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) { var isChecked = this.adapter_.isCheckboxCheckedAtIndex(index); if (toggleCheckbox) { isChecked = !isChecked; this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, isChecked); } this.adapter_.setAttributeForElementIndex(index, strings$1.ARIA_CHECKED, isChecked ? 'true' : 'false'); // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value. var selectedIndexes = this.selectedIndex_ === numbers$1.UNSET_INDEX ? [] : this.selectedIndex_.slice(); if (isChecked) { selectedIndexes.push(index); } else { selectedIndexes = selectedIndexes.filter(function (i) { return i !== index; }); } this.selectedIndex_ = selectedIndexes; }; return MDCListFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCList = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCList, _super); function MDCList() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCList.prototype, "vertical", { set: function set(value) { this.foundation_.setVerticalOrientation(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "listElements", { get: function get() { return [].slice.call(this.root_.querySelectorAll(strings$1.ENABLED_ITEMS_SELECTOR)); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "wrapFocus", { set: function set(value) { this.foundation_.setWrapFocus(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "singleSelection", { set: function set(isSingleSelectionList) { this.foundation_.setSingleSelection(isSingleSelectionList); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "selectedIndex", { get: function get() { return this.foundation_.getSelectedIndex(); }, set: function set(index) { this.foundation_.setSelectedIndex(index); }, enumerable: true, configurable: true }); MDCList.attachTo = function (root) { return new MDCList(root); }; MDCList.prototype.initialSyncWithDOM = function () { this.handleClick_ = this.handleClickEvent_.bind(this); this.handleKeydown_ = this.handleKeydownEvent_.bind(this); this.focusInEventListener_ = this.handleFocusInEvent_.bind(this); this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this); this.listen('keydown', this.handleKeydown_); this.listen('click', this.handleClick_); this.listen('focusin', this.focusInEventListener_); this.listen('focusout', this.focusOutEventListener_); this.layout(); this.initializeListType(); }; MDCList.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten('click', this.handleClick_); this.unlisten('focusin', this.focusInEventListener_); this.unlisten('focusout', this.focusOutEventListener_); }; MDCList.prototype.layout = function () { var direction = this.root_.getAttribute(strings$1.ARIA_ORIENTATION); this.vertical = direction !== strings$1.ARIA_ORIENTATION_HORIZONTAL; // List items need to have at least tabindex=-1 to be focusable. [].slice.call(this.root_.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (el) { el.setAttribute('tabindex', '-1'); }); // Child button/a elements are not tabbable until the list item is focused. [].slice.call(this.root_.querySelectorAll(strings$1.FOCUSABLE_CHILD_ELEMENTS)).forEach(function (el) { return el.setAttribute('tabindex', '-1'); }); this.foundation_.layout(); }; /** * Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio. */ MDCList.prototype.initializeListType = function () { var _this = this; var checkboxListItems = this.root_.querySelectorAll(strings$1.ARIA_ROLE_CHECKBOX_SELECTOR); var singleSelectedListItem = this.root_.querySelector("\n ." + cssClasses$1.LIST_ITEM_ACTIVATED_CLASS + ",\n ." + cssClasses$1.LIST_ITEM_SELECTED_CLASS + "\n "); var radioSelectedListItem = this.root_.querySelector(strings$1.ARIA_CHECKED_RADIO_SELECTOR); if (checkboxListItems.length) { var preselectedItems = this.root_.querySelectorAll(strings$1.ARIA_CHECKED_CHECKBOX_SELECTOR); this.selectedIndex = [].map.call(preselectedItems, function (listItem) { return _this.listElements.indexOf(listItem); }); } else if (singleSelectedListItem) { if (singleSelectedListItem.classList.contains(cssClasses$1.LIST_ITEM_ACTIVATED_CLASS)) { this.foundation_.setUseActivatedClass(true); } this.singleSelection = true; this.selectedIndex = this.listElements.indexOf(singleSelectedListItem); } else if (radioSelectedListItem) { this.selectedIndex = this.listElements.indexOf(radioSelectedListItem); } }; MDCList.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClassForElementIndex: function addClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.add(className); } }, focusItemAtIndex: function focusItemAtIndex(index) { var element = _this.listElements[index]; if (element) { element.focus(); } }, getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) { return _this.listElements[index].getAttribute(attr); }, getFocusedElementIndex: function getFocusedElementIndex() { return _this.listElements.indexOf(document.activeElement); }, getListItemCount: function getListItemCount() { return _this.listElements.length; }, hasCheckboxAtIndex: function hasCheckboxAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(strings$1.CHECKBOX_SELECTOR); }, hasRadioAtIndex: function hasRadioAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(strings$1.RADIO_SELECTOR); }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(strings$1.CHECKBOX_SELECTOR); return toggleEl.checked; }, isFocusInsideList: function isFocusInsideList() { return _this.root_.contains(document.activeElement); }, notifyAction: function notifyAction(index) { _this.emit(strings$1.ACTION_EVENT, { index: index }, /** shouldBubble */ true); }, removeClassForElementIndex: function removeClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.remove(className); } }, setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { var element = _this.listElements[index]; if (element) { element.setAttribute(attr, value); } }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(strings$1.CHECKBOX_RADIO_SELECTOR); toggleEl.checked = isChecked; var event = document.createEvent('Event'); event.initEvent('change', true, true); toggleEl.dispatchEvent(event); }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { var element = _this.listElements[listItemIndex]; var listItemChildren = [].slice.call(element.querySelectorAll(strings$1.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)); listItemChildren.forEach(function (el) { return el.setAttribute('tabindex', tabIndexValue); }); } }; return new MDCListFoundation(adapter); }; /** * Used to figure out which list item this event is targetting. Or returns -1 if * there is no list item */ MDCList.prototype.getListItemIndex_ = function (evt) { var eventTarget = evt.target; var nearestParent = closest(eventTarget, "." + cssClasses$1.LIST_ITEM_CLASS + ", ." + cssClasses$1.ROOT); // Get the index of the element if it is a list item. if (nearestParent && matches(nearestParent, "." + cssClasses$1.LIST_ITEM_CLASS)) { return this.listElements.indexOf(nearestParent); } return -1; }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusInEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation_.handleFocusIn(evt, index); }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusOutEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation_.handleFocusOut(evt, index); }; /** * Used to figure out which element was focused when keydown event occurred before sending the event to the * foundation. */ MDCList.prototype.handleKeydownEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; if (index >= 0) { this.foundation_.handleKeydown(evt, target.classList.contains(cssClasses$1.LIST_ITEM_CLASS), index); } }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleClickEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events. var toggleCheckbox = !matches(target, strings$1.CHECKBOX_RADIO_SELECTOR); this.foundation_.handleClick(index, toggleCheckbox); }; return MDCList; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenuSurfaceFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCMenuSurfaceFoundation, _super); function MDCMenuSurfaceFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCMenuSurfaceFoundation.defaultAdapter, adapter)) || this; _this.isOpen_ = false; _this.isQuickOpen_ = false; _this.isHoistedElement_ = false; _this.isFixedPosition_ = false; _this.openAnimationEndTimerId_ = 0; _this.closeAnimationEndTimerId_ = 0; _this.animationRequestId_ = 0; _this.anchorCorner_ = Corner.TOP_START; _this.anchorMargin_ = { top: 0, right: 0, bottom: 0, left: 0 }; _this.position_ = { x: 0, y: 0 }; return _this; } Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", { get: function get() { return Corner; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", { /** * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, hasAnchor: function hasAnchor() { return false; }, isElementInContainer: function isElementInContainer() { return false; }, isFocused: function isFocused() { return false; }, isFirstElementFocused: function isFirstElementFocused() { return false; }, isLastElementFocused: function isLastElementFocused() { return false; }, isRtl: function isRtl() { return false; }, getInnerDimensions: function getInnerDimensions() { return { height: 0, width: 0 }; }, getAnchorDimensions: function getAnchorDimensions() { return null; }, getWindowDimensions: function getWindowDimensions() { return { height: 0, width: 0 }; }, getBodyDimensions: function getBodyDimensions() { return { height: 0, width: 0 }; }, getWindowScroll: function getWindowScroll() { return { x: 0, y: 0 }; }, setPosition: function setPosition() { return undefined; }, setMaxHeight: function setMaxHeight() { return undefined; }, setTransformOrigin: function setTransformOrigin() { return undefined; }, saveFocus: function saveFocus() { return undefined; }, restoreFocus: function restoreFocus() { return undefined; }, focusFirstElement: function focusFirstElement() { return undefined; }, focusLastElement: function focusLastElement() { return undefined; }, notifyClose: function notifyClose() { return undefined; }, notifyOpen: function notifyOpen() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCMenuSurfaceFoundation.prototype.init = function () { var _a = MDCMenuSurfaceFoundation.cssClasses, ROOT = _a.ROOT, OPEN = _a.OPEN; if (!this.adapter_.hasClass(ROOT)) { throw new Error(ROOT + " class required in root element."); } if (this.adapter_.hasClass(OPEN)) { this.isOpen_ = true; } }; MDCMenuSurfaceFoundation.prototype.destroy = function () { clearTimeout(this.openAnimationEndTimerId_); clearTimeout(this.closeAnimationEndTimerId_); // Cancel any currently running animations. cancelAnimationFrame(this.animationRequestId_); }; /** * @param corner Default anchor corner alignment of top-left menu surface corner. */ MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) { this.anchorCorner_ = corner; }; /** * @param margin Set of margin values from anchor. */ MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) { this.anchorMargin_.top = margin.top || 0; this.anchorMargin_.right = margin.right || 0; this.anchorMargin_.bottom = margin.bottom || 0; this.anchorMargin_.left = margin.left || 0; }; /** Used to indicate if the menu-surface is hoisted to the body. */ MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) { this.isHoistedElement_ = isHoisted; }; /** Used to set the menu-surface calculations based on a fixed position menu. */ MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) { this.isFixedPosition_ = isFixedPosition; }; /** Sets the menu-surface position on the page. */ MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) { this.position_.x = this.isFinite_(x) ? x : 0; this.position_.y = this.isFinite_(y) ? y : 0; }; MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) { this.isQuickOpen_ = quickOpen; }; MDCMenuSurfaceFoundation.prototype.isOpen = function () { return this.isOpen_; }; /** * Open the menu surface. */ MDCMenuSurfaceFoundation.prototype.open = function () { var _this = this; this.adapter_.saveFocus(); if (!this.isQuickOpen_) { this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); } this.animationRequestId_ = requestAnimationFrame(function () { _this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); _this.dimensions_ = _this.adapter_.getInnerDimensions(); _this.autoPosition_(); if (_this.isQuickOpen_) { _this.adapter_.notifyOpen(); } else { _this.openAnimationEndTimerId_ = setTimeout(function () { _this.openAnimationEndTimerId_ = 0; _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); _this.adapter_.notifyOpen(); }, numbers.TRANSITION_OPEN_DURATION); } }); this.isOpen_ = true; }; /** * Closes the menu surface. */ MDCMenuSurfaceFoundation.prototype.close = function () { var _this = this; if (!this.isQuickOpen_) { this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); } requestAnimationFrame(function () { _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); if (_this.isQuickOpen_) { _this.adapter_.notifyClose(); } else { _this.closeAnimationEndTimerId_ = setTimeout(function () { _this.closeAnimationEndTimerId_ = 0; _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); _this.adapter_.notifyClose(); }, numbers.TRANSITION_CLOSE_DURATION); } }); this.isOpen_ = false; this.maybeRestoreFocus_(); }; /** Handle clicks and close if not within menu-surface element. */ MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) { var el = evt.target; if (this.adapter_.isElementInContainer(el)) { return; } this.close(); }; /** Handle keys that close the surface. */ MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) { var keyCode = evt.keyCode, key = evt.key, shiftKey = evt.shiftKey; var isEscape = key === 'Escape' || keyCode === 27; var isTab = key === 'Tab' || keyCode === 9; if (isEscape) { this.close(); } else if (isTab) { if (this.adapter_.isLastElementFocused() && !shiftKey) { this.adapter_.focusFirstElement(); evt.preventDefault(); } else if (this.adapter_.isFirstElementFocused() && shiftKey) { this.adapter_.focusLastElement(); evt.preventDefault(); } } }; MDCMenuSurfaceFoundation.prototype.autoPosition_ = function () { var _a; // Compute measurements for autoposition methods reuse. this.measurements_ = this.getAutoLayoutMeasurements_(); var corner = this.getOriginCorner_(); var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight_(corner); var verticalAlignment = this.hasBit_(corner, CornerBit.BOTTOM) ? 'bottom' : 'top'; var horizontalAlignment = this.hasBit_(corner, CornerBit.RIGHT) ? 'right' : 'left'; var horizontalOffset = this.getHorizontalOriginOffset_(corner); var verticalOffset = this.getVerticalOriginOffset_(corner); var _b = this.measurements_, anchorSize = _b.anchorSize, surfaceSize = _b.surfaceSize; var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a); // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner. if (anchorSize.width / surfaceSize.width > numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) { horizontalAlignment = 'center'; } // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element if (this.isHoistedElement_ || this.isFixedPosition_) { this.adjustPositionForHoistedElement_(position); } this.adapter_.setTransformOrigin(horizontalAlignment + " " + verticalAlignment); this.adapter_.setPosition(position); this.adapter_.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : ''); }; /** * @return Measurements used to position menu surface popup. */ MDCMenuSurfaceFoundation.prototype.getAutoLayoutMeasurements_ = function () { var anchorRect = this.adapter_.getAnchorDimensions(); var bodySize = this.adapter_.getBodyDimensions(); var viewportSize = this.adapter_.getWindowDimensions(); var windowScroll = this.adapter_.getWindowScroll(); if (!anchorRect) { // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together anchorRect = { top: this.position_.y, right: this.position_.x, bottom: this.position_.y, left: this.position_.x, width: 0, height: 0 }; // tslint:enable:object-literal-sort-keys } return { anchorSize: anchorRect, bodySize: bodySize, surfaceSize: this.dimensions_, viewportDistance: { // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together top: anchorRect.top, right: viewportSize.width - anchorRect.right, bottom: viewportSize.height - anchorRect.bottom, left: anchorRect.left }, viewportSize: viewportSize, windowScroll: windowScroll }; }; /** * Computes the corner of the anchor from which to animate and position the menu surface. */ MDCMenuSurfaceFoundation.prototype.getOriginCorner_ = function () { // Defaults: open from the top left. var corner = Corner.TOP_LEFT; var _a = this.measurements_, viewportDistance = _a.viewportDistance, anchorSize = _a.anchorSize, surfaceSize = _a.surfaceSize; var isBottomAligned = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var availableTop = isBottomAligned ? viewportDistance.top + anchorSize.height + this.anchorMargin_.bottom : viewportDistance.top + this.anchorMargin_.top; var availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom : viewportDistance.bottom + anchorSize.height - this.anchorMargin_.top; var topOverflow = surfaceSize.height - availableTop; var bottomOverflow = surfaceSize.height - availableBottom; if (bottomOverflow > 0 && topOverflow < bottomOverflow) { corner = this.setBit_(corner, CornerBit.BOTTOM); } var isRtl = this.adapter_.isRtl(); var isFlipRtl = this.hasBit_(this.anchorCorner_, CornerBit.FLIP_RTL); var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.RIGHT); var isAlignedRight = avoidHorizontalOverlap && !isRtl || !avoidHorizontalOverlap && isFlipRtl && isRtl; var availableLeft = isAlignedRight ? viewportDistance.left + anchorSize.width + this.anchorMargin_.right : viewportDistance.left + this.anchorMargin_.left; var availableRight = isAlignedRight ? viewportDistance.right - this.anchorMargin_.right : viewportDistance.right + anchorSize.width - this.anchorMargin_.left; var leftOverflow = surfaceSize.width - availableLeft; var rightOverflow = surfaceSize.width - availableRight; if (leftOverflow < 0 && isAlignedRight && isRtl || avoidHorizontalOverlap && !isAlignedRight && leftOverflow < 0 || rightOverflow > 0 && leftOverflow < rightOverflow) { corner = this.setBit_(corner, CornerBit.RIGHT); } return corner; }; /** * @param corner Origin corner of the menu surface. * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set. */ MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight_ = function (corner) { var viewportDistance = this.measurements_.viewportDistance; var maxHeight = 0; var isBottomAligned = this.hasBit_(corner, CornerBit.BOTTOM); var isBottomAnchored = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE; // When maximum height is not specified, it is handled from CSS. if (isBottomAligned) { maxHeight = viewportDistance.top + this.anchorMargin_.top - MARGIN_TO_EDGE; if (!isBottomAnchored) { maxHeight += this.measurements_.anchorSize.height; } } else { maxHeight = viewportDistance.bottom - this.anchorMargin_.bottom + this.measurements_.anchorSize.height - MARGIN_TO_EDGE; if (isBottomAnchored) { maxHeight -= this.measurements_.anchorSize.height; } } return maxHeight; }; /** * @param corner Origin corner of the menu surface. * @return Horizontal offset of menu surface origin corner from corresponding anchor corner. */ MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset_ = function (corner) { var anchorSize = this.measurements_.anchorSize; // isRightAligned corresponds to using the 'right' property on the surface. var isRightAligned = this.hasBit_(corner, CornerBit.RIGHT); var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.RIGHT); if (isRightAligned) { var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.left : this.anchorMargin_.right; // For hoisted or fixed elements, adjust the offset by the difference between viewport width and body width so // when we calculate the right value (`adjustPositionForHoistedElement_`) based on the element position, // the right property is correct. if (this.isHoistedElement_ || this.isFixedPosition_) { return rightOffset - (this.measurements_.viewportSize.width - this.measurements_.bodySize.width); } return rightOffset; } return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.right : this.anchorMargin_.left; }; /** * @param corner Origin corner of the menu surface. * @return Vertical offset of menu surface origin corner from corresponding anchor corner. */ MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset_ = function (corner) { var anchorSize = this.measurements_.anchorSize; var isBottomAligned = this.hasBit_(corner, CornerBit.BOTTOM); var avoidVerticalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var y = 0; if (isBottomAligned) { y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin_.top : -this.anchorMargin_.bottom; } else { y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin_.bottom : this.anchorMargin_.top; } return y; }; /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */ MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement_ = function (position) { var e_1, _a; var _b = this.measurements_, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance; var props = Object.keys(position); try { for (var props_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__values"])(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) { var prop = props_1_1.value; var value = position[prop] || 0; // Hoisted surfaces need to have the anchor elements location on the page added to the // position properties for proper alignment on the body. value += viewportDistance[prop]; // Surfaces that are absolutely positioned need to have additional calculations for scroll // and bottom positioning. if (!this.isFixedPosition_) { if (prop === 'top') { value += windowScroll.y; } else if (prop === 'bottom') { value -= windowScroll.y; } else if (prop === 'left') { value += windowScroll.x; } else { // prop === 'right' value -= windowScroll.x; } } position[prop] = value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1); } finally { if (e_1) throw e_1.error; } } }; /** * The last focused element when the menu surface was opened should regain focus, if the user is * focused on or within the menu surface when it is closed. */ MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus_ = function () { var isRootFocused = this.adapter_.isFocused(); var childHasFocus = document.activeElement && this.adapter_.isElementInContainer(document.activeElement); if (isRootFocused || childHasFocus) { this.adapter_.restoreFocus(); } }; MDCMenuSurfaceFoundation.prototype.hasBit_ = function (corner, bit) { return Boolean(corner & bit); // tslint:disable-line:no-bitwise }; MDCMenuSurfaceFoundation.prototype.setBit_ = function (corner, bit) { return corner | bit; // tslint:disable-line:no-bitwise }; /** * isFinite that doesn't force conversion to number type. * Equivalent to Number.isFinite in ES2015, which is not supported in IE. */ MDCMenuSurfaceFoundation.prototype.isFinite_ = function (num) { return typeof num === 'number' && isFinite(num); }; return MDCMenuSurfaceFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cachedCssTransformPropertyName_; /** * Returns the name of the correct transform property to use on the current browser. */ function getTransformPropertyName(globalObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } if (cachedCssTransformPropertyName_ === undefined || forceRefresh) { var el = globalObj.document.createElement('div'); cachedCssTransformPropertyName_ = 'transform' in el.style ? 'transform' : 'webkitTransform'; } return cachedCssTransformPropertyName_; } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenuSurface = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCMenuSurface, _super); function MDCMenuSurface() { return _super !== null && _super.apply(this, arguments) || this; } MDCMenuSurface.attachTo = function (root) { return new MDCMenuSurface(root); }; MDCMenuSurface.prototype.initialSyncWithDOM = function () { var _this = this; var parentEl = this.root_.parentElement; this.anchorElement = parentEl && parentEl.classList.contains(cssClasses.ANCHOR) ? parentEl : null; if (this.root_.classList.contains(cssClasses.FIXED)) { this.setFixedPosition(true); } this.handleKeydown_ = function (evt) { return _this.foundation_.handleKeydown(evt); }; this.handleBodyClick_ = function (evt) { return _this.foundation_.handleBodyClick(evt); }; this.registerBodyClickListener_ = function () { return document.body.addEventListener('click', _this.handleBodyClick_); }; this.deregisterBodyClickListener_ = function () { return document.body.removeEventListener('click', _this.handleBodyClick_); }; this.listen('keydown', this.handleKeydown_); this.listen(strings.OPENED_EVENT, this.registerBodyClickListener_); this.listen(strings.CLOSED_EVENT, this.deregisterBodyClickListener_); }; MDCMenuSurface.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten(strings.OPENED_EVENT, this.registerBodyClickListener_); this.unlisten(strings.CLOSED_EVENT, this.deregisterBodyClickListener_); _super.prototype.destroy.call(this); }; Object.defineProperty(MDCMenuSurface.prototype, "open", { get: function get() { return this.foundation_.isOpen(); }, set: function set(value) { if (value) { var focusableElements = this.root_.querySelectorAll(strings.FOCUSABLE_ELEMENTS); this.firstFocusableElement_ = focusableElements[0]; this.lastFocusableElement_ = focusableElements[focusableElements.length - 1]; this.foundation_.open(); } else { this.foundation_.close(); } }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", { set: function set(quickOpen) { this.foundation_.setQuickOpen(quickOpen); }, enumerable: true, configurable: true }); /** * Removes the menu-surface from it's current location and appends it to the * body to overcome any overflow:hidden issues. */ MDCMenuSurface.prototype.hoistMenuToBody = function () { document.body.appendChild(this.root_); this.setIsHoisted(true); }; /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) { this.foundation_.setIsHoisted(isHoisted); }; /** Sets the element that the menu-surface is anchored to. */ MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) { this.anchorElement = element; }; /** Sets the menu-surface to position: fixed. */ MDCMenuSurface.prototype.setFixedPosition = function (isFixed) { if (isFixed) { this.root_.classList.add(cssClasses.FIXED); } else { this.root_.classList.remove(cssClasses.FIXED); } this.foundation_.setFixedPosition(isFixed); }; /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */ MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) { this.foundation_.setAbsolutePosition(x, y); this.setIsHoisted(true); }; /** * @param corner Default anchor corner alignment of top-left surface corner. */ MDCMenuSurface.prototype.setAnchorCorner = function (corner) { this.foundation_.setAnchorCorner(corner); }; MDCMenuSurface.prototype.setAnchorMargin = function (margin) { this.foundation_.setAnchorMargin(margin); }; MDCMenuSurface.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, hasAnchor: function hasAnchor() { return !!_this.anchorElement; }, notifyClose: function notifyClose() { return _this.emit(MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {}); }, notifyOpen: function notifyOpen() { return _this.emit(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {}); }, isElementInContainer: function isElementInContainer(el) { return _this.root_.contains(el); }, isRtl: function isRtl() { return getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl'; }, setTransformOrigin: function setTransformOrigin(origin) { var propertyName = getTransformPropertyName(window) + "-origin"; _this.root_.style.setProperty(propertyName, origin); }, isFocused: function isFocused() { return document.activeElement === _this.root_; }, saveFocus: function saveFocus() { _this.previousFocus_ = document.activeElement; }, restoreFocus: function restoreFocus() { if (_this.root_.contains(document.activeElement)) { if (_this.previousFocus_ && _this.previousFocus_.focus) { _this.previousFocus_.focus(); } } }, isFirstElementFocused: function isFirstElementFocused() { return _this.firstFocusableElement_ ? _this.firstFocusableElement_ === document.activeElement : false; }, isLastElementFocused: function isLastElementFocused() { return _this.lastFocusableElement_ ? _this.lastFocusableElement_ === document.activeElement : false; }, focusFirstElement: function focusFirstElement() { return _this.firstFocusableElement_ && _this.firstFocusableElement_.focus && _this.firstFocusableElement_.focus(); }, focusLastElement: function focusLastElement() { return _this.lastFocusableElement_ && _this.lastFocusableElement_.focus && _this.lastFocusableElement_.focus(); }, getInnerDimensions: function getInnerDimensions() { return { width: _this.root_.offsetWidth, height: _this.root_.offsetHeight }; }, getAnchorDimensions: function getAnchorDimensions() { return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null; }, getWindowDimensions: function getWindowDimensions() { return { width: window.innerWidth, height: window.innerHeight }; }, getBodyDimensions: function getBodyDimensions() { return { width: document.body.clientWidth, height: document.body.clientHeight }; }, getWindowScroll: function getWindowScroll() { return { x: window.pageXOffset, y: window.pageYOffset }; }, setPosition: function setPosition(position) { _this.root_.style.left = 'left' in position ? position.left + "px" : ''; _this.root_.style.right = 'right' in position ? position.right + "px" : ''; _this.root_.style.top = 'top' in position ? position.top + "px" : ''; _this.root_.style.bottom = 'bottom' in position ? position.bottom + "px" : ''; }, setMaxHeight: function setMaxHeight(height) { _this.root_.style.maxHeight = height; } }; // tslint:enable:object-literal-sort-keys return new MDCMenuSurfaceFoundation(adapter); }; return MDCMenuSurface; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$2 = { MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected', MENU_SELECTION_GROUP: 'mdc-menu__selection-group', ROOT: 'mdc-menu' }; var strings$2 = { ARIA_SELECTED_ATTR: 'aria-selected', CHECKBOX_SELECTOR: 'input[type="checkbox"]', LIST_SELECTOR: '.mdc-list', SELECTED_EVENT: 'MDCMenu:selected' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenuFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCMenuFoundation, _super); function MDCMenuFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCMenuFoundation.defaultAdapter, adapter)) || this; _this.closeAnimationEndTimerId_ = 0; return _this; } Object.defineProperty(MDCMenuFoundation, "cssClasses", { get: function get() { return cssClasses$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuFoundation, "strings", { get: function get() { return strings$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuFoundation, "defaultAdapter", { /** * @see {@link MDCMenuAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClassToElementAtIndex: function addClassToElementAtIndex() { return undefined; }, removeClassFromElementAtIndex: function removeClassFromElementAtIndex() { return undefined; }, addAttributeToElementAtIndex: function addAttributeToElementAtIndex() { return undefined; }, removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() { return undefined; }, elementContainsClass: function elementContainsClass() { return false; }, closeSurface: function closeSurface() { return undefined; }, getElementIndex: function getElementIndex() { return -1; }, getParentElement: function getParentElement() { return null; }, getSelectedElementIndex: function getSelectedElementIndex() { return -1; }, notifySelected: function notifySelected() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCMenuFoundation.prototype.destroy = function () { if (this.closeAnimationEndTimerId_) { clearTimeout(this.closeAnimationEndTimerId_); } this.adapter_.closeSurface(); }; MDCMenuFoundation.prototype.handleKeydown = function (evt) { var key = evt.key, keyCode = evt.keyCode; var isTab = key === 'Tab' || keyCode === 9; if (isTab) { this.adapter_.closeSurface(); } }; MDCMenuFoundation.prototype.handleItemAction = function (listItem) { var _this = this; var index = this.adapter_.getElementIndex(listItem); if (index < 0) { return; } this.adapter_.notifySelected({ index: index }); this.adapter_.closeSurface(); // Wait for the menu to close before adding/removing classes that affect styles. this.closeAnimationEndTimerId_ = setTimeout(function () { var selectionGroup = _this.getSelectionGroup_(listItem); if (selectionGroup) { _this.handleSelectionGroup_(selectionGroup, index); } }, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION); }; /** * Handles toggling the selected classes in a selection group when a selection is made. */ MDCMenuFoundation.prototype.handleSelectionGroup_ = function (selectionGroup, index) { // De-select the previous selection in this group. var selectedIndex = this.adapter_.getSelectedElementIndex(selectionGroup); if (selectedIndex >= 0) { this.adapter_.removeAttributeFromElementAtIndex(selectedIndex, strings$2.ARIA_SELECTED_ATTR); this.adapter_.removeClassFromElementAtIndex(selectedIndex, cssClasses$2.MENU_SELECTED_LIST_ITEM); } // Select the new list item in this group. this.adapter_.addClassToElementAtIndex(index, cssClasses$2.MENU_SELECTED_LIST_ITEM); this.adapter_.addAttributeToElementAtIndex(index, strings$2.ARIA_SELECTED_ATTR, 'true'); }; /** * Returns the parent selection group of an element if one exists. */ MDCMenuFoundation.prototype.getSelectionGroup_ = function (listItem) { var parent = this.adapter_.getParentElement(listItem); if (!parent) { return null; } var isGroup = this.adapter_.elementContainsClass(parent, cssClasses$2.MENU_SELECTION_GROUP); // Iterate through ancestors until we find the group or get to the list. while (!isGroup && parent && !this.adapter_.elementContainsClass(parent, MDCListFoundation.cssClasses.ROOT)) { parent = this.adapter_.getParentElement(parent); isGroup = parent ? this.adapter_.elementContainsClass(parent, cssClasses$2.MENU_SELECTION_GROUP) : false; } if (isGroup) { return parent; } else { return null; } }; return MDCMenuFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenu = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCMenu, _super); function MDCMenu() { return _super !== null && _super.apply(this, arguments) || this; } MDCMenu.attachTo = function (root) { return new MDCMenu(root); }; MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) { if (menuSurfaceFactory === void 0) { menuSurfaceFactory = function menuSurfaceFactory(el) { return new MDCMenuSurface(el); }; } if (listFactory === void 0) { listFactory = function listFactory(el) { return new MDCList(el); }; } this.menuSurfaceFactory_ = menuSurfaceFactory; this.listFactory_ = listFactory; }; MDCMenu.prototype.initialSyncWithDOM = function () { var _this = this; this.menuSurface_ = this.menuSurfaceFactory_(this.root_); var list = this.root_.querySelector(strings$2.LIST_SELECTOR); if (list) { this.list_ = this.listFactory_(list); this.list_.wrapFocus = true; } else { this.list_ = null; } this.handleKeydown_ = function (evt) { return _this.foundation_.handleKeydown(evt); }; this.handleItemAction_ = function (evt) { return _this.foundation_.handleItemAction(_this.items[evt.detail.index]); }; this.afterOpenedCallback_ = function () { return _this.handleAfterOpened_(); }; this.menuSurface_.listen(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.afterOpenedCallback_); this.listen('keydown', this.handleKeydown_); this.listen(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_); }; MDCMenu.prototype.destroy = function () { if (this.list_) { this.list_.destroy(); } this.menuSurface_.destroy(); this.menuSurface_.unlisten(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.afterOpenedCallback_); this.unlisten('keydown', this.handleKeydown_); this.unlisten(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_); _super.prototype.destroy.call(this); }; Object.defineProperty(MDCMenu.prototype, "open", { get: function get() { return this.menuSurface_.open; }, set: function set(value) { this.menuSurface_.open = value; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenu.prototype, "wrapFocus", { get: function get() { return this.list_ ? this.list_.wrapFocus : false; }, set: function set(value) { if (this.list_) { this.list_.wrapFocus = value; } }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenu.prototype, "items", { /** * Return the items within the menu. Note that this only contains the set of elements within * the items container that are proper list items, and not supplemental / presentational DOM * elements. */ get: function get() { return this.list_ ? this.list_.listElements : []; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenu.prototype, "quickOpen", { set: function set(quickOpen) { this.menuSurface_.quickOpen = quickOpen; }, enumerable: true, configurable: true }); /** * @param corner Default anchor corner alignment of top-left menu corner. */ MDCMenu.prototype.setAnchorCorner = function (corner) { this.menuSurface_.setAnchorCorner(corner); }; MDCMenu.prototype.setAnchorMargin = function (margin) { this.menuSurface_.setAnchorMargin(margin); }; /** * @return The item within the menu at the index specified. */ MDCMenu.prototype.getOptionByIndex = function (index) { var items = this.items; if (index < items.length) { return this.items[index]; } else { return null; } }; MDCMenu.prototype.setFixedPosition = function (isFixed) { this.menuSurface_.setFixedPosition(isFixed); }; MDCMenu.prototype.hoistMenuToBody = function () { this.menuSurface_.hoistMenuToBody(); }; MDCMenu.prototype.setIsHoisted = function (isHoisted) { this.menuSurface_.setIsHoisted(isHoisted); }; MDCMenu.prototype.setAbsolutePosition = function (x, y) { this.menuSurface_.setAbsolutePosition(x, y); }; /** * Sets the element that the menu-surface is anchored to. */ MDCMenu.prototype.setAnchorElement = function (element) { this.menuSurface_.anchorElement = element; }; MDCMenu.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClassToElementAtIndex: function addClassToElementAtIndex(index, className) { var list = _this.items; list[index].classList.add(className); }, removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) { var list = _this.items; list[index].classList.remove(className); }, addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) { var list = _this.items; list[index].setAttribute(attr, value); }, removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) { var list = _this.items; list[index].removeAttribute(attr); }, elementContainsClass: function elementContainsClass(element, className) { return element.classList.contains(className); }, closeSurface: function closeSurface() { return _this.open = false; }, getElementIndex: function getElementIndex(element) { return _this.items.indexOf(element); }, getParentElement: function getParentElement(element) { return element.parentElement; }, getSelectedElementIndex: function getSelectedElementIndex(selectionGroup) { var selectedListItem = selectionGroup.querySelector("." + cssClasses$2.MENU_SELECTED_LIST_ITEM); return selectedListItem ? _this.items.indexOf(selectedListItem) : -1; }, notifySelected: function notifySelected(evtData) { return _this.emit(strings$2.SELECTED_EVENT, { index: evtData.index, item: _this.items[evtData.index] }); } }; // tslint:enable:object-literal-sort-keys return new MDCMenuFoundation(adapter); }; MDCMenu.prototype.handleAfterOpened_ = function () { var list = this.items; if (list.length > 0) { list[0].focus(); } }; return MDCMenu; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcMenuSelectedEvent = /** @class */ (function () { function MdcMenuSelectedEvent(index, source) { this.index = index; this.source = source; } return MdcMenuSelectedEvent; }()); /** @type {?} */ var nextUniqueId = 0; var MdcMenuSelectionGroup = /** @class */ (function () { function MdcMenuSelectionGroup(elementRef) { this.elementRef = elementRef; } MdcMenuSelectionGroup.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcMenuSelectionGroup], mdc-menu-selection-group', host: { 'class': 'mdc-menu__selection-group' }, exportAs: 'mdcMenuSelectionGroup' },] }, ]; /** @nocollapse */ MdcMenuSelectionGroup.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcMenuSelectionGroup; }()); var MdcMenuSelectionGroupIcon = /** @class */ (function () { function MdcMenuSelectionGroupIcon(elementRef) { this.elementRef = elementRef; } MdcMenuSelectionGroupIcon.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcMenuSelectionGroupIcon], mdc-menu-selection-group-icon', host: { 'class': 'mdc-menu__selection-group-icon' }, exportAs: 'mdcMenuSelectionGroupIcon' },] }, ]; /** @nocollapse */ MdcMenuSelectionGroupIcon.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcMenuSelectionGroupIcon; }()); var MdcMenu = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MdcMenu, _super); function MdcMenu() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * Emits whenever the component is destroyed. */ _this._destroyed = new rxjs__WEBPACK_IMPORTED_MODULE_3__["Subject"](); _this._uniqueId = "mdc-menu-" + ++nextUniqueId; _this.id = _this._uniqueId; _this._wrapFocus = false; _this.selected = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); _this._menuFoundation = new MDCMenuFoundation(_this._createAdapter()); return _this; } Object.defineProperty(MdcMenu.prototype, "wrapFocus", { get: /** * @return {?} */ function () { return this._wrapFocus; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (newValue !== this._wrapFocus) { this._wrapFocus = newValue; this._list.wrapFocus = newValue; } }, enumerable: true, configurable: true }); /** * @private * @return {?} */ MdcMenu.prototype._createAdapter = /** * @private * @return {?} */ function () { var _this = this; return Object.assign({ addClassToElementAtIndex: (/** * @param {?} index * @param {?} className * @return {?} */ function (index, className) { return _this._list.items.toArray()[index].getListItemElement().classList.add(className); }), removeClassFromElementAtIndex: (/** * @param {?} index * @param {?} className * @return {?} */ function (index, className) { return _this._list.items.toArray()[index].getListItemElement().classList.remove(className); }), addAttributeToElementAtIndex: (/** * @param {?} index * @param {?} attr * @param {?} value * @return {?} */ function (index, attr, value) { return _this._list.items.toArray()[index].getListItemElement().setAttribute(attr, value); }), removeAttributeFromElementAtIndex: (/** * @param {?} index * @param {?} attr * @return {?} */ function (index, attr) { return _this._list.items.toArray()[index].getListItemElement().removeAttribute(attr); }), elementContainsClass: (/** * @param {?} element * @param {?} className * @return {?} */ function (element, className) { return element.classList.contains(className); }), closeSurface: (/** * @return {?} */ function () { _this.open = false; _this.setOpen(); }), getElementIndex: (/** * @param {?} element * @return {?} */ function (element) { return _this._list.items.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.getListItemElement() === element; })); }), getParentElement: (/** * @param {?} element * @return {?} */ function (element) { return element.parentElement; }), getSelectedElementIndex: (/** * @param {?} selectionGroup * @return {?} */ function (selectionGroup) { /** @type {?} */ var selectedItem = selectionGroup.querySelector(".mdc-menu-item--selected"); return selectedItem ? _this._list.items.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.id === selectedItem.id; })) : -1; }), notifySelected: (/** * @param {?} evtData * @return {?} */ function (evtData) { return _this.selected.emit(new MdcMenuSelectedEvent(evtData.index, _this._list.items.toArray()[evtData.index])); }), getMenuItemCount: (/** * @return {?} */ function () { return _this._list.items.length; }), focusItemAtIndex: (/** * @param {?} index * @return {?} */ function (index) { return _this._list.items.toArray()[index].focus(); }), isRootFocused: (/** * @return {?} */ function () { return document.activeElement === _this._getHostElement(); }), focusRoot: (/** * @return {?} */ function () { return _this._getHostElement().focus(); }) }); }; /** * @return {?} */ MdcMenu.prototype.ngAfterContentInit = /** * @return {?} */ function () { var _this = this; this.initMenuSurface(); this._initList(); this._listenForListItemActions(); this.opened.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(this._destroyed)) .subscribe((/** * @return {?} */ function () { if (_this._list) { _this._list.focusFirstElement(); } })); }; /** * @return {?} */ MdcMenu.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroyed.next(); this._destroyed.complete(); this.destroyMenuSurface(); this._menuFoundation.destroy(); }; /** * @return {?} */ MdcMenu.prototype.focus = /** * @return {?} */ function () { this._getHostElement().focus(); }; /** * @param {?} evt * @return {?} */ MdcMenu.prototype._handleKeydown = /** * @param {?} evt * @return {?} */ function (evt) { this._menuFoundation.handleKeydown(evt); }; /** * @private * @return {?} */ MdcMenu.prototype._initList = /** * @private * @return {?} */ function () { var _this = this; if (!this._list) { return; } this._list.setRole('menu'); this._list.wrapFocus = this._wrapFocus; // When the list items change, re-subscribe this._list.items.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(this._destroyed)) .subscribe((/** * @return {?} */ function () { return _this._list.items.forEach((/** * @param {?} item * @return {?} */ function (item) { return item.setRole('menuitem'); })); })); }; /** Listens to action events on each list item. */ /** * Listens to action events on each list item. * @private * @return {?} */ MdcMenu.prototype._listenForListItemActions = /** * Listens to action events on each list item. * @private * @return {?} */ function () { var _this = this; this._list.actionEvent.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(this._destroyed)) .subscribe((/** * @param {?} event * @return {?} */ function (event) { return _this._menuFoundation.handleItemAction(_this._list.items.toArray()[event.index].getListItemElement()); })); }; MdcMenu.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-menu', exportAs: 'mdcMenu', host: { '[id]': 'id', 'tabindex': '-1', 'class': 'mdc-menu mdc-menu-surface', '(keydown)': '_handleKeydown($event)', }, template: '', encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; MdcMenu.propDecorators = { id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], wrapFocus: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], selected: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], _list: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [_angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_6__["MdcList"],] }] }; return MdcMenu; }(_angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_1__["MdcMenuSurfaceBase"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var MENU_DECLARATIONS = [ MdcMenu, MdcMenuSelectionGroup, MdcMenuSelectionGroupIcon ]; var MdcMenuModule = /** @class */ (function () { function MdcMenuModule() { } MdcMenuModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_1__["MdcMenuSurfaceModule"]], exports: MENU_DECLARATIONS.concat([ _angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_1__["MdcMenuSurfaceModule"] ]), declarations: [MENU_DECLARATIONS] },] }, ]; return MdcMenuModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=menu.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/notched-outline.es5.js": /*!*******************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/notched-outline.es5.js ***! \*******************************************************************/ /*! exports provided: MdcNotchedOutline, MdcNotchedOutlineModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcNotchedOutline", function() { return MdcNotchedOutline; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcNotchedOutlineModule", function() { return MdcNotchedOutlineModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/floating-label */ "./node_modules/@angular-mdc/web/esm5/floating-label.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above', LABEL_SHAKE: 'mdc-floating-label--shake', ROOT: 'mdc-floating-label' }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFloatingLabelFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCFloatingLabelFoundation, _super); function MDCFloatingLabelFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCFloatingLabelFoundation.defaultAdapter, adapter)) || this; _this.shakeAnimationEndHandler_ = function () { return _this.handleShakeAnimationEnd_(); }; return _this; } Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", { /** * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, getWidth: function getWidth() { return 0; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCFloatingLabelFoundation.prototype.init = function () { this.adapter_.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; MDCFloatingLabelFoundation.prototype.destroy = function () { this.adapter_.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; /** * Returns the width of the label element. */ MDCFloatingLabelFoundation.prototype.getWidth = function () { return this.adapter_.getWidth(); }; /** * Styles the label to produce a shake animation to indicate an error. * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class. */ MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; if (shouldShake) { this.adapter_.addClass(LABEL_SHAKE); } else { this.adapter_.removeClass(LABEL_SHAKE); } }; /** * Styles the label to float or dock. * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label. */ MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) { var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE; if (shouldFloat) { this.adapter_.addClass(LABEL_FLOAT_ABOVE); } else { this.adapter_.removeClass(LABEL_FLOAT_ABOVE); this.adapter_.removeClass(LABEL_SHAKE); } }; MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; this.adapter_.removeClass(LABEL_SHAKE); }; return MDCFloatingLabelFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings = { NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch' }; var numbers = { // This should stay in sync with $mdc-notched-outline-padding * 2. NOTCH_ELEMENT_PADDING: 8 }; var cssClasses$1 = { NO_LABEL: 'mdc-notched-outline--no-label', OUTLINE_NOTCHED: 'mdc-notched-outline--notched', OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded' }; /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCNotchedOutlineFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCNotchedOutlineFoundation, _super); function MDCNotchedOutlineFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCNotchedOutlineFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCNotchedOutlineFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", { /** * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, setNotchWidthProperty: function setNotchWidthProperty() { return undefined; }, removeNotchWidthProperty: function removeNotchWidthProperty() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); /** * Adds the outline notched selector and updates the notch width calculated based off of notchWidth. */ MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) { var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; if (notchWidth > 0) { notchWidth += numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right. } this.adapter_.setNotchWidthProperty(notchWidth); this.adapter_.addClass(OUTLINE_NOTCHED); }; /** * Removes notched outline selector to close the notch in the outline. */ MDCNotchedOutlineFoundation.prototype.closeNotch = function () { var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; this.adapter_.removeClass(OUTLINE_NOTCHED); this.adapter_.removeNotchWidthProperty(); }; return MDCNotchedOutlineFoundation; }(MDCFoundation); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCNotchedOutline = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCNotchedOutline, _super); function MDCNotchedOutline() { return _super !== null && _super.apply(this, arguments) || this; } MDCNotchedOutline.attachTo = function (root) { return new MDCNotchedOutline(root); }; MDCNotchedOutline.prototype.initialSyncWithDOM = function () { this.notchElement_ = this.root_.querySelector(strings.NOTCH_ELEMENT_SELECTOR); var label = this.root_.querySelector('.' + MDCFloatingLabelFoundation.cssClasses.ROOT); if (label) { label.style.transitionDuration = '0s'; this.root_.classList.add(cssClasses$1.OUTLINE_UPGRADED); requestAnimationFrame(function () { label.style.transitionDuration = ''; }); } else { this.root_.classList.add(cssClasses$1.NO_LABEL); } }; /** * Updates classes and styles to open the notch to the specified width. * @param notchWidth The notch width in the outline. */ MDCNotchedOutline.prototype.notch = function (notchWidth) { this.foundation_.notch(notchWidth); }; /** * Updates classes and styles to close the notch. */ MDCNotchedOutline.prototype.closeNotch = function () { this.foundation_.closeNotch(); }; MDCNotchedOutline.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, setNotchWidthProperty: function setNotchWidthProperty(width) { return _this.notchElement_.style.setProperty('width', width + 'px'); }, removeNotchWidthProperty: function removeNotchWidthProperty() { return _this.notchElement_.style.removeProperty('width'); } }; // tslint:enable:object-literal-sort-keys return new MDCNotchedOutlineFoundation(adapter); }; return MDCNotchedOutline; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcNotchedOutline = /** @class */ (function () { function MdcNotchedOutline(elementRef) { this.elementRef = elementRef; this._foundation = new MDCNotchedOutlineFoundation(this._createAdapter()); } /** * @private * @return {?} */ MdcNotchedOutline.prototype._createAdapter = /** * @private * @return {?} */ function () { var _this = this; return { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this.elementRef.nativeElement.classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this.elementRef.nativeElement.classList.remove(className); }), setNotchWidthProperty: (/** * @param {?} width * @return {?} */ function (width) { return _this._notchElement.nativeElement.style.setProperty('width', width + "px"); }), removeNotchWidthProperty: (/** * @return {?} */ function () { return _this._notchElement.nativeElement.style.removeProperty('width'); }) }; }; /** Updates classes and styles to open the notch to the specified width. */ /** * Updates classes and styles to open the notch to the specified width. * @param {?} notchWidth * @return {?} */ MdcNotchedOutline.prototype.notch = /** * Updates classes and styles to open the notch to the specified width. * @param {?} notchWidth * @return {?} */ function (notchWidth) { this._foundation.notch(notchWidth); }; /** Updates classes and styles to close the notch. */ /** * Updates classes and styles to close the notch. * @return {?} */ MdcNotchedOutline.prototype.closeNotch = /** * Updates classes and styles to close the notch. * @return {?} */ function () { this._foundation.closeNotch(); }; MdcNotchedOutline.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdcNotchedOutline], mdc-notched-outline', exportAs: 'mdcNotchedOutline', host: { 'class': 'mdc-notched-outline', '[class.mdc-notched-outline--upgraded]': 'label', '[class.mdc-notched-outline--no-label]': '!label' }, template: "\n
\n
\n \n
\n
\n ", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcNotchedOutline.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcNotchedOutline.propDecorators = { label: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], for: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], _notchElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['notch',] }], floatingLabel: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_1__["MdcFloatingLabel"],] }] }; return MdcNotchedOutline; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcNotchedOutlineModule = /** @class */ (function () { function MdcNotchedOutlineModule() { } MdcNotchedOutlineModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_1__["MdcFloatingLabelModule"]], exports: [MdcNotchedOutline], declarations: [MdcNotchedOutline] },] }, ]; return MdcNotchedOutlineModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=notched-outline.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/overlay.es5.js": /*!***********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/overlay.es5.js ***! \***********************************************************/ /*! exports provided: Overlay, OverlayConfig, OverlayContainer, OverlayModule, OverlayRef */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Overlay", function() { return Overlay; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OverlayConfig", function() { return OverlayConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OverlayContainer", function() { return OverlayContainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OverlayModule", function() { return OverlayModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OverlayRef", function() { return OverlayRef; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/portal */ "./node_modules/@angular-mdc/web/esm5/portal.es5.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Initial configuration used when creating an overlay. */ var /** * Initial configuration used when creating an overlay. */ OverlayConfig = /** @class */ (function () { function OverlayConfig(config) { var _this = this; /** * Whether the overlay should be disposed of when the user goes backwards/forwards in history. * Note that this usually doesn't include clicking on links (unless the user is using * the `HashLocationStrategy`). */ this.disposeOnNavigation = false; if (config) { Object.keys(config).forEach((/** * @param {?} k * @return {?} */ function (k) { /** @type {?} */ var key = (/** @type {?} */ (k)); if (typeof config[key] !== 'undefined') { _this[key] = config[key]; } })); } } return OverlayConfig; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Container inside which all overlays will render. */ var OverlayContainer = /** @class */ (function () { function OverlayContainer(_document) { this._document = _document; this._containerElement = null; } /** * @return {?} */ OverlayContainer.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this._containerElement && this._containerElement.parentNode) { this._containerElement.parentNode.removeChild(this._containerElement); } }; /** * This method returns the overlay container element. It will lazily * create the element the first time it is called to facilitate using * the container in non-browser environments. * @returns the container element */ /** * This method returns the overlay container element. It will lazily * create the element the first time it is called to facilitate using * the container in non-browser environments. * @return {?} the container element */ OverlayContainer.prototype.getContainerElement = /** * This method returns the overlay container element. It will lazily * create the element the first time it is called to facilitate using * the container in non-browser environments. * @return {?} the container element */ function () { if (!this._containerElement) { this._createContainer(); } return (/** @type {?} */ (this._containerElement)); }; /** * Create the overlay container element, which is simply a div * with the 'cdk-overlay-container' class on the document body. */ /** * Create the overlay container element, which is simply a div * with the 'cdk-overlay-container' class on the document body. * @protected * @return {?} */ OverlayContainer.prototype._createContainer = /** * Create the overlay container element, which is simply a div * with the 'cdk-overlay-container' class on the document body. * @protected * @return {?} */ function () { /** @type {?} */ var container = this._document.createElement('div'); container.classList.add('cdk-overlay-container'); (/** @type {?} */ (this._document.body)).appendChild(container); this._containerElement = container; }; OverlayContainer.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"], args: [{ providedIn: 'root' },] }, ]; /** @nocollapse */ OverlayContainer.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_2__["DOCUMENT"],] }] } ]; }; /** @nocollapse */ OverlayContainer.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["defineInjectable"])({ factory: function OverlayContainer_Factory() { return new OverlayContainer(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_common__WEBPACK_IMPORTED_MODULE_2__["DOCUMENT"])); }, token: OverlayContainer, providedIn: "root" }); return OverlayContainer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Reference to an overlay that has been created with the Overlay service. * Used to manipulate or dispose of said overlay. */ var /** * Reference to an overlay that has been created with the Overlay service. * Used to manipulate or dispose of said overlay. */ OverlayRef = /** @class */ (function () { function OverlayRef(_portalOutlet, _host, _pane, _config, _ngZone, _document, _location) { this._portalOutlet = _portalOutlet; this._host = _host; this._pane = _pane; this._config = _config; this._ngZone = _ngZone; this._document = _document; this._location = _location; this._attachments = new rxjs__WEBPACK_IMPORTED_MODULE_3__["Subject"](); this._detachments = new rxjs__WEBPACK_IMPORTED_MODULE_3__["Subject"](); this._locationChanges = rxjs__WEBPACK_IMPORTED_MODULE_3__["Subscription"].EMPTY; /** * Reference to the parent of the `_host` at the time it was detached. Used to restore * the `_host` to its original position in the DOM when it gets re-attached. */ this._previousHostParent = null; } Object.defineProperty(OverlayRef.prototype, "overlayElement", { /** The overlay's HTML element */ get: /** * The overlay's HTML element * @return {?} */ function () { return this._pane; }, enumerable: true, configurable: true }); Object.defineProperty(OverlayRef.prototype, "hostElement", { /** * Wrapper around the panel element. Can be used for advanced * positioning where a wrapper with specific styling is * required around the overlay pane. */ get: /** * Wrapper around the panel element. Can be used for advanced * positioning where a wrapper with specific styling is * required around the overlay pane. * @return {?} */ function () { return this._host; }, enumerable: true, configurable: true }); /** * Attaches content, given via a Portal, to the overlay. * If the overlay is configured to have a backdrop, it will be created. * * @param portal Portal instance to which to attach the overlay. * @returns The portal attachment result. */ /** * Attaches content, given via a Portal, to the overlay. * If the overlay is configured to have a backdrop, it will be created. * * @param {?} portal Portal instance to which to attach the overlay. * @return {?} The portal attachment result. */ OverlayRef.prototype.attach = /** * Attaches content, given via a Portal, to the overlay. * If the overlay is configured to have a backdrop, it will be created. * * @param {?} portal Portal instance to which to attach the overlay. * @return {?} The portal attachment result. */ function (portal) { var _this = this; /** @type {?} */ var attachResult = this._portalOutlet.attach(portal); // Update the pane element with the given configuration. if (!this._host.parentElement && this._previousHostParent) { this._previousHostParent.appendChild(this._host); } this._updateStackingOrder(); // Enable pointer events for the overlay pane element. this._togglePointerEvents(true); // Only emit the `attachments` event once all other setup is done. this._attachments.next(); // @breaking-change 8.0.0 remove the null check for `_location` // once the constructor parameter is made required. if (this._config.disposeOnNavigation && this._location) { this._locationChanges = this._location.subscribe((/** * @return {?} */ function () { return _this.dispose(); })); } return attachResult; }; /** * Detaches an overlay from a portal. * @returns The portal detachment result. */ /** * Detaches an overlay from a portal. * @return {?} The portal detachment result. */ OverlayRef.prototype.detach = /** * Detaches an overlay from a portal. * @return {?} The portal detachment result. */ function () { if (!this.hasAttached()) { return; } // When the overlay is detached, the pane element should disable pointer events. // This is necessary because otherwise the pane element will cover the page and disable // pointer events therefore. Depends on the position strategy and the applied pane boundaries. this._togglePointerEvents(false); /** @type {?} */ var detachmentResult = this._portalOutlet.detach(); // Only emit after everything is detached. this._detachments.next(); // Keeping the host element in DOM the can cause scroll jank, because it still gets // rendered, even though it's transparent and unclickable which is why we remove it. this._detachContentWhenStable(); // Stop listening for location changes. this._locationChanges.unsubscribe(); return detachmentResult; }; /** Cleans up the overlay from the DOM. */ /** * Cleans up the overlay from the DOM. * @return {?} */ OverlayRef.prototype.dispose = /** * Cleans up the overlay from the DOM. * @return {?} */ function () { /** @type {?} */ var isAttached = this.hasAttached(); this._locationChanges.unsubscribe(); this._portalOutlet.dispose(); this._attachments.complete(); if (this._host && this._host.parentNode) { this._host.parentNode.removeChild(this._host); this._host = (/** @type {?} */ (null)); } this._previousHostParent = this._pane = (/** @type {?} */ (null)); if (isAttached) { this._detachments.next(); } this._detachments.complete(); }; /** Whether the overlay has attached content. */ /** * Whether the overlay has attached content. * @return {?} */ OverlayRef.prototype.hasAttached = /** * Whether the overlay has attached content. * @return {?} */ function () { return this._portalOutlet.hasAttached(); }; /** Gets an observable that emits when the overlay has been attached. */ /** * Gets an observable that emits when the overlay has been attached. * @return {?} */ OverlayRef.prototype.attachments = /** * Gets an observable that emits when the overlay has been attached. * @return {?} */ function () { return this._attachments.asObservable(); }; /** Gets an observable that emits when the overlay has been detached. */ /** * Gets an observable that emits when the overlay has been detached. * @return {?} */ OverlayRef.prototype.detachments = /** * Gets an observable that emits when the overlay has been detached. * @return {?} */ function () { return this._detachments.asObservable(); }; /** Gets the the current overlay configuration, which is immutable. */ /** * Gets the the current overlay configuration, which is immutable. * @return {?} */ OverlayRef.prototype.getConfig = /** * Gets the the current overlay configuration, which is immutable. * @return {?} */ function () { return this._config; }; /** Toggles the pointer events for the overlay pane element. */ /** * Toggles the pointer events for the overlay pane element. * @private * @param {?} enablePointer * @return {?} */ OverlayRef.prototype._togglePointerEvents = /** * Toggles the pointer events for the overlay pane element. * @private * @param {?} enablePointer * @return {?} */ function (enablePointer) { this._pane.style.pointerEvents = enablePointer ? 'auto' : 'none'; }; /** * Updates the stacking order of the element, moving it to the top if necessary. * This is required in cases where one overlay was detached, while another one, * that should be behind it, was destroyed. The next time both of them are opened, * the stacking will be wrong, because the detached element's pane will still be * in its original DOM position. */ /** * Updates the stacking order of the element, moving it to the top if necessary. * This is required in cases where one overlay was detached, while another one, * that should be behind it, was destroyed. The next time both of them are opened, * the stacking will be wrong, because the detached element's pane will still be * in its original DOM position. * @private * @return {?} */ OverlayRef.prototype._updateStackingOrder = /** * Updates the stacking order of the element, moving it to the top if necessary. * This is required in cases where one overlay was detached, while another one, * that should be behind it, was destroyed. The next time both of them are opened, * the stacking will be wrong, because the detached element's pane will still be * in its original DOM position. * @private * @return {?} */ function () { if (this._host.nextSibling) { (/** @type {?} */ (this._host.parentNode)).appendChild(this._host); } }; /** Detaches the overlay content next time the zone stabilizes. */ /** * Detaches the overlay content next time the zone stabilizes. * @private * @return {?} */ OverlayRef.prototype._detachContentWhenStable = /** * Detaches the overlay content next time the zone stabilizes. * @private * @return {?} */ function () { var _this = this; // Normally we wouldn't have to explicitly run this outside the `NgZone`, however // if the consumer is using `zone-patch-rxjs`, the `Subscription.unsubscribe` call will // be patched to run inside the zone, which will throw us into an infinite loop. this._ngZone.runOutsideAngular((/** * @return {?} */ function () { // We can't remove the host here immediately, because the overlay pane's content // might still be animating. This stream helps us avoid interrupting the animation // by waiting for the pane to become empty. /** @type {?} */ var subscription = _this._ngZone.onStable .asObservable() .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["merge"])(_this._attachments, _this._detachments))) .subscribe((/** * @return {?} */ function () { // Needs a couple of checks for the pane and host, because // they may have been removed by the time the zone stabilizes. if (!_this._pane || !_this._host || _this._pane.children.length === 0) { if (_this._host && _this._host.parentElement) { _this._previousHostParent = _this._host.parentElement; _this._previousHostParent.removeChild(_this._host); } subscription.unsubscribe(); } })); })); }; return OverlayRef; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Next overlay unique ID. * @type {?} */ var nextUniqueId = 0; // Note that Overlay is *not* scoped to the app root because the ComponentFactoryResolver // it needs is different based on where OverlayModule is imported. /** * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be * used as a low-level building block for other components. Dialogs, tooltips, menus, * selects, etc. can all be built using overlays. The service should primarily be used by authors * of re-usable components rather than developers building end-user applications. * * An overlay *is* a PortalOutlet, so any kind of Portal can be loaded into one. */ var Overlay = /** @class */ (function () { function Overlay(_overlayContainer, _componentFactoryResolver, _injector, _ngZone, _document, _location) { this._overlayContainer = _overlayContainer; this._componentFactoryResolver = _componentFactoryResolver; this._injector = _injector; this._ngZone = _ngZone; this._document = _document; this._location = _location; } /** * Creates an overlay. * @param config Configuration applied to the overlay. * @returns Reference to the created overlay. */ /** * Creates an overlay. * @param {?=} config Configuration applied to the overlay. * @return {?} Reference to the created overlay. */ Overlay.prototype.create = /** * Creates an overlay. * @param {?=} config Configuration applied to the overlay. * @return {?} Reference to the created overlay. */ function (config) { /** @type {?} */ var host = this._createHostElement(); /** @type {?} */ var pane = this._createPaneElement(host); /** @type {?} */ var portalOutlet = this._createPortalOutlet(pane); /** @type {?} */ var overlayConfig = new OverlayConfig(config); return new OverlayRef(portalOutlet, host, pane, overlayConfig, this._ngZone, this._document, this._location); }; /** * Creates the DOM element for an overlay and appends it to the overlay container. * @returns Newly-created pane element */ /** * Creates the DOM element for an overlay and appends it to the overlay container. * @private * @param {?} host * @return {?} Newly-created pane element */ Overlay.prototype._createPaneElement = /** * Creates the DOM element for an overlay and appends it to the overlay container. * @private * @param {?} host * @return {?} Newly-created pane element */ function (host) { /** @type {?} */ var pane = this._document.createElement('div'); pane.id = "cdk-overlay-" + nextUniqueId++; host.appendChild(pane); return pane; }; /** * Creates the host element that wraps around an overlay * and can be used for advanced positioning. * @returns Newly-create host element. */ /** * Creates the host element that wraps around an overlay * and can be used for advanced positioning. * @private * @return {?} Newly-create host element. */ Overlay.prototype._createHostElement = /** * Creates the host element that wraps around an overlay * and can be used for advanced positioning. * @private * @return {?} Newly-create host element. */ function () { /** @type {?} */ var host = this._document.createElement('div'); this._overlayContainer.getContainerElement().appendChild(host); return host; }; /** * Create a DomPortalOutlet into which the overlay content can be loaded. * @param pane The DOM element to turn into a portal outlet. * @returns A portal outlet for the given DOM element. */ /** * Create a DomPortalOutlet into which the overlay content can be loaded. * @private * @param {?} pane The DOM element to turn into a portal outlet. * @return {?} A portal outlet for the given DOM element. */ Overlay.prototype._createPortalOutlet = /** * Create a DomPortalOutlet into which the overlay content can be loaded. * @private * @param {?} pane The DOM element to turn into a portal outlet. * @return {?} A portal outlet for the given DOM element. */ function (pane) { // We have to resolve the ApplicationRef later in order to allow people // to use overlay-based providers during app initialization. if (!this._appRef) { this._appRef = this._injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ApplicationRef"]); } return new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_1__["DomPortalOutlet"](pane, this._componentFactoryResolver, this._appRef, this._injector); }; Overlay.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, ]; /** @nocollapse */ Overlay.ctorParameters = function () { return [ { type: OverlayContainer }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ComponentFactoryResolver"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injector"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_2__["DOCUMENT"],] }] }, { type: _angular_common__WEBPACK_IMPORTED_MODULE_2__["Location"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] } ]; }; return Overlay; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var OverlayModule = /** @class */ (function () { function OverlayModule() { } OverlayModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_1__["PortalModule"]], providers: [Overlay] },] }, ]; return OverlayModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=overlay.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/portal.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/portal.es5.js ***! \**********************************************************/ /*! exports provided: BasePortalHost, BasePortalOutlet, CdkPortal, CdkPortalOutlet, ComponentPortal, DomPortalHost, DomPortalOutlet, Portal, PortalHostDirective, PortalInjector, PortalModule, TemplatePortal, TemplatePortalDirective */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BasePortalHost", function() { return BasePortalOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BasePortalOutlet", function() { return BasePortalOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkPortal", function() { return CdkPortal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkPortalOutlet", function() { return CdkPortalOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentPortal", function() { return ComponentPortal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomPortalHost", function() { return DomPortalOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomPortalOutlet", function() { return DomPortalOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Portal", function() { return Portal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PortalHostDirective", function() { return CdkPortalOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PortalInjector", function() { return PortalInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PortalModule", function() { return PortalModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplatePortal", function() { return TemplatePortal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplatePortalDirective", function() { return CdkPortal; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Throws an exception when attempting to attach a null portal to a host. * \@docs-private * @return {?} */ function throwNullPortalError() { throw Error('Must provide a portal to attach'); } /** * Throws an exception when attempting to attach a portal to a host that is already attached. * \@docs-private * @return {?} */ function throwPortalAlreadyAttachedError() { throw Error('Host already has a portal attached'); } /** * Throws an exception when attempting to attach a portal to an already-disposed host. * \@docs-private * @return {?} */ function throwPortalOutletAlreadyDisposedError() { throw Error('This PortalOutlet has already been disposed'); } /** * Throws an exception when attempting to attach an unknown portal type. * \@docs-private * @return {?} */ function throwUnknownPortalTypeError() { throw Error('Attempting to attach an unknown Portal type. BasePortalOutlet accepts either ' + 'a ComponentPortal or a TemplatePortal.'); } /** * Throws an exception when attempting to attach a portal to a null host. * \@docs-private * @return {?} */ function throwNullPortalOutletError() { throw Error('Attempting to attach a portal to a null PortalOutlet'); } /** * Throws an exception when attempting to detach a portal that is not attached. * \@docs-private * @return {?} */ function throwNoPortalAttachedError() { throw Error('Attempting to detach a portal that is not attached to a host'); } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A `Portal` is something that you want to render somewhere else. * It can be attach to / detached from a `PortalOutlet`. * @abstract * @template T */ var /** * A `Portal` is something that you want to render somewhere else. * It can be attach to / detached from a `PortalOutlet`. * @abstract * @template T */ Portal = /** @class */ (function () { function Portal() { this._attachedHost = null; } /** Attach this portal to a host. */ /** * Attach this portal to a host. * @param {?} host * @return {?} */ Portal.prototype.attach = /** * Attach this portal to a host. * @param {?} host * @return {?} */ function (host) { if (host == null) { throwNullPortalOutletError(); } if (host.hasAttached()) { throwPortalAlreadyAttachedError(); } return (/** @type {?} */ (host.attach(this))); }; /** Detach this portal from its host */ /** * Detach this portal from its host * @return {?} */ Portal.prototype.detach = /** * Detach this portal from its host * @return {?} */ function () { /** @type {?} */ var host = this._attachedHost; if (host == null) { throwNoPortalAttachedError(); } else { this._attachedHost = null; host.detach(); } }; Object.defineProperty(Portal.prototype, "isAttached", { /** Whether this portal is attached to a host. */ get: /** * Whether this portal is attached to a host. * @return {?} */ function () { return !!this._attachedHost; }, enumerable: true, configurable: true }); /** * Sets the PortalOutlet reference without performing `attach()`. This is used directly by * the PortalOutlet when it is performing an `attach()` or `detach()`. */ /** * Sets the PortalOutlet reference without performing `attach()`. This is used directly by * the PortalOutlet when it is performing an `attach()` or `detach()`. * @param {?} host * @return {?} */ Portal.prototype.setAttachedHost = /** * Sets the PortalOutlet reference without performing `attach()`. This is used directly by * the PortalOutlet when it is performing an `attach()` or `detach()`. * @param {?} host * @return {?} */ function (host) { this._attachedHost = host; }; return Portal; }()); /** * A `ComponentPortal` is a portal that instantiates some Component upon attachment. * @template T */ var /** * A `ComponentPortal` is a portal that instantiates some Component upon attachment. * @template T */ ComponentPortal = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ComponentPortal, _super); function ComponentPortal(component, viewContainerRef, injector, componentFactoryResolver) { var _this = _super.call(this) || this; _this.component = component; _this.viewContainerRef = viewContainerRef; _this.injector = injector; _this.componentFactoryResolver = componentFactoryResolver; return _this; } return ComponentPortal; }(Portal)); /** * A `TemplatePortal` is a portal that represents some embedded template (TemplateRef). * @template C */ var /** * A `TemplatePortal` is a portal that represents some embedded template (TemplateRef). * @template C */ TemplatePortal = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TemplatePortal, _super); function TemplatePortal(template, viewContainerRef, context) { var _this = _super.call(this) || this; _this.templateRef = template; _this.viewContainerRef = viewContainerRef; _this.context = context; return _this; } Object.defineProperty(TemplatePortal.prototype, "origin", { get: /** * @return {?} */ function () { return this.templateRef.elementRef; }, enumerable: true, configurable: true }); /** * Attach the portal to the provided `PortalOutlet`. * When a context is provided it will override the `context` property of the `TemplatePortal` * instance. */ /** * Attach the portal to the provided `PortalOutlet`. * When a context is provided it will override the `context` property of the `TemplatePortal` * instance. * @param {?} host * @param {?=} context * @return {?} */ TemplatePortal.prototype.attach = /** * Attach the portal to the provided `PortalOutlet`. * When a context is provided it will override the `context` property of the `TemplatePortal` * instance. * @param {?} host * @param {?=} context * @return {?} */ function (host, context) { if (context === void 0) { context = this.context; } this.context = context; return _super.prototype.attach.call(this, host); }; /** * @return {?} */ TemplatePortal.prototype.detach = /** * @return {?} */ function () { this.context = undefined; return _super.prototype.detach.call(this); }; return TemplatePortal; }(Portal)); /** * Partial implementation of PortalOutlet that handles attaching * ComponentPortal and TemplatePortal. * @abstract */ var /** * Partial implementation of PortalOutlet that handles attaching * ComponentPortal and TemplatePortal. * @abstract */ BasePortalOutlet = /** @class */ (function () { function BasePortalOutlet() { /** * The portal currently attached to the host. */ this._attachedPortal = null; /** * A function that will permanently dispose this host. */ this._disposeFn = null; /** * Whether this host has already been permanently disposed. */ this._isDisposed = false; } /** Whether this host has an attached portal. */ /** * Whether this host has an attached portal. * @return {?} */ BasePortalOutlet.prototype.hasAttached = /** * Whether this host has an attached portal. * @return {?} */ function () { return !!this._attachedPortal; }; /** Attaches a portal. */ /** * Attaches a portal. * @param {?} portal * @return {?} */ BasePortalOutlet.prototype.attach = /** * Attaches a portal. * @param {?} portal * @return {?} */ function (portal) { if (!portal) { throwNullPortalError(); } if (this.hasAttached()) { throwPortalAlreadyAttachedError(); } if (this._isDisposed) { throwPortalOutletAlreadyDisposedError(); } if (portal instanceof ComponentPortal) { this._attachedPortal = portal; portal._attachedHost = this; return this.attachComponentPortal(portal); } else if (portal instanceof TemplatePortal) { this._attachedPortal = portal; portal._attachedHost = this; return this.attachTemplatePortal(portal); } throwUnknownPortalTypeError(); }; /** Detaches a previously attached portal. */ /** * Detaches a previously attached portal. * @return {?} */ BasePortalOutlet.prototype.detach = /** * Detaches a previously attached portal. * @return {?} */ function () { if (this._attachedPortal) { this._attachedPortal.setAttachedHost(null); this._attachedPortal = null; } this._invokeDisposeFn(); }; /** Permanently dispose of this portal host. */ /** * Permanently dispose of this portal host. * @return {?} */ BasePortalOutlet.prototype.dispose = /** * Permanently dispose of this portal host. * @return {?} */ function () { if (this.hasAttached()) { this.detach(); } this._invokeDisposeFn(); this._isDisposed = true; }; /** @docs-private */ /** * \@docs-private * @param {?} fn * @return {?} */ BasePortalOutlet.prototype.setDisposeFn = /** * \@docs-private * @param {?} fn * @return {?} */ function (fn) { this._disposeFn = fn; }; /** * @private * @return {?} */ BasePortalOutlet.prototype._invokeDisposeFn = /** * @private * @return {?} */ function () { if (this._disposeFn) { this._disposeFn(); this._disposeFn = null; } }; return BasePortalOutlet; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A PortalOutlet for attaching portals to an arbitrary DOM element outside of the Angular * application context. */ var /** * A PortalOutlet for attaching portals to an arbitrary DOM element outside of the Angular * application context. */ DomPortalOutlet = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DomPortalOutlet, _super); function DomPortalOutlet(outletElement, _componentFactoryResolver, _appRef, _defaultInjector) { var _this = _super.call(this) || this; _this.outletElement = outletElement; _this._componentFactoryResolver = _componentFactoryResolver; _this._appRef = _appRef; _this._defaultInjector = _defaultInjector; return _this; } /** * Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver. * @param portal Portal to be attached * @returns Reference to the created component. */ /** * Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver. * @template T * @param {?} portal Portal to be attached * @return {?} Reference to the created component. */ DomPortalOutlet.prototype.attachComponentPortal = /** * Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver. * @template T * @param {?} portal Portal to be attached * @return {?} Reference to the created component. */ function (portal) { var _this = this; /** @type {?} */ var resolver = portal.componentFactoryResolver || this._componentFactoryResolver; /** @type {?} */ var componentFactory = resolver.resolveComponentFactory(portal.component); /** @type {?} */ var componentRef; // If the portal specifies a ViewContainerRef, we will use that as the attachment point // for the component (in terms of Angular's component tree, not rendering). // When the ViewContainerRef is missing, we use the factory to create the component directly // and then manually attach the view to the application. if (portal.viewContainerRef) { componentRef = portal.viewContainerRef.createComponent(componentFactory, portal.viewContainerRef.length, portal.injector || portal.viewContainerRef.injector); this.setDisposeFn((/** * @return {?} */ function () { return componentRef.destroy(); })); } else { componentRef = componentFactory.create(portal.injector || this._defaultInjector); this._appRef.attachView(componentRef.hostView); this.setDisposeFn((/** * @return {?} */ function () { _this._appRef.detachView(componentRef.hostView); componentRef.destroy(); })); } // At this point the component has been instantiated, so we move it to the location in the DOM // where we want it to be rendered. this.outletElement.appendChild(this._getComponentRootNode(componentRef)); return componentRef; }; /** * Attaches a template portal to the DOM as an embedded view. * @param portal Portal to be attached. * @returns Reference to the created embedded view. */ /** * Attaches a template portal to the DOM as an embedded view. * @template C * @param {?} portal Portal to be attached. * @return {?} Reference to the created embedded view. */ DomPortalOutlet.prototype.attachTemplatePortal = /** * Attaches a template portal to the DOM as an embedded view. * @template C * @param {?} portal Portal to be attached. * @return {?} Reference to the created embedded view. */ function (portal) { var _this = this; /** @type {?} */ var viewContainer = portal.viewContainerRef; /** @type {?} */ var viewRef = viewContainer.createEmbeddedView(portal.templateRef, portal.context); viewRef.detectChanges(); // The method `createEmbeddedView` will add the view as a child of the viewContainer. // But for the DomPortalOutlet the view can be added everywhere in the DOM // (e.g Overlay Container) To move the view to the specified host element. We just // re-append the existing root nodes. viewRef.rootNodes.forEach((/** * @param {?} rootNode * @return {?} */ function (rootNode) { return _this.outletElement.appendChild(rootNode); })); this.setDisposeFn(((/** * @return {?} */ function () { /** @type {?} */ var index = viewContainer.indexOf(viewRef); if (index !== -1) { viewContainer.remove(index); } }))); // TODO(jelbourn): Return locals from view. return viewRef; }; /** * Clears out a portal from the DOM. */ /** * Clears out a portal from the DOM. * @return {?} */ DomPortalOutlet.prototype.dispose = /** * Clears out a portal from the DOM. * @return {?} */ function () { _super.prototype.dispose.call(this); if (this.outletElement.parentNode != null) { this.outletElement.parentNode.removeChild(this.outletElement); } }; /** Gets the root HTMLElement for an instantiated component. */ /** * Gets the root HTMLElement for an instantiated component. * @private * @param {?} componentRef * @return {?} */ DomPortalOutlet.prototype._getComponentRootNode = /** * Gets the root HTMLElement for an instantiated component. * @private * @param {?} componentRef * @return {?} */ function (componentRef) { return (/** @type {?} */ (((/** @type {?} */ (componentRef.hostView))).rootNodes[0])); }; return DomPortalOutlet; }(BasePortalOutlet)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Directive version of a `TemplatePortal`. Because the directive *is* a TemplatePortal, * the directive instance itself can be attached to a host, enabling declarative use of portals. */ var CdkPortal = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CdkPortal, _super); function CdkPortal(templateRef, viewContainerRef) { return _super.call(this, templateRef, viewContainerRef) || this; } CdkPortal.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: '[cdk-portal], [cdkPortal], [portal]', exportAs: 'cdkPortal', },] }, ]; /** @nocollapse */ CdkPortal.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["TemplateRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewContainerRef"] } ]; }; return CdkPortal; }(TemplatePortal)); /** * Directive version of a PortalOutlet. Because the directive *is* a PortalOutlet, portals can be * directly attached to it, enabling declarative use. * * Usage: * `` */ var CdkPortalOutlet = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CdkPortalOutlet, _super); function CdkPortalOutlet(_componentFactoryResolver, _viewContainerRef) { var _this = _super.call(this) || this; _this._componentFactoryResolver = _componentFactoryResolver; _this._viewContainerRef = _viewContainerRef; /** * Whether the portal component is initialized. */ _this._isInitialized = false; /** * Reference to the currently-attached component/view ref. */ _this._attachedRef = null; /** * Emits when a portal is attached to the outlet. */ _this.attached = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"](); return _this; } Object.defineProperty(CdkPortalOutlet.prototype, "portal", { /** Portal associated with the Portal outlet. */ get: /** * Portal associated with the Portal outlet. * @return {?} */ function () { return this._attachedPortal; }, set: /** * @param {?} portal * @return {?} */ function (portal) { // Ignore the cases where the `portal` is set to a falsy value before the lifecycle hooks have // run. This handles the cases where the user might do something like `
` // and attach a portal programmatically in the parent component. When Angular does the first CD // round, it will fire the setter with empty string, causing the user's content to be cleared. if (this.hasAttached() && !portal && !this._isInitialized) { return; } if (this.hasAttached()) { _super.prototype.detach.call(this); } if (portal) { _super.prototype.attach.call(this, portal); } this._attachedPortal = portal; }, enumerable: true, configurable: true }); Object.defineProperty(CdkPortalOutlet.prototype, "attachedRef", { /** Component or view reference that is attached to the portal. */ get: /** * Component or view reference that is attached to the portal. * @return {?} */ function () { return this._attachedRef; }, enumerable: true, configurable: true }); /** * @return {?} */ CdkPortalOutlet.prototype.ngOnInit = /** * @return {?} */ function () { this._isInitialized = true; }; /** * @return {?} */ CdkPortalOutlet.prototype.ngOnDestroy = /** * @return {?} */ function () { _super.prototype.dispose.call(this); this._attachedPortal = null; this._attachedRef = null; }; /** * Attach the given ComponentPortal to this PortalOutlet using the ComponentFactoryResolver. * * @param portal Portal to be attached to the portal outlet. * @returns Reference to the created component. */ /** * Attach the given ComponentPortal to this PortalOutlet using the ComponentFactoryResolver. * * @template T * @param {?} portal Portal to be attached to the portal outlet. * @return {?} Reference to the created component. */ CdkPortalOutlet.prototype.attachComponentPortal = /** * Attach the given ComponentPortal to this PortalOutlet using the ComponentFactoryResolver. * * @template T * @param {?} portal Portal to be attached to the portal outlet. * @return {?} Reference to the created component. */ function (portal) { portal.setAttachedHost(this); // If the portal specifies an origin, use that as the logical location of the component // in the application tree. Otherwise use the location of this PortalOutlet. /** @type {?} */ var viewContainerRef = portal.viewContainerRef != null ? portal.viewContainerRef : this._viewContainerRef; /** @type {?} */ var resolver = portal.componentFactoryResolver || this._componentFactoryResolver; /** @type {?} */ var componentFactory = resolver.resolveComponentFactory(portal.component); /** @type {?} */ var ref = viewContainerRef.createComponent(componentFactory, viewContainerRef.length, portal.injector || viewContainerRef.injector); _super.prototype.setDisposeFn.call(this, (/** * @return {?} */ function () { return ref.destroy(); })); this._attachedPortal = portal; this._attachedRef = ref; this.attached.emit(ref); return ref; }; /** * Attach the given TemplatePortal to this PortlHost as an embedded View. * @param portal Portal to be attached. * @returns Reference to the created embedded view. */ /** * Attach the given TemplatePortal to this PortlHost as an embedded View. * @template C * @param {?} portal Portal to be attached. * @return {?} Reference to the created embedded view. */ CdkPortalOutlet.prototype.attachTemplatePortal = /** * Attach the given TemplatePortal to this PortlHost as an embedded View. * @template C * @param {?} portal Portal to be attached. * @return {?} Reference to the created embedded view. */ function (portal) { var _this = this; portal.setAttachedHost(this); /** @type {?} */ var viewRef = this._viewContainerRef.createEmbeddedView(portal.templateRef, portal.context); _super.prototype.setDisposeFn.call(this, (/** * @return {?} */ function () { return _this._viewContainerRef.clear(); })); this._attachedPortal = portal; this._attachedRef = viewRef; this.attached.emit(viewRef); return viewRef; }; CdkPortalOutlet.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: '[cdkPortalOutlet], [cdkPortalHost], [portalHost]', exportAs: 'cdkPortalOutlet, cdkPortalHost', inputs: ['portal: cdkPortalOutlet'] },] }, ]; /** @nocollapse */ CdkPortalOutlet.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentFactoryResolver"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewContainerRef"] } ]; }; CdkPortalOutlet.propDecorators = { attached: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"] }] }; return CdkPortalOutlet; }(BasePortalOutlet)); var PortalModule = /** @class */ (function () { function PortalModule() { } PortalModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"], args: [{ exports: [CdkPortal, CdkPortalOutlet], declarations: [CdkPortal, CdkPortalOutlet], },] }, ]; return PortalModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Custom injector to be used when providing custom * injection tokens to components inside a portal. * \@docs-private */ var /** * Custom injector to be used when providing custom * injection tokens to components inside a portal. * \@docs-private */ PortalInjector = /** @class */ (function () { function PortalInjector(_parentInjector, _customTokens) { this._parentInjector = _parentInjector; this._customTokens = _customTokens; } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ PortalInjector.prototype.get = /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ function (token, notFoundValue) { /** @type {?} */ var value = this._customTokens.get(token); if (typeof value !== 'undefined') { return value; } return this._parentInjector.get(token, notFoundValue); }; return PortalInjector; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=portal.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/radio.es5.js": /*!*********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/radio.es5.js ***! \*********************************************************/ /*! exports provided: MDC_RADIO_GROUP_CONTROL_VALUE_ACCESSOR, MdcRadio, MdcRadioChange, MdcRadioGroup, MdcRadioModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_RADIO_GROUP_CONTROL_VALUE_ACCESSOR", function() { return MDC_RADIO_GROUP_CONTROL_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRadio", function() { return MdcRadio; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRadioChange", function() { return MdcRadioChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRadioGroup", function() { return MdcRadioGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRadioModule", function() { return MdcRadioModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/form-field */ "./node_modules/@angular-mdc/web/esm5/form-field.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$1 = { NATIVE_CONTROL_SELECTOR: '.mdc-radio__native-control' }; var cssClasses$1 = { DISABLED: 'mdc-radio--disabled', ROOT: 'mdc-radio' }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRadioFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRadioFoundation, _super); function MDCRadioFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCRadioFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCRadioFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRadioFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRadioFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, setNativeControlDisabled: function setNativeControlDisabled() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRadioFoundation.prototype.setDisabled = function (disabled) { var DISABLED = MDCRadioFoundation.cssClasses.DISABLED; this.adapter_.setNativeControlDisabled(disabled); if (disabled) { this.adapter_.addClass(DISABLED); } else { this.adapter_.removeClass(DISABLED); } }; return MDCRadioFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRadio = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRadio, _super); function MDCRadio() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ripple_ = _this.createRipple_(); return _this; } MDCRadio.attachTo = function (root) { return new MDCRadio(root); }; Object.defineProperty(MDCRadio.prototype, "checked", { get: function get() { return this.nativeControl_.checked; }, set: function set(checked) { this.nativeControl_.checked = checked; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRadio.prototype, "disabled", { get: function get() { return this.nativeControl_.disabled; }, set: function set(disabled) { this.foundation_.setDisabled(disabled); }, enumerable: true, configurable: true }); Object.defineProperty(MDCRadio.prototype, "value", { get: function get() { return this.nativeControl_.value; }, set: function set(value) { this.nativeControl_.value = value; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRadio.prototype, "ripple", { get: function get() { return this.ripple_; }, enumerable: true, configurable: true }); MDCRadio.prototype.destroy = function () { this.ripple_.destroy(); _super.prototype.destroy.call(this); }; MDCRadio.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, setNativeControlDisabled: function setNativeControlDisabled(disabled) { return _this.nativeControl_.disabled = disabled; } }; return new MDCRadioFoundation(adapter); }; MDCRadio.prototype.createRipple_ = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCRipple.createAdapter(this), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.nativeControl_.addEventListener(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.nativeControl_.removeEventListener(evtType, handler); }, // Radio buttons technically go "active" whenever there is *any* keyboard interaction. // This is not the UI we desire. isSurfaceActive: function isSurfaceActive() { return false; }, isUnbounded: function isUnbounded() { return true; } }); // tslint:enable:object-literal-sort-keys return new MDCRipple(this.root_, new MDCRippleFoundation(adapter)); }; Object.defineProperty(MDCRadio.prototype, "nativeControl_", { get: function get() { var NATIVE_CONTROL_SELECTOR = MDCRadioFoundation.strings.NATIVE_CONTROL_SELECTOR; var el = this.root_.querySelector(NATIVE_CONTROL_SELECTOR); if (!el) { throw new Error("Radio component requires a " + NATIVE_CONTROL_SELECTOR + " element"); } return el; }, enumerable: true, configurable: true }); return MDCRadio; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Provider Expression that allows mdc-radio-group to register as a ControlValueAccessor. This * allows it to support [(ngModel)] and ngControl. * @type {?} */ var MDC_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = { provide: _angular_forms__WEBPACK_IMPORTED_MODULE_3__["NG_VALUE_ACCESSOR"], useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])((/** * @return {?} */ function () { return MdcRadioGroup; })), multi: true }; /** @type {?} */ var nextUniqueId = 0; /** * Change event object emitted by MdcRadio. */ var /** * Change event object emitted by MdcRadio. */ MdcRadioChange = /** @class */ (function () { function MdcRadioChange(source, value) { this.source = source; this.value = value; } return MdcRadioChange; }()); var MdcRadioGroup = /** @class */ (function () { function MdcRadioGroup(_changeDetectorRef, elementRef) { this._changeDetectorRef = _changeDetectorRef; this.elementRef = elementRef; this._name = "mdc-radio-group-" + nextUniqueId++; /** * Selected value for the radio group. */ this._value = null; /** * Whether the `value` has been set to its initial value. */ this._isInitialized = false; this._selected = null; this._required = false; this._disabled = false; /** * The method to be called in order to update ngModel */ this._controlValueAccessorChangeFn = (/** * @return {?} */ function () { }); /** * onTouch function registered via registerOnTouch (ControlValueAccessor). */ this.onTouched = (/** * @return {?} */ function () { }); this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); } Object.defineProperty(MdcRadioGroup.prototype, "name", { /** Name of the radio button group. All radio buttons inside this group will use this name. */ get: /** * Name of the radio button group. All radio buttons inside this group will use this name. * @return {?} */ function () { return this._name; }, set: /** * @param {?} value * @return {?} */ function (value) { this._name = value; this._updateRadioButtonNames(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRadioGroup.prototype, "value", { /** * Value for the radio-group. Should equal the value of the selected radio button if there is * a corresponding radio button with a matching value. If there is not such a corresponding * radio button, this value persists to be applied in case a new radio button is added with a * matching value. */ get: /** * Value for the radio-group. Should equal the value of the selected radio button if there is * a corresponding radio button with a matching value. If there is not such a corresponding * radio button, this value persists to be applied in case a new radio button is added with a * matching value. * @return {?} */ function () { return this._value; }, set: /** * @param {?} newValue * @return {?} */ function (newValue) { if (this._value !== newValue) { // Set this before proceeding to ensure no circular loop occurs with selection. this._value = newValue; this._updateSelectedRadioFromValue(); this._checkSelectedRadioButton(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcRadioGroup.prototype, "selected", { /** * The currently selected radio button. If set to a new radio button, the radio group value * will be updated to match the new selected button. */ get: /** * The currently selected radio button. If set to a new radio button, the radio group value * will be updated to match the new selected button. * @return {?} */ function () { return this._selected; }, set: /** * @param {?} selected * @return {?} */ function (selected) { this._selected = selected; this.value = selected ? selected.value : null; this._checkSelectedRadioButton(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRadioGroup.prototype, "required", { get: /** * @return {?} */ function () { return this._required; }, set: /** * @param {?} value * @return {?} */ function (value) { this._required = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(value); this._markRadiosForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRadioGroup.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(value); this._updateDisableRadioState(this._disabled); this._markRadiosForCheck(); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcRadioGroup.prototype._checkSelectedRadioButton = /** * @return {?} */ function () { if (this._selected && !this._selected.checked) { this._selected.checked = true; } }; /** * @return {?} */ MdcRadioGroup.prototype.ngAfterContentInit = /** * @return {?} */ function () { this._isInitialized = true; }; /** * @return {?} */ MdcRadioGroup.prototype._touch = /** * @return {?} */ function () { if (this.onTouched) { this.onTouched(); } }; /** * @private * @return {?} */ MdcRadioGroup.prototype._updateRadioButtonNames = /** * @private * @return {?} */ function () { var _this = this; if (this._radios) { this._radios.forEach((/** * @param {?} radio * @return {?} */ function (radio) { radio.name = _this.name; radio.markForCheck(); })); } }; /** Updates the `selected` radio button from the internal _value state. */ /** * Updates the `selected` radio button from the internal _value state. * @private * @return {?} */ MdcRadioGroup.prototype._updateSelectedRadioFromValue = /** * Updates the `selected` radio button from the internal _value state. * @private * @return {?} */ function () { var _this = this; // If the value already matches the selected radio, do nothing. /** @type {?} */ var isAlreadySelected = this._selected !== null && this._selected.value === this._value; if (this._radios && !isAlreadySelected) { this._selected = null; this._radios.forEach((/** * @param {?} radio * @return {?} */ function (radio) { radio.checked = _this.value === radio.value; if (radio.checked) { _this._selected = radio; } })); } }; /** * @private * @return {?} */ MdcRadioGroup.prototype._markRadiosForCheck = /** * @private * @return {?} */ function () { if (this._radios) { this._radios.forEach((/** * @param {?} radio * @return {?} */ function (radio) { return radio.markForCheck(); })); } }; /** * @private * @param {?} disabled * @return {?} */ MdcRadioGroup.prototype._updateDisableRadioState = /** * @private * @param {?} disabled * @return {?} */ function (disabled) { if (this._radios) { this._radios.forEach((/** * @param {?} radio * @return {?} */ function (radio) { return radio.disabled = disabled; })); } }; /** Sets the model value. Implemented as part of ControlValueAccessor. */ /** * Sets the model value. Implemented as part of ControlValueAccessor. * @param {?} value * @return {?} */ MdcRadioGroup.prototype.writeValue = /** * Sets the model value. Implemented as part of ControlValueAccessor. * @param {?} value * @return {?} */ function (value) { this.value = value; this._changeDetectorRef.markForCheck(); }; /** * Registers a callback to be triggered when the model value changes. * Implemented as part of ControlValueAccessor. * @param fn Callback to be registered. */ /** * Registers a callback to be triggered when the model value changes. * Implemented as part of ControlValueAccessor. * @param {?} fn Callback to be registered. * @return {?} */ MdcRadioGroup.prototype.registerOnChange = /** * Registers a callback to be triggered when the model value changes. * Implemented as part of ControlValueAccessor. * @param {?} fn Callback to be registered. * @return {?} */ function (fn) { this._controlValueAccessorChangeFn = fn; }; /** * Registers a callback to be triggered when the control is touched. * Implemented as part of ControlValueAccessor. * @param fn Callback to be registered. */ /** * Registers a callback to be triggered when the control is touched. * Implemented as part of ControlValueAccessor. * @param {?} fn Callback to be registered. * @return {?} */ MdcRadioGroup.prototype.registerOnTouched = /** * Registers a callback to be triggered when the control is touched. * Implemented as part of ControlValueAccessor. * @param {?} fn Callback to be registered. * @return {?} */ function (fn) { this.onTouched = fn; }; /** * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor. * @param isDisabled Whether the control should be disabled. */ /** * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor. * @param {?} isDisabled Whether the control should be disabled. * @return {?} */ MdcRadioGroup.prototype.setDisabledState = /** * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor. * @param {?} isDisabled Whether the control should be disabled. * @return {?} */ function (isDisabled) { this.disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(isDisabled); this._changeDetectorRef.markForCheck(); }; /** Dispatch change event with current selection and group value. */ /** * Dispatch change event with current selection and group value. * @return {?} */ MdcRadioGroup.prototype.emitChangeEvent = /** * Dispatch change event with current selection and group value. * @return {?} */ function () { if (this._isInitialized) { this.change.emit(new MdcRadioChange((/** @type {?} */ (this._selected)), this._value)); } }; MdcRadioGroup.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{ selector: 'mdc-radio-group, [mdcRadioGroup]', exportAs: 'mdcRadioGroup', host: { 'role': 'radiogroup', '[attr.name]': 'null' }, template: '', changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, providers: [MDC_RADIO_GROUP_CONTROL_VALUE_ACCESSOR] },] }, ]; /** @nocollapse */ MdcRadioGroup.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcRadioGroup.propDecorators = { _radios: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])((/** * @return {?} */ function () { return MdcRadio; })), { descendants: true },] }], name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], selected: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], required: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], change: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }] }; return MdcRadioGroup; }()); var MdcRadio = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MdcRadio, _super); function MdcRadio(_changeDetectorRef, elementRef, ripple, _radioDispatcher, radioGroup, _parentFormField) { var _this = _super.call(this, elementRef) || this; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this.ripple = ripple; _this._radioDispatcher = _radioDispatcher; _this._parentFormField = _parentFormField; _this._uniqueId = "mdc-radio-" + ++nextUniqueId; /** * The unique ID for the radio button. */ _this.id = _this._uniqueId; _this.tabIndex = 0; _this._checked = false; _this._disabled = false; _this._required = false; _this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Unregister function for _radioDispatcher */ _this._removeUniqueSelectionListener = (/** * @return {?} */ function () { }); _this.radioGroup = radioGroup; if (_this._parentFormField) { _parentFormField.elementRef.nativeElement.classList.add('mdc-form-field'); } _this._removeUniqueSelectionListener = _radioDispatcher.listen((/** * @param {?} id * @param {?} name * @return {?} */ function (id, name) { if (id !== _this.id && name === _this.name) { // Get the checked state from native radio button. The native radio buttons with the same // name have separate unique selection in different form containers. _this.checked = _this._getInputElement().checked; } })); return _this; } Object.defineProperty(MdcRadio.prototype, "inputId", { get: /** * @return {?} */ function () { return (this.id || this._uniqueId) + "-input"; }, enumerable: true, configurable: true }); Object.defineProperty(MdcRadio.prototype, "value", { get: /** * @return {?} */ function () { return this._value; }, set: /** * @param {?} newValue * @return {?} */ function (newValue) { this.setValue(newValue); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRadio.prototype, "checked", { get: /** * @return {?} */ function () { return this._checked; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setChecked(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRadio.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled || (this.radioGroup !== null && this.radioGroup.disabled); }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newDisabledState = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(value); if (this._disabled !== newDisabledState) { this._disabled = newDisabledState; this._foundation.setDisabled(this._disabled); this._changeDetectorRef.markForCheck(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcRadio.prototype, "required", { get: /** * @return {?} */ function () { return this._required || (this.radioGroup && this.radioGroup.required); }, set: /** * @param {?} value * @return {?} */ function (value) { this._required = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(value); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcRadio.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), setNativeControlDisabled: (/** * @param {?} disabled * @return {?} */ function (disabled) { return _this.disabled = disabled; }) }; return new MDCRadioFoundation(adapter); }; /** * @return {?} */ MdcRadio.prototype.ngAfterViewInit = /** * @return {?} */ function () { var _this = this; this._foundation.init(); this._initRipple(); if (this.radioGroup) { Promise.resolve().then((/** * @return {?} */ function () { // If the radio is inside a radio group, determine if it should be checked _this.checked = _this.radioGroup.value === _this._value; // Copy name from parent radio group _this.name = _this.radioGroup.name; _this._changeDetectorRef.markForCheck(); })); } }; /** * @return {?} */ MdcRadio.prototype.ngOnDestroy = /** * @return {?} */ function () { this._removeUniqueSelectionListener(); this.ripple.destroy(); this._foundation.destroy(); }; /** * @param {?} event * @return {?} */ MdcRadio.prototype.onInputClick = /** * @param {?} event * @return {?} */ function (event) { // Preventing bubbling for the second event will solve that issue. event.stopPropagation(); }; /** * @param {?} event * @return {?} */ MdcRadio.prototype.onInputChange = /** * @param {?} event * @return {?} */ function (event) { event.stopPropagation(); /** @type {?} */ var groupValueChanged = this.radioGroup && this.value !== this.radioGroup.value; this.checked = true; this._emitChangeEvent(); if (this.radioGroup) { this.radioGroup._controlValueAccessorChangeFn(this.value); if (groupValueChanged) { this.radioGroup.emitChangeEvent(); } } }; /** * @param {?} checked * @return {?} */ MdcRadio.prototype.setChecked = /** * @param {?} checked * @return {?} */ function (checked) { /** @type {?} */ var newCheckedState = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(checked); if (this._checked !== newCheckedState) { this._checked = newCheckedState; this._getInputElement().checked = newCheckedState; if (newCheckedState && this.radioGroup && this.radioGroup.value !== this.value) { this.radioGroup.selected = this; } else if (!newCheckedState && this.radioGroup && this.radioGroup.value === this.value) { // When unchecking the selected radio button, update the selected radio // property on the group. this.radioGroup.selected = null; } this._changeDetectorRef.markForCheck(); if (newCheckedState) { // Notify all radio buttons with the same name to un-check. this._radioDispatcher.notify(this.id, this.name); } } }; /** * @param {?} value * @return {?} */ MdcRadio.prototype.setValue = /** * @param {?} value * @return {?} */ function (value) { if (this._value !== value) { this._value = value; this._getInputElement().value = this._value; if (this.radioGroup !== null) { if (!this.checked) { // Update checked when the value changed to match the radio group's value this.checked = this.radioGroup.value === value; } if (this.checked) { this.radioGroup.selected = this; } } } }; /** * @return {?} */ MdcRadio.prototype.focus = /** * @return {?} */ function () { this._getInputElement().focus(); }; /** * @return {?} */ MdcRadio.prototype.markForCheck = /** * @return {?} */ function () { this._changeDetectorRef.markForCheck(); }; /** * @private * @return {?} */ MdcRadio.prototype._initRipple = /** * @private * @return {?} */ function () { var _this = this; this.ripple.init({ surface: this._getHostElement(), activator: this._getInputElement() }, Object.assign(this.ripple.createAdapter(), { isUnbounded: (/** * @return {?} */ function () { return true; }), isSurfaceActive: (/** * @return {?} */ function () { return false; }), isSurfaceDisabled: (/** * @return {?} */ function () { return _this._disabled; }) })); }; /** Dispatch change event with current value. */ /** * Dispatch change event with current value. * @private * @return {?} */ MdcRadio.prototype._emitChangeEvent = /** * Dispatch change event with current value. * @private * @return {?} */ function () { this.change.emit(new MdcRadioChange(this, this._value)); }; /** Retrieves the DOM element of the component input. */ /** * Retrieves the DOM element of the component input. * @private * @return {?} */ MdcRadio.prototype._getInputElement = /** * Retrieves the DOM element of the component input. * @private * @return {?} */ function () { return this.input.nativeElement; }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcRadio.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcRadio.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-radio', exportAs: 'mdcRadio', host: { '[id]': 'id', 'class': 'mdc-radio', '(focus)': 'input.nativeElement.focus()', '[attr.tabindex]': '-1', '[attr.name]': 'null' }, template: "\n \n
\n
\n
\n
\n ", encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, providers: [ _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_5__["MdcRipple"], { provide: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormFieldControl"], useExisting: MdcRadio } ] },] }, ]; /** @nocollapse */ MdcRadio.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_5__["MdcRipple"] }, { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["UniqueSelectionDispatcher"] }, { type: MdcRadioGroup, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormField"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] } ]; }; MdcRadio.propDecorators = { id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], tabIndex: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ariaLabel: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['aria-label',] }], ariaLabelledby: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['aria-labelledby',] }], ariaDescribedby: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['aria-describedby',] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], checked: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], required: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], change: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], input: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['input',] }] }; return MdcRadio; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcRadioModule = /** @class */ (function () { function MdcRadioModule() { } MdcRadioModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormFieldModule"]], exports: [ MdcRadio, MdcRadioGroup ], declarations: [ MdcRadio, MdcRadioGroup ] },] }, ]; return MdcRadioModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=radio.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/ripple.es5.js ***! \**********************************************************/ /*! exports provided: MdcRipple, MdcRippleComponent, MdcRippleConfig, MdcRippleDirective, MdcRippleModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRipple", function() { return MdcRipple; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRippleComponent", function() { return MdcRippleComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRippleConfig", function() { return MdcRippleConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRippleDirective", function() { return MdcRippleDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcRippleModule", function() { return MdcRippleModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // Activation events registered on the root element of each instance for activation /** @type {?} */ var ACTIVATION_EVENT_TYPES$1 = ['touchstart', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs /** @type {?} */ var POINTER_DEACTIVATION_EVENT_TYPES$1 = ['touchend', 'pointerup', 'mouseup', 'keyup', 'contextmenu']; /** * Time in milliseconds for which to ignore mouse events, after * receiving a touch event. Used to avoid doing double work for * touch devices where the browser fires fake mouse events, in * addition to touch events. * @type {?} */ var MOUSE_EVENT_IGNORE_TIME = 800; var MdcRippleConfig = /** @class */ (function () { function MdcRippleConfig() { } return MdcRippleConfig; }()); var MdcRipple = /** @class */ (function () { function MdcRipple(_ngZone, _platform) { this._ngZone = _ngZone; this._platform = _platform; /** * Emits whenever the component is destroyed. */ this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_3__["Subject"](); this._initialized = false; this.initialized = this._initialized; /** * Time in milliseconds when the last touchstart event happened. */ this._lastTouchStartEvent = 0; this._focusSubscription = null; this._blurSubscription = null; this._activationEventsSubscription = null; this._pointerDeactivationEventsSubscription = null; } Object.defineProperty(MdcRipple.prototype, "activationEvents", { /** Combined stream of all of the activation events. */ get: /** * Combined stream of all of the activation events. * @return {?} */ function () { var _this = this; return rxjs__WEBPACK_IMPORTED_MODULE_3__["merge"].apply(void 0, ACTIVATION_EVENT_TYPES$1.map((/** * @param {?} evt * @return {?} */ function (evt) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["fromEvent"])(_this._rippleConfig.activator ? _this._rippleConfig.activator : _this._rippleConfig.surface, evt, (/** @type {?} */ (applyPassive()))); }))); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRipple.prototype, "pointerDeactivationEvents", { /** Combined stream of all of the de-activation events. */ get: /** * Combined stream of all of the de-activation events. * @return {?} */ function () { var _this = this; return rxjs__WEBPACK_IMPORTED_MODULE_3__["merge"].apply(void 0, POINTER_DEACTIVATION_EVENT_TYPES$1.map((/** * @param {?} evt * @return {?} */ function (evt) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["fromEvent"])(_this._rippleConfig.activator ? _this._rippleConfig.activator : _this._rippleConfig.surface, evt, (/** @type {?} */ (applyPassive()))); }))); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcRipple.prototype.createAdapter = /** * @return {?} */ function () { var _this = this; return { browserSupportsCssVars: (/** * @return {?} */ function () { return _this._platform.isBrowser ? supportsCssVariables(window) : false; }), isUnbounded: (/** * @return {?} */ function () { return _this._rippleConfig.unbounded; }), isSurfaceActive: (/** * @return {?} */ function () { return matches(_this._rippleConfig.surface, ':active'); }), isSurfaceDisabled: (/** * @return {?} */ function () { return _this._rippleConfig.disabled; }), addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._rippleConfig.surface.classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._rippleConfig.surface.classList.remove(className); }), containsEventTarget: (/** * @param {?} target * @return {?} */ function (target) { return _this._rippleConfig.surface.contains(target); }), registerDocumentInteractionHandler: (/** * @param {?} evtType * @param {?} handler * @return {?} */ function (evtType, handler) { if (!_this._platform.isBrowser) { return; } (/** @type {?} */ (document.documentElement)).addEventListener(evtType, handler, applyPassive()); }), deregisterDocumentInteractionHandler: (/** * @param {?} evtType * @param {?} handler * @return {?} */ function (evtType, handler) { if (!_this._platform.isBrowser) { return; } (/** @type {?} */ (document.documentElement)).removeEventListener(evtType, handler, applyPassive()); }), registerResizeHandler: (/** * @param {?} handler * @return {?} */ function (handler) { if (!_this._platform.isBrowser) { return; } window.addEventListener('resize', handler); }), deregisterResizeHandler: (/** * @param {?} handler * @return {?} */ function (handler) { if (!_this._platform.isBrowser) { return; } window.removeEventListener('resize', handler); }), updateCssVariable: (/** * @param {?} varName * @param {?} value * @return {?} */ function (varName, value) { return _this._rippleConfig.surface.style.setProperty(varName, value); }), computeBoundingRect: (/** * @return {?} */ function () { if (!_this._platform.isBrowser) { return {}; } return _this._rippleConfig.surface.getBoundingClientRect(); }), getWindowPageOffset: (/** * @return {?} */ function () { return ({ x: _this._platform.isBrowser ? window.pageXOffset : 0, y: _this._platform.isBrowser ? window.pageYOffset : 0 }); }) }; }; /** * @param {?} config * @param {?=} adapter * @return {?} */ MdcRipple.prototype.init = /** * @param {?} config * @param {?=} adapter * @return {?} */ function (config, adapter) { if (!this._platform.isBrowser) { return; } this._rippleConfig = config; this._foundation = new MDCRippleFoundation(adapter || this.createAdapter()); this._loadListeners(); this._foundation.init(); this._initialized = true; }; /** * @return {?} */ MdcRipple.prototype.destroy = /** * @return {?} */ function () { if (!this._platform.isBrowser) { return; } this._destroy.next(); this._destroy.complete(); this._unloadListeners(); if (this._foundation) { this._foundation.destroy(); } this._initialized = false; }; /** * @return {?} */ MdcRipple.prototype.ngOnDestroy = /** * @return {?} */ function () { this.destroy(); }; /** * @param {?=} event * @return {?} */ MdcRipple.prototype.activateRipple = /** * @param {?=} event * @return {?} */ function (event) { var _this = this; if (event) { if (event instanceof MouseEvent) { /** @type {?} */ var isSyntheticEvent = this._lastTouchStartEvent && Date.now() < this._lastTouchStartEvent + MOUSE_EVENT_IGNORE_TIME; if (isSyntheticEvent) { return; } } else { this._lastTouchStartEvent = Date.now(); } } setTimeout((/** * @return {?} */ function () { return _this._foundation.activate(event); })); }; /** * @param {?=} event * @return {?} */ MdcRipple.prototype.deactivateRipple = /** * @param {?=} event * @return {?} */ function (event) { var _this = this; setTimeout((/** * @return {?} */ function () { return _this._foundation.deactivate(event); })); }; /** * @return {?} */ MdcRipple.prototype.handleFocus = /** * @return {?} */ function () { this._foundation.handleFocus(); }; /** * @return {?} */ MdcRipple.prototype.handleBlur = /** * @return {?} */ function () { this._foundation.handleBlur(); }; /** * @private * @return {?} */ MdcRipple.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._activationEventsSubscription = this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return _this.activationEvents.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(_this._destroy)) .subscribe((/** * @param {?} event * @return {?} */ function (event) { return _this._ngZone.run((/** * @return {?} */ function () { return _this.activateRipple(event); })); })); })); this._pointerDeactivationEventsSubscription = this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return _this.pointerDeactivationEvents.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(_this._destroy)) .subscribe((/** * @param {?} event * @return {?} */ function (event) { return _this._ngZone.run((/** * @return {?} */ function () { return _this.deactivateRipple(event); })); })); })); this._focusSubscription = this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["fromEvent"])(_this._rippleConfig.activator ? _this._rippleConfig.activator : _this._rippleConfig.surface, 'focus').pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(_this._destroy)) .subscribe((/** * @return {?} */ function () { return _this._ngZone.run((/** * @return {?} */ function () { return _this.handleFocus(); })); })); })); this._blurSubscription = this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["fromEvent"])(_this._rippleConfig.activator ? _this._rippleConfig.activator : _this._rippleConfig.surface, 'blur').pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(_this._destroy)) .subscribe((/** * @return {?} */ function () { return _this._ngZone.run((/** * @return {?} */ function () { return _this.handleBlur(); })); })); })); }; /** * @private * @return {?} */ MdcRipple.prototype._unloadListeners = /** * @private * @return {?} */ function () { if (this._activationEventsSubscription) { this._activationEventsSubscription.unsubscribe(); this._activationEventsSubscription = null; } if (this._pointerDeactivationEventsSubscription) { this._pointerDeactivationEventsSubscription.unsubscribe(); this._pointerDeactivationEventsSubscription = null; } if (this._focusSubscription) { this._focusSubscription.unsubscribe(); this._focusSubscription = null; } if (this._blurSubscription) { this._blurSubscription.unsubscribe(); this._blurSubscription = null; } }; MdcRipple.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, ]; /** @nocollapse */ MdcRipple.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["Platform"] } ]; }; return MdcRipple; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcRippleComponent = /** @class */ (function () { function MdcRippleComponent(_changeDetectorRef, _ripple, elementRef) { this._changeDetectorRef = _changeDetectorRef; this._ripple = _ripple; this.elementRef = elementRef; this._attachTo = this._getHostElement(); this._primary = false; this._secondary = false; this._disabled = false; this._unbounded = false; } Object.defineProperty(MdcRippleComponent.prototype, "ripple", { get: /** * @return {?} */ function () { return this._ripple; }, enumerable: true, configurable: true }); Object.defineProperty(MdcRippleComponent.prototype, "attachTo", { get: /** * @return {?} */ function () { return this._attachTo; }, set: /** * @param {?} element * @return {?} */ function (element) { if (this._attachTo) { this._attachTo.classList.remove('mdc-ripple-surface'); } this._attachTo = element; if (this._attachTo) { this._attachTo.classList.add('mdc-ripple-surface'); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcRippleComponent.prototype, "primary", { get: /** * @return {?} */ function () { return this._primary; }, set: /** * @param {?} value * @return {?} */ function (value) { this._primary = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); this._primary ? this.attachTo.classList.add('mdc-ripple-surface--primary') : this.attachTo.classList.remove('mdc-ripple-surface--primary'); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRippleComponent.prototype, "secondary", { get: /** * @return {?} */ function () { return this._secondary; }, set: /** * @param {?} value * @return {?} */ function (value) { this._secondary = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); this._secondary ? this.attachTo.classList.add('mdc-ripple-surface--accent') : this.attachTo.classList.remove('mdc-ripple-surface--accent'); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRippleComponent.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcRippleComponent.prototype, "unbounded", { get: /** * @return {?} */ function () { return this._unbounded; }, set: /** * @param {?} value * @return {?} */ function (value) { this._unbounded = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_2__["toBoolean"])(value); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcRippleComponent.prototype.ngAfterContentInit = /** * @return {?} */ function () { this._initRipple(); }; /** * @return {?} */ MdcRippleComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { this.ripple.destroy(); }; /** * @private * @return {?} */ MdcRippleComponent.prototype._initRipple = /** * @private * @return {?} */ function () { var _this = this; this.ripple.init({ surface: this._attachTo }, Object.assign(this.ripple.createAdapter(), { isUnbounded: (/** * @return {?} */ function () { return _this._unbounded; }), isSurfaceDisabled: (/** * @return {?} */ function () { return _this._disabled; }) })); this._changeDetectorRef.markForCheck(); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcRippleComponent.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcRippleComponent.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{ selector: 'mdc-ripple, [mdc-ripple]', template: '', providers: [MdcRipple], changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcRippleComponent.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: MdcRipple }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcRippleComponent.propDecorators = { attachTo: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], primary: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], secondary: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], unbounded: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcRippleComponent; }()); var MdcRippleDirective = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MdcRippleDirective, _super); function MdcRippleDirective(_changeDetectorRef, _ripple, elementRef) { var _this = _super.call(this, _changeDetectorRef, _ripple, elementRef) || this; _this._unbounded = true; _this.elementRef.nativeElement.setAttribute('data-mdc-ripple-is-unbounded', ''); return _this; } MdcRippleDirective.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcRipple]', providers: [MdcRipple] },] }, ]; /** @nocollapse */ MdcRippleDirective.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: MdcRipple }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcRippleDirective; }(MdcRippleComponent)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcRippleModule = /** @class */ (function () { function MdcRippleModule() { } MdcRippleModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: [MdcRippleComponent, MdcRippleDirective], declarations: [MdcRippleComponent, MdcRippleDirective], },] }, ]; return MdcRippleModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=ripple.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/select.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/select.es5.js ***! \**********************************************************/ /*! exports provided: MDC_SELECT_DEFAULT_OPTIONS, MdcSelect, MdcSelectChange, MdcSelectIcon, MdcSelectModule, MdcSelectOption */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_SELECT_DEFAULT_OPTIONS", function() { return MDC_SELECT_DEFAULT_OPTIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSelect", function() { return MdcSelect; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSelectChange", function() { return MdcSelectChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSelectIcon", function() { return MdcSelectIcon; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSelectModule", function() { return MdcSelectModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSelectOption", function() { return MdcSelectOption; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/floating-label */ "./node_modules/@angular-mdc/web/esm5/floating-label.es5.js"); /* harmony import */ var _angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/line-ripple */ "./node_modules/@angular-mdc/web/esm5/line-ripple.es5.js"); /* harmony import */ var _angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/notched-outline */ "./node_modules/@angular-mdc/web/esm5/notched-outline.es5.js"); /* harmony import */ var _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/form-field */ "./node_modules/@angular-mdc/web/esm5/form-field.es5.js"); /* harmony import */ var _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/menu */ "./node_modules/@angular-mdc/web/esm5/menu.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /* harmony import */ var _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @angular-mdc/web/list */ "./node_modules/@angular-mdc/web/esm5/list.es5.js"); /* harmony import */ var _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @angular-mdc/web/icon */ "./node_modules/@angular-mdc/web/esm5/icon.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcSelectIcon = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MdcSelectIcon, _super); function MdcSelectIcon() { return _super !== null && _super.apply(this, arguments) || this; } MdcSelectIcon.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcSelectIcon]', exportAs: 'mdcSelectIcon', host: { 'class': 'mdc-select__icon' } },] }, ]; return MdcSelectIcon; }(_angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_14__["MdcIcon"])); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings = { ARIA_HIDDEN: 'aria-hidden', ROLE: 'role' }; var cssClasses = { HELPER_TEXT_PERSISTENT: 'mdc-select-helper-text--persistent', HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCSelectHelperTextFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCSelectHelperTextFoundation, _super); function MDCSelectHelperTextFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCSelectHelperTextFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelectHelperTextFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", { /** * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setAttr: function setAttr() { return undefined; }, removeAttr: function removeAttr() { return undefined; }, setContent: function setContent() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); /** * Sets the content of the helper text field. */ MDCSelectHelperTextFoundation.prototype.setContent = function (content) { this.adapter_.setContent(content); }; /** * Sets the persistency of the helper text. */ MDCSelectHelperTextFoundation.prototype.setPersistent = function (isPersistent) { if (isPersistent) { this.adapter_.addClass(cssClasses.HELPER_TEXT_PERSISTENT); } else { this.adapter_.removeClass(cssClasses.HELPER_TEXT_PERSISTENT); } }; /** * @param isValidation True to make the helper text act as an error validation message. */ MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) { if (isValidation) { this.adapter_.addClass(cssClasses.HELPER_TEXT_VALIDATION_MSG); } else { this.adapter_.removeClass(cssClasses.HELPER_TEXT_VALIDATION_MSG); } }; /** * Makes the helper text visible to screen readers. */ MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () { this.adapter_.removeAttr(strings.ARIA_HIDDEN); }; /** * Sets the validity of the helper text based on the select validity. */ MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) { var helperTextIsPersistent = this.adapter_.hasClass(cssClasses.HELPER_TEXT_PERSISTENT); var helperTextIsValidationMsg = this.adapter_.hasClass(cssClasses.HELPER_TEXT_VALIDATION_MSG); var validationMsgNeedsDisplay = helperTextIsValidationMsg && !selectIsValid; if (validationMsgNeedsDisplay) { this.adapter_.setAttr(strings.ROLE, 'alert'); } else { this.adapter_.removeAttr(strings.ROLE); } if (!helperTextIsPersistent && !validationMsgNeedsDisplay) { this.hide_(); } }; /** * Hides the help text from screen readers. */ MDCSelectHelperTextFoundation.prototype.hide_ = function () { this.adapter_.setAttr(strings.ARIA_HIDDEN, 'true'); }; return MDCSelectHelperTextFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCSelectHelperText = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCSelectHelperText, _super); function MDCSelectHelperText() { return _super !== null && _super.apply(this, arguments) || this; } MDCSelectHelperText.attachTo = function (root) { return new MDCSelectHelperText(root); }; Object.defineProperty(MDCSelectHelperText.prototype, "foundation", { get: function get() { return this.foundation_; }, enumerable: true, configurable: true }); MDCSelectHelperText.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, setAttr: function setAttr(attr, value) { return _this.root_.setAttribute(attr, value); }, removeAttr: function removeAttr(attr) { return _this.root_.removeAttribute(attr); }, setContent: function setContent(content) { _this.root_.textContent = content; } }; // tslint:enable:object-literal-sort-keys return new MDCSelectHelperTextFoundation(adapter); }; return MDCSelectHelperText; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { DISABLED: 'mdc-select--disabled', FOCUSED: 'mdc-select--focused', INVALID: 'mdc-select--invalid', OUTLINED: 'mdc-select--outlined', REQUIRED: 'mdc-select--required', ROOT: 'mdc-select', SELECTED_ITEM_CLASS: 'mdc-list-item--selected', WITH_LEADING_ICON: 'mdc-select--with-leading-icon' }; var strings$1 = { ARIA_CONTROLS: 'aria-controls', ARIA_SELECTED_ATTR: 'aria-selected', CHANGE_EVENT: 'MDCSelect:change', ENHANCED_VALUE_ATTR: 'data-value', HIDDEN_INPUT_SELECTOR: 'input[type="hidden"]', LABEL_SELECTOR: '.mdc-floating-label', LEADING_ICON_SELECTOR: '.mdc-select__icon', LINE_RIPPLE_SELECTOR: '.mdc-line-ripple', MENU_SELECTOR: '.mdc-select__menu', NATIVE_CONTROL_SELECTOR: '.mdc-select__native-control', OUTLINE_SELECTOR: '.mdc-notched-outline', SELECTED_ITEM_SELECTOR: "." + cssClasses$1.SELECTED_ITEM_CLASS, SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text' }; var numbers = { LABEL_SCALE: 0.75 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$2 = { LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above', LABEL_SHAKE: 'mdc-floating-label--shake', ROOT: 'mdc-floating-label' }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFloatingLabelFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCFloatingLabelFoundation, _super); function MDCFloatingLabelFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCFloatingLabelFoundation.defaultAdapter, adapter)) || this; _this.shakeAnimationEndHandler_ = function () { return _this.handleShakeAnimationEnd_(); }; return _this; } Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", { get: function get() { return cssClasses$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", { /** * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, getWidth: function getWidth() { return 0; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCFloatingLabelFoundation.prototype.init = function () { this.adapter_.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; MDCFloatingLabelFoundation.prototype.destroy = function () { this.adapter_.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; /** * Returns the width of the label element. */ MDCFloatingLabelFoundation.prototype.getWidth = function () { return this.adapter_.getWidth(); }; /** * Styles the label to produce a shake animation to indicate an error. * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class. */ MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; if (shouldShake) { this.adapter_.addClass(LABEL_SHAKE); } else { this.adapter_.removeClass(LABEL_SHAKE); } }; /** * Styles the label to float or dock. * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label. */ MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) { var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE; if (shouldFloat) { this.adapter_.addClass(LABEL_FLOAT_ABOVE); } else { this.adapter_.removeClass(LABEL_FLOAT_ABOVE); this.adapter_.removeClass(LABEL_SHAKE); } }; MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; this.adapter_.removeClass(LABEL_SHAKE); }; return MDCFloatingLabelFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFloatingLabel = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCFloatingLabel, _super); function MDCFloatingLabel() { return _super !== null && _super.apply(this, arguments) || this; } MDCFloatingLabel.attachTo = function (root) { return new MDCFloatingLabel(root); }; /** * Styles the label to produce the label shake for errors. * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class. */ MDCFloatingLabel.prototype.shake = function (shouldShake) { this.foundation_.shake(shouldShake); }; /** * Styles the label to float/dock. * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class. */ MDCFloatingLabel.prototype.float = function (shouldFloat) { this.foundation_.float(shouldFloat); }; MDCFloatingLabel.prototype.getWidth = function () { return this.foundation_.getWidth(); }; MDCFloatingLabel.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, getWidth: function getWidth() { return _this.root_.scrollWidth; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.unlisten(evtType, handler); } }; // tslint:enable:object-literal-sort-keys return new MDCFloatingLabelFoundation(adapter); }; return MDCFloatingLabel; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$3 = { LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active', LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCLineRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCLineRippleFoundation, _super); function MDCLineRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCLineRippleFoundation.defaultAdapter, adapter)) || this; _this.transitionEndHandler_ = function (evt) { return _this.handleTransitionEnd(evt); }; return _this; } Object.defineProperty(MDCLineRippleFoundation, "cssClasses", { get: function get() { return cssClasses$3; }, enumerable: true, configurable: true }); Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", { /** * See {@link MDCLineRippleAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setStyle: function setStyle() { return undefined; }, registerEventHandler: function registerEventHandler() { return undefined; }, deregisterEventHandler: function deregisterEventHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCLineRippleFoundation.prototype.init = function () { this.adapter_.registerEventHandler('transitionend', this.transitionEndHandler_); }; MDCLineRippleFoundation.prototype.destroy = function () { this.adapter_.deregisterEventHandler('transitionend', this.transitionEndHandler_); }; MDCLineRippleFoundation.prototype.activate = function () { this.adapter_.removeClass(cssClasses$3.LINE_RIPPLE_DEACTIVATING); this.adapter_.addClass(cssClasses$3.LINE_RIPPLE_ACTIVE); }; MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) { this.adapter_.setStyle('transform-origin', xCoordinate + "px center"); }; MDCLineRippleFoundation.prototype.deactivate = function () { this.adapter_.addClass(cssClasses$3.LINE_RIPPLE_DEACTIVATING); }; MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) { // Wait for the line ripple to be either transparent or opaque // before emitting the animation end event var isDeactivating = this.adapter_.hasClass(cssClasses$3.LINE_RIPPLE_DEACTIVATING); if (evt.propertyName === 'opacity') { if (isDeactivating) { this.adapter_.removeClass(cssClasses$3.LINE_RIPPLE_ACTIVE); this.adapter_.removeClass(cssClasses$3.LINE_RIPPLE_DEACTIVATING); } } }; return MDCLineRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCLineRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCLineRipple, _super); function MDCLineRipple() { return _super !== null && _super.apply(this, arguments) || this; } MDCLineRipple.attachTo = function (root) { return new MDCLineRipple(root); }; /** * Activates the line ripple */ MDCLineRipple.prototype.activate = function () { this.foundation_.activate(); }; /** * Deactivates the line ripple */ MDCLineRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. */ MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) { this.foundation_.setRippleCenter(xCoordinate); }; MDCLineRipple.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, setStyle: function setStyle(propertyName, value) { return _this.root_.style.setProperty(propertyName, value); }, registerEventHandler: function registerEventHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterEventHandler: function deregisterEventHandler(evtType, handler) { return _this.unlisten(evtType, handler); } }; // tslint:enable:object-literal-sort-keys return new MDCLineRippleFoundation(adapter); }; return MDCLineRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$4 = { ANCHOR: 'mdc-menu-surface--anchor', ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed', ANIMATING_OPEN: 'mdc-menu-surface--animating-open', FIXED: 'mdc-menu-surface--fixed', OPEN: 'mdc-menu-surface--open', ROOT: 'mdc-menu-surface' }; // tslint:disable:object-literal-sort-keys var strings$2 = { CLOSED_EVENT: 'MDCMenuSurface:closed', OPENED_EVENT: 'MDCMenuSurface:opened', 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(', ') }; // tslint:enable:object-literal-sort-keys var numbers$1 = { /** Total duration of menu-surface open animation. */ TRANSITION_OPEN_DURATION: 120, /** Total duration of menu-surface close animation. */ TRANSITION_CLOSE_DURATION: 75, /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */ MARGIN_TO_EDGE: 32, /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */ ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67 }; /** * Enum for bits in the {@see Corner) bitmap. */ var CornerBit; (function (CornerBit) { CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM"; CornerBit[CornerBit["CENTER"] = 2] = "CENTER"; CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT"; CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL"; })(CornerBit || (CornerBit = {})); /** * Enum for representing an element corner for positioning the menu-surface. * * The START constants map to LEFT if element directionality is left * to right and RIGHT if the directionality is right to left. * Likewise END maps to RIGHT or LEFT depending on the directionality. */ var Corner; (function (Corner) { Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT"; Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT"; Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT"; Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT"; Corner[Corner["TOP_START"] = 8] = "TOP_START"; Corner[Corner["TOP_END"] = 12] = "TOP_END"; Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START"; Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END"; })(Corner || (Corner = {})); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$5 = { MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected', MENU_SELECTION_GROUP: 'mdc-menu__selection-group', ROOT: 'mdc-menu' }; var strings$3 = { ARIA_SELECTED_ATTR: 'aria-selected', CHECKBOX_SELECTOR: 'input[type="checkbox"]', LIST_SELECTOR: '.mdc-list', SELECTED_EVENT: 'MDCMenu:selected' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. */ function closest(element, selector) { if (element.closest) { return element.closest(selector); } var el = element; while (el) { if (matches(el, selector)) { return el; } el = el.parentElement; } return null; } function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$6 = { LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated', LIST_ITEM_CLASS: 'mdc-list-item', LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected', ROOT: 'mdc-list' }; var strings$4 = { ACTION_EVENT: 'MDCList:action', ARIA_CHECKED: 'aria-checked', ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]', ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]', ARIA_CURRENT: 'aria-current', ARIA_ORIENTATION: 'aria-orientation', ARIA_ORIENTATION_HORIZONTAL: 'horizontal', ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]', ARIA_SELECTED: 'aria-selected', CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled)', CHECKBOX_SELECTOR: 'input[type="checkbox"]:not(:disabled)', CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses$6.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$6.LIST_ITEM_CLASS + " a\n ", ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)', FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses$6.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$6.LIST_ITEM_CLASS + " a,\n ." + cssClasses$6.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses$6.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled)\n ", RADIO_SELECTOR: 'input[type="radio"]:not(:disabled)' }; var numbers$2 = { UNSET_INDEX: -1 }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select']; function isNumberArray(selectedIndex) { return selectedIndex instanceof Array; } var MDCListFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCListFoundation, _super); function MDCListFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCListFoundation.defaultAdapter, adapter)) || this; _this.wrapFocus_ = false; _this.isVertical_ = true; _this.isSingleSelectionList_ = false; _this.selectedIndex_ = numbers$2.UNSET_INDEX; _this.focusedItemIndex_ = numbers$2.UNSET_INDEX; _this.useActivatedClass_ = false; _this.ariaCurrentAttrValue_ = null; _this.isCheckboxList_ = false; _this.isRadioList_ = false; return _this; } Object.defineProperty(MDCListFoundation, "strings", { get: function get() { return strings$4; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "cssClasses", { get: function get() { return cssClasses$6; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "numbers", { get: function get() { return numbers$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "defaultAdapter", { get: function get() { return { addClassForElementIndex: function addClassForElementIndex() { return undefined; }, focusItemAtIndex: function focusItemAtIndex() { return undefined; }, getAttributeForElementIndex: function getAttributeForElementIndex() { return null; }, getFocusedElementIndex: function getFocusedElementIndex() { return 0; }, getListItemCount: function getListItemCount() { return 0; }, hasCheckboxAtIndex: function hasCheckboxAtIndex() { return false; }, hasRadioAtIndex: function hasRadioAtIndex() { return false; }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() { return false; }, isFocusInsideList: function isFocusInsideList() { return false; }, notifyAction: function notifyAction() { return undefined; }, removeClassForElementIndex: function removeClassForElementIndex() { return undefined; }, setAttributeForElementIndex: function setAttributeForElementIndex() { return undefined; }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() { return undefined; }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren() { return undefined; } }; }, enumerable: true, configurable: true }); MDCListFoundation.prototype.layout = function () { if (this.adapter_.getListItemCount() === 0) { return; } if (this.adapter_.hasCheckboxAtIndex(0)) { this.isCheckboxList_ = true; } else if (this.adapter_.hasRadioAtIndex(0)) { this.isRadioList_ = true; } }; /** * Sets the private wrapFocus_ variable. */ MDCListFoundation.prototype.setWrapFocus = function (value) { this.wrapFocus_ = value; }; /** * Sets the isVertical_ private variable. */ MDCListFoundation.prototype.setVerticalOrientation = function (value) { this.isVertical_ = value; }; /** * Sets the isSingleSelectionList_ private variable. */ MDCListFoundation.prototype.setSingleSelection = function (value) { this.isSingleSelectionList_ = value; }; /** * Sets the useActivatedClass_ private variable. */ MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) { this.useActivatedClass_ = useActivated; }; MDCListFoundation.prototype.getSelectedIndex = function () { return this.selectedIndex_; }; MDCListFoundation.prototype.setSelectedIndex = function (index) { if (!this.isIndexValid_(index)) { return; } if (this.isCheckboxList_) { this.setCheckboxAtIndex_(index); } else if (this.isRadioList_) { this.setRadioAtIndex_(index); } else { this.setSingleSelectionAtIndex_(index); } }; /** * Focus in handler for the list items. */ MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) { if (listItemIndex >= 0) { this.adapter_.setTabIndexForListItemChildren(listItemIndex, '0'); } }; /** * Focus out handler for the list items. */ MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) { var _this = this; if (listItemIndex >= 0) { this.adapter_.setTabIndexForListItemChildren(listItemIndex, '-1'); } /** * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus * is moved to next element. */ setTimeout(function () { if (!_this.adapter_.isFocusInsideList()) { _this.setTabindexToFirstSelectedItem_(); } }, 0); }; /** * Key handler for the list. */ MDCListFoundation.prototype.handleKeydown = function (evt, isRootListItem, listItemIndex) { var arrowLeft = evt.key === 'ArrowLeft' || evt.keyCode === 37; var arrowUp = evt.key === 'ArrowUp' || evt.keyCode === 38; var arrowRight = evt.key === 'ArrowRight' || evt.keyCode === 39; var arrowDown = evt.key === 'ArrowDown' || evt.keyCode === 40; var isHome = evt.key === 'Home' || evt.keyCode === 36; var isEnd = evt.key === 'End' || evt.keyCode === 35; var isEnter = evt.key === 'Enter' || evt.keyCode === 13; var isSpace = evt.key === 'Space' || evt.keyCode === 32; var currentIndex = this.adapter_.getFocusedElementIndex(); var nextIndex = numbers$2.UNSET_INDEX; if (currentIndex === numbers$2.UNSET_INDEX) { currentIndex = listItemIndex; if (currentIndex < 0) { // If this event doesn't have a mdc-list-item ancestor from the // current list (not from a sublist), return early. return; } } if (this.isVertical_ && arrowDown || !this.isVertical_ && arrowRight) { this.preventDefaultEvent_(evt); nextIndex = this.focusNextElement(currentIndex); } else if (this.isVertical_ && arrowUp || !this.isVertical_ && arrowLeft) { this.preventDefaultEvent_(evt); nextIndex = this.focusPrevElement(currentIndex); } else if (isHome) { this.preventDefaultEvent_(evt); nextIndex = this.focusFirstElement(); } else if (isEnd) { this.preventDefaultEvent_(evt); nextIndex = this.focusLastElement(); } else if (isEnter || isSpace) { if (isRootListItem) { // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event. var target = evt.target; if (target && target.tagName === 'A' && isEnter) { return; } this.preventDefaultEvent_(evt); if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(currentIndex); } this.adapter_.notifyAction(currentIndex); } } this.focusedItemIndex_ = currentIndex; if (nextIndex >= 0) { this.setTabindexAtIndex_(nextIndex); this.focusedItemIndex_ = nextIndex; } }; /** * Click handler for the list. */ MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) { if (index === numbers$2.UNSET_INDEX) { return; } if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(index, toggleCheckbox); } this.adapter_.notifyAction(index); this.setTabindexAtIndex_(index); this.focusedItemIndex_ = index; }; /** * Focuses the next element on the list. */ MDCListFoundation.prototype.focusNextElement = function (index) { var count = this.adapter_.getListItemCount(); var nextIndex = index + 1; if (nextIndex >= count) { if (this.wrapFocus_) { nextIndex = 0; } else { // Return early because last item is already focused. return index; } } this.adapter_.focusItemAtIndex(nextIndex); return nextIndex; }; /** * Focuses the previous element on the list. */ MDCListFoundation.prototype.focusPrevElement = function (index) { var prevIndex = index - 1; if (prevIndex < 0) { if (this.wrapFocus_) { prevIndex = this.adapter_.getListItemCount() - 1; } else { // Return early because first item is already focused. return index; } } this.adapter_.focusItemAtIndex(prevIndex); return prevIndex; }; MDCListFoundation.prototype.focusFirstElement = function () { this.adapter_.focusItemAtIndex(0); return 0; }; MDCListFoundation.prototype.focusLastElement = function () { var lastIndex = this.adapter_.getListItemCount() - 1; this.adapter_.focusItemAtIndex(lastIndex); return lastIndex; }; /** * Ensures that preventDefault is only called if the containing element doesn't * consume the event, and it will cause an unintended scroll. */ MDCListFoundation.prototype.preventDefaultEvent_ = function (evt) { var target = evt.target; var tagName = ("" + target.tagName).toLowerCase(); if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) { evt.preventDefault(); } }; MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) { if (this.selectedIndex_ === index) { return; } var selectedClassName = cssClasses$6.LIST_ITEM_SELECTED_CLASS; if (this.useActivatedClass_) { selectedClassName = cssClasses$6.LIST_ITEM_ACTIVATED_CLASS; } if (this.selectedIndex_ !== numbers$2.UNSET_INDEX) { this.adapter_.removeClassForElementIndex(this.selectedIndex_, selectedClassName); } this.adapter_.addClassForElementIndex(index, selectedClassName); this.setAriaForSingleSelectionAtIndex_(index); this.selectedIndex_ = index; }; /** * Sets aria attribute for single selection at given index. */ MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) { // Detect the presence of aria-current and get the value only during list initialization when it is in unset state. if (this.selectedIndex_ === numbers$2.UNSET_INDEX) { this.ariaCurrentAttrValue_ = this.adapter_.getAttributeForElementIndex(index, strings$4.ARIA_CURRENT); } var isAriaCurrent = this.ariaCurrentAttrValue_ !== null; var ariaAttribute = isAriaCurrent ? strings$4.ARIA_CURRENT : strings$4.ARIA_SELECTED; if (this.selectedIndex_ !== numbers$2.UNSET_INDEX) { this.adapter_.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false'); } var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true'; this.adapter_.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue); }; /** * Toggles radio at give index. Radio doesn't change the checked state if it is already checked. */ MDCListFoundation.prototype.setRadioAtIndex_ = function (index) { this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, true); if (this.selectedIndex_ !== numbers$2.UNSET_INDEX) { this.adapter_.setAttributeForElementIndex(this.selectedIndex_, strings$4.ARIA_CHECKED, 'false'); } this.adapter_.setAttributeForElementIndex(index, strings$4.ARIA_CHECKED, 'true'); this.selectedIndex_ = index; }; MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) { for (var i = 0; i < this.adapter_.getListItemCount(); i++) { var isChecked = false; if (index.indexOf(i) >= 0) { isChecked = true; } this.adapter_.setCheckedCheckboxOrRadioAtIndex(i, isChecked); this.adapter_.setAttributeForElementIndex(i, strings$4.ARIA_CHECKED, isChecked ? 'true' : 'false'); } this.selectedIndex_ = index; }; MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) { if (this.focusedItemIndex_ === numbers$2.UNSET_INDEX && index !== 0) { // If no list item was selected set first list item's tabindex to -1. // Generally, tabindex is set to 0 on first list item of list that has no preselected items. this.adapter_.setAttributeForElementIndex(0, 'tabindex', '-1'); } else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) { this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_, 'tabindex', '-1'); } this.adapter_.setAttributeForElementIndex(index, 'tabindex', '0'); }; /** * @return Return true if it is single selectin list, checkbox list or radio list. */ MDCListFoundation.prototype.isSelectableList_ = function () { return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_; }; MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () { var targetIndex = 0; if (this.isSelectableList_()) { if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== numbers$2.UNSET_INDEX) { targetIndex = this.selectedIndex_; } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) { targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { return Math.min(currentIndex, minIndex); }); } } this.setTabindexAtIndex_(targetIndex); }; MDCListFoundation.prototype.isIndexValid_ = function (index) { var _this = this; if (index instanceof Array) { if (!this.isCheckboxList_) { throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list'); } if (index.length === 0) { return true; } else { return index.some(function (i) { return _this.isIndexInRange_(i); }); } } else if (typeof index === 'number') { if (this.isCheckboxList_) { throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index); } return this.isIndexInRange_(index); } else { return false; } }; MDCListFoundation.prototype.isIndexInRange_ = function (index) { var listSize = this.adapter_.getListItemCount(); return index >= 0 && index < listSize; }; MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) { if (toggleCheckbox === void 0) { toggleCheckbox = true; } if (this.isCheckboxList_) { this.toggleCheckboxAtIndex_(index, toggleCheckbox); } else { this.setSelectedIndex(index); } }; MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) { var isChecked = this.adapter_.isCheckboxCheckedAtIndex(index); if (toggleCheckbox) { isChecked = !isChecked; this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, isChecked); } this.adapter_.setAttributeForElementIndex(index, strings$4.ARIA_CHECKED, isChecked ? 'true' : 'false'); // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value. var selectedIndexes = this.selectedIndex_ === numbers$2.UNSET_INDEX ? [] : this.selectedIndex_.slice(); if (isChecked) { selectedIndexes.push(index); } else { selectedIndexes = selectedIndexes.filter(function (i) { return i !== index; }); } this.selectedIndex_ = selectedIndexes; }; return MDCListFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCList = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCList, _super); function MDCList() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCList.prototype, "vertical", { set: function set(value) { this.foundation_.setVerticalOrientation(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "listElements", { get: function get() { return [].slice.call(this.root_.querySelectorAll(strings$4.ENABLED_ITEMS_SELECTOR)); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "wrapFocus", { set: function set(value) { this.foundation_.setWrapFocus(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "singleSelection", { set: function set(isSingleSelectionList) { this.foundation_.setSingleSelection(isSingleSelectionList); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "selectedIndex", { get: function get() { return this.foundation_.getSelectedIndex(); }, set: function set(index) { this.foundation_.setSelectedIndex(index); }, enumerable: true, configurable: true }); MDCList.attachTo = function (root) { return new MDCList(root); }; MDCList.prototype.initialSyncWithDOM = function () { this.handleClick_ = this.handleClickEvent_.bind(this); this.handleKeydown_ = this.handleKeydownEvent_.bind(this); this.focusInEventListener_ = this.handleFocusInEvent_.bind(this); this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this); this.listen('keydown', this.handleKeydown_); this.listen('click', this.handleClick_); this.listen('focusin', this.focusInEventListener_); this.listen('focusout', this.focusOutEventListener_); this.layout(); this.initializeListType(); }; MDCList.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten('click', this.handleClick_); this.unlisten('focusin', this.focusInEventListener_); this.unlisten('focusout', this.focusOutEventListener_); }; MDCList.prototype.layout = function () { var direction = this.root_.getAttribute(strings$4.ARIA_ORIENTATION); this.vertical = direction !== strings$4.ARIA_ORIENTATION_HORIZONTAL; // List items need to have at least tabindex=-1 to be focusable. [].slice.call(this.root_.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (el) { el.setAttribute('tabindex', '-1'); }); // Child button/a elements are not tabbable until the list item is focused. [].slice.call(this.root_.querySelectorAll(strings$4.FOCUSABLE_CHILD_ELEMENTS)).forEach(function (el) { return el.setAttribute('tabindex', '-1'); }); this.foundation_.layout(); }; /** * Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio. */ MDCList.prototype.initializeListType = function () { var _this = this; var checkboxListItems = this.root_.querySelectorAll(strings$4.ARIA_ROLE_CHECKBOX_SELECTOR); var singleSelectedListItem = this.root_.querySelector("\n ." + cssClasses$6.LIST_ITEM_ACTIVATED_CLASS + ",\n ." + cssClasses$6.LIST_ITEM_SELECTED_CLASS + "\n "); var radioSelectedListItem = this.root_.querySelector(strings$4.ARIA_CHECKED_RADIO_SELECTOR); if (checkboxListItems.length) { var preselectedItems = this.root_.querySelectorAll(strings$4.ARIA_CHECKED_CHECKBOX_SELECTOR); this.selectedIndex = [].map.call(preselectedItems, function (listItem) { return _this.listElements.indexOf(listItem); }); } else if (singleSelectedListItem) { if (singleSelectedListItem.classList.contains(cssClasses$6.LIST_ITEM_ACTIVATED_CLASS)) { this.foundation_.setUseActivatedClass(true); } this.singleSelection = true; this.selectedIndex = this.listElements.indexOf(singleSelectedListItem); } else if (radioSelectedListItem) { this.selectedIndex = this.listElements.indexOf(radioSelectedListItem); } }; MDCList.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClassForElementIndex: function addClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.add(className); } }, focusItemAtIndex: function focusItemAtIndex(index) { var element = _this.listElements[index]; if (element) { element.focus(); } }, getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) { return _this.listElements[index].getAttribute(attr); }, getFocusedElementIndex: function getFocusedElementIndex() { return _this.listElements.indexOf(document.activeElement); }, getListItemCount: function getListItemCount() { return _this.listElements.length; }, hasCheckboxAtIndex: function hasCheckboxAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(strings$4.CHECKBOX_SELECTOR); }, hasRadioAtIndex: function hasRadioAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(strings$4.RADIO_SELECTOR); }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(strings$4.CHECKBOX_SELECTOR); return toggleEl.checked; }, isFocusInsideList: function isFocusInsideList() { return _this.root_.contains(document.activeElement); }, notifyAction: function notifyAction(index) { _this.emit(strings$4.ACTION_EVENT, { index: index }, /** shouldBubble */ true); }, removeClassForElementIndex: function removeClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.remove(className); } }, setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { var element = _this.listElements[index]; if (element) { element.setAttribute(attr, value); } }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(strings$4.CHECKBOX_RADIO_SELECTOR); toggleEl.checked = isChecked; var event = document.createEvent('Event'); event.initEvent('change', true, true); toggleEl.dispatchEvent(event); }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { var element = _this.listElements[listItemIndex]; var listItemChildren = [].slice.call(element.querySelectorAll(strings$4.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)); listItemChildren.forEach(function (el) { return el.setAttribute('tabindex', tabIndexValue); }); } }; return new MDCListFoundation(adapter); }; /** * Used to figure out which list item this event is targetting. Or returns -1 if * there is no list item */ MDCList.prototype.getListItemIndex_ = function (evt) { var eventTarget = evt.target; var nearestParent = closest(eventTarget, "." + cssClasses$6.LIST_ITEM_CLASS + ", ." + cssClasses$6.ROOT); // Get the index of the element if it is a list item. if (nearestParent && matches(nearestParent, "." + cssClasses$6.LIST_ITEM_CLASS)) { return this.listElements.indexOf(nearestParent); } return -1; }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusInEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation_.handleFocusIn(evt, index); }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusOutEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation_.handleFocusOut(evt, index); }; /** * Used to figure out which element was focused when keydown event occurred before sending the event to the * foundation. */ MDCList.prototype.handleKeydownEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; if (index >= 0) { this.foundation_.handleKeydown(evt, target.classList.contains(cssClasses$6.LIST_ITEM_CLASS), index); } }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleClickEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events. var toggleCheckbox = !matches(target, strings$4.CHECKBOX_RADIO_SELECTOR); this.foundation_.handleClick(index, toggleCheckbox); }; return MDCList; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenuSurfaceFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCMenuSurfaceFoundation, _super); function MDCMenuSurfaceFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCMenuSurfaceFoundation.defaultAdapter, adapter)) || this; _this.isOpen_ = false; _this.isQuickOpen_ = false; _this.isHoistedElement_ = false; _this.isFixedPosition_ = false; _this.openAnimationEndTimerId_ = 0; _this.closeAnimationEndTimerId_ = 0; _this.animationRequestId_ = 0; _this.anchorCorner_ = Corner.TOP_START; _this.anchorMargin_ = { top: 0, right: 0, bottom: 0, left: 0 }; _this.position_ = { x: 0, y: 0 }; return _this; } Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", { get: function get() { return cssClasses$4; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "strings", { get: function get() { return strings$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", { get: function get() { return numbers$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", { get: function get() { return Corner; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", { /** * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, hasAnchor: function hasAnchor() { return false; }, isElementInContainer: function isElementInContainer() { return false; }, isFocused: function isFocused() { return false; }, isFirstElementFocused: function isFirstElementFocused() { return false; }, isLastElementFocused: function isLastElementFocused() { return false; }, isRtl: function isRtl() { return false; }, getInnerDimensions: function getInnerDimensions() { return { height: 0, width: 0 }; }, getAnchorDimensions: function getAnchorDimensions() { return null; }, getWindowDimensions: function getWindowDimensions() { return { height: 0, width: 0 }; }, getBodyDimensions: function getBodyDimensions() { return { height: 0, width: 0 }; }, getWindowScroll: function getWindowScroll() { return { x: 0, y: 0 }; }, setPosition: function setPosition() { return undefined; }, setMaxHeight: function setMaxHeight() { return undefined; }, setTransformOrigin: function setTransformOrigin() { return undefined; }, saveFocus: function saveFocus() { return undefined; }, restoreFocus: function restoreFocus() { return undefined; }, focusFirstElement: function focusFirstElement() { return undefined; }, focusLastElement: function focusLastElement() { return undefined; }, notifyClose: function notifyClose() { return undefined; }, notifyOpen: function notifyOpen() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCMenuSurfaceFoundation.prototype.init = function () { var _a = MDCMenuSurfaceFoundation.cssClasses, ROOT = _a.ROOT, OPEN = _a.OPEN; if (!this.adapter_.hasClass(ROOT)) { throw new Error(ROOT + " class required in root element."); } if (this.adapter_.hasClass(OPEN)) { this.isOpen_ = true; } }; MDCMenuSurfaceFoundation.prototype.destroy = function () { clearTimeout(this.openAnimationEndTimerId_); clearTimeout(this.closeAnimationEndTimerId_); // Cancel any currently running animations. cancelAnimationFrame(this.animationRequestId_); }; /** * @param corner Default anchor corner alignment of top-left menu surface corner. */ MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) { this.anchorCorner_ = corner; }; /** * @param margin Set of margin values from anchor. */ MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) { this.anchorMargin_.top = margin.top || 0; this.anchorMargin_.right = margin.right || 0; this.anchorMargin_.bottom = margin.bottom || 0; this.anchorMargin_.left = margin.left || 0; }; /** Used to indicate if the menu-surface is hoisted to the body. */ MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) { this.isHoistedElement_ = isHoisted; }; /** Used to set the menu-surface calculations based on a fixed position menu. */ MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) { this.isFixedPosition_ = isFixedPosition; }; /** Sets the menu-surface position on the page. */ MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) { this.position_.x = this.isFinite_(x) ? x : 0; this.position_.y = this.isFinite_(y) ? y : 0; }; MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) { this.isQuickOpen_ = quickOpen; }; MDCMenuSurfaceFoundation.prototype.isOpen = function () { return this.isOpen_; }; /** * Open the menu surface. */ MDCMenuSurfaceFoundation.prototype.open = function () { var _this = this; this.adapter_.saveFocus(); if (!this.isQuickOpen_) { this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); } this.animationRequestId_ = requestAnimationFrame(function () { _this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); _this.dimensions_ = _this.adapter_.getInnerDimensions(); _this.autoPosition_(); if (_this.isQuickOpen_) { _this.adapter_.notifyOpen(); } else { _this.openAnimationEndTimerId_ = setTimeout(function () { _this.openAnimationEndTimerId_ = 0; _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN); _this.adapter_.notifyOpen(); }, numbers$1.TRANSITION_OPEN_DURATION); } }); this.isOpen_ = true; }; /** * Closes the menu surface. */ MDCMenuSurfaceFoundation.prototype.close = function () { var _this = this; if (!this.isQuickOpen_) { this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); } requestAnimationFrame(function () { _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN); if (_this.isQuickOpen_) { _this.adapter_.notifyClose(); } else { _this.closeAnimationEndTimerId_ = setTimeout(function () { _this.closeAnimationEndTimerId_ = 0; _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED); _this.adapter_.notifyClose(); }, numbers$1.TRANSITION_CLOSE_DURATION); } }); this.isOpen_ = false; this.maybeRestoreFocus_(); }; /** Handle clicks and close if not within menu-surface element. */ MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) { var el = evt.target; if (this.adapter_.isElementInContainer(el)) { return; } this.close(); }; /** Handle keys that close the surface. */ MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) { var keyCode = evt.keyCode, key = evt.key, shiftKey = evt.shiftKey; var isEscape = key === 'Escape' || keyCode === 27; var isTab = key === 'Tab' || keyCode === 9; if (isEscape) { this.close(); } else if (isTab) { if (this.adapter_.isLastElementFocused() && !shiftKey) { this.adapter_.focusFirstElement(); evt.preventDefault(); } else if (this.adapter_.isFirstElementFocused() && shiftKey) { this.adapter_.focusLastElement(); evt.preventDefault(); } } }; MDCMenuSurfaceFoundation.prototype.autoPosition_ = function () { var _a; // Compute measurements for autoposition methods reuse. this.measurements_ = this.getAutoLayoutMeasurements_(); var corner = this.getOriginCorner_(); var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight_(corner); var verticalAlignment = this.hasBit_(corner, CornerBit.BOTTOM) ? 'bottom' : 'top'; var horizontalAlignment = this.hasBit_(corner, CornerBit.RIGHT) ? 'right' : 'left'; var horizontalOffset = this.getHorizontalOriginOffset_(corner); var verticalOffset = this.getVerticalOriginOffset_(corner); var _b = this.measurements_, anchorSize = _b.anchorSize, surfaceSize = _b.surfaceSize; var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a); // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner. if (anchorSize.width / surfaceSize.width > numbers$1.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) { horizontalAlignment = 'center'; } // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element if (this.isHoistedElement_ || this.isFixedPosition_) { this.adjustPositionForHoistedElement_(position); } this.adapter_.setTransformOrigin(horizontalAlignment + " " + verticalAlignment); this.adapter_.setPosition(position); this.adapter_.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : ''); }; /** * @return Measurements used to position menu surface popup. */ MDCMenuSurfaceFoundation.prototype.getAutoLayoutMeasurements_ = function () { var anchorRect = this.adapter_.getAnchorDimensions(); var bodySize = this.adapter_.getBodyDimensions(); var viewportSize = this.adapter_.getWindowDimensions(); var windowScroll = this.adapter_.getWindowScroll(); if (!anchorRect) { // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together anchorRect = { top: this.position_.y, right: this.position_.x, bottom: this.position_.y, left: this.position_.x, width: 0, height: 0 }; // tslint:enable:object-literal-sort-keys } return { anchorSize: anchorRect, bodySize: bodySize, surfaceSize: this.dimensions_, viewportDistance: { // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together top: anchorRect.top, right: viewportSize.width - anchorRect.right, bottom: viewportSize.height - anchorRect.bottom, left: anchorRect.left }, viewportSize: viewportSize, windowScroll: windowScroll }; }; /** * Computes the corner of the anchor from which to animate and position the menu surface. */ MDCMenuSurfaceFoundation.prototype.getOriginCorner_ = function () { // Defaults: open from the top left. var corner = Corner.TOP_LEFT; var _a = this.measurements_, viewportDistance = _a.viewportDistance, anchorSize = _a.anchorSize, surfaceSize = _a.surfaceSize; var isBottomAligned = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var availableTop = isBottomAligned ? viewportDistance.top + anchorSize.height + this.anchorMargin_.bottom : viewportDistance.top + this.anchorMargin_.top; var availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom : viewportDistance.bottom + anchorSize.height - this.anchorMargin_.top; var topOverflow = surfaceSize.height - availableTop; var bottomOverflow = surfaceSize.height - availableBottom; if (bottomOverflow > 0 && topOverflow < bottomOverflow) { corner = this.setBit_(corner, CornerBit.BOTTOM); } var isRtl = this.adapter_.isRtl(); var isFlipRtl = this.hasBit_(this.anchorCorner_, CornerBit.FLIP_RTL); var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.RIGHT); var isAlignedRight = avoidHorizontalOverlap && !isRtl || !avoidHorizontalOverlap && isFlipRtl && isRtl; var availableLeft = isAlignedRight ? viewportDistance.left + anchorSize.width + this.anchorMargin_.right : viewportDistance.left + this.anchorMargin_.left; var availableRight = isAlignedRight ? viewportDistance.right - this.anchorMargin_.right : viewportDistance.right + anchorSize.width - this.anchorMargin_.left; var leftOverflow = surfaceSize.width - availableLeft; var rightOverflow = surfaceSize.width - availableRight; if (leftOverflow < 0 && isAlignedRight && isRtl || avoidHorizontalOverlap && !isAlignedRight && leftOverflow < 0 || rightOverflow > 0 && leftOverflow < rightOverflow) { corner = this.setBit_(corner, CornerBit.RIGHT); } return corner; }; /** * @param corner Origin corner of the menu surface. * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set. */ MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight_ = function (corner) { var viewportDistance = this.measurements_.viewportDistance; var maxHeight = 0; var isBottomAligned = this.hasBit_(corner, CornerBit.BOTTOM); var isBottomAnchored = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE; // When maximum height is not specified, it is handled from CSS. if (isBottomAligned) { maxHeight = viewportDistance.top + this.anchorMargin_.top - MARGIN_TO_EDGE; if (!isBottomAnchored) { maxHeight += this.measurements_.anchorSize.height; } } else { maxHeight = viewportDistance.bottom - this.anchorMargin_.bottom + this.measurements_.anchorSize.height - MARGIN_TO_EDGE; if (isBottomAnchored) { maxHeight -= this.measurements_.anchorSize.height; } } return maxHeight; }; /** * @param corner Origin corner of the menu surface. * @return Horizontal offset of menu surface origin corner from corresponding anchor corner. */ MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset_ = function (corner) { var anchorSize = this.measurements_.anchorSize; // isRightAligned corresponds to using the 'right' property on the surface. var isRightAligned = this.hasBit_(corner, CornerBit.RIGHT); var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.RIGHT); if (isRightAligned) { var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.left : this.anchorMargin_.right; // For hoisted or fixed elements, adjust the offset by the difference between viewport width and body width so // when we calculate the right value (`adjustPositionForHoistedElement_`) based on the element position, // the right property is correct. if (this.isHoistedElement_ || this.isFixedPosition_) { return rightOffset - (this.measurements_.viewportSize.width - this.measurements_.bodySize.width); } return rightOffset; } return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.right : this.anchorMargin_.left; }; /** * @param corner Origin corner of the menu surface. * @return Vertical offset of menu surface origin corner from corresponding anchor corner. */ MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset_ = function (corner) { var anchorSize = this.measurements_.anchorSize; var isBottomAligned = this.hasBit_(corner, CornerBit.BOTTOM); var avoidVerticalOverlap = this.hasBit_(this.anchorCorner_, CornerBit.BOTTOM); var y = 0; if (isBottomAligned) { y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin_.top : -this.anchorMargin_.bottom; } else { y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin_.bottom : this.anchorMargin_.top; } return y; }; /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */ MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement_ = function (position) { var e_1, _a; var _b = this.measurements_, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance; var props = Object.keys(position); try { for (var props_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__values"])(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) { var prop = props_1_1.value; var value = position[prop] || 0; // Hoisted surfaces need to have the anchor elements location on the page added to the // position properties for proper alignment on the body. value += viewportDistance[prop]; // Surfaces that are absolutely positioned need to have additional calculations for scroll // and bottom positioning. if (!this.isFixedPosition_) { if (prop === 'top') { value += windowScroll.y; } else if (prop === 'bottom') { value -= windowScroll.y; } else if (prop === 'left') { value += windowScroll.x; } else { // prop === 'right' value -= windowScroll.x; } } position[prop] = value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1); } finally { if (e_1) throw e_1.error; } } }; /** * The last focused element when the menu surface was opened should regain focus, if the user is * focused on or within the menu surface when it is closed. */ MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus_ = function () { var isRootFocused = this.adapter_.isFocused(); var childHasFocus = document.activeElement && this.adapter_.isElementInContainer(document.activeElement); if (isRootFocused || childHasFocus) { this.adapter_.restoreFocus(); } }; MDCMenuSurfaceFoundation.prototype.hasBit_ = function (corner, bit) { return Boolean(corner & bit); // tslint:disable-line:no-bitwise }; MDCMenuSurfaceFoundation.prototype.setBit_ = function (corner, bit) { return corner | bit; // tslint:disable-line:no-bitwise }; /** * isFinite that doesn't force conversion to number type. * Equivalent to Number.isFinite in ES2015, which is not supported in IE. */ MDCMenuSurfaceFoundation.prototype.isFinite_ = function (num) { return typeof num === 'number' && isFinite(num); }; return MDCMenuSurfaceFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cachedCssTransformPropertyName_; /** * Returns the name of the correct transform property to use on the current browser. */ function getTransformPropertyName(globalObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } if (cachedCssTransformPropertyName_ === undefined || forceRefresh) { var el = globalObj.document.createElement('div'); cachedCssTransformPropertyName_ = 'transform' in el.style ? 'transform' : 'webkitTransform'; } return cachedCssTransformPropertyName_; } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenuSurface = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCMenuSurface, _super); function MDCMenuSurface() { return _super !== null && _super.apply(this, arguments) || this; } MDCMenuSurface.attachTo = function (root) { return new MDCMenuSurface(root); }; MDCMenuSurface.prototype.initialSyncWithDOM = function () { var _this = this; var parentEl = this.root_.parentElement; this.anchorElement = parentEl && parentEl.classList.contains(cssClasses$4.ANCHOR) ? parentEl : null; if (this.root_.classList.contains(cssClasses$4.FIXED)) { this.setFixedPosition(true); } this.handleKeydown_ = function (evt) { return _this.foundation_.handleKeydown(evt); }; this.handleBodyClick_ = function (evt) { return _this.foundation_.handleBodyClick(evt); }; this.registerBodyClickListener_ = function () { return document.body.addEventListener('click', _this.handleBodyClick_); }; this.deregisterBodyClickListener_ = function () { return document.body.removeEventListener('click', _this.handleBodyClick_); }; this.listen('keydown', this.handleKeydown_); this.listen(strings$2.OPENED_EVENT, this.registerBodyClickListener_); this.listen(strings$2.CLOSED_EVENT, this.deregisterBodyClickListener_); }; MDCMenuSurface.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten(strings$2.OPENED_EVENT, this.registerBodyClickListener_); this.unlisten(strings$2.CLOSED_EVENT, this.deregisterBodyClickListener_); _super.prototype.destroy.call(this); }; Object.defineProperty(MDCMenuSurface.prototype, "open", { get: function get() { return this.foundation_.isOpen(); }, set: function set(value) { if (value) { var focusableElements = this.root_.querySelectorAll(strings$2.FOCUSABLE_ELEMENTS); this.firstFocusableElement_ = focusableElements[0]; this.lastFocusableElement_ = focusableElements[focusableElements.length - 1]; this.foundation_.open(); } else { this.foundation_.close(); } }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", { set: function set(quickOpen) { this.foundation_.setQuickOpen(quickOpen); }, enumerable: true, configurable: true }); /** * Removes the menu-surface from it's current location and appends it to the * body to overcome any overflow:hidden issues. */ MDCMenuSurface.prototype.hoistMenuToBody = function () { document.body.appendChild(this.root_); this.setIsHoisted(true); }; /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) { this.foundation_.setIsHoisted(isHoisted); }; /** Sets the element that the menu-surface is anchored to. */ MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) { this.anchorElement = element; }; /** Sets the menu-surface to position: fixed. */ MDCMenuSurface.prototype.setFixedPosition = function (isFixed) { if (isFixed) { this.root_.classList.add(cssClasses$4.FIXED); } else { this.root_.classList.remove(cssClasses$4.FIXED); } this.foundation_.setFixedPosition(isFixed); }; /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */ MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) { this.foundation_.setAbsolutePosition(x, y); this.setIsHoisted(true); }; /** * @param corner Default anchor corner alignment of top-left surface corner. */ MDCMenuSurface.prototype.setAnchorCorner = function (corner) { this.foundation_.setAnchorCorner(corner); }; MDCMenuSurface.prototype.setAnchorMargin = function (margin) { this.foundation_.setAnchorMargin(margin); }; MDCMenuSurface.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, hasAnchor: function hasAnchor() { return !!_this.anchorElement; }, notifyClose: function notifyClose() { return _this.emit(MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {}); }, notifyOpen: function notifyOpen() { return _this.emit(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {}); }, isElementInContainer: function isElementInContainer(el) { return _this.root_.contains(el); }, isRtl: function isRtl() { return getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl'; }, setTransformOrigin: function setTransformOrigin(origin) { var propertyName = getTransformPropertyName(window) + "-origin"; _this.root_.style.setProperty(propertyName, origin); }, isFocused: function isFocused() { return document.activeElement === _this.root_; }, saveFocus: function saveFocus() { _this.previousFocus_ = document.activeElement; }, restoreFocus: function restoreFocus() { if (_this.root_.contains(document.activeElement)) { if (_this.previousFocus_ && _this.previousFocus_.focus) { _this.previousFocus_.focus(); } } }, isFirstElementFocused: function isFirstElementFocused() { return _this.firstFocusableElement_ ? _this.firstFocusableElement_ === document.activeElement : false; }, isLastElementFocused: function isLastElementFocused() { return _this.lastFocusableElement_ ? _this.lastFocusableElement_ === document.activeElement : false; }, focusFirstElement: function focusFirstElement() { return _this.firstFocusableElement_ && _this.firstFocusableElement_.focus && _this.firstFocusableElement_.focus(); }, focusLastElement: function focusLastElement() { return _this.lastFocusableElement_ && _this.lastFocusableElement_.focus && _this.lastFocusableElement_.focus(); }, getInnerDimensions: function getInnerDimensions() { return { width: _this.root_.offsetWidth, height: _this.root_.offsetHeight }; }, getAnchorDimensions: function getAnchorDimensions() { return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null; }, getWindowDimensions: function getWindowDimensions() { return { width: window.innerWidth, height: window.innerHeight }; }, getBodyDimensions: function getBodyDimensions() { return { width: document.body.clientWidth, height: document.body.clientHeight }; }, getWindowScroll: function getWindowScroll() { return { x: window.pageXOffset, y: window.pageYOffset }; }, setPosition: function setPosition(position) { _this.root_.style.left = 'left' in position ? position.left + "px" : ''; _this.root_.style.right = 'right' in position ? position.right + "px" : ''; _this.root_.style.top = 'top' in position ? position.top + "px" : ''; _this.root_.style.bottom = 'bottom' in position ? position.bottom + "px" : ''; }, setMaxHeight: function setMaxHeight(height) { _this.root_.style.maxHeight = height; } }; // tslint:enable:object-literal-sort-keys return new MDCMenuSurfaceFoundation(adapter); }; return MDCMenuSurface; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenuFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCMenuFoundation, _super); function MDCMenuFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCMenuFoundation.defaultAdapter, adapter)) || this; _this.closeAnimationEndTimerId_ = 0; return _this; } Object.defineProperty(MDCMenuFoundation, "cssClasses", { get: function get() { return cssClasses$5; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuFoundation, "strings", { get: function get() { return strings$3; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenuFoundation, "defaultAdapter", { /** * @see {@link MDCMenuAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClassToElementAtIndex: function addClassToElementAtIndex() { return undefined; }, removeClassFromElementAtIndex: function removeClassFromElementAtIndex() { return undefined; }, addAttributeToElementAtIndex: function addAttributeToElementAtIndex() { return undefined; }, removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() { return undefined; }, elementContainsClass: function elementContainsClass() { return false; }, closeSurface: function closeSurface() { return undefined; }, getElementIndex: function getElementIndex() { return -1; }, getParentElement: function getParentElement() { return null; }, getSelectedElementIndex: function getSelectedElementIndex() { return -1; }, notifySelected: function notifySelected() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCMenuFoundation.prototype.destroy = function () { if (this.closeAnimationEndTimerId_) { clearTimeout(this.closeAnimationEndTimerId_); } this.adapter_.closeSurface(); }; MDCMenuFoundation.prototype.handleKeydown = function (evt) { var key = evt.key, keyCode = evt.keyCode; var isTab = key === 'Tab' || keyCode === 9; if (isTab) { this.adapter_.closeSurface(); } }; MDCMenuFoundation.prototype.handleItemAction = function (listItem) { var _this = this; var index = this.adapter_.getElementIndex(listItem); if (index < 0) { return; } this.adapter_.notifySelected({ index: index }); this.adapter_.closeSurface(); // Wait for the menu to close before adding/removing classes that affect styles. this.closeAnimationEndTimerId_ = setTimeout(function () { var selectionGroup = _this.getSelectionGroup_(listItem); if (selectionGroup) { _this.handleSelectionGroup_(selectionGroup, index); } }, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION); }; /** * Handles toggling the selected classes in a selection group when a selection is made. */ MDCMenuFoundation.prototype.handleSelectionGroup_ = function (selectionGroup, index) { // De-select the previous selection in this group. var selectedIndex = this.adapter_.getSelectedElementIndex(selectionGroup); if (selectedIndex >= 0) { this.adapter_.removeAttributeFromElementAtIndex(selectedIndex, strings$3.ARIA_SELECTED_ATTR); this.adapter_.removeClassFromElementAtIndex(selectedIndex, cssClasses$5.MENU_SELECTED_LIST_ITEM); } // Select the new list item in this group. this.adapter_.addClassToElementAtIndex(index, cssClasses$5.MENU_SELECTED_LIST_ITEM); this.adapter_.addAttributeToElementAtIndex(index, strings$3.ARIA_SELECTED_ATTR, 'true'); }; /** * Returns the parent selection group of an element if one exists. */ MDCMenuFoundation.prototype.getSelectionGroup_ = function (listItem) { var parent = this.adapter_.getParentElement(listItem); if (!parent) { return null; } var isGroup = this.adapter_.elementContainsClass(parent, cssClasses$5.MENU_SELECTION_GROUP); // Iterate through ancestors until we find the group or get to the list. while (!isGroup && parent && !this.adapter_.elementContainsClass(parent, MDCListFoundation.cssClasses.ROOT)) { parent = this.adapter_.getParentElement(parent); isGroup = parent ? this.adapter_.elementContainsClass(parent, cssClasses$5.MENU_SELECTION_GROUP) : false; } if (isGroup) { return parent; } else { return null; } }; return MDCMenuFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCMenu = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCMenu, _super); function MDCMenu() { return _super !== null && _super.apply(this, arguments) || this; } MDCMenu.attachTo = function (root) { return new MDCMenu(root); }; MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) { if (menuSurfaceFactory === void 0) { menuSurfaceFactory = function menuSurfaceFactory(el) { return new MDCMenuSurface(el); }; } if (listFactory === void 0) { listFactory = function listFactory(el) { return new MDCList(el); }; } this.menuSurfaceFactory_ = menuSurfaceFactory; this.listFactory_ = listFactory; }; MDCMenu.prototype.initialSyncWithDOM = function () { var _this = this; this.menuSurface_ = this.menuSurfaceFactory_(this.root_); var list = this.root_.querySelector(strings$3.LIST_SELECTOR); if (list) { this.list_ = this.listFactory_(list); this.list_.wrapFocus = true; } else { this.list_ = null; } this.handleKeydown_ = function (evt) { return _this.foundation_.handleKeydown(evt); }; this.handleItemAction_ = function (evt) { return _this.foundation_.handleItemAction(_this.items[evt.detail.index]); }; this.afterOpenedCallback_ = function () { return _this.handleAfterOpened_(); }; this.menuSurface_.listen(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.afterOpenedCallback_); this.listen('keydown', this.handleKeydown_); this.listen(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_); }; MDCMenu.prototype.destroy = function () { if (this.list_) { this.list_.destroy(); } this.menuSurface_.destroy(); this.menuSurface_.unlisten(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.afterOpenedCallback_); this.unlisten('keydown', this.handleKeydown_); this.unlisten(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_); _super.prototype.destroy.call(this); }; Object.defineProperty(MDCMenu.prototype, "open", { get: function get() { return this.menuSurface_.open; }, set: function set(value) { this.menuSurface_.open = value; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenu.prototype, "wrapFocus", { get: function get() { return this.list_ ? this.list_.wrapFocus : false; }, set: function set(value) { if (this.list_) { this.list_.wrapFocus = value; } }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenu.prototype, "items", { /** * Return the items within the menu. Note that this only contains the set of elements within * the items container that are proper list items, and not supplemental / presentational DOM * elements. */ get: function get() { return this.list_ ? this.list_.listElements : []; }, enumerable: true, configurable: true }); Object.defineProperty(MDCMenu.prototype, "quickOpen", { set: function set(quickOpen) { this.menuSurface_.quickOpen = quickOpen; }, enumerable: true, configurable: true }); /** * @param corner Default anchor corner alignment of top-left menu corner. */ MDCMenu.prototype.setAnchorCorner = function (corner) { this.menuSurface_.setAnchorCorner(corner); }; MDCMenu.prototype.setAnchorMargin = function (margin) { this.menuSurface_.setAnchorMargin(margin); }; /** * @return The item within the menu at the index specified. */ MDCMenu.prototype.getOptionByIndex = function (index) { var items = this.items; if (index < items.length) { return this.items[index]; } else { return null; } }; MDCMenu.prototype.setFixedPosition = function (isFixed) { this.menuSurface_.setFixedPosition(isFixed); }; MDCMenu.prototype.hoistMenuToBody = function () { this.menuSurface_.hoistMenuToBody(); }; MDCMenu.prototype.setIsHoisted = function (isHoisted) { this.menuSurface_.setIsHoisted(isHoisted); }; MDCMenu.prototype.setAbsolutePosition = function (x, y) { this.menuSurface_.setAbsolutePosition(x, y); }; /** * Sets the element that the menu-surface is anchored to. */ MDCMenu.prototype.setAnchorElement = function (element) { this.menuSurface_.anchorElement = element; }; MDCMenu.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClassToElementAtIndex: function addClassToElementAtIndex(index, className) { var list = _this.items; list[index].classList.add(className); }, removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) { var list = _this.items; list[index].classList.remove(className); }, addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) { var list = _this.items; list[index].setAttribute(attr, value); }, removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) { var list = _this.items; list[index].removeAttribute(attr); }, elementContainsClass: function elementContainsClass(element, className) { return element.classList.contains(className); }, closeSurface: function closeSurface() { return _this.open = false; }, getElementIndex: function getElementIndex(element) { return _this.items.indexOf(element); }, getParentElement: function getParentElement(element) { return element.parentElement; }, getSelectedElementIndex: function getSelectedElementIndex(selectionGroup) { var selectedListItem = selectionGroup.querySelector("." + cssClasses$5.MENU_SELECTED_LIST_ITEM); return selectedListItem ? _this.items.indexOf(selectedListItem) : -1; }, notifySelected: function notifySelected(evtData) { return _this.emit(strings$3.SELECTED_EVENT, { index: evtData.index, item: _this.items[evtData.index] }); } }; // tslint:enable:object-literal-sort-keys return new MDCMenuFoundation(adapter); }; MDCMenu.prototype.handleAfterOpened_ = function () { var list = this.items; if (list.length > 0) { list[0].focus(); } }; return MDCMenu; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$5 = { NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch' }; var numbers$3 = { // This should stay in sync with $mdc-notched-outline-padding * 2. NOTCH_ELEMENT_PADDING: 8 }; var cssClasses$7 = { NO_LABEL: 'mdc-notched-outline--no-label', OUTLINE_NOTCHED: 'mdc-notched-outline--notched', OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded' }; /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCNotchedOutlineFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCNotchedOutlineFoundation, _super); function MDCNotchedOutlineFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCNotchedOutlineFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCNotchedOutlineFoundation, "strings", { get: function get() { return strings$5; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", { get: function get() { return cssClasses$7; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", { get: function get() { return numbers$3; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", { /** * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, setNotchWidthProperty: function setNotchWidthProperty() { return undefined; }, removeNotchWidthProperty: function removeNotchWidthProperty() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); /** * Adds the outline notched selector and updates the notch width calculated based off of notchWidth. */ MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) { var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; if (notchWidth > 0) { notchWidth += numbers$3.NOTCH_ELEMENT_PADDING; // Add padding from left/right. } this.adapter_.setNotchWidthProperty(notchWidth); this.adapter_.addClass(OUTLINE_NOTCHED); }; /** * Removes notched outline selector to close the notch in the outline. */ MDCNotchedOutlineFoundation.prototype.closeNotch = function () { var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; this.adapter_.removeClass(OUTLINE_NOTCHED); this.adapter_.removeNotchWidthProperty(); }; return MDCNotchedOutlineFoundation; }(MDCFoundation); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCNotchedOutline = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCNotchedOutline, _super); function MDCNotchedOutline() { return _super !== null && _super.apply(this, arguments) || this; } MDCNotchedOutline.attachTo = function (root) { return new MDCNotchedOutline(root); }; MDCNotchedOutline.prototype.initialSyncWithDOM = function () { this.notchElement_ = this.root_.querySelector(strings$5.NOTCH_ELEMENT_SELECTOR); var label = this.root_.querySelector('.' + MDCFloatingLabelFoundation.cssClasses.ROOT); if (label) { label.style.transitionDuration = '0s'; this.root_.classList.add(cssClasses$7.OUTLINE_UPGRADED); requestAnimationFrame(function () { label.style.transitionDuration = ''; }); } else { this.root_.classList.add(cssClasses$7.NO_LABEL); } }; /** * Updates classes and styles to open the notch to the specified width. * @param notchWidth The notch width in the outline. */ MDCNotchedOutline.prototype.notch = function (notchWidth) { this.foundation_.notch(notchWidth); }; /** * Updates classes and styles to close the notch. */ MDCNotchedOutline.prototype.closeNotch = function () { this.foundation_.closeNotch(); }; MDCNotchedOutline.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, setNotchWidthProperty: function setNotchWidthProperty(width) { return _this.notchElement_.style.setProperty('width', width + 'px'); }, removeNotchWidthProperty: function removeNotchWidthProperty() { return _this.notchElement_.style.removeProperty('width'); } }; // tslint:enable:object-literal-sort-keys return new MDCNotchedOutlineFoundation(adapter); }; return MDCNotchedOutline; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$8 = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings$6 = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers$4 = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses$8; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings$6; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers$4; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers$4.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCSelectFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCSelectFoundation, _super); /* istanbul ignore next: optional argument is not a branch statement */ /** * @param adapter * @param foundationMap Map from subcomponent names to their subfoundations. */ function MDCSelectFoundation(adapter, foundationMap) { if (foundationMap === void 0) { foundationMap = {}; } var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCSelectFoundation.defaultAdapter, adapter)) || this; _this.leadingIcon_ = foundationMap.leadingIcon; _this.helperText_ = foundationMap.helperText; return _this; } Object.defineProperty(MDCSelectFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelectFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelectFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelectFoundation, "defaultAdapter", { /** * See {@link MDCSelectAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, activateBottomLine: function activateBottomLine() { return undefined; }, deactivateBottomLine: function deactivateBottomLine() { return undefined; }, setValue: function setValue() { return undefined; }, getValue: function getValue() { return ''; }, floatLabel: function floatLabel() { return undefined; }, getLabelWidth: function getLabelWidth() { return 0; }, hasOutline: function hasOutline() { return false; }, notchOutline: function notchOutline() { return undefined; }, closeOutline: function closeOutline() { return undefined; }, openMenu: function openMenu() { return undefined; }, closeMenu: function closeMenu() { return undefined; }, isMenuOpen: function isMenuOpen() { return false; }, setSelectedIndex: function setSelectedIndex() { return undefined; }, setDisabled: function setDisabled() { return undefined; }, setRippleCenter: function setRippleCenter() { return undefined; }, notifyChange: function notifyChange() { return undefined; }, checkValidity: function checkValidity() { return false; }, setValid: function setValid() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCSelectFoundation.prototype.setSelectedIndex = function (index) { this.adapter_.setSelectedIndex(index); this.adapter_.closeMenu(); var didChange = true; this.handleChange(didChange); }; MDCSelectFoundation.prototype.setValue = function (value) { this.adapter_.setValue(value); var didChange = true; this.handleChange(didChange); }; MDCSelectFoundation.prototype.getValue = function () { return this.adapter_.getValue(); }; MDCSelectFoundation.prototype.setDisabled = function (isDisabled) { if (isDisabled) { this.adapter_.addClass(cssClasses$1.DISABLED); } else { this.adapter_.removeClass(cssClasses$1.DISABLED); } this.adapter_.setDisabled(isDisabled); this.adapter_.closeMenu(); if (this.leadingIcon_) { this.leadingIcon_.setDisabled(isDisabled); } }; /** * @param content Sets the content of the helper text. */ MDCSelectFoundation.prototype.setHelperTextContent = function (content) { if (this.helperText_) { this.helperText_.setContent(content); } }; MDCSelectFoundation.prototype.layout = function () { var openNotch = this.getValue().length > 0; this.notchOutline(openNotch); }; /** * Handles value changes, via change event or programmatic updates. */ MDCSelectFoundation.prototype.handleChange = function (didChange) { if (didChange === void 0) { didChange = true; } var value = this.getValue(); var optionHasValue = value.length > 0; var isRequired = this.adapter_.hasClass(cssClasses$1.REQUIRED); this.notchOutline(optionHasValue); if (!this.adapter_.hasClass(cssClasses$1.FOCUSED)) { this.adapter_.floatLabel(optionHasValue); } if (didChange) { this.adapter_.notifyChange(value); if (isRequired) { this.setValid(this.isValid()); if (this.helperText_) { this.helperText_.setValidity(this.isValid()); } } } }; /** * Handles focus events from select element. */ MDCSelectFoundation.prototype.handleFocus = function () { this.adapter_.addClass(cssClasses$1.FOCUSED); this.adapter_.floatLabel(true); this.notchOutline(true); this.adapter_.activateBottomLine(); if (this.helperText_) { this.helperText_.showToScreenReader(); } }; /** * Handles blur events from select element. */ MDCSelectFoundation.prototype.handleBlur = function () { if (this.adapter_.isMenuOpen()) { return; } this.adapter_.removeClass(cssClasses$1.FOCUSED); this.handleChange(false); this.adapter_.deactivateBottomLine(); var isRequired = this.adapter_.hasClass(cssClasses$1.REQUIRED); if (isRequired) { this.setValid(this.isValid()); if (this.helperText_) { this.helperText_.setValidity(this.isValid()); } } }; MDCSelectFoundation.prototype.handleClick = function (normalizedX) { if (this.adapter_.isMenuOpen()) { return; } this.adapter_.setRippleCenter(normalizedX); this.adapter_.openMenu(); }; MDCSelectFoundation.prototype.handleKeydown = function (event) { if (this.adapter_.isMenuOpen()) { return; } var isEnter = event.key === 'Enter' || event.keyCode === 13; var isSpace = event.key === 'Space' || event.keyCode === 32; var arrowUp = event.key === 'ArrowUp' || event.keyCode === 38; var arrowDown = event.key === 'ArrowDown' || event.keyCode === 40; if (this.adapter_.hasClass(cssClasses$1.FOCUSED) && (isEnter || isSpace || arrowUp || arrowDown)) { this.adapter_.openMenu(); event.preventDefault(); } }; /** * Opens/closes the notched outline. */ MDCSelectFoundation.prototype.notchOutline = function (openNotch) { if (!this.adapter_.hasOutline()) { return; } var isFocused = this.adapter_.hasClass(cssClasses$1.FOCUSED); if (openNotch) { var labelScale = numbers.LABEL_SCALE; var labelWidth = this.adapter_.getLabelWidth() * labelScale; this.adapter_.notchOutline(labelWidth); } else if (!isFocused) { this.adapter_.closeOutline(); } }; /** * Sets the aria label of the leading icon. */ MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) { if (this.leadingIcon_) { this.leadingIcon_.setAriaLabel(label); } }; /** * Sets the text content of the leading icon. */ MDCSelectFoundation.prototype.setLeadingIconContent = function (content) { if (this.leadingIcon_) { this.leadingIcon_.setContent(content); } }; MDCSelectFoundation.prototype.setValid = function (isValid) { this.adapter_.setValid(isValid); }; MDCSelectFoundation.prototype.isValid = function () { return this.adapter_.checkValidity(); }; return MDCSelectFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$7 = { ICON_EVENT: 'MDCSelect:icon', ICON_ROLE: 'button' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var INTERACTION_EVENTS = ['click', 'keydown']; var MDCSelectIconFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCSelectIconFoundation, _super); function MDCSelectIconFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCSelectIconFoundation.defaultAdapter, adapter)) || this; _this.savedTabIndex_ = null; _this.interactionHandler_ = function (evt) { return _this.handleInteraction(evt); }; return _this; } Object.defineProperty(MDCSelectIconFoundation, "strings", { get: function get() { return strings$7; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelectIconFoundation, "defaultAdapter", { /** * See {@link MDCSelectIconAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { getAttr: function getAttr() { return null; }, setAttr: function setAttr() { return undefined; }, removeAttr: function removeAttr() { return undefined; }, setContent: function setContent() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, notifyIconAction: function notifyIconAction() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCSelectIconFoundation.prototype.init = function () { var _this = this; this.savedTabIndex_ = this.adapter_.getAttr('tabindex'); INTERACTION_EVENTS.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.interactionHandler_); }); }; MDCSelectIconFoundation.prototype.destroy = function () { var _this = this; INTERACTION_EVENTS.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.interactionHandler_); }); }; MDCSelectIconFoundation.prototype.setDisabled = function (disabled) { if (!this.savedTabIndex_) { return; } if (disabled) { this.adapter_.setAttr('tabindex', '-1'); this.adapter_.removeAttr('role'); } else { this.adapter_.setAttr('tabindex', this.savedTabIndex_); this.adapter_.setAttr('role', strings$7.ICON_ROLE); } }; MDCSelectIconFoundation.prototype.setAriaLabel = function (label) { this.adapter_.setAttr('aria-label', label); }; MDCSelectIconFoundation.prototype.setContent = function (content) { this.adapter_.setContent(content); }; MDCSelectIconFoundation.prototype.handleInteraction = function (evt) { var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13; if (evt.type === 'click' || isEnterKey) { this.adapter_.notifyIconAction(); } }; return MDCSelectIconFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCSelectIcon = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCSelectIcon, _super); function MDCSelectIcon() { return _super !== null && _super.apply(this, arguments) || this; } MDCSelectIcon.attachTo = function (root) { return new MDCSelectIcon(root); }; Object.defineProperty(MDCSelectIcon.prototype, "foundation", { get: function get() { return this.foundation_; }, enumerable: true, configurable: true }); MDCSelectIcon.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { getAttr: function getAttr(attr) { return _this.root_.getAttribute(attr); }, setAttr: function setAttr(attr, value) { return _this.root_.setAttribute(attr, value); }, removeAttr: function removeAttr(attr) { return _this.root_.removeAttribute(attr); }, setContent: function setContent(content) { _this.root_.textContent = content; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.unlisten(evtType, handler); }, notifyIconAction: function notifyIconAction() { return _this.emit(MDCSelectIconFoundation.strings.ICON_EVENT, {} /* evtData */ , true /* shouldBubble */ ); } }; // tslint:enable:object-literal-sort-keys return new MDCSelectIconFoundation(adapter); }; return MDCSelectIcon; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var POINTER_EVENTS = ['mousedown', 'touchstart']; var VALIDATION_ATTR_WHITELIST = ['required', 'aria-required']; var MDCSelect = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MDCSelect, _super); function MDCSelect() { return _super !== null && _super.apply(this, arguments) || this; } MDCSelect.attachTo = function (root) { return new MDCSelect(root); }; MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) { if (labelFactory === void 0) { labelFactory = function labelFactory(el) { return new MDCFloatingLabel(el); }; } if (lineRippleFactory === void 0) { lineRippleFactory = function lineRippleFactory(el) { return new MDCLineRipple(el); }; } if (outlineFactory === void 0) { outlineFactory = function outlineFactory(el) { return new MDCNotchedOutline(el); }; } if (menuFactory === void 0) { menuFactory = function menuFactory(el) { return new MDCMenu(el); }; } if (iconFactory === void 0) { iconFactory = function iconFactory(el) { return new MDCSelectIcon(el); }; } if (helperTextFactory === void 0) { helperTextFactory = function helperTextFactory(el) { return new MDCSelectHelperText(el); }; } this.isMenuOpen_ = false; this.nativeControl_ = this.root_.querySelector(strings$1.NATIVE_CONTROL_SELECTOR); this.selectedText_ = this.root_.querySelector(strings$1.SELECTED_TEXT_SELECTOR); var targetElement = this.nativeControl_ || this.selectedText_; if (!targetElement) { throw new Error('MDCSelect: Missing required element: Exactly one of the following selectors must be present: ' + ("'" + strings$1.NATIVE_CONTROL_SELECTOR + "' or '" + strings$1.SELECTED_TEXT_SELECTOR + "'")); } this.targetElement_ = targetElement; if (this.targetElement_.hasAttribute(strings$1.ARIA_CONTROLS)) { var helperTextElement = document.getElementById(this.targetElement_.getAttribute(strings$1.ARIA_CONTROLS)); if (helperTextElement) { this.helperText_ = helperTextFactory(helperTextElement); } } if (this.selectedText_) { this.enhancedSelectSetup_(menuFactory); } var labelElement = this.root_.querySelector(strings$1.LABEL_SELECTOR); this.label_ = labelElement ? labelFactory(labelElement) : null; var lineRippleElement = this.root_.querySelector(strings$1.LINE_RIPPLE_SELECTOR); this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null; var outlineElement = this.root_.querySelector(strings$1.OUTLINE_SELECTOR); this.outline_ = outlineElement ? outlineFactory(outlineElement) : null; var leadingIcon = this.root_.querySelector(strings$1.LEADING_ICON_SELECTOR); if (leadingIcon) { this.root_.classList.add(cssClasses$1.WITH_LEADING_ICON); this.leadingIcon_ = iconFactory(leadingIcon); if (this.menuElement_) { this.menuElement_.classList.add(cssClasses$1.WITH_LEADING_ICON); } } if (!this.root_.classList.contains(cssClasses$1.OUTLINED)) { this.ripple = this.createRipple_(); } // The required state needs to be sync'd before the mutation observer is added. this.initialSyncRequiredState_(); this.addMutationObserverForRequired_(); }; /** * Initializes the select's event listeners and internal state based * on the environment's state. */ MDCSelect.prototype.initialSyncWithDOM = function () { var _this = this; this.handleChange_ = function () { return _this.foundation_.handleChange( /* didChange */ true); }; this.handleFocus_ = function () { return _this.foundation_.handleFocus(); }; this.handleBlur_ = function () { return _this.foundation_.handleBlur(); }; this.handleClick_ = function (evt) { if (_this.selectedText_) { _this.selectedText_.focus(); } _this.foundation_.handleClick(_this.getNormalizedXCoordinate_(evt)); }; this.handleKeydown_ = function (evt) { return _this.foundation_.handleKeydown(evt); }; this.handleMenuSelected_ = function (evtData) { return _this.selectedIndex = evtData.detail.index; }; this.handleMenuOpened_ = function () { // Menu should open to the last selected element. if (_this.selectedIndex >= 0) { var selectedItemEl = _this.menu_.items[_this.selectedIndex]; selectedItemEl.focus(); } }; this.handleMenuClosed_ = function () { // isMenuOpen_ is used to track the state of the menu opening or closing since the menu.open function // will return false if the menu is still closing and this method listens to the closed event which // occurs after the menu is already closed. _this.isMenuOpen_ = false; _this.selectedText_.removeAttribute('aria-expanded'); if (document.activeElement !== _this.selectedText_) { _this.foundation_.handleBlur(); } }; this.targetElement_.addEventListener('change', this.handleChange_); this.targetElement_.addEventListener('focus', this.handleFocus_); this.targetElement_.addEventListener('blur', this.handleBlur_); POINTER_EVENTS.forEach(function (evtType) { _this.targetElement_.addEventListener(evtType, _this.handleClick_); }); if (this.menuElement_) { this.selectedText_.addEventListener('keydown', this.handleKeydown_); this.menu_.listen(strings$2.CLOSED_EVENT, this.handleMenuClosed_); this.menu_.listen(strings$2.OPENED_EVENT, this.handleMenuOpened_); this.menu_.listen(strings$3.SELECTED_EVENT, this.handleMenuSelected_); if (this.hiddenInput_ && this.hiddenInput_.value) { // If the hidden input already has a value, use it to restore the select's value. // This can happen e.g. if the user goes back or (in some browsers) refreshes the page. var enhancedAdapterMethods = this.getEnhancedSelectAdapterMethods_(); enhancedAdapterMethods.setValue(this.hiddenInput_.value); } else if (this.menuElement_.querySelector(strings$1.SELECTED_ITEM_SELECTOR)) { // If an element is selected, the select should set the initial selected text. var enhancedAdapterMethods = this.getEnhancedSelectAdapterMethods_(); enhancedAdapterMethods.setValue(enhancedAdapterMethods.getValue()); } } // Initially sync floating label this.foundation_.handleChange( /* didChange */ false); if (this.root_.classList.contains(cssClasses$1.DISABLED) || this.nativeControl_ && this.nativeControl_.disabled) { this.disabled = true; } }; MDCSelect.prototype.destroy = function () { var _this = this; this.targetElement_.removeEventListener('change', this.handleChange_); this.targetElement_.removeEventListener('focus', this.handleFocus_); this.targetElement_.removeEventListener('blur', this.handleBlur_); this.targetElement_.removeEventListener('keydown', this.handleKeydown_); POINTER_EVENTS.forEach(function (evtType) { _this.targetElement_.removeEventListener(evtType, _this.handleClick_); }); if (this.menu_) { this.menu_.unlisten(strings$2.CLOSED_EVENT, this.handleMenuClosed_); this.menu_.unlisten(strings$2.OPENED_EVENT, this.handleMenuOpened_); this.menu_.unlisten(strings$3.SELECTED_EVENT, this.handleMenuSelected_); this.menu_.destroy(); } if (this.ripple) { this.ripple.destroy(); } if (this.outline_) { this.outline_.destroy(); } if (this.leadingIcon_) { this.leadingIcon_.destroy(); } if (this.helperText_) { this.helperText_.destroy(); } if (this.validationObserver_) { this.validationObserver_.disconnect(); } _super.prototype.destroy.call(this); }; Object.defineProperty(MDCSelect.prototype, "value", { get: function get() { return this.foundation_.getValue(); }, set: function set(value) { this.foundation_.setValue(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelect.prototype, "selectedIndex", { get: function get() { var selectedIndex = -1; if (this.menuElement_ && this.menu_) { var selectedEl = this.menuElement_.querySelector(strings$1.SELECTED_ITEM_SELECTOR); selectedIndex = this.menu_.items.indexOf(selectedEl); } else if (this.nativeControl_) { selectedIndex = this.nativeControl_.selectedIndex; } return selectedIndex; }, set: function set(selectedIndex) { this.foundation_.setSelectedIndex(selectedIndex); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelect.prototype, "disabled", { get: function get() { return this.root_.classList.contains(cssClasses$1.DISABLED) || (this.nativeControl_ ? this.nativeControl_.disabled : false); }, set: function set(disabled) { this.foundation_.setDisabled(disabled); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelect.prototype, "leadingIconAriaLabel", { set: function set(label) { this.foundation_.setLeadingIconAriaLabel(label); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelect.prototype, "leadingIconContent", { /** * Sets the text content of the leading icon. */ set: function set(content) { this.foundation_.setLeadingIconContent(content); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelect.prototype, "helperTextContent", { /** * Sets the text content of the helper text. */ set: function set(content) { this.foundation_.setHelperTextContent(content); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelect.prototype, "valid", { /** * Checks if the select is in a valid state. */ get: function get() { return this.foundation_.isValid(); }, /** * Sets the current invalid state of the select. */ set: function set(isValid) { this.foundation_.setValid(isValid); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSelect.prototype, "required", { /** * Returns whether the select is required. */ get: function get() { if (this.nativeControl_) { return this.nativeControl_.required; } else { return this.selectedText_.getAttribute('aria-required') === 'true'; } }, /** * Sets the control to the required state. */ set: function set(isRequired) { if (this.nativeControl_) { this.nativeControl_.required = isRequired; } else { if (isRequired) { this.selectedText_.setAttribute('aria-required', isRequired.toString()); } else { this.selectedText_.removeAttribute('aria-required'); } } }, enumerable: true, configurable: true }); /** * Recomputes the outline SVG path for the outline element. */ MDCSelect.prototype.layout = function () { this.foundation_.layout(); }; MDCSelect.prototype.getDefaultFoundation = function () { // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, this.nativeControl_ ? this.getNativeSelectAdapterMethods_() : this.getEnhancedSelectAdapterMethods_(), this.getCommonAdapterMethods_(), this.getOutlineAdapterMethods_(), this.getLabelAdapterMethods_()); return new MDCSelectFoundation(adapter, this.getFoundationMap_()); }; /** * Handles setup for the enhanced menu. */ MDCSelect.prototype.enhancedSelectSetup_ = function (menuFactory) { var isDisabled = this.root_.classList.contains(cssClasses$1.DISABLED); this.selectedText_.setAttribute('tabindex', isDisabled ? '-1' : '0'); this.hiddenInput_ = this.root_.querySelector(strings$1.HIDDEN_INPUT_SELECTOR); this.menuElement_ = this.root_.querySelector(strings$1.MENU_SELECTOR); this.menu_ = menuFactory(this.menuElement_); this.menu_.hoistMenuToBody(); this.menu_.setAnchorElement(this.root_); this.menu_.setAnchorCorner(Corner.BOTTOM_START); this.menu_.wrapFocus = false; }; MDCSelect.prototype.createRipple_ = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__assign"])({}, MDCRipple.createAdapter(this), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.targetElement_.addEventListener(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.targetElement_.removeEventListener(evtType, handler); } }); // tslint:enable:object-literal-sort-keys return new MDCRipple(this.root_, new MDCRippleFoundation(adapter)); }; MDCSelect.prototype.getNativeSelectAdapterMethods_ = function () { var _this = this; // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { getValue: function getValue() { return _this.nativeControl_.value; }, setValue: function setValue(value) { _this.nativeControl_.value = value; }, openMenu: function openMenu() { return undefined; }, closeMenu: function closeMenu() { return undefined; }, isMenuOpen: function isMenuOpen() { return false; }, setSelectedIndex: function setSelectedIndex(index) { _this.nativeControl_.selectedIndex = index; }, setDisabled: function setDisabled(isDisabled) { _this.nativeControl_.disabled = isDisabled; }, setValid: function setValid(isValid) { if (isValid) { _this.root_.classList.remove(cssClasses$1.INVALID); } else { _this.root_.classList.add(cssClasses$1.INVALID); } }, checkValidity: function checkValidity() { return _this.nativeControl_.checkValidity(); } }; // tslint:enable:object-literal-sort-keys }; MDCSelect.prototype.getEnhancedSelectAdapterMethods_ = function () { var _this = this; // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { getValue: function getValue() { var listItem = _this.menuElement_.querySelector(strings$1.SELECTED_ITEM_SELECTOR); if (listItem && listItem.hasAttribute(strings$1.ENHANCED_VALUE_ATTR)) { return listItem.getAttribute(strings$1.ENHANCED_VALUE_ATTR) || ''; } return ''; }, setValue: function setValue(value) { var element = _this.menuElement_.querySelector("[" + strings$1.ENHANCED_VALUE_ATTR + "=\"" + value + "\"]"); _this.setEnhancedSelectedIndex_(element ? _this.menu_.items.indexOf(element) : -1); }, openMenu: function openMenu() { if (_this.menu_ && !_this.menu_.open) { _this.menu_.open = true; _this.isMenuOpen_ = true; _this.selectedText_.setAttribute('aria-expanded', 'true'); } }, closeMenu: function closeMenu() { if (_this.menu_ && _this.menu_.open) { _this.menu_.open = false; } }, isMenuOpen: function isMenuOpen() { return Boolean(_this.menu_) && _this.isMenuOpen_; }, setSelectedIndex: function setSelectedIndex(index) { return _this.setEnhancedSelectedIndex_(index); }, setDisabled: function setDisabled(isDisabled) { _this.selectedText_.setAttribute('tabindex', isDisabled ? '-1' : '0'); _this.selectedText_.setAttribute('aria-disabled', isDisabled.toString()); if (_this.hiddenInput_) { _this.hiddenInput_.disabled = isDisabled; } }, checkValidity: function checkValidity() { var classList = _this.root_.classList; if (classList.contains(cssClasses$1.REQUIRED) && !classList.contains(cssClasses$1.DISABLED)) { // See notes for required attribute under https://www.w3.org/TR/html52/sec-forms.html#the-select-element // TL;DR: Invalid if no index is selected, or if the first index is selected and has an empty value. return _this.selectedIndex !== -1 && (_this.selectedIndex !== 0 || Boolean(_this.value)); } else { return true; } }, setValid: function setValid(isValid) { _this.selectedText_.setAttribute('aria-invalid', (!isValid).toString()); if (isValid) { _this.root_.classList.remove(cssClasses$1.INVALID); } else { _this.root_.classList.add(cssClasses$1.INVALID); } } }; // tslint:enable:object-literal-sort-keys }; MDCSelect.prototype.getCommonAdapterMethods_ = function () { var _this = this; // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, setRippleCenter: function setRippleCenter(normalizedX) { return _this.lineRipple_ && _this.lineRipple_.setRippleCenter(normalizedX); }, activateBottomLine: function activateBottomLine() { return _this.lineRipple_ && _this.lineRipple_.activate(); }, deactivateBottomLine: function deactivateBottomLine() { return _this.lineRipple_ && _this.lineRipple_.deactivate(); }, notifyChange: function notifyChange(value) { var index = _this.selectedIndex; _this.emit(strings$1.CHANGE_EVENT, { value: value, index: index }, true /* shouldBubble */ ); } }; // tslint:enable:object-literal-sort-keys }; MDCSelect.prototype.getOutlineAdapterMethods_ = function () { var _this = this; // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { hasOutline: function hasOutline() { return Boolean(_this.outline_); }, notchOutline: function notchOutline(labelWidth) { return _this.outline_ && _this.outline_.notch(labelWidth); }, closeOutline: function closeOutline() { return _this.outline_ && _this.outline_.closeNotch(); } }; // tslint:enable:object-literal-sort-keys }; MDCSelect.prototype.getLabelAdapterMethods_ = function () { var _this = this; return { floatLabel: function floatLabel(shouldFloat) { return _this.label_ && _this.label_.float(shouldFloat); }, getLabelWidth: function getLabelWidth() { return _this.label_ ? _this.label_.getWidth() : 0; } }; }; /** * Calculates where the line ripple should start based on the x coordinate within the component. */ MDCSelect.prototype.getNormalizedXCoordinate_ = function (evt) { var targetClientRect = evt.target.getBoundingClientRect(); var xCoordinate = this.isTouchEvent_(evt) ? evt.touches[0].clientX : evt.clientX; return xCoordinate - targetClientRect.left; }; MDCSelect.prototype.isTouchEvent_ = function (evt) { return Boolean(evt.touches); }; /** * Returns a map of all subcomponents to subfoundations. */ MDCSelect.prototype.getFoundationMap_ = function () { return { helperText: this.helperText_ ? this.helperText_.foundation : undefined, leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundation : undefined }; }; MDCSelect.prototype.setEnhancedSelectedIndex_ = function (index) { var selectedItem = this.menu_.items[index]; this.selectedText_.textContent = selectedItem ? selectedItem.textContent.trim() : ''; var previouslySelected = this.menuElement_.querySelector(strings$1.SELECTED_ITEM_SELECTOR); if (previouslySelected) { previouslySelected.classList.remove(cssClasses$1.SELECTED_ITEM_CLASS); previouslySelected.removeAttribute(strings$1.ARIA_SELECTED_ATTR); } if (selectedItem) { selectedItem.classList.add(cssClasses$1.SELECTED_ITEM_CLASS); selectedItem.setAttribute(strings$1.ARIA_SELECTED_ATTR, 'true'); } // Synchronize hidden input's value with data-value attribute of selected item. // This code path is also followed when setting value directly, so this covers all cases. if (this.hiddenInput_) { this.hiddenInput_.value = selectedItem ? selectedItem.getAttribute(strings$1.ENHANCED_VALUE_ATTR) || '' : ''; } this.layout(); }; MDCSelect.prototype.initialSyncRequiredState_ = function () { var isRequired = this.targetElement_.required || this.targetElement_.getAttribute('aria-required') === 'true' || this.root_.classList.contains(cssClasses$1.REQUIRED); if (isRequired) { if (this.nativeControl_) { this.nativeControl_.required = true; } else { this.selectedText_.setAttribute('aria-required', 'true'); } this.root_.classList.add(cssClasses$1.REQUIRED); } }; MDCSelect.prototype.addMutationObserverForRequired_ = function () { var _this = this; var observerHandler = function observerHandler(attributesList) { attributesList.some(function (attributeName) { if (VALIDATION_ATTR_WHITELIST.indexOf(attributeName) === -1) { return false; } if (_this.selectedText_) { if (_this.selectedText_.getAttribute('aria-required') === 'true') { _this.root_.classList.add(cssClasses$1.REQUIRED); } else { _this.root_.classList.remove(cssClasses$1.REQUIRED); } } else { if (_this.nativeControl_.required) { _this.root_.classList.add(cssClasses$1.REQUIRED); } else { _this.root_.classList.remove(cssClasses$1.REQUIRED); } } return true; }); }; var getAttributesList = function getAttributesList(mutationsList) { return mutationsList.map(function (mutation) { return mutation.attributeName; }).filter(function (attributeName) { return attributeName; }); }; var observer = new MutationObserver(function (mutationsList) { return observerHandler(getAttributesList(mutationsList)); }); observer.observe(this.targetElement_, { attributes: true }); this.validationObserver_ = observer; }; return MDCSelect; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Injection token that can be used to configure the default options for all * mdc-select usage within an app. * @type {?} */ var MDC_SELECT_DEFAULT_OPTIONS = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('MDC_SELECT_DEFAULT_OPTIONS'); var MdcSelectBase = /** @class */ (function () { function MdcSelectBase(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) { this._defaultErrorStateMatcher = _defaultErrorStateMatcher; this._parentForm = _parentForm; this._parentFormGroup = _parentFormGroup; this.ngControl = ngControl; } return MdcSelectBase; }()); /** @type {?} */ var _MdcSelectMixinBase = Object(_angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["mixinErrorState"])(MdcSelectBase); var MdcSelectChange = /** @class */ (function () { function MdcSelectChange(source, index, value) { this.source = source; this.index = index; this.value = value; } return MdcSelectChange; }()); var MdcSelectOption = /** @class */ (function () { function MdcSelectOption() { } MdcSelectOption.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'option', exportAs: 'mdcSelectOption', },] }, ]; return MdcSelectOption; }()); /** @type {?} */ var nextUniqueId = 0; var MdcSelect = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_7__["__extends"])(MdcSelect, _super); function MdcSelect(_platform, _changeDetectorRef, elementRef, _defaultErrorStateMatcher, _parentFormField, _ripple, ngControl, _parentForm, _parentFormGroup, _defaults) { var _this = _super.call(this, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this; _this._platform = _platform; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this._defaultErrorStateMatcher = _defaultErrorStateMatcher; _this._parentFormField = _parentFormField; _this._ripple = _ripple; _this.ngControl = ngControl; _this._defaults = _defaults; /** * Emits whenever the component is destroyed. */ _this._destroyed = new rxjs__WEBPACK_IMPORTED_MODULE_9__["Subject"](); _this._uniqueId = "mdc-select-" + ++nextUniqueId; _this.controlType = 'mdc-select'; _this._enhancedSelectedText = ''; _this.focused = false; _this.id = _this._uniqueId; _this.name = null; _this._placeholder = ''; _this._disabled = false; _this._floatLabel = true; _this._outlined = false; _this._required = false; _this._autosize = false; _this._compareWith = (/** * @param {?} o1 * @param {?} o2 * @return {?} */ function (o1, o2) { return o1 === o2; }); _this._value = ''; _this._helperText = null; /** * Event emitted when the selected value has been changed by the user. */ _this.selectionChange = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Event that emits whenever the raw value of the select changes. This is here primarily * to facilitate the two-way binding for the `value` input. */ _this.valueChange = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * View to model callback called when value changes */ _this._onChange = (/** * @return {?} */ function () { }); /** * View to model callback called when select has been touched */ _this._onTouched = (/** * @return {?} */ function () { }); if (_this.ngControl) { // Note: we provide the value accessor through here, instead of // the `providers` to avoid running into a circular import. _this.ngControl.valueAccessor = _this; } if (_this._parentFormField) { _parentFormField.elementRef.nativeElement.classList.add('ngx-form-field-select'); } // Force setter to be called in case id was not specified. _this.id = _this.id; return _this; } Object.defineProperty(MdcSelect.prototype, "placeholder", { /** Placeholder to be shown if no value has been selected. */ get: /** * Placeholder to be shown if no value has been selected. * @return {?} */ function () { return this._placeholder; }, set: /** * @param {?} value * @return {?} */ function (value) { this._placeholder = value; }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setDisabledState(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "floatLabel", { get: /** * @return {?} */ function () { return this._floatLabel; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_11__["toBoolean"])(value); if (newValue !== this._floatLabel) { this._floatLabel = newValue; this.layout(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "outlined", { get: /** * @return {?} */ function () { return this._outlined; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_11__["toBoolean"])(value); if (newValue !== this._outlined) { this._outlined = newValue || (this._defaults && this._defaults.outlined) || false; this.layout(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "required", { get: /** * @return {?} */ function () { return this._required; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_11__["toBoolean"])(value); if (newValue !== this._required) { this._required = newValue; if (this._foundation) { if (!this._required) { this.valid = true; this._changeDetectorRef.markForCheck(); } if (this.ngControl && !this._isEnhancedVariant()) { this._required ? this._getInputElement().setAttribute('required', '') : this._getInputElement().removeAttribute('required'); } } } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "valid", { get: /** * @return {?} */ function () { return this._valid; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_11__["toBoolean"])(value); if (newValue !== this._valid) { this._valid = newValue; if (this._foundation && this._valid !== undefined) { this._foundation.setValid(this._valid); } } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "autosize", { get: /** * @return {?} */ function () { return this._autosize; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_11__["toBoolean"])(value); if (newValue !== this._autosize) { this._autosize = newValue; this._setWidth(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "compareWith", { get: /** * @return {?} */ function () { return this._compareWith; }, set: /** * @param {?} fn * @return {?} */ function (fn) { this._compareWith = fn; }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "value", { /** Value of the select control. */ get: /** * Value of the select control. * @return {?} */ function () { return this._value; }, set: /** * @param {?} newValue * @return {?} */ function (newValue) { this.setSelectionByValue(newValue); }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "helperText", { get: /** * @return {?} */ function () { return this._helperText; }, set: /** * @param {?} helperText * @return {?} */ function (helperText) { if (this._helperText !== helperText) { this._helperText = helperText; this._initHelperText(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSelect.prototype, "placeholderText", { get: /** * @return {?} */ function () { return !this._hasFloatingLabel() && this.getValue() ? '' : this.placeholder; }, enumerable: true, configurable: true }); /** * @private * @return {?} */ MdcSelect.prototype._createAdapter = /** * @private * @return {?} */ function () { return Object.assign(this._isEnhancedVariant() ? this._getEnhancedSelectAdapterMethods() : this._getNativeSelectAdapterMethods(), this._getCommonAdapterMethods(), this._getOutlineAdapterMethods(), this._getLabelAdapterMethods()); }; /** * @private * @return {?} */ MdcSelect.prototype._getCommonAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), setRippleCenter: (/** * @param {?} normalizedX * @return {?} */ function (normalizedX) { return _this._lineRipple && _this._lineRipple.setRippleCenter(normalizedX); }), activateBottomLine: (/** * @return {?} */ function () { if (_this._lineRipple) { _this._lineRipple.activate(); } }), deactivateBottomLine: (/** * @return {?} */ function () { if (_this._lineRipple) { _this._lineRipple.deactivate(); } }), notifyChange: (/** * @param {?} value * @return {?} */ function (value) { return _this.selectionChange.emit(new MdcSelectChange(_this, _this.getSelectedIndex(), value)); }) }; }; /** * @private * @return {?} */ MdcSelect.prototype._getNativeSelectAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { getValue: (/** * @return {?} */ function () { return _this._platform.isBrowser ? _this._getInputElement().value : ''; }), setValue: (/** * @param {?} value * @return {?} */ function (value) { return _this._getInputElement().value = value; }), isMenuOpen: (/** * @return {?} */ function () { return false; }), setSelectedIndex: (/** * @param {?} index * @return {?} */ function (index) { return _this._getInputElement().selectedIndex = index; }), setDisabled: (/** * @param {?} isDisabled * @return {?} */ function (isDisabled) { return _this._getInputElement().disabled = isDisabled; }), setValid: (/** * @param {?} isValid * @return {?} */ function (isValid) { if (_this.ngControl) { return; } isValid ? _this._getHostElement().classList.remove(cssClasses$1.INVALID) : _this._getHostElement().classList.add(cssClasses$1.INVALID); }), checkValidity: (/** * @return {?} */ function () { return _this._getInputElement().checkValidity(); }) }; }; /** * @private * @return {?} */ MdcSelect.prototype._getEnhancedSelectAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { getValue: (/** * @return {?} */ function () { return _this.getValue() || ''; }), openMenu: (/** * @return {?} */ function () { if (_this._menu && !_this._menu.open) { _this._menu.open = true; (/** @type {?} */ (_this._selectedText)).nativeElement.setAttribute('aria-expanded', 'true'); } }), closeMenu: (/** * @return {?} */ function () { if (_this._menu && _this._menu.open) { _this._menu.open = false; } }), isMenuOpen: (/** * @return {?} */ function () { return _this._menu && _this._menu.open; }), setDisabled: (/** * @param {?} isDisabled * @return {?} */ function (isDisabled) { _this._selectedText.nativeElement.setAttribute('aria-disabled', isDisabled.toString()); }), checkValidity: (/** * @return {?} */ function () { return _this._isValid(); }), setValid: (/** * @param {?} isValid * @return {?} */ function (isValid) { _this._selectedText.nativeElement.setAttribute('aria-invalid', (!isValid).toString()); _this._valid = isValid; isValid ? _this._getHostElement().classList.remove(cssClasses$1.INVALID) : _this._getHostElement().classList.add(cssClasses$1.INVALID); }) }; }; /** * @private * @return {?} */ MdcSelect.prototype._getOutlineAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { hasOutline: (/** * @return {?} */ function () { return !!_this._notchedOutline; }), notchOutline: (/** * @param {?} labelWidth * @return {?} */ function (labelWidth) { return (/** @type {?} */ (_this._notchedOutline)).notch(labelWidth); }), closeOutline: (/** * @return {?} */ function () { return (/** @type {?} */ (_this._notchedOutline)).closeNotch(); }) }; }; /** * @private * @return {?} */ MdcSelect.prototype._getLabelAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { floatLabel: (/** * @param {?} shouldFloat * @return {?} */ function (shouldFloat) { return _this._getFloatingLabel().float(shouldFloat); }), getLabelWidth: (/** * @return {?} */ function () { return _this._hasFloatingLabel() ? (/** @type {?} */ (_this._getFloatingLabel())).getWidth() : 0; }) }; }; /** Returns a map of all subcomponents to subfoundations.*/ /** * Returns a map of all subcomponents to subfoundations. * @private * @return {?} */ MdcSelect.prototype._getFoundationMap = /** * Returns a map of all subcomponents to subfoundations. * @private * @return {?} */ function () { return { helperText: this._helperText ? this._helperText.foundation : undefined }; }; /** * @return {?} */ MdcSelect.prototype.ngAfterContentInit = /** * @return {?} */ function () { this._setDefaultOptions(); }; /** * @return {?} */ MdcSelect.prototype.ngAfterViewInit = /** * @return {?} */ function () { var _this = this; this.init(); if (!this._isEnhancedVariant()) { this._options.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_10__["takeUntil"])(this._destroyed)) .subscribe((/** * @return {?} */ function () { _this._getFloatingLabel().float(!!_this.getValue()); if (_this.outlined) { _this.getValue() ? (/** @type {?} */ (_this._notchedOutline)).notch(_this._getFloatingLabel().getWidth()) : (/** @type {?} */ (_this._notchedOutline)).closeNotch(); } })); } }; /** * @return {?} */ MdcSelect.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy(); }; /** * @return {?} */ MdcSelect.prototype.ngDoCheck = /** * @return {?} */ function () { if (this.ngControl) { // We need to re-evaluate this on every change detection cycle, because there are some // error triggers that we can't subscribe to (e.g. parent form submissions). This means // that whatever logic is in here has to be super lean or we risk destroying the performance. this.updateErrorState(); } }; /** * @return {?} */ MdcSelect.prototype.init = /** * @return {?} */ function () { this._foundation = new MDCSelectFoundation(this._createAdapter(), this._getFoundationMap()); this._changeDetectorRef.detectChanges(); // initialize after running a detectChanges() this._initRipple(); this._initializeSelection(); this._setWidth(); this._enhancedSelectSetup(); this._foundation.handleChange(false); }; /** * @param {?} value * @return {?} */ MdcSelect.prototype.writeValue = /** * @param {?} value * @return {?} */ function (value) { this.setSelectionByValue(value, false); }; /** * @param {?} fn * @return {?} */ MdcSelect.prototype.registerOnChange = /** * @param {?} fn * @return {?} */ function (fn) { this._onChange = fn; }; /** * @param {?} fn * @return {?} */ MdcSelect.prototype.registerOnTouched = /** * @param {?} fn * @return {?} */ function (fn) { this._onTouched = fn; }; /** * @param {?} event * @return {?} */ MdcSelect.prototype.onChange = /** * @param {?} event * @return {?} */ function (event) { this.setSelectionByValue(((/** @type {?} */ (event.target))).value); event.stopPropagation(); }; /** * @return {?} */ MdcSelect.prototype.onBlur = /** * @return {?} */ function () { if (!this.disabled) { this._foundation.handleBlur(); this._onTouched(); this.focused = false; } }; /** * @return {?} */ MdcSelect.prototype.onFocus = /** * @return {?} */ function () { if (!this.disabled) { this._foundation.handleFocus(); this._onTouched(); this.focused = true; } }; /** * @param {?} evt * @return {?} */ MdcSelect.prototype.onInteraction = /** * @param {?} evt * @return {?} */ function (evt) { if (this._selectedText) { this._selectedText.nativeElement.focus(); } this._foundation.handleClick(this._getNormalizedXCoordinate(evt)); }; /** * @param {?} evt * @return {?} */ MdcSelect.prototype.onKeydown = /** * @param {?} evt * @return {?} */ function (evt) { this._foundation.handleKeydown(evt); }; /** * @return {?} */ MdcSelect.prototype.getValue = /** * @return {?} */ function () { return this._value; }; /** * @return {?} */ MdcSelect.prototype.getSelectedIndex = /** * @return {?} */ function () { if (this._isEnhancedVariant()) { return this._list ? this._list.getSelectedIndex() : -1; } return ((/** @type {?} */ (this._getInputElement()))).selectedIndex || -1; }; /** * Sets the selected option based on a value. If no option can be * found with the designated value, the select trigger is cleared. */ /** * Sets the selected option based on a value. If no option can be * found with the designated value, the select trigger is cleared. * @param {?} value * @param {?=} isUserInput * @return {?} */ MdcSelect.prototype.setSelectionByValue = /** * Sets the selected option based on a value. If no option can be * found with the designated value, the select trigger is cleared. * @param {?} value * @param {?=} isUserInput * @return {?} */ function (value, isUserInput) { if (isUserInput === void 0) { isUserInput = true; } if (!this._foundation) { return; } this._setEnhancedSelection(value); // if enhanced select, perform selection this._value = value !== null ? value : ''; if (!this.isValueEmpty()) { this._foundation.setValue(this._value); } this.valueChange.emit({ index: this.getSelectedIndex(), value: this._value }); if (isUserInput) { this._onChange(this._value); } if (this.isValueEmpty()) { this._getFloatingLabel().float(false); this._foundation.notchOutline(false); } this._changeDetectorRef.markForCheck(); }; /** * @param {?} index * @return {?} */ MdcSelect.prototype.setSelectedIndex = /** * @param {?} index * @return {?} */ function (index) { if (this._isEnhancedVariant()) { this._list.setSelectedIndex(index); this._getEnhancedSelectAdapterMethods().closeMenu(); } else { this._getNativeSelectAdapterMethods().setSelectedIndex(index); } /** @type {?} */ var value = this._isEnhancedVariant() ? this._list.getSelectedValue() : this._getInputElement().value; this.setSelectionByValue(value); }; // Implemented as part of ControlValueAccessor. // Implemented as part of ControlValueAccessor. /** * @param {?} disabled * @return {?} */ MdcSelect.prototype.setDisabledState = // Implemented as part of ControlValueAccessor. /** * @param {?} disabled * @return {?} */ function (disabled) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_11__["toBoolean"])(disabled); if (this._foundation) { this._foundation.setDisabled(this._disabled); } this._changeDetectorRef.markForCheck(); }; /** * @return {?} */ MdcSelect.prototype.focus = /** * @return {?} */ function () { if (!this.disabled) { this._isEnhancedVariant() ? this._selectedText.nativeElement.focus() : this._getInputElement().focus(); } }; /** * @return {?} */ MdcSelect.prototype.reset = /** * @return {?} */ function () { if (this._isEnhancedVariant()) { this._enhancedSelectedText = ''; this._list.reset(); } this._value = ''; this.setSelectedIndex(-1); this._foundation.setValid(true); }; /** * @return {?} */ MdcSelect.prototype.isValueEmpty = /** * @return {?} */ function () { return (this._value === undefined || this._value === null) || this._value.length === 0 ? true : false; }; /** Initialize Select internal state based on the environment state */ /** * Initialize Select internal state based on the environment state * @private * @return {?} */ MdcSelect.prototype.layout = /** * Initialize Select internal state based on the environment state * @private * @return {?} */ function () { if (this._foundation) { this._destroy(); } this.init(); this._changeDetectorRef.markForCheck(); if (this._outlined) { this._foundation.layout(); } }; /** * @private * @return {?} */ MdcSelect.prototype._initializeSelection = /** * @private * @return {?} */ function () { var _this = this; // Defer setting the value in order to avoid the "Expression // has changed after it was checked" errors from Angular. Promise.resolve().then((/** * @return {?} */ function () { /** @type {?} */ var value = _this.ngControl ? _this.ngControl.value : _this._value; if (value) { _this.setSelectionByValue(value, false); _this._foundation.layout(); } })); }; /** * @private * @return {?} */ MdcSelect.prototype._initHelperText = /** * @private * @return {?} */ function () { /** @type {?} */ var helper = this.helperText; if (helper) { helper.addHelperTextClass(this.controlType); helper.init(MDCSelectHelperTextFoundation); } }; /** * @private * @return {?} */ MdcSelect.prototype._initRipple = /** * @private * @return {?} */ function () { if (!this.outlined) { this._ripple.init({ surface: this.elementRef.nativeElement, activator: this._nativeSelect ? this._nativeSelect.nativeElement : this._selectedText.nativeElement }); } }; /** Set the default options. */ /** * Set the default options. * @private * @return {?} */ MdcSelect.prototype._setDefaultOptions = /** * Set the default options. * @private * @return {?} */ function () { if (this._defaults && this._defaults.outlined) { this._outlined = this._defaults.outlined; } }; /** * @private * @return {?} */ MdcSelect.prototype._destroy = /** * @private * @return {?} */ function () { this._destroyed.next(); this._destroyed.complete(); if (this._lineRipple) { this._lineRipple.destroy(); } if (this._ripple) { this._ripple.destroy(); } }; /** * @private * @return {?} */ MdcSelect.prototype._isEnhancedVariant = /** * @private * @return {?} */ function () { return !!this._list; }; /** * @private * @param {?} value * @return {?} */ MdcSelect.prototype._setEnhancedSelection = /** * @private * @param {?} value * @return {?} */ function (value) { if (this._isEnhancedVariant()) { this._list.setSelectedValue(value); this._enhancedSelectedText = this._list.getSelectedText(); this._menu.open = false; } }; /** * @private * @return {?} */ MdcSelect.prototype._enhancedSelectSetup = /** * @private * @return {?} */ function () { var _this = this; if (this._isEnhancedVariant()) { this._menu.elementRef.nativeElement.classList.add('mdc-select__menu'); this._menu.hoistToBody = true; this._menu.anchorElement = this._getHostElement(); this._menu.wrapFocus = false; this._list.useSelectedClass = true; this._list.singleSelection = true; // Subscribe to menu opened event this._menu.opened.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_10__["takeUntil"])(this._destroyed)) .subscribe((/** * @return {?} */ function () { /** @type {?} */ var selectedIndex = _this._list.getSelectedIndex(); if (selectedIndex > -1) { _this._list.items.toArray()[selectedIndex].focus(); } })); // Subscribe to menu closed event this._menu.closed.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_10__["takeUntil"])(this._destroyed)) .subscribe((/** * @return {?} */ function () { _this._selectedText.nativeElement.removeAttribute('aria-expanded'); if (_this._platform.isBrowser) { if (document.activeElement !== _this._selectedText.nativeElement) { _this._foundation.handleBlur(); } } })); // Subscribe to menu selected event this._list.selectionChange.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_10__["takeUntil"])(this._destroyed)) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { _this.setSelectionByValue(evt.option.value, true); })); } }; /** * @private * @return {?} */ MdcSelect.prototype._isValid = /** * @private * @return {?} */ function () { if (this.ngControl) { return !this.errorState; } if (this.required && !this.disabled) { return this.getSelectedIndex() !== -1 && (this.getSelectedIndex() !== 0 || !this.isValueEmpty()); } return true; }; /** * @private * @return {?} */ MdcSelect.prototype._hasFloatingLabel = /** * @private * @return {?} */ function () { return (this.placeholder && this.floatLabel) || this._required && (this._floatingLabel || this._notchedOutline) ? true : false; }; /** * @private * @return {?} */ MdcSelect.prototype._getFloatingLabel = /** * @private * @return {?} */ function () { return this._floatingLabel || (/** @type {?} */ (this._notchedOutline)).floatingLabel; }; /** * Calculates where the line ripple should start based on the x coordinate within the component. */ /** * Calculates where the line ripple should start based on the x coordinate within the component. * @private * @param {?} evt * @return {?} */ MdcSelect.prototype._getNormalizedXCoordinate = /** * Calculates where the line ripple should start based on the x coordinate within the component. * @private * @param {?} evt * @return {?} */ function (evt) { /** @type {?} */ var targetClientRect = ((/** @type {?} */ (evt.target))).getBoundingClientRect(); if (evt instanceof MouseEvent) { return evt.clientX - targetClientRect.left; } /** @type {?} */ var clientX = evt.touches[0] && evt.touches[0].clientX; return clientX - targetClientRect.left; }; /** * @private * @return {?} */ MdcSelect.prototype._setWidth = /** * @private * @return {?} */ function () { if (this.placeholder && this.autosize) { /** @type {?} */ var labelLength = this.placeholder.length; this._getHostElement().style.setProperty('width', labelLength + "rem"); } else { this._getHostElement().style.removeProperty('width'); } }; /** Retrieves the select input element. */ /** * Retrieves the select input element. * @private * @return {?} */ MdcSelect.prototype._getInputElement = /** * Retrieves the select input element. * @private * @return {?} */ function () { return this._nativeSelect.nativeElement; }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcSelect.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcSelect.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-select', exportAs: 'mdcSelect', host: { '[id]': 'id', 'class': 'mdc-select', '[class.mdc-select--disabled]': 'disabled', '[class.mdc-select--outlined]': 'outlined', '[class.mdc-select--required]': 'required', '[class.mdc-select--with-leading-icon]': 'leadingIcon', '[class.mdc-select--invalid]': 'errorState && !focused' }, template: "\n \n \n
{{_enhancedSelectedText}}
\n \n
\n \n \n \n \n \n ", providers: [ _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_12__["MdcRipple"], { provide: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcFormFieldControl"], useExisting: MdcSelect } ], encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcSelect.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_11__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["ErrorStateMatcher"] }, { type: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcFormField"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_12__["MdcRipple"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_8__["NgControl"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_8__["NgForm"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_8__["FormGroupDirective"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [MDC_SELECT_DEFAULT_OPTIONS,] }] } ]; }; MdcSelect.propDecorators = { id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], placeholder: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], floatLabel: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], outlined: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], required: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], valid: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], autosize: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], compareWith: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], helperText: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], errorStateMatcher: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], selectionChange: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], valueChange: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], _floatingLabel: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_2__["MdcFloatingLabel"],] }], _lineRipple: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_3__["MdcLineRipple"],] }], _notchedOutline: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_4__["MdcNotchedOutline"],] }], _nativeSelect: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['nativeSelect',] }], _selectedText: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['selectedText',] }], _menu: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [_angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_6__["MdcMenu"],] }], leadingIcon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [MdcSelectIcon,] }], _list: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [_angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_13__["MdcList"],] }], _options: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [MdcSelectOption,] }] }; return MdcSelect; }(_MdcSelectMixinBase)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var SELECT_DECLARATIONS = [ MdcSelect, MdcSelectIcon, MdcSelectOption ]; var MdcSelectModule = /** @class */ (function () { function MdcSelectModule() { } MdcSelectModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"], _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_6__["MdcMenuModule"], _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcFormFieldModule"], _angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_2__["MdcFloatingLabelModule"], _angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_4__["MdcNotchedOutlineModule"], _angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_3__["MdcLineRippleModule"] ], exports: [ _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_6__["MdcMenuModule"], _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcFormFieldModule"], SELECT_DECLARATIONS ], declarations: SELECT_DECLARATIONS },] }, ]; return MdcSelectModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=select.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/slider.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/slider.es5.js ***! \**********************************************************/ /*! exports provided: MDC_SLIDER_CONTROL_VALUE_ACCESSOR, MdcSlider, MdcSliderChange, MdcSliderModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_SLIDER_CONTROL_VALUE_ACCESSOR", function() { return MDC_SLIDER_CONTROL_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSlider", function() { return MdcSlider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSliderChange", function() { return MdcSliderChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSliderModule", function() { return MdcSliderModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { ACTIVE: 'mdc-slider--active', DISABLED: 'mdc-slider--disabled', DISCRETE: 'mdc-slider--discrete', FOCUS: 'mdc-slider--focus', HAS_TRACK_MARKER: 'mdc-slider--display-markers', IN_TRANSIT: 'mdc-slider--in-transit', IS_DISCRETE: 'mdc-slider--discrete' }; var strings = { ARIA_DISABLED: 'aria-disabled', ARIA_VALUEMAX: 'aria-valuemax', ARIA_VALUEMIN: 'aria-valuemin', ARIA_VALUENOW: 'aria-valuenow', CHANGE_EVENT: 'MDCSlider:change', INPUT_EVENT: 'MDCSlider:input', LAST_TRACK_MARKER_SELECTOR: '.mdc-slider__track-marker:last-child', PIN_VALUE_MARKER_SELECTOR: '.mdc-slider__pin-value-marker', STEP_DATA_ATTR: 'data-step', THUMB_CONTAINER_SELECTOR: '.mdc-slider__thumb-container', TRACK_MARKER_CONTAINER_SELECTOR: '.mdc-slider__track-marker-container', TRACK_SELECTOR: '.mdc-slider__track' }; var numbers = { PAGE_FACTOR: 4 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssPropertyNameMap = { animation: { prefixed: '-webkit-animation', standard: 'animation' }, transform: { prefixed: '-webkit-transform', standard: 'transform' }, transition: { prefixed: '-webkit-transition', standard: 'transition' } }; var jsEventTypeMap = { animationend: { cssProperty: 'animation', prefixed: 'webkitAnimationEnd', standard: 'animationend' }, animationiteration: { cssProperty: 'animation', prefixed: 'webkitAnimationIteration', standard: 'animationiteration' }, animationstart: { cssProperty: 'animation', prefixed: 'webkitAnimationStart', standard: 'animationstart' }, transitionend: { cssProperty: 'transition', prefixed: 'webkitTransitionEnd', standard: 'transitionend' } }; function isWindow(windowObj) { return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; } function getCorrectPropertyName(windowObj, cssProperty) { if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { var el = windowObj.document.createElement('div'); var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed; var isStandard = standard in el.style; return isStandard ? standard : prefixed; } return cssProperty; } function getCorrectEventName(windowObj, eventType) { if (isWindow(windowObj) && eventType in jsEventTypeMap) { var el = windowObj.document.createElement('div'); var _a = jsEventTypeMap[eventType], standard = _a.standard, prefixed = _a.prefixed, cssProperty = _a.cssProperty; var isStandard = cssProperty in el.style; return isStandard ? standard : prefixed; } return eventType; } /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var DOWN_EVENTS = ['mousedown', 'pointerdown', 'touchstart']; var UP_EVENTS = ['mouseup', 'pointerup', 'touchend']; var MOVE_EVENT_MAP = { mousedown: 'mousemove', pointerdown: 'pointermove', touchstart: 'touchmove' }; var KEY_IDS = { ARROW_DOWN: 'ArrowDown', ARROW_LEFT: 'ArrowLeft', ARROW_RIGHT: 'ArrowRight', ARROW_UP: 'ArrowUp', END: 'End', HOME: 'Home', PAGE_DOWN: 'PageDown', PAGE_UP: 'PageUp' }; var MDCSliderFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCSliderFoundation, _super); function MDCSliderFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCSliderFoundation.defaultAdapter, adapter)) || this; /** * We set this to NaN since we want it to be a number, but we can't use '0' or '-1' * because those could be valid tabindices set by the client code. */ _this.savedTabIndex_ = NaN; _this.active_ = false; _this.inTransit_ = false; _this.isDiscrete_ = false; _this.hasTrackMarker_ = false; _this.handlingThumbTargetEvt_ = false; _this.min_ = 0; _this.max_ = 100; _this.step_ = 0; _this.value_ = 0; _this.disabled_ = false; _this.preventFocusState_ = false; _this.thumbContainerPointerHandler_ = function () { return _this.handlingThumbTargetEvt_ = true; }; _this.interactionStartHandler_ = function (evt) { return _this.handleDown_(evt); }; _this.keydownHandler_ = function (evt) { return _this.handleKeydown_(evt); }; _this.focusHandler_ = function () { return _this.handleFocus_(); }; _this.blurHandler_ = function () { return _this.handleBlur_(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCSliderFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSliderFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSliderFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSliderFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { hasClass: function hasClass() { return false; }, addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, getAttribute: function getAttribute() { return null; }, setAttribute: function setAttribute() { return undefined; }, removeAttribute: function removeAttribute() { return undefined; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, getTabIndex: function getTabIndex() { return 0; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler() { return undefined; }, deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler() { return undefined; }, registerBodyInteractionHandler: function registerBodyInteractionHandler() { return undefined; }, deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, notifyInput: function notifyInput() { return undefined; }, notifyChange: function notifyChange() { return undefined; }, setThumbContainerStyleProperty: function setThumbContainerStyleProperty() { return undefined; }, setTrackStyleProperty: function setTrackStyleProperty() { return undefined; }, setMarkerValue: function setMarkerValue() { return undefined; }, appendTrackMarkers: function appendTrackMarkers() { return undefined; }, removeTrackMarkers: function removeTrackMarkers() { return undefined; }, setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty() { return undefined; }, isRTL: function isRTL() { return false; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCSliderFoundation.prototype.init = function () { var _this = this; this.isDiscrete_ = this.adapter_.hasClass(cssClasses.IS_DISCRETE); this.hasTrackMarker_ = this.adapter_.hasClass(cssClasses.HAS_TRACK_MARKER); DOWN_EVENTS.forEach(function (evtName) { _this.adapter_.registerInteractionHandler(evtName, _this.interactionStartHandler_); _this.adapter_.registerThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_); }); this.adapter_.registerInteractionHandler('keydown', this.keydownHandler_); this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); this.adapter_.registerResizeHandler(this.resizeHandler_); this.layout(); // At last step, provide a reasonable default value to discrete slider if (this.isDiscrete_ && this.getStep() === 0) { this.step_ = 1; } }; MDCSliderFoundation.prototype.destroy = function () { var _this = this; DOWN_EVENTS.forEach(function (evtName) { _this.adapter_.deregisterInteractionHandler(evtName, _this.interactionStartHandler_); _this.adapter_.deregisterThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_); }); this.adapter_.deregisterInteractionHandler('keydown', this.keydownHandler_); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); this.adapter_.deregisterResizeHandler(this.resizeHandler_); }; MDCSliderFoundation.prototype.setupTrackMarker = function () { if (this.isDiscrete_ && this.hasTrackMarker_ && this.getStep() !== 0) { var min = this.getMin(); var max = this.getMax(); var step = this.getStep(); var numMarkers = (max - min) / step; // In case distance between max & min is indivisible to step, // we place the secondary to last marker proportionally at where thumb // could reach and place the last marker at max value var indivisible = Math.ceil(numMarkers) !== numMarkers; if (indivisible) { numMarkers = Math.ceil(numMarkers); } this.adapter_.removeTrackMarkers(); this.adapter_.appendTrackMarkers(numMarkers); if (indivisible) { var lastStepRatio = (max - numMarkers * step) / step + 1; this.adapter_.setLastTrackMarkersStyleProperty('flex-grow', String(lastStepRatio)); } } }; MDCSliderFoundation.prototype.layout = function () { this.rect_ = this.adapter_.computeBoundingRect(); this.updateUIForCurrentValue_(); }; MDCSliderFoundation.prototype.getValue = function () { return this.value_; }; MDCSliderFoundation.prototype.setValue = function (value) { this.setValue_(value, false); }; MDCSliderFoundation.prototype.getMax = function () { return this.max_; }; MDCSliderFoundation.prototype.setMax = function (max) { if (max < this.min_) { throw new Error('Cannot set max to be less than the slider\'s minimum value'); } this.max_ = max; this.setValue_(this.value_, false, true); this.adapter_.setAttribute(strings.ARIA_VALUEMAX, String(this.max_)); this.setupTrackMarker(); }; MDCSliderFoundation.prototype.getMin = function () { return this.min_; }; MDCSliderFoundation.prototype.setMin = function (min) { if (min > this.max_) { throw new Error('Cannot set min to be greater than the slider\'s maximum value'); } this.min_ = min; this.setValue_(this.value_, false, true); this.adapter_.setAttribute(strings.ARIA_VALUEMIN, String(this.min_)); this.setupTrackMarker(); }; MDCSliderFoundation.prototype.getStep = function () { return this.step_; }; MDCSliderFoundation.prototype.setStep = function (step) { if (step < 0) { throw new Error('Step cannot be set to a negative number'); } if (this.isDiscrete_ && (typeof step !== 'number' || step < 1)) { step = 1; } this.step_ = step; this.setValue_(this.value_, false, true); this.setupTrackMarker(); }; MDCSliderFoundation.prototype.isDisabled = function () { return this.disabled_; }; MDCSliderFoundation.prototype.setDisabled = function (disabled) { this.disabled_ = disabled; this.toggleClass_(cssClasses.DISABLED, this.disabled_); if (this.disabled_) { this.savedTabIndex_ = this.adapter_.getTabIndex(); this.adapter_.setAttribute(strings.ARIA_DISABLED, 'true'); this.adapter_.removeAttribute('tabindex'); } else { this.adapter_.removeAttribute(strings.ARIA_DISABLED); if (!isNaN(this.savedTabIndex_)) { this.adapter_.setAttribute('tabindex', String(this.savedTabIndex_)); } } }; /** * Called when the user starts interacting with the slider */ MDCSliderFoundation.prototype.handleDown_ = function (downEvent) { var _this = this; if (this.disabled_) { return; } this.preventFocusState_ = true; this.setInTransit_(!this.handlingThumbTargetEvt_); this.handlingThumbTargetEvt_ = false; this.setActive_(true); var moveHandler = function moveHandler(moveEvent) { _this.handleMove_(moveEvent); }; var moveEventType = MOVE_EVENT_MAP[downEvent.type]; // Note: upHandler is [de]registered on ALL potential pointer-related release event types, since some browsers // do not always fire these consistently in pairs. // (See https://github.com/material-components/material-components-web/issues/1192) var upHandler = function upHandler() { _this.handleUp_(); _this.adapter_.deregisterBodyInteractionHandler(moveEventType, moveHandler); UP_EVENTS.forEach(function (evtName) { return _this.adapter_.deregisterBodyInteractionHandler(evtName, upHandler); }); }; this.adapter_.registerBodyInteractionHandler(moveEventType, moveHandler); UP_EVENTS.forEach(function (evtName) { return _this.adapter_.registerBodyInteractionHandler(evtName, upHandler); }); this.setValueFromEvt_(downEvent); }; /** * Called when the user moves the slider */ MDCSliderFoundation.prototype.handleMove_ = function (evt) { evt.preventDefault(); this.setValueFromEvt_(evt); }; /** * Called when the user's interaction with the slider ends */ MDCSliderFoundation.prototype.handleUp_ = function () { this.setActive_(false); this.adapter_.notifyChange(); }; /** * Returns the pageX of the event */ MDCSliderFoundation.prototype.getPageX_ = function (evt) { if (evt.targetTouches && evt.targetTouches.length > 0) { return evt.targetTouches[0].pageX; } return evt.pageX; }; /** * Sets the slider value from an event */ MDCSliderFoundation.prototype.setValueFromEvt_ = function (evt) { var pageX = this.getPageX_(evt); var value = this.computeValueFromPageX_(pageX); this.setValue_(value, true); }; /** * Computes the new value from the pageX position */ MDCSliderFoundation.prototype.computeValueFromPageX_ = function (pageX) { var _a = this, max = _a.max_, min = _a.min_; var xPos = pageX - this.rect_.left; var pctComplete = xPos / this.rect_.width; if (this.adapter_.isRTL()) { pctComplete = 1 - pctComplete; } // Fit the percentage complete between the range [min,max] // by remapping from [0, 1] to [min, min+(max-min)]. return min + pctComplete * (max - min); }; /** * Handles keydown events */ MDCSliderFoundation.prototype.handleKeydown_ = function (evt) { var keyId = this.getKeyId_(evt); var value = this.getValueForKeyId_(keyId); if (isNaN(value)) { return; } // Prevent page from scrolling due to key presses that would normally scroll the page evt.preventDefault(); this.adapter_.addClass(cssClasses.FOCUS); this.setValue_(value, true); this.adapter_.notifyChange(); }; /** * Returns the computed name of the event */ MDCSliderFoundation.prototype.getKeyId_ = function (kbdEvt) { if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) { return KEY_IDS.ARROW_LEFT; } if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) { return KEY_IDS.ARROW_RIGHT; } if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) { return KEY_IDS.ARROW_UP; } if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) { return KEY_IDS.ARROW_DOWN; } if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) { return KEY_IDS.HOME; } if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) { return KEY_IDS.END; } if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) { return KEY_IDS.PAGE_UP; } if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) { return KEY_IDS.PAGE_DOWN; } return ''; }; /** * Computes the value given a keyboard key ID */ MDCSliderFoundation.prototype.getValueForKeyId_ = function (keyId) { var _a = this, max = _a.max_, min = _a.min_, step = _a.step_; var delta = step || (max - min) / 100; var valueNeedsToBeFlipped = this.adapter_.isRTL() && (keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT); if (valueNeedsToBeFlipped) { delta = -delta; } switch (keyId) { case KEY_IDS.ARROW_LEFT: case KEY_IDS.ARROW_DOWN: return this.value_ - delta; case KEY_IDS.ARROW_RIGHT: case KEY_IDS.ARROW_UP: return this.value_ + delta; case KEY_IDS.HOME: return this.min_; case KEY_IDS.END: return this.max_; case KEY_IDS.PAGE_UP: return this.value_ + delta * numbers.PAGE_FACTOR; case KEY_IDS.PAGE_DOWN: return this.value_ - delta * numbers.PAGE_FACTOR; default: return NaN; } }; MDCSliderFoundation.prototype.handleFocus_ = function () { if (this.preventFocusState_) { return; } this.adapter_.addClass(cssClasses.FOCUS); }; MDCSliderFoundation.prototype.handleBlur_ = function () { this.preventFocusState_ = false; this.adapter_.removeClass(cssClasses.FOCUS); }; /** * Sets the value of the slider */ MDCSliderFoundation.prototype.setValue_ = function (value, shouldFireInput, force) { if (force === void 0) { force = false; } if (value === this.value_ && !force) { return; } var _a = this, min = _a.min_, max = _a.max_; var valueSetToBoundary = value === min || value === max; if (this.step_ && !valueSetToBoundary) { value = this.quantize_(value); } if (value < min) { value = min; } else if (value > max) { value = max; } this.value_ = value; this.adapter_.setAttribute(strings.ARIA_VALUENOW, String(this.value_)); this.updateUIForCurrentValue_(); if (shouldFireInput) { this.adapter_.notifyInput(); if (this.isDiscrete_) { this.adapter_.setMarkerValue(value); } } }; /** * Calculates the quantized value */ MDCSliderFoundation.prototype.quantize_ = function (value) { var numSteps = Math.round(value / this.step_); return numSteps * this.step_; }; MDCSliderFoundation.prototype.updateUIForCurrentValue_ = function () { var _this = this; var _a = this, max = _a.max_, min = _a.min_, value = _a.value_; var pctComplete = (value - min) / (max - min); var translatePx = pctComplete * this.rect_.width; if (this.adapter_.isRTL()) { translatePx = this.rect_.width - translatePx; } var transformProp = getCorrectPropertyName(window, 'transform'); var transitionendEvtName = getCorrectEventName(window, 'transitionend'); if (this.inTransit_) { var onTransitionEnd_1 = function onTransitionEnd_1() { _this.setInTransit_(false); _this.adapter_.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1); }; this.adapter_.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1); } requestAnimationFrame(function () { // NOTE(traviskaufman): It would be nice to use calc() here, // but IE cannot handle calcs in transforms correctly. // See: https://goo.gl/NC2itk // Also note that the -50% offset is used to center the slider thumb. _this.adapter_.setThumbContainerStyleProperty(transformProp, "translateX(" + translatePx + "px) translateX(-50%)"); _this.adapter_.setTrackStyleProperty(transformProp, "scaleX(" + pctComplete + ")"); }); }; /** * Toggles the active state of the slider */ MDCSliderFoundation.prototype.setActive_ = function (active) { this.active_ = active; this.toggleClass_(cssClasses.ACTIVE, this.active_); }; /** * Toggles the inTransit state of the slider */ MDCSliderFoundation.prototype.setInTransit_ = function (inTransit) { this.inTransit_ = inTransit; this.toggleClass_(cssClasses.IN_TRANSIT, this.inTransit_); }; /** * Conditionally adds or removes a class based on shouldBePresent */ MDCSliderFoundation.prototype.toggleClass_ = function (className, shouldBePresent) { if (shouldBePresent) { this.adapter_.addClass(className); } else { this.adapter_.removeClass(className); } }; return MDCSliderFoundation; }(MDCFoundation); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCSlider = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCSlider, _super); function MDCSlider() { return _super !== null && _super.apply(this, arguments) || this; } MDCSlider.attachTo = function (root) { return new MDCSlider(root); }; Object.defineProperty(MDCSlider.prototype, "value", { get: function get() { return this.foundation_.getValue(); }, set: function set(value) { this.foundation_.setValue(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSlider.prototype, "min", { get: function get() { return this.foundation_.getMin(); }, set: function set(min) { this.foundation_.setMin(min); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSlider.prototype, "max", { get: function get() { return this.foundation_.getMax(); }, set: function set(max) { this.foundation_.setMax(max); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSlider.prototype, "step", { get: function get() { return this.foundation_.getStep(); }, set: function set(step) { this.foundation_.setStep(step); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSlider.prototype, "disabled", { get: function get() { return this.foundation_.isDisabled(); }, set: function set(disabled) { this.foundation_.setDisabled(disabled); }, enumerable: true, configurable: true }); MDCSlider.prototype.initialize = function () { this.thumbContainer_ = this.root_.querySelector(strings.THUMB_CONTAINER_SELECTOR); this.track_ = this.root_.querySelector(strings.TRACK_SELECTOR); this.pinValueMarker_ = this.root_.querySelector(strings.PIN_VALUE_MARKER_SELECTOR); this.trackMarkerContainer_ = this.root_.querySelector(strings.TRACK_MARKER_CONTAINER_SELECTOR); }; MDCSlider.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, getAttribute: function getAttribute(name) { return _this.root_.getAttribute(name); }, setAttribute: function setAttribute(name, value) { return _this.root_.setAttribute(name, value); }, removeAttribute: function removeAttribute(name) { return _this.root_.removeAttribute(name); }, computeBoundingRect: function computeBoundingRect() { return _this.root_.getBoundingClientRect(); }, getTabIndex: function getTabIndex() { return _this.root_.tabIndex; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.unlisten(evtType, handler); }, registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler(evtType, handler) { _this.thumbContainer_.addEventListener(evtType, handler); }, deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler(evtType, handler) { _this.thumbContainer_.removeEventListener(evtType, handler); }, registerBodyInteractionHandler: function registerBodyInteractionHandler(evtType, handler) { return document.body.addEventListener(evtType, handler); }, deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler(evtType, handler) { return document.body.removeEventListener(evtType, handler); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, notifyInput: function notifyInput() { return _this.emit(strings.INPUT_EVENT, _this); }, notifyChange: function notifyChange() { return _this.emit(strings.CHANGE_EVENT, _this); }, setThumbContainerStyleProperty: function setThumbContainerStyleProperty(propertyName, value) { _this.thumbContainer_.style.setProperty(propertyName, value); }, setTrackStyleProperty: function setTrackStyleProperty(propertyName, value) { return _this.track_.style.setProperty(propertyName, value); }, setMarkerValue: function setMarkerValue(value) { return _this.pinValueMarker_.innerText = value.toLocaleString(); }, appendTrackMarkers: function appendTrackMarkers(numMarkers) { var frag = document.createDocumentFragment(); for (var i = 0; i < numMarkers; i++) { var marker = document.createElement('div'); marker.classList.add('mdc-slider__track-marker'); frag.appendChild(marker); } _this.trackMarkerContainer_.appendChild(frag); }, removeTrackMarkers: function removeTrackMarkers() { while (_this.trackMarkerContainer_.firstChild) { _this.trackMarkerContainer_.removeChild(_this.trackMarkerContainer_.firstChild); } }, setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty(propertyName, value) { // We remove and append new nodes, thus, the last track marker must be dynamically found. var lastTrackMarker = _this.root_.querySelector(strings.LAST_TRACK_MARKER_SELECTOR); lastTrackMarker.style.setProperty(propertyName, value); }, isRTL: function isRTL() { return getComputedStyle(_this.root_).direction === 'rtl'; } }; // tslint:enable:object-literal-sort-keys return new MDCSliderFoundation(adapter); }; MDCSlider.prototype.initialSyncWithDOM = function () { var origValueNow = this.parseFloat_(this.root_.getAttribute(strings.ARIA_VALUENOW), this.value); var min = this.parseFloat_(this.root_.getAttribute(strings.ARIA_VALUEMIN), this.min); var max = this.parseFloat_(this.root_.getAttribute(strings.ARIA_VALUEMAX), this.max); // min and max need to be set in the right order to avoid throwing an error // when the new min is greater than the default max. if (min >= this.max) { this.max = max; this.min = min; } else { this.min = min; this.max = max; } this.step = this.parseFloat_(this.root_.getAttribute(strings.STEP_DATA_ATTR), this.step); this.value = origValueNow; this.disabled = this.root_.hasAttribute(strings.ARIA_DISABLED) && this.root_.getAttribute(strings.ARIA_DISABLED) !== 'false'; this.foundation_.setupTrackMarker(); }; MDCSlider.prototype.layout = function () { this.foundation_.layout(); }; MDCSlider.prototype.stepUp = function (amount) { if (amount === void 0) { amount = this.step || 1; } this.value += amount; }; MDCSlider.prototype.stepDown = function (amount) { if (amount === void 0) { amount = this.step || 1; } this.value -= amount; }; MDCSlider.prototype.parseFloat_ = function (str, defaultValue) { var num = parseFloat(str); // tslint:disable-line:ban var isNumeric = typeof num === 'number' && isFinite(num); return isNumeric ? num : defaultValue; }; return MDCSlider; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var MDC_SLIDER_CONTROL_VALUE_ACCESSOR = { provide: _angular_forms__WEBPACK_IMPORTED_MODULE_3__["NG_VALUE_ACCESSOR"], useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])((/** * @return {?} */ function () { return MdcSlider; })), multi: true }; var MdcSliderChange = /** @class */ (function () { function MdcSliderChange(source, value) { this.source = source; this.value = value; } return MdcSliderChange; }()); var MdcSlider = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MdcSlider, _super); function MdcSlider(_platform, _changeDetectorRef, elementRef) { var _this = _super.call(this, elementRef) || this; _this._platform = _platform; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this._initialized = false; _this._discrete = false; _this._markers = false; _this._min = 0; _this._max = 100; _this._step = 0; _this._value = 0; _this._disabled = false; _this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); _this.input = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * View to model callback called when value changes */ _this._onChanged = (/** * @return {?} */ function () { }); /** * onTouch function registered via registerOnTouch (ControlValueAccessor). */ _this._onTouched = (/** * @return {?} */ function () { }); return _this; } Object.defineProperty(MdcSlider.prototype, "discrete", { get: /** * @return {?} */ function () { return this._discrete; }, set: /** * @param {?} value * @return {?} */ function (value) { this._discrete = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (this._foundation) { if (this._discrete && this.markers) { this._foundation.setupTrackMarker(); } } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSlider.prototype, "markers", { get: /** * @return {?} */ function () { return this._markers; }, set: /** * @param {?} value * @return {?} */ function (value) { this._markers = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); if (this._foundation) { if (this._markers && this.discrete) { this._foundation.setupTrackMarker(); } } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSlider.prototype, "min", { get: /** * @return {?} */ function () { return this._min; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var min = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toNumber"])(value, this._min); if (min > this._max) { return; } if (min !== this._min) { this._min = min; if (this._foundation && this._initialized) { this._foundation.setMin(this._min); } this._changeDetectorRef.markForCheck(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSlider.prototype, "max", { get: /** * @return {?} */ function () { return this._max; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var max = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toNumber"])(value, this._max); if (max < this._min) { return; } if (max !== this._max) { this._max = max; if (this._foundation && this._initialized) { this._foundation.setMax(this._max); } this._changeDetectorRef.markForCheck(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSlider.prototype, "step", { get: /** * @return {?} */ function () { return this._step; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var step = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toNumber"])(value, this._step); if (step !== this._step) { this._step = step; if (this._foundation && this._initialized) { this._foundation.setStep(this._step); } this._changeDetectorRef.markForCheck(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcSlider.prototype, "value", { get: /** * @return {?} */ function () { return this._value; }, set: /** * @param {?} newValue * @return {?} */ function (newValue) { this.setValue(newValue, true); }, enumerable: true, configurable: true }); Object.defineProperty(MdcSlider.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setDisabledState(value); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcSlider.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), getAttribute: (/** * @param {?} name * @return {?} */ function (name) { return _this._getHostElement().getAttribute(name); }), setAttribute: (/** * @param {?} name * @param {?} value * @return {?} */ function (name, value) { return _this._getHostElement().setAttribute(name, value); }), removeAttribute: (/** * @param {?} name * @return {?} */ function (name) { return _this._getHostElement().removeAttribute(name); }), computeBoundingRect: (/** * @return {?} */ function () { return _this._getHostElement().getBoundingClientRect(); }), getTabIndex: (/** * @return {?} */ function () { return _this._getHostElement().tabIndex; }), registerInteractionHandler: (/** * @param {?} type * @param {?} handler * @return {?} */ function (type, handler) { return _this._getHostElement().addEventListener(type, handler); }), deregisterInteractionHandler: (/** * @param {?} type * @param {?} handler * @return {?} */ function (type, handler) { return _this._getHostElement().removeEventListener(type, handler); }), registerThumbContainerInteractionHandler: (/** * @param {?} type * @param {?} handler * @return {?} */ function (type, handler) { return _this.thumbContainer.nativeElement.addEventListener(type, handler); }), deregisterThumbContainerInteractionHandler: (/** * @param {?} type * @param {?} handler * @return {?} */ function (type, handler) { return _this.thumbContainer.nativeElement.removeEventListener(type, handler); }), registerBodyInteractionHandler: (/** * @param {?} type * @param {?} handler * @return {?} */ function (type, handler) { return document.body.addEventListener(type, handler); }), deregisterBodyInteractionHandler: (/** * @param {?} type * @param {?} handler * @return {?} */ function (type, handler) { return document.body.removeEventListener(type, handler); }), registerResizeHandler: (/** * @param {?} handler * @return {?} */ function (handler) { return window.addEventListener('resize', handler); }), deregisterResizeHandler: (/** * @param {?} handler * @return {?} */ function (handler) { return window.removeEventListener('resize', handler); }), notifyInput: (/** * @return {?} */ function () { return _this._onInput(); }), notifyChange: (/** * @return {?} */ function () { return _this._onChange(); }), setThumbContainerStyleProperty: (/** * @param {?} propertyName * @param {?} value * @return {?} */ function (propertyName, value) { return _this.thumbContainer.nativeElement.style.setProperty(propertyName, value); }), setTrackStyleProperty: (/** * @param {?} propertyName * @param {?} value * @return {?} */ function (propertyName, value) { return _this.track.nativeElement.style.setProperty(propertyName, value); }), setMarkerValue: (/** * @param {?} value * @return {?} */ function (value) { return (/** @type {?} */ (_this.pinValueMarker)).nativeElement.innerText = value !== null ? value.toString() : null; }), appendTrackMarkers: (/** * @param {?} numMarkers * @return {?} */ function (numMarkers) { /** @type {?} */ var docFrag = document.createDocumentFragment(); for (var i = 0; i < numMarkers; i++) { /** @type {?} */ var marker = document.createElement('div'); marker.classList.add('mdc-slider__track-marker'); docFrag.appendChild(marker); } (/** @type {?} */ (_this.trackMarkerContainer)).nativeElement.appendChild(docFrag); }), removeTrackMarkers: (/** * @return {?} */ function () { while ((/** @type {?} */ (_this.trackMarkerContainer)).nativeElement.firstChild) { (/** @type {?} */ (_this.trackMarkerContainer)).nativeElement.removeChild((/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ (_this.trackMarkerContainer)).nativeElement)).firstChild))); } }), setLastTrackMarkersStyleProperty: (/** * @param {?} propertyName * @param {?} value * @return {?} */ function (propertyName, value) { /** @type {?} */ var lastTrackMarker = _this._getHostElement().querySelector(strings.LAST_TRACK_MARKER_SELECTOR); (/** @type {?} */ (lastTrackMarker)).style.setProperty(propertyName, value); }), isRTL: (/** * @return {?} */ function () { return getComputedStyle(_this._getHostElement()).direction === 'rtl'; }) }; return new MDCSliderFoundation(adapter); }; /** * @return {?} */ MdcSlider.prototype.ngAfterViewInit = /** * @return {?} */ function () { if (this._platform.isBrowser) { this._foundation.init(); this._initializeSelection(); this._foundation.setupTrackMarker(); this._initialized = true; } }; /** * @return {?} */ MdcSlider.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this._foundation) { this._foundation.destroy(); } }; /** * @param {?} value * @return {?} */ MdcSlider.prototype.writeValue = /** * @param {?} value * @return {?} */ function (value) { this.setValue(value); }; /** * @param {?} fn * @return {?} */ MdcSlider.prototype.registerOnChange = /** * @param {?} fn * @return {?} */ function (fn) { this._onChanged = fn; }; /** * @param {?} fn * @return {?} */ MdcSlider.prototype.registerOnTouched = /** * @param {?} fn * @return {?} */ function (fn) { this._onTouched = fn; }; /** * @param {?} value * @param {?=} isUserInput * @return {?} */ MdcSlider.prototype.setValue = /** * @param {?} value * @param {?=} isUserInput * @return {?} */ function (value, isUserInput) { if (this.disabled) { return; } /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toNumber"])(value, this.min); this._value = Math.round(newValue); if (this._foundation && this._initialized) { this._foundation.setValue(this._value); } if (isUserInput) { this._onChanged(this._value); } this._changeDetectorRef.markForCheck(); }; /** * @param {?} disabled * @return {?} */ MdcSlider.prototype.setDisabledState = /** * @param {?} disabled * @return {?} */ function (disabled) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(disabled); if (!this._foundation) { return; } this._foundation.setDisabled(this._disabled); this._changeDetectorRef.markForCheck(); }; /** * @private * @return {?} */ MdcSlider.prototype._onInput = /** * @private * @return {?} */ function () { this.setValue(this._foundation.getValue(), true); this.input.emit(new MdcSliderChange(this, this._value)); }; /** * @private * @return {?} */ MdcSlider.prototype._onChange = /** * @private * @return {?} */ function () { this.setValue(this._foundation.getValue(), true); this.change.emit(new MdcSliderChange(this, this._value)); }; /** * @private * @return {?} */ MdcSlider.prototype._initializeSelection = /** * @private * @return {?} */ function () { var _this = this; // Defer setting the value in order to avoid the "Expression // has changed after it was checked" errors from Angular. Promise.resolve().then((/** * @return {?} */ function () { _this._foundation.setMin(_this._min); _this._foundation.setMax(_this._max); _this._foundation.setStep(_this._step); _this._foundation.setValue(_this._value); })); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcSlider.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcSlider.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-slider', exportAs: 'mdcSlider', host: { 'role': 'slider', 'tabindex': '0', 'class': 'mdc-slider', '[class.mdc-slider--discrete]': 'discrete', '[class.mdc-slider--display-markers]': 'markers && discrete' }, template: "\n
\n
\n
\n
\n
\n
\n \n
\n \n \n \n
\n
", providers: [MDC_SLIDER_CONTROL_VALUE_ACCESSOR], changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcSlider.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcSlider.propDecorators = { discrete: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], markers: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], min: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], max: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], step: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], change: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], input: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], thumbContainer: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['thumbcontainer',] }], _sliderThumb: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['sliderThumb',] }], track: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['track',] }], pinValueMarker: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['pin',] }], trackMarkerContainer: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['markercontainer',] }] }; return MdcSlider; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcSliderModule = /** @class */ (function () { function MdcSliderModule() { } MdcSliderModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"]], exports: [MdcSlider], declarations: [MdcSlider] },] }, ]; return MdcSliderModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=slider.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/snackbar.es5.js": /*!************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/snackbar.es5.js ***! \************************************************************/ /*! exports provided: MDC_SNACKBAR_DATA, MDC_SNACKBAR_DEFAULT_OPTIONS, MDC_SNACKBAR_DEFAULT_OPTIONS_FACTORY, MdcSnackbar, MdcSnackbarComponent, MdcSnackbarConfig, MdcSnackbarContainer, MdcSnackbarModule, MdcSnackbarRef */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_SNACKBAR_DATA", function() { return MDC_SNACKBAR_DATA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_SNACKBAR_DEFAULT_OPTIONS", function() { return MDC_SNACKBAR_DEFAULT_OPTIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_SNACKBAR_DEFAULT_OPTIONS_FACTORY", function() { return MDC_SNACKBAR_DEFAULT_OPTIONS_FACTORY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbar", function() { return MdcSnackbar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarComponent", function() { return MdcSnackbarComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarConfig", function() { return MdcSnackbarConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarContainer", function() { return MdcSnackbarContainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarModule", function() { return MdcSnackbarModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarRef", function() { return MdcSnackbarRef; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/overlay */ "./node_modules/@angular-mdc/web/esm5/overlay.es5.js"); /* harmony import */ var _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/portal */ "./node_modules/@angular-mdc/web/esm5/portal.es5.js"); /* harmony import */ var _angular_mdc_web_button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/button */ "./node_modules/@angular-mdc/web/esm5/button.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Reference to a snackbar dispatched from the snackbar service. * @template T */ var /** * Reference to a snackbar dispatched from the snackbar service. * @template T */ MdcSnackbarRef = /** @class */ (function () { function MdcSnackbarRef(containerInstance, _overlayRef) { this.containerInstance = containerInstance; this._overlayRef = _overlayRef; /** * Subject for notifying the user that the snackbar has been dismissed. */ this._afterDismiss = new rxjs__WEBPACK_IMPORTED_MODULE_7__["Subject"](); this.componentInstance = containerInstance; } /** Gets an observable that is notified when the snackbar is finished closing. */ /** * Gets an observable that is notified when the snackbar is finished closing. * @return {?} */ MdcSnackbarRef.prototype.afterDismiss = /** * Gets an observable that is notified when the snackbar is finished closing. * @return {?} */ function () { return this._afterDismiss.asObservable(); }; /** * @param {?=} reason * @return {?} */ MdcSnackbarRef.prototype.dismiss = /** * @param {?=} reason * @return {?} */ function (reason) { if (!this._afterDismiss.closed) { this._dismissedReason = reason; this._finishDismiss(); } }; /** Cleans up the DOM after closing. */ /** * Cleans up the DOM after closing. * @private * @return {?} */ MdcSnackbarRef.prototype._finishDismiss = /** * Cleans up the DOM after closing. * @private * @return {?} */ function () { this._overlayRef.dispose(); this._afterDismiss.next(this._dismissedReason); this._afterDismiss.complete(); }; return MdcSnackbarRef; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Injection token that can be used to access the data that was passed in to a snackbar. * @type {?} */ var MDC_SNACKBAR_DATA = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('MdcSnackbarData'); /** * @template D */ var /** * @template D */ MdcSnackbarConfig = /** @class */ (function () { function MdcSnackbarConfig() { /** * Data being injected into the child component. */ this.data = null; /** * Positions the action button/icon below the label instead of alongside it. */ this.stacked = false; /** * Positions the snackbar on the leading edge of the screen */ this.leading = false; /** * Positions the snackbar on the trailing edge of the screen */ this.trailing = false; /** * The layout direction of the snackbar content */ this.direction = 'ltr'; /** * Show dismiss ("X") icon */ this.dismiss = false; /** * Whether the snackbar closes when it is focused and the user presses the ESC key */ this.closeOnEscape = true; } return MdcSnackbarConfig; }()); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { CLOSING: 'mdc-snackbar--closing', OPEN: 'mdc-snackbar--open', OPENING: 'mdc-snackbar--opening' }; var strings = { ACTION_SELECTOR: '.mdc-snackbar__action', ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text', CLOSED_EVENT: 'MDCSnackbar:closed', CLOSING_EVENT: 'MDCSnackbar:closing', DISMISS_SELECTOR: '.mdc-snackbar__dismiss', LABEL_SELECTOR: '.mdc-snackbar__label', OPENED_EVENT: 'MDCSnackbar:opened', OPENING_EVENT: 'MDCSnackbar:opening', REASON_ACTION: 'action', REASON_DISMISS: 'dismiss', SURFACE_SELECTOR: '.mdc-snackbar__surface' }; var numbers = { DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000, MAX_AUTO_DISMISS_TIMEOUT_MS: 10000, MIN_AUTO_DISMISS_TIMEOUT_MS: 4000, // These variables need to be kept in sync with the values in _variables.scss. SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75, SNACKBAR_ANIMATION_OPEN_TIME_MS: 150, /** * Number of milliseconds to wait between temporarily clearing the label text * in the DOM and subsequently restoring it. This is necessary to force IE 11 * to pick up the `aria-live` content change and announce it to the user. */ ARIA_LIVE_DELAY_MS: 1000 }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ARIA_LIVE_DELAY_MS = numbers.ARIA_LIVE_DELAY_MS; var ARIA_LIVE_LABEL_TEXT_ATTR = strings.ARIA_LIVE_LABEL_TEXT_ATTR; function announce(ariaEl, labelEl) { if (labelEl === void 0) { labelEl = ariaEl; } var priority = ariaEl.getAttribute('aria-live'); // Trim text to ignore ` ` (see below). // textContent is only null if the node is a document, DOCTYPE, or notation. var labelText = labelEl.textContent.trim(); if (!labelText || !priority) { return; } // Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice. ariaEl.setAttribute('aria-live', 'off'); // Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers. // `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars // sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first. // Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event, // so screen readers won't announce the second message unless we first clear `textContent`. // // We have to clear the label text two different ways to make it work in all browsers and screen readers: // // 1. `textContent = ''` is required for IE11 + JAWS // 2. `innerHTML = ' '` is required for Chrome + JAWS and NVDA // // All other browser/screen reader combinations support both methods. // // The wrapper `` visually hides the space character so that it doesn't cause jank when added/removed. // N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change. // // This technique has been tested in: // // * JAWS 2019: // - Chrome 70 // - Firefox 60 (ESR) // - IE 11 // * NVDA 2018: // - Chrome 70 // - Firefox 60 (ESR) // - IE 11 // * ChromeVox 53 labelEl.textContent = ''; labelEl.innerHTML = ' '; // Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element. // CSS generated content is normally announced by screen readers // (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/); // however, `aria-live` is turned off, so this DOM update will be ignored by screen readers. labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText); setTimeout(function () { // Allow screen readers to announce changes to the DOM again. ariaEl.setAttribute('aria-live', priority); // Remove the message from the ::before pseudo-element. labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR); // Restore the original label text, which will be announced by screen readers. labelEl.textContent = labelText; }, ARIA_LIVE_DELAY_MS); } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. */ function closest(element, selector) { if (element.closest) { return element.closest(selector); } var el = element; while (el) { if (matches(el, selector)) { return el; } el = el.parentElement; } return null; } function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var OPENING = cssClasses.OPENING, OPEN = cssClasses.OPEN, CLOSING = cssClasses.CLOSING; var REASON_ACTION = strings.REASON_ACTION, REASON_DISMISS = strings.REASON_DISMISS; var MDCSnackbarFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__extends"])(MDCSnackbarFoundation, _super); function MDCSnackbarFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__assign"])({}, MDCSnackbarFoundation.defaultAdapter, adapter)) || this; _this.isOpen_ = false; _this.animationFrame_ = 0; _this.animationTimer_ = 0; _this.autoDismissTimer_ = 0; _this.autoDismissTimeoutMs_ = numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS; _this.closeOnEscape_ = true; return _this; } Object.defineProperty(MDCSnackbarFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSnackbarFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSnackbarFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, announce: function announce() { return undefined; }, notifyClosed: function notifyClosed() { return undefined; }, notifyClosing: function notifyClosing() { return undefined; }, notifyOpened: function notifyOpened() { return undefined; }, notifyOpening: function notifyOpening() { return undefined; }, removeClass: function removeClass() { return undefined; } }; }, enumerable: true, configurable: true }); MDCSnackbarFoundation.prototype.destroy = function () { this.clearAutoDismissTimer_(); cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = 0; clearTimeout(this.animationTimer_); this.animationTimer_ = 0; this.adapter_.removeClass(OPENING); this.adapter_.removeClass(OPEN); this.adapter_.removeClass(CLOSING); }; MDCSnackbarFoundation.prototype.open = function () { var _this = this; this.clearAutoDismissTimer_(); this.isOpen_ = true; this.adapter_.notifyOpening(); this.adapter_.removeClass(CLOSING); this.adapter_.addClass(OPENING); this.adapter_.announce(); // Wait a frame once display is no longer "none", to establish basis for animation this.runNextAnimationFrame_(function () { _this.adapter_.addClass(OPEN); _this.animationTimer_ = setTimeout(function () { _this.handleAnimationTimerEnd_(); _this.adapter_.notifyOpened(); _this.autoDismissTimer_ = setTimeout(function () { _this.close(REASON_DISMISS); }, _this.getTimeoutMs()); }, numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS); }); }; /** * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom * client-specific values may also be used if desired. */ MDCSnackbarFoundation.prototype.close = function (reason) { var _this = this; if (reason === void 0) { reason = ''; } if (!this.isOpen_) { // Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed return; } cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = 0; this.clearAutoDismissTimer_(); this.isOpen_ = false; this.adapter_.notifyClosing(reason); this.adapter_.addClass(cssClasses.CLOSING); this.adapter_.removeClass(cssClasses.OPEN); this.adapter_.removeClass(cssClasses.OPENING); clearTimeout(this.animationTimer_); this.animationTimer_ = setTimeout(function () { _this.handleAnimationTimerEnd_(); _this.adapter_.notifyClosed(reason); }, numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS); }; MDCSnackbarFoundation.prototype.isOpen = function () { return this.isOpen_; }; MDCSnackbarFoundation.prototype.getTimeoutMs = function () { return this.autoDismissTimeoutMs_; }; MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) { // Use shorter variable names to make the code more readable var minValue = numbers.MIN_AUTO_DISMISS_TIMEOUT_MS; var maxValue = numbers.MAX_AUTO_DISMISS_TIMEOUT_MS; if (timeoutMs <= maxValue && timeoutMs >= minValue) { this.autoDismissTimeoutMs_ = timeoutMs; } else { throw new Error("timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + ", but got '" + timeoutMs + "'"); } }; MDCSnackbarFoundation.prototype.getCloseOnEscape = function () { return this.closeOnEscape_; }; MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) { this.closeOnEscape_ = closeOnEscape; }; MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) { var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27; if (isEscapeKey && this.getCloseOnEscape()) { this.close(REASON_DISMISS); } }; MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) { this.close(REASON_ACTION); }; MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) { this.close(REASON_DISMISS); }; MDCSnackbarFoundation.prototype.clearAutoDismissTimer_ = function () { clearTimeout(this.autoDismissTimer_); this.autoDismissTimer_ = 0; }; MDCSnackbarFoundation.prototype.handleAnimationTimerEnd_ = function () { this.animationTimer_ = 0; this.adapter_.removeClass(cssClasses.OPENING); this.adapter_.removeClass(cssClasses.CLOSING); }; /** * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. */ MDCSnackbarFoundation.prototype.runNextAnimationFrame_ = function (callback) { var _this = this; cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = requestAnimationFrame(function () { _this.animationFrame_ = 0; clearTimeout(_this.animationTimer_); _this.animationTimer_ = setTimeout(callback, 0); }); }; return MDCSnackbarFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var SURFACE_SELECTOR = strings.SURFACE_SELECTOR, LABEL_SELECTOR = strings.LABEL_SELECTOR, ACTION_SELECTOR = strings.ACTION_SELECTOR, DISMISS_SELECTOR = strings.DISMISS_SELECTOR, OPENING_EVENT = strings.OPENING_EVENT, OPENED_EVENT = strings.OPENED_EVENT, CLOSING_EVENT = strings.CLOSING_EVENT, CLOSED_EVENT = strings.CLOSED_EVENT; var MDCSnackbar = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__extends"])(MDCSnackbar, _super); function MDCSnackbar() { return _super !== null && _super.apply(this, arguments) || this; } MDCSnackbar.attachTo = function (root) { return new MDCSnackbar(root); }; MDCSnackbar.prototype.initialize = function (announcerFactory) { if (announcerFactory === void 0) { announcerFactory = function announcerFactory() { return announce; }; } this.announce_ = announcerFactory(); }; MDCSnackbar.prototype.initialSyncWithDOM = function () { var _this = this; this.surfaceEl_ = this.root_.querySelector(SURFACE_SELECTOR); this.labelEl_ = this.root_.querySelector(LABEL_SELECTOR); this.actionEl_ = this.root_.querySelector(ACTION_SELECTOR); this.handleKeyDown_ = function (evt) { return _this.foundation_.handleKeyDown(evt); }; this.handleSurfaceClick_ = function (evt) { var target = evt.target; if (_this.isActionButton_(target)) { _this.foundation_.handleActionButtonClick(evt); } else if (_this.isActionIcon_(target)) { _this.foundation_.handleActionIconClick(evt); } }; this.registerKeyDownHandler_(this.handleKeyDown_); this.registerSurfaceClickHandler_(this.handleSurfaceClick_); }; MDCSnackbar.prototype.destroy = function () { _super.prototype.destroy.call(this); this.deregisterKeyDownHandler_(this.handleKeyDown_); this.deregisterSurfaceClickHandler_(this.handleSurfaceClick_); }; MDCSnackbar.prototype.open = function () { this.foundation_.open(); }; /** * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom * client-specific values may also be used if desired. */ MDCSnackbar.prototype.close = function (reason) { if (reason === void 0) { reason = ''; } this.foundation_.close(reason); }; MDCSnackbar.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, announce: function announce() { return _this.announce_(_this.labelEl_); }, notifyClosed: function notifyClosed(reason) { return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {}); }, notifyClosing: function notifyClosing(reason) { return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {}); }, notifyOpened: function notifyOpened() { return _this.emit(OPENED_EVENT, {}); }, notifyOpening: function notifyOpening() { return _this.emit(OPENING_EVENT, {}); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); } }; return new MDCSnackbarFoundation(adapter); }; Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", { get: function get() { return this.foundation_.getTimeoutMs(); }, set: function set(timeoutMs) { this.foundation_.setTimeoutMs(timeoutMs); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", { get: function get() { return this.foundation_.getCloseOnEscape(); }, set: function set(closeOnEscape) { this.foundation_.setCloseOnEscape(closeOnEscape); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSnackbar.prototype, "isOpen", { get: function get() { return this.foundation_.isOpen(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSnackbar.prototype, "labelText", { get: function get() { // This property only returns null if the node is a document, DOCTYPE, or notation. // On Element nodes, it always returns a string. return this.labelEl_.textContent; }, set: function set(labelText) { this.labelEl_.textContent = labelText; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", { get: function get() { return this.actionEl_.textContent; }, set: function set(actionButtonText) { this.actionEl_.textContent = actionButtonText; }, enumerable: true, configurable: true }); MDCSnackbar.prototype.registerKeyDownHandler_ = function (handler) { this.listen('keydown', handler); }; MDCSnackbar.prototype.deregisterKeyDownHandler_ = function (handler) { this.unlisten('keydown', handler); }; MDCSnackbar.prototype.registerSurfaceClickHandler_ = function (handler) { this.surfaceEl_.addEventListener('click', handler); }; MDCSnackbar.prototype.deregisterSurfaceClickHandler_ = function (handler) { this.surfaceEl_.removeEventListener('click', handler); }; MDCSnackbar.prototype.isActionButton_ = function (target) { return Boolean(closest(target, ACTION_SELECTOR)); }; MDCSnackbar.prototype.isActionIcon_ = function (target) { return Boolean(closest(target, DISMISS_SELECTOR)); }; return MDCSnackbar; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcSnackbarComponent = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__extends"])(MdcSnackbarComponent, _super); function MdcSnackbarComponent(_changeDetectorRef, elementRef, snackbarRef, data) { var _this = _super.call(this, elementRef) || this; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this.snackbarRef = snackbarRef; _this.data = data; return _this; } Object.defineProperty(MdcSnackbarComponent.prototype, "config", { get: /** * @return {?} */ function () { return this.snackbarRef.componentInstance.snackbarConfig; }, enumerable: true, configurable: true }); /** * @return {?} */ MdcSnackbarComponent.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), announce: (/** * @return {?} */ function () { return announce(_this.label.nativeElement); }), notifyClosing: (/** * @return {?} */ function () { }), notifyOpened: (/** * @return {?} */ function () { }), notifyOpening: (/** * @return {?} */ function () { }), notifyClosed: (/** * @param {?} reason * @return {?} */ function (reason) { return _this.snackbarRef.dismiss(reason); }) }; return new MDCSnackbarFoundation(adapter); }; /** * @return {?} */ MdcSnackbarComponent.prototype.ngOnInit = /** * @return {?} */ function () { this._changeDetectorRef.detectChanges(); this._applyClasses(); this._applyConfig(); }; /** * @return {?} */ MdcSnackbarComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this._foundation) { this._foundation.destroy(); } }; /** * @param {?} evt * @return {?} */ MdcSnackbarComponent.prototype._onKeydown = /** * @param {?} evt * @return {?} */ function (evt) { this._foundation.handleKeyDown(evt); }; /** * @param {?} evt * @return {?} */ MdcSnackbarComponent.prototype._onActionClick = /** * @param {?} evt * @return {?} */ function (evt) { this._foundation.handleActionButtonClick(evt); }; /** * @param {?} evt * @return {?} */ MdcSnackbarComponent.prototype._onActionIconClick = /** * @param {?} evt * @return {?} */ function (evt) { this._foundation.handleActionIconClick(evt); }; /** * @return {?} */ MdcSnackbarComponent.prototype.open = /** * @return {?} */ function () { this._foundation.open(); }; /** * @param {?=} reason * @return {?} */ MdcSnackbarComponent.prototype.close = /** * @param {?=} reason * @return {?} */ function (reason) { this._foundation.close(reason); }; /** * @private * @return {?} */ MdcSnackbarComponent.prototype._applyClasses = /** * @private * @return {?} */ function () { var _a, _b, _c; /** @type {?} */ var classes = this.config.classes; if (classes) { if (classes instanceof Array) { (_a = this._getHostElement().classList).add.apply(_a, (/** @type {?} */ (this.config.classes))); } else { this._getHostElement().classList.toggle(classes); } } /** @type {?} */ var actionClasses = this.config.actionClasses; if (actionClasses && this.action) { if (actionClasses instanceof Array) { (_b = this.action.nativeElement.classList).add.apply(_b, (/** @type {?} */ (this.config.actionClasses))); } else { this.action.nativeElement.classList.toggle(actionClasses); } } if (this.dismiss) { /** @type {?} */ var dismissClasses = this.config.dismissClasses; if (dismissClasses) { if (dismissClasses instanceof Array) { (_c = this.dismiss.nativeElement.classList).add.apply(_c, (/** @type {?} */ (this.config.dismissClasses))); } else { this.dismiss.nativeElement.classList.toggle(dismissClasses); } } } }; /** * @private * @return {?} */ MdcSnackbarComponent.prototype._applyConfig = /** * @private * @return {?} */ function () { if (this.config.timeoutMs) { this._foundation.setTimeoutMs(this.config.timeoutMs); } if (this.config.dismiss) { this._foundation.setCloseOnEscape(this.config.closeOnEscape ? true : false); } }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcSnackbarComponent.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcSnackbarComponent.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-snackbar', host: { 'class': 'mdc-snackbar', '[dir]': 'this.config.direction', '[class.mdc-snackbar--stacked]': 'config.stacked', '[class.mdc-snackbar--leading]': 'config.leading', '[class.ngx-mdc-snackbar--trailing]': 'config.trailing', '(keydown)': '_onKeydown($event)' }, template: "\n
\n
{{data.message}}
\n
\n \n \n
\n
", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcSnackbarComponent.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: MdcSnackbarRef }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [MDC_SNACKBAR_DATA,] }] } ]; }; MdcSnackbarComponent.propDecorators = { label: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['label',] }], action: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['action',] }], dismiss: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['dismiss',] }] }; return MdcSnackbarComponent; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_6__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcSnackbarContainer = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__extends"])(MdcSnackbarContainer, _super); function MdcSnackbarContainer(_ngZone, snackbarConfig) { var _this = _super.call(this) || this; _this._ngZone = _ngZone; _this.snackbarConfig = snackbarConfig; /** * Subject for notifying that the snackbar has exited from view. */ _this._onExit = new rxjs__WEBPACK_IMPORTED_MODULE_7__["Subject"](); return _this; } /** Attach a component portal as content to this snackbar container. */ /** * Attach a component portal as content to this snackbar container. * @template T * @param {?} portal * @return {?} */ MdcSnackbarContainer.prototype.attachComponentPortal = /** * Attach a component portal as content to this snackbar container. * @template T * @param {?} portal * @return {?} */ function (portal) { return this._portalOutlet.attachComponentPortal(portal); }; /** Attach a template portal as content to this snackbar container. */ /** * Attach a template portal as content to this snackbar container. * @template C * @param {?} portal * @return {?} */ MdcSnackbarContainer.prototype.attachTemplatePortal = /** * Attach a template portal as content to this snackbar container. * @template C * @param {?} portal * @return {?} */ function (portal) { return this._portalOutlet.attachTemplatePortal(portal); }; /** * @return {?} */ MdcSnackbarContainer.prototype.ngOnDestroy = /** * @return {?} */ function () { this._completeExit(); }; /** * Waits for the zone to settle before removing the element. Helps prevent * errors where we end up removing an element which is in the middle of an animation. */ /** * Waits for the zone to settle before removing the element. Helps prevent * errors where we end up removing an element which is in the middle of an animation. * @private * @return {?} */ MdcSnackbarContainer.prototype._completeExit = /** * Waits for the zone to settle before removing the element. Helps prevent * errors where we end up removing an element which is in the middle of an animation. * @private * @return {?} */ function () { var _this = this; this._ngZone.onMicrotaskEmpty.asObservable().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_8__["take"])(1)).subscribe((/** * @return {?} */ function () { _this._onExit.next(); _this._onExit.complete(); })); }; MdcSnackbarContainer.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-snackbar-container', template: '', changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcSnackbarContainer.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: MdcSnackbarConfig } ]; }; MdcSnackbarContainer.propDecorators = { _portalOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_3__["CdkPortalOutlet"],] }] }; return MdcSnackbarContainer; }(_angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_3__["BasePortalOutlet"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcSnackbarModule = /** @class */ (function () { function MdcSnackbarModule() { } MdcSnackbarModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"], _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_2__["OverlayModule"], _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_3__["PortalModule"], _angular_mdc_web_button__WEBPACK_IMPORTED_MODULE_4__["MdcButtonModule"] ], exports: [MdcSnackbarContainer], declarations: [MdcSnackbarContainer, MdcSnackbarComponent], entryComponents: [MdcSnackbarContainer, MdcSnackbarComponent] },] }, ]; return MdcSnackbarModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Injection token that can be used to specify default snackbar. * @type {?} */ var MDC_SNACKBAR_DEFAULT_OPTIONS = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('mdc-snackbar-default-options', { providedIn: 'root', factory: MDC_SNACKBAR_DEFAULT_OPTIONS_FACTORY, }); /** * \@docs-private * @return {?} */ function MDC_SNACKBAR_DEFAULT_OPTIONS_FACTORY() { return new MdcSnackbarConfig(); } var MdcSnackbar = /** @class */ (function () { function MdcSnackbar(_overlay, _injector, _parentSnackBar, _defaultConfig) { this._overlay = _overlay; this._injector = _injector; this._parentSnackBar = _parentSnackBar; this._defaultConfig = _defaultConfig; /** * Reference to the current snackbar in the view *at this level* (in the Angular injector tree). * If there is a parent snack-bar service, all operations should delegate to that parent * via `_openedSnackBarRef`. */ this._snackBarRefAtThisLevel = null; } Object.defineProperty(MdcSnackbar.prototype, "_openedSnackbarRef", { /** Reference to the currently opened snackbar at *any* level. */ get: /** * Reference to the currently opened snackbar at *any* level. * @return {?} */ function () { /** @type {?} */ var parent = this._parentSnackBar; return parent ? parent._openedSnackbarRef : this._snackBarRefAtThisLevel; }, set: /** * @param {?} value * @return {?} */ function (value) { if (this._parentSnackBar) { this._parentSnackBar._openedSnackbarRef = value; } else { this._snackBarRefAtThisLevel = value; } }, enumerable: true, configurable: true }); /** * Creates and dispatches a snackbar with a custom component for the content, removing any * currently opened snackbars. * * @param component Component to be instantiated. * @param config Extra configuration for the snackbar. */ /** * Creates and dispatches a snackbar with a custom component for the content, removing any * currently opened snackbars. * * @template T * @param {?} component Component to be instantiated. * @param {?=} config Extra configuration for the snackbar. * @return {?} */ MdcSnackbar.prototype.openFromComponent = /** * Creates and dispatches a snackbar with a custom component for the content, removing any * currently opened snackbars. * * @template T * @param {?} component Component to be instantiated. * @param {?=} config Extra configuration for the snackbar. * @return {?} */ function (component, config) { return (/** @type {?} */ (this._attach(component, config))); }; /** * Opens a snackbar with a message and an optional action. * @param message Message text. * @param action The label for the snackbar action. * @param config Additional configuration options for the snackbar. */ /** * Opens a snackbar with a message and an optional action. * @param {?} message Message text. * @param {?=} action The label for the snackbar action. * @param {?=} config Additional configuration options for the snackbar. * @return {?} */ MdcSnackbar.prototype.open = /** * Opens a snackbar with a message and an optional action. * @param {?} message Message text. * @param {?=} action The label for the snackbar action. * @param {?=} config Additional configuration options for the snackbar. * @return {?} */ function (message, action, config) { if (action === void 0) { action = ''; } /** @type {?} */ var _config = Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__assign"])({}, this._defaultConfig, config); // Since the user doesn't have access to the component, we can // override the data to pass in our own message and action. _config.data = { message: message, action: action }; return this.openFromComponent(MdcSnackbarComponent, _config); }; /** * Dismisses the currently-visible snackbar. */ /** * Dismisses the currently-visible snackbar. * @return {?} */ MdcSnackbar.prototype.dismiss = /** * Dismisses the currently-visible snackbar. * @return {?} */ function () { if (this._openedSnackbarRef) { if (this._openedSnackbarRef.instance instanceof MdcSnackbarComponent) { ((/** @type {?} */ (this._openedSnackbarRef.instance))).close(); } this._openedSnackbarRef.dismiss(); } }; /** * @return {?} */ MdcSnackbar.prototype.ngOnDestroy = /** * @return {?} */ function () { // Only dismiss the snackbar at the current level on destroy. if (this._snackBarRefAtThisLevel) { this._snackBarRefAtThisLevel.dismiss(); } }; /** * Attaches the snackbar container component to the overlay. */ /** * Attaches the snackbar container component to the overlay. * @private * @param {?} overlayRef * @param {?} config * @return {?} */ MdcSnackbar.prototype._attachSnackbarContainer = /** * Attaches the snackbar container component to the overlay. * @private * @param {?} overlayRef * @param {?} config * @return {?} */ function (overlayRef, config) { /** @type {?} */ var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; /** @type {?} */ var injector = new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_3__["PortalInjector"](userInjector || this._injector, new WeakMap([ [MdcSnackbarConfig, config] ])); /** @type {?} */ var containerPortal = new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_3__["ComponentPortal"](MdcSnackbarContainer, config.viewContainerRef, injector); /** @type {?} */ var containerRef = overlayRef.attach(containerPortal); containerRef.instance.snackbarConfig = config; return containerRef.instance; }; /** * Places a new component or a template as the content of the snackbar container. */ /** * Places a new component or a template as the content of the snackbar container. * @private * @template T * @param {?} content * @param {?=} userConfig * @return {?} */ MdcSnackbar.prototype._attach = /** * Places a new component or a template as the content of the snackbar container. * @private * @template T * @param {?} content * @param {?=} userConfig * @return {?} */ function (content, userConfig) { /** @type {?} */ var config = Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__assign"])({}, new MdcSnackbarConfig(), this._defaultConfig, userConfig); /** @type {?} */ var overlayRef = this._createOverlay(); /** @type {?} */ var container = this._attachSnackbarContainer(overlayRef, config); /** @type {?} */ var snackbarRef = new MdcSnackbarRef(container, overlayRef); /** @type {?} */ var injector = this._createInjector(config, snackbarRef); /** @type {?} */ var portal = new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_3__["ComponentPortal"](content, undefined, injector); /** @type {?} */ var contentRef = container.attachComponentPortal(portal); // We can't pass this via the injector, because the injector is created earlier. snackbarRef.instance = contentRef.instance; this._loadListeners(snackbarRef); this._openedSnackbarRef = snackbarRef; if (snackbarRef.instance instanceof MdcSnackbarComponent) { ((/** @type {?} */ (snackbarRef.instance))).open(); } return this._openedSnackbarRef; }; /** * @private * @param {?} snackbarRef * @return {?} */ MdcSnackbar.prototype._loadListeners = /** * @private * @param {?} snackbarRef * @return {?} */ function (snackbarRef) { var _this = this; // When the snackbar is dismissed, clear the reference to it. snackbarRef.afterDismiss().subscribe((/** * @return {?} */ function () { // Clear the snackbar ref if it hasn't already been replaced by a newer snackbar. if (_this._openedSnackbarRef === snackbarRef) { _this._openedSnackbarRef = null; } })); if (this._openedSnackbarRef) { this._openedSnackbarRef.dismiss(); } }; /** * Creates a new overlay and places it in the correct location. * @param config The user-specified snackbar config. */ /** * Creates a new overlay and places it in the correct location. * @private * @return {?} */ MdcSnackbar.prototype._createOverlay = /** * Creates a new overlay and places it in the correct location. * @private * @return {?} */ function () { return this._overlay.create(); }; /** * Creates an injector to be used inside of a snackbar component. * @param config Config that was used to create the snackbar. * @param snackbarRef Reference to the snackbar. */ /** * Creates an injector to be used inside of a snackbar component. * @private * @template T * @param {?} config Config that was used to create the snackbar. * @param {?} snackbarRef Reference to the snackbar. * @return {?} */ MdcSnackbar.prototype._createInjector = /** * Creates an injector to be used inside of a snackbar component. * @private * @template T * @param {?} config Config that was used to create the snackbar. * @param {?} snackbarRef Reference to the snackbar. * @return {?} */ function (config, snackbarRef) { /** @type {?} */ var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; return new _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_3__["PortalInjector"](userInjector || this._injector, new WeakMap([ [MdcSnackbarRef, snackbarRef], [MDC_SNACKBAR_DATA, config.data] ])); }; MdcSnackbar.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"], args: [{ providedIn: MdcSnackbarModule },] }, ]; /** @nocollapse */ MdcSnackbar.ctorParameters = function () { return [ { type: _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_2__["Overlay"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injector"] }, { type: MdcSnackbar, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["SkipSelf"] }] }, { type: MdcSnackbarConfig, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [MDC_SNACKBAR_DEFAULT_OPTIONS,] }] } ]; }; /** @nocollapse */ MdcSnackbar.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["defineInjectable"])({ factory: function MdcSnackbar_Factory() { return new MdcSnackbar(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_2__["Overlay"]), Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["INJECTOR"]), Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(MdcSnackbar, 12), Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(MDC_SNACKBAR_DEFAULT_OPTIONS)); }, token: MdcSnackbar, providedIn: MdcSnackbarModule }); return MdcSnackbar; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=snackbar.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/switch.es5.js": /*!**********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/switch.es5.js ***! \**********************************************************/ /*! exports provided: MDC_SWITCH_CONTROL_VALUE_ACCESSOR, MdcSwitch, MdcSwitchChange, MdcSwitchModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_SWITCH_CONTROL_VALUE_ACCESSOR", function() { return MDC_SWITCH_CONTROL_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSwitch", function() { return MdcSwitch; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSwitchChange", function() { return MdcSwitchChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSwitchModule", function() { return MdcSwitchModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/form-field */ "./node_modules/@angular-mdc/web/esm5/form-field.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** CSS classes used by the switch. */ var cssClasses$1 = { /** Class used for a switch that is in the "checked" (on) position. */ CHECKED: 'mdc-switch--checked', /** Class used for a switch that is disabled. */ DISABLED: 'mdc-switch--disabled' }; /** String constants used by the switch. */ var strings$1 = { /** A CSS selector used to locate the native HTML control for the switch. */ NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control', /** A CSS selector used to locate the ripple surface element for the switch. */ RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCSwitchFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCSwitchFoundation, _super); function MDCSwitchFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCSwitchFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCSwitchFoundation, "strings", { /** The string constants used by the switch. */ get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSwitchFoundation, "cssClasses", { /** The CSS classes used by the switch. */ get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", { /** The default Adapter for the switch. */ get: function get() { return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, setNativeControlChecked: function setNativeControlChecked() { return undefined; }, setNativeControlDisabled: function setNativeControlDisabled() { return undefined; } }; }, enumerable: true, configurable: true }); /** Sets the checked state of the switch. */ MDCSwitchFoundation.prototype.setChecked = function (checked) { this.adapter_.setNativeControlChecked(checked); this.updateCheckedStyling_(checked); }; /** Sets the disabled state of the switch. */ MDCSwitchFoundation.prototype.setDisabled = function (disabled) { this.adapter_.setNativeControlDisabled(disabled); if (disabled) { this.adapter_.addClass(cssClasses$1.DISABLED); } else { this.adapter_.removeClass(cssClasses$1.DISABLED); } }; /** Handles the change event for the switch native control. */ MDCSwitchFoundation.prototype.handleChange = function (evt) { var nativeControl = evt.target; this.updateCheckedStyling_(nativeControl.checked); }; /** Updates the styling of the switch based on its checked state. */ MDCSwitchFoundation.prototype.updateCheckedStyling_ = function (checked) { if (checked) { this.adapter_.addClass(cssClasses$1.CHECKED); } else { this.adapter_.removeClass(cssClasses$1.CHECKED); } }; return MDCSwitchFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCSwitch = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCSwitch, _super); function MDCSwitch() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ripple_ = _this.createRipple_(); return _this; } MDCSwitch.attachTo = function (root) { return new MDCSwitch(root); }; MDCSwitch.prototype.destroy = function () { _super.prototype.destroy.call(this); this.ripple_.destroy(); this.nativeControl_.removeEventListener('change', this.changeHandler_); }; MDCSwitch.prototype.initialSyncWithDOM = function () { var _this = this; this.changeHandler_ = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var _a; return (_a = _this.foundation_).handleChange.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); }; this.nativeControl_.addEventListener('change', this.changeHandler_); // Sometimes the checked state of the input element is saved in the history. // The switch styling should match the checked state of the input element. // Do an initial sync between the native control and the foundation. this.checked = this.checked; }; MDCSwitch.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, setNativeControlChecked: function setNativeControlChecked(checked) { return _this.nativeControl_.checked = checked; }, setNativeControlDisabled: function setNativeControlDisabled(disabled) { return _this.nativeControl_.disabled = disabled; } }; return new MDCSwitchFoundation(adapter); }; Object.defineProperty(MDCSwitch.prototype, "ripple", { get: function get() { return this.ripple_; }, enumerable: true, configurable: true }); Object.defineProperty(MDCSwitch.prototype, "checked", { get: function get() { return this.nativeControl_.checked; }, set: function set(checked) { this.foundation_.setChecked(checked); }, enumerable: true, configurable: true }); Object.defineProperty(MDCSwitch.prototype, "disabled", { get: function get() { return this.nativeControl_.disabled; }, set: function set(disabled) { this.foundation_.setDisabled(disabled); }, enumerable: true, configurable: true }); MDCSwitch.prototype.createRipple_ = function () { var _this = this; var RIPPLE_SURFACE_SELECTOR = MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR; var rippleSurface = this.root_.querySelector(RIPPLE_SURFACE_SELECTOR); // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCRipple.createAdapter(this), { addClass: function addClass(className) { return rippleSurface.classList.add(className); }, computeBoundingRect: function computeBoundingRect() { return rippleSurface.getBoundingClientRect(); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { _this.nativeControl_.removeEventListener(evtType, handler); }, isSurfaceActive: function isSurfaceActive() { return matches(_this.nativeControl_, ':active'); }, isUnbounded: function isUnbounded() { return true; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { _this.nativeControl_.addEventListener(evtType, handler); }, removeClass: function removeClass(className) { return rippleSurface.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { rippleSurface.style.setProperty(varName, value); } }); return new MDCRipple(this.root_, new MDCRippleFoundation(adapter)); }; Object.defineProperty(MDCSwitch.prototype, "nativeControl_", { get: function get() { var NATIVE_CONTROL_SELECTOR = MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR; return this.root_.querySelector(NATIVE_CONTROL_SELECTOR); }, enumerable: true, configurable: true }); return MDCSwitch; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var MDC_SWITCH_CONTROL_VALUE_ACCESSOR = { provide: _angular_forms__WEBPACK_IMPORTED_MODULE_3__["NG_VALUE_ACCESSOR"], useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])((/** * @return {?} */ function () { return MdcSwitch; })), multi: true }; /** * Change event object emitted by MdcSwitch. */ var /** * Change event object emitted by MdcSwitch. */ MdcSwitchChange = /** @class */ (function () { function MdcSwitchChange(source, checked) { this.source = source; this.checked = checked; } return MdcSwitchChange; }()); /** @type {?} */ var nextUniqueId = 0; var MdcSwitch = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MdcSwitch, _super); function MdcSwitch(_changeDetectorRef, ripple, elementRef, _parentFormField) { var _this = _super.call(this, elementRef) || this; _this._changeDetectorRef = _changeDetectorRef; _this.ripple = ripple; _this.elementRef = elementRef; _this._parentFormField = _parentFormField; _this._uniqueId = "mdc-switch-" + ++nextUniqueId; _this.id = _this._uniqueId; _this.name = null; _this.tabIndex = 0; /** * The value attribute of the native input element */ _this.value = null; _this._checked = false; _this._disabled = false; _this._required = false; /** * Used to set the aria-label attribute on the underlying input element. */ _this.ariaLabel = null; /** * Used to set the aria-labelledby attribute on the underlying input element. */ _this.ariaLabelledby = null; _this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * View to model callback called when value changes */ _this._onChange = (/** * @param {?} _ * @return {?} */ function (_) { }); /** * View to model callback called when control has been touched */ _this._onTouched = (/** * @return {?} */ function () { }); if (_this._parentFormField) { _parentFormField.elementRef.nativeElement.classList.add('mdc-form-field'); } return _this; } Object.defineProperty(MdcSwitch.prototype, "checked", { get: /** * @return {?} */ function () { return this._checked; }, set: /** * @param {?} value * @return {?} */ function (value) { if (this.disabled) { return; } this._checked = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); this._changeDetectorRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcSwitch.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setDisabledState(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcSwitch.prototype, "required", { get: /** * @return {?} */ function () { return this._required; }, set: /** * @param {?} value * @return {?} */ function (value) { this._required = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcSwitch.prototype, "inputId", { get: /** * @return {?} */ function () { return (this.id || this._uniqueId) + "-input"; }, enumerable: true, configurable: true }); /** * @return {?} */ MdcSwitch.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), setNativeControlChecked: (/** * @param {?} checked * @return {?} */ function (checked) { return _this._getInputElement().checked = checked; }), setNativeControlDisabled: (/** * @param {?} disabled * @return {?} */ function (disabled) { return _this._getInputElement().disabled = disabled; }) }; return new MDCSwitchFoundation(adapter); }; /** * @return {?} */ MdcSwitch.prototype.ngAfterViewInit = /** * @return {?} */ function () { this._foundation.init(); this._initRipple(); }; /** * @return {?} */ MdcSwitch.prototype.ngOnDestroy = /** * @return {?} */ function () { this.ripple.destroy(); }; /** * @param {?} evt * @return {?} */ MdcSwitch.prototype.onChange = /** * @param {?} evt * @return {?} */ function (evt) { evt.stopPropagation(); if (this.disabled) { return; } this._foundation.handleChange(evt); this._checked = this._inputElement.nativeElement.checked; this._foundation.setChecked(this._checked); this._emitChangeEvent(); this._changeDetectorRef.markForCheck(); }; /** * @param {?} evt * @return {?} */ MdcSwitch.prototype.onInputClick = /** * @param {?} evt * @return {?} */ function (evt) { evt.stopPropagation(); }; /** * @return {?} */ MdcSwitch.prototype.onBlur = /** * @return {?} */ function () { this._onTouched(); }; /** * @param {?} value * @return {?} */ MdcSwitch.prototype.writeValue = /** * @param {?} value * @return {?} */ function (value) { this.checked = !!value; }; /** * @param {?} fn * @return {?} */ MdcSwitch.prototype.registerOnChange = /** * @param {?} fn * @return {?} */ function (fn) { this._onChange = fn; }; /** * @param {?} fn * @return {?} */ MdcSwitch.prototype.registerOnTouched = /** * @param {?} fn * @return {?} */ function (fn) { this._onTouched = fn; }; /** Toggles the checked state of the switch. */ /** * Toggles the checked state of the switch. * @return {?} */ MdcSwitch.prototype.toggle = /** * Toggles the checked state of the switch. * @return {?} */ function () { this.checked = !this.checked; this._onChange(this.checked); }; /** * @param {?} disabled * @return {?} */ MdcSwitch.prototype.setDisabledState = /** * @param {?} disabled * @return {?} */ function (disabled) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["toBoolean"])(disabled); this._foundation.setDisabled(this._disabled); this._changeDetectorRef.markForCheck(); }; /** * @return {?} */ MdcSwitch.prototype.focus = /** * @return {?} */ function () { this._inputElement.nativeElement.focus(); }; /** * @private * @return {?} */ MdcSwitch.prototype._initRipple = /** * @private * @return {?} */ function () { var _this = this; this.ripple.init({ surface: this.thumbUnderlay.nativeElement, activator: this._inputElement.nativeElement }, Object.assign(this.ripple.createAdapter(), { isUnbounded: (/** * @return {?} */ function () { return true; }), isSurfaceDisabled: (/** * @return {?} */ function () { return _this._disabled; }) })); }; /** * Emits a change event on the `change` output. Also notifies the FormControl about the change. */ /** * Emits a change event on the `change` output. Also notifies the FormControl about the change. * @private * @return {?} */ MdcSwitch.prototype._emitChangeEvent = /** * Emits a change event on the `change` output. Also notifies the FormControl about the change. * @private * @return {?} */ function () { this._onChange(this.checked); this.change.emit(new MdcSwitchChange(this, this.checked)); }; /** Retrieves the DOM element of the component input. */ /** * Retrieves the DOM element of the component input. * @private * @return {?} */ MdcSwitch.prototype._getInputElement = /** * Retrieves the DOM element of the component input. * @private * @return {?} */ function () { return this._inputElement.nativeElement; }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcSwitch.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcSwitch.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-switch', host: { '[id]': 'id', 'class': 'mdc-switch', '[class.mdc-switch--checked]': 'checked', '[class.mdc-switch--disabled]': 'disabled', '(focus)': '_inputElement.nativeElement.focus()' }, template: "\n
\n
\n
\n \n
\n
\n ", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, providers: [ MDC_SWITCH_CONTROL_VALUE_ACCESSOR, { provide: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormFieldControl"], useExisting: MdcSwitch }, _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_6__["MdcRipple"] ] },] }, ]; /** @nocollapse */ MdcSwitch.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_6__["MdcRipple"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormField"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] } ]; }; MdcSwitch.propDecorators = { id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], tabIndex: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], checked: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], required: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ariaLabel: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['aria-label',] }], ariaLabelledby: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['aria-labelledby',] }], change: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], _inputElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['input',] }], thumbUnderlay: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['thumbUnderlay',] }] }; return MdcSwitch; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcSwitchModule = /** @class */ (function () { function MdcSwitchModule() { } MdcSwitchModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormFieldModule"]], exports: [ _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_1__["MdcFormFieldModule"], MdcSwitch ], declarations: [MdcSwitch] },] }, ]; return MdcSwitchModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=switch.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/tab-bar.es5.js": /*!***********************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/tab-bar.es5.js ***! \***********************************************************/ /*! exports provided: MdcTabActivatedEvent, MdcTabBar, MdcTabBarModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabActivatedEvent", function() { return MdcTabActivatedEvent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabBar", function() { return MdcTabBar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabBarModule", function() { return MdcTabBarModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/tab-indicator */ "./node_modules/@angular-mdc/web/esm5/tab-indicator.es5.js"); /* harmony import */ var _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/tab */ "./node_modules/@angular-mdc/web/esm5/tab.es5.js"); /* harmony import */ var _angular_mdc_web_tab_scroller__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/tab-scroller */ "./node_modules/@angular-mdc/web/esm5/tab-scroller.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { ANIMATING: 'mdc-tab-scroller--animating', SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll', SCROLL_TEST: 'mdc-tab-scroller__test' }; var strings = { AREA_SELECTOR: '.mdc-tab-scroller__scroll-area', CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing. */ var horizontalScrollbarHeight_; /** * Computes the height of browser-rendered horizontal scrollbars using a self-created test element. * May return 0 (e.g. on OS X browsers under default configuration). */ function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) { if (shouldCacheResult === void 0) { shouldCacheResult = true; } if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') { return horizontalScrollbarHeight_; } var el = documentObj.createElement('div'); el.classList.add(cssClasses.SCROLL_TEST); documentObj.body.appendChild(el); var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight; documentObj.body.removeChild(el); if (shouldCacheResult) { horizontalScrollbarHeight_ = horizontalScrollbarHeight; } return horizontalScrollbarHeight; } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerRTL = /** @class */ function () { function MDCTabScrollerRTL(adapter) { this.adapter_ = adapter; } return MDCTabScrollerRTL; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerRTLDefault = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabScrollerRTLDefault, _super); function MDCTabScrollerRTLDefault() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var right = this.calculateScrollEdges_().right; // Scroll values on most browsers are ints instead of floats so we round return Math.round(right - currentScrollLeft); }; MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) { var edges = this.calculateScrollEdges_(); var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(edges.right - scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: clampedScrollLeft - currentScrollLeft }; }; MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: clampedScrollLeft - currentScrollLeft }; }; MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) { return scrollX; }; MDCTabScrollerRTLDefault.prototype.calculateScrollEdges_ = function () { var contentWidth = this.adapter_.getScrollContentOffsetWidth(); var rootWidth = this.adapter_.getScrollAreaOffsetWidth(); return { left: 0, right: contentWidth - rootWidth }; }; MDCTabScrollerRTLDefault.prototype.clampScrollValue_ = function (scrollX) { var edges = this.calculateScrollEdges_(); return Math.min(Math.max(edges.left, scrollX), edges.right); }; return MDCTabScrollerRTLDefault; }(MDCTabScrollerRTL); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerRTLNegative = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabScrollerRTLNegative, _super); function MDCTabScrollerRTLNegative() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); return Math.round(translateX - currentScrollLeft); }; MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(-scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: clampedScrollLeft - currentScrollLeft }; }; MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: clampedScrollLeft - currentScrollLeft }; }; MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) { return scrollX - translateX; }; MDCTabScrollerRTLNegative.prototype.calculateScrollEdges_ = function () { var contentWidth = this.adapter_.getScrollContentOffsetWidth(); var rootWidth = this.adapter_.getScrollAreaOffsetWidth(); return { left: rootWidth - contentWidth, right: 0 }; }; MDCTabScrollerRTLNegative.prototype.clampScrollValue_ = function (scrollX) { var edges = this.calculateScrollEdges_(); return Math.max(Math.min(edges.right, scrollX), edges.left); }; return MDCTabScrollerRTLNegative; }(MDCTabScrollerRTL); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerRTLReverse = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabScrollerRTLReverse, _super); function MDCTabScrollerRTLReverse() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); // Scroll values on most browsers are ints instead of floats so we round return Math.round(currentScrollLeft - translateX); }; MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: currentScrollLeft - clampedScrollLeft }; }; MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft + scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: currentScrollLeft - clampedScrollLeft }; }; MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) { return scrollX + translateX; }; MDCTabScrollerRTLReverse.prototype.calculateScrollEdges_ = function () { var contentWidth = this.adapter_.getScrollContentOffsetWidth(); var rootWidth = this.adapter_.getScrollAreaOffsetWidth(); return { left: contentWidth - rootWidth, right: 0 }; }; MDCTabScrollerRTLReverse.prototype.clampScrollValue_ = function (scrollX) { var edges = this.calculateScrollEdges_(); return Math.min(Math.max(edges.right, scrollX), edges.left); }; return MDCTabScrollerRTLReverse; }(MDCTabScrollerRTL); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabScrollerFoundation, _super); function MDCTabScrollerFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__assign"])({}, MDCTabScrollerFoundation.defaultAdapter, adapter)) || this; /** * Controls whether we should handle the transitionend and interaction events during the animation. */ _this.isAnimating_ = false; return _this; } Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabScrollerFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { eventTargetMatchesSelector: function eventTargetMatchesSelector() { return false; }, addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, addScrollAreaClass: function addScrollAreaClass() { return undefined; }, setScrollAreaStyleProperty: function setScrollAreaStyleProperty() { return undefined; }, setScrollContentStyleProperty: function setScrollContentStyleProperty() { return undefined; }, getScrollContentStyleValue: function getScrollContentStyleValue() { return ''; }, setScrollAreaScrollLeft: function setScrollAreaScrollLeft() { return undefined; }, getScrollAreaScrollLeft: function getScrollAreaScrollLeft() { return 0; }, getScrollContentOffsetWidth: function getScrollContentOffsetWidth() { return 0; }, getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() { return 0; }, computeScrollAreaClientRect: function computeScrollAreaClientRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, computeScrollContentClientRect: function computeScrollContentClientRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() { return 0; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTabScrollerFoundation.prototype.init = function () { // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs. var horizontalScrollbarHeight = this.adapter_.computeHorizontalScrollbarHeight(); this.adapter_.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px'); this.adapter_.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL); }; /** * Computes the current visual scroll position */ MDCTabScrollerFoundation.prototype.getScrollPosition = function () { if (this.isRTL_()) { return this.computeCurrentScrollPositionRTL_(); } var currentTranslateX = this.calculateCurrentTranslateX_(); var scrollLeft = this.adapter_.getScrollAreaScrollLeft(); return scrollLeft - currentTranslateX; }; /** * Handles interaction events that occur during transition */ MDCTabScrollerFoundation.prototype.handleInteraction = function () { // Early exit if we aren't animating if (!this.isAnimating_) { return; } // Prevent other event listeners from handling this event this.stopScrollAnimation_(); }; /** * Handles the transitionend event */ MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) { // Early exit if we aren't animating or the event was triggered by a different element. var evtTarget = evt.target; if (!this.isAnimating_ || !this.adapter_.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) { return; } this.isAnimating_ = false; this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); }; /** * Increment the scroll value by the scrollXIncrement * @param scrollXIncrement The value by which to increment the scroll position */ MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) { // Early exit for non-operational increment values if (scrollXIncrement === 0) { return; } if (this.isRTL_()) { return this.incrementScrollRTL_(scrollXIncrement); } this.incrementScroll_(scrollXIncrement); }; /** * Scrolls to the given scrollX value */ MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) { if (this.isRTL_()) { return this.scrollToRTL_(scrollX); } this.scrollTo_(scrollX); }; /** * @return Browser-specific {@link MDCTabScrollerRTL} instance. */ MDCTabScrollerFoundation.prototype.getRTLScroller = function () { if (!this.rtlScrollerInstance_) { this.rtlScrollerInstance_ = this.rtlScrollerFactory_(); } return this.rtlScrollerInstance_; }; /** * @return translateX value from a CSS matrix transform function string. */ MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX_ = function () { var transformValue = this.adapter_.getScrollContentStyleValue('transform'); // Early exit if no transform is present if (transformValue === 'none') { return 0; } // The transform value comes back as a matrix transformation in the form // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so // we're going to grab all the parenthesized values, strip out tx, and // parse it. var match = /\((.+?)\)/.exec(transformValue); if (!match) { return 0; } var matrixParams = match[1]; // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error. // @ts-ignore These unused variables should retain their semantic names for clarity. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__read"])(matrixParams.split(','), 6), a = _a[0], b = _a[1], c = _a[2], d = _a[3], tx = _a[4], ty = _a[5]; return parseFloat(tx); // tslint:disable-line:ban }; /** * Calculates a safe scroll value that is > 0 and < the max scroll value * @param scrollX The distance to scroll */ MDCTabScrollerFoundation.prototype.clampScrollValue_ = function (scrollX) { var edges = this.calculateScrollEdges_(); return Math.min(Math.max(edges.left, scrollX), edges.right); }; MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL_ = function () { var translateX = this.calculateCurrentTranslateX_(); return this.getRTLScroller().getScrollPositionRTL(translateX); }; MDCTabScrollerFoundation.prototype.calculateScrollEdges_ = function () { var contentWidth = this.adapter_.getScrollContentOffsetWidth(); var rootWidth = this.adapter_.getScrollAreaOffsetWidth(); return { left: 0, right: contentWidth - rootWidth }; }; /** * Internal scroll method * @param scrollX The new scroll position */ MDCTabScrollerFoundation.prototype.scrollTo_ = function (scrollX) { var currentScrollX = this.getScrollPosition(); var safeScrollX = this.clampScrollValue_(scrollX); var scrollDelta = safeScrollX - currentScrollX; this.animate_({ finalScrollPosition: safeScrollX, scrollDelta: scrollDelta }); }; /** * Internal RTL scroll method * @param scrollX The new scroll position */ MDCTabScrollerFoundation.prototype.scrollToRTL_ = function (scrollX) { var animation = this.getRTLScroller().scrollToRTL(scrollX); this.animate_(animation); }; /** * Internal increment scroll method * @param scrollX The new scroll position increment */ MDCTabScrollerFoundation.prototype.incrementScroll_ = function (scrollX) { var currentScrollX = this.getScrollPosition(); var targetScrollX = scrollX + currentScrollX; var safeScrollX = this.clampScrollValue_(targetScrollX); var scrollDelta = safeScrollX - currentScrollX; this.animate_({ finalScrollPosition: safeScrollX, scrollDelta: scrollDelta }); }; /** * Internal increment scroll RTL method * @param scrollX The new scroll position RTL increment */ MDCTabScrollerFoundation.prototype.incrementScrollRTL_ = function (scrollX) { var animation = this.getRTLScroller().incrementScrollRTL(scrollX); this.animate_(animation); }; /** * Animates the tab scrolling * @param animation The animation to apply */ MDCTabScrollerFoundation.prototype.animate_ = function (animation) { var _this = this; // Early exit if translateX is 0, which means there's no animation to perform if (animation.scrollDelta === 0) { return; } this.stopScrollAnimation_(); // This animation uses the FLIP approach. // Read more here: https://aerotwist.com/blog/flip-your-animations/ this.adapter_.setScrollAreaScrollLeft(animation.finalScrollPosition); this.adapter_.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)"); // Force repaint this.adapter_.computeScrollAreaClientRect(); requestAnimationFrame(function () { _this.adapter_.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); _this.adapter_.setScrollContentStyleProperty('transform', 'none'); }); this.isAnimating_ = true; }; /** * Stops scroll animation */ MDCTabScrollerFoundation.prototype.stopScrollAnimation_ = function () { this.isAnimating_ = false; var currentScrollPosition = this.getAnimatingScrollPosition_(); this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); this.adapter_.setScrollContentStyleProperty('transform', 'translateX(0px)'); this.adapter_.setScrollAreaScrollLeft(currentScrollPosition); }; /** * Gets the current scroll position during animation */ MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition_ = function () { var currentTranslateX = this.calculateCurrentTranslateX_(); var scrollLeft = this.adapter_.getScrollAreaScrollLeft(); if (this.isRTL_()) { return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX); } return scrollLeft - currentTranslateX; }; /** * Determines the RTL Scroller to use */ MDCTabScrollerFoundation.prototype.rtlScrollerFactory_ = function () { // Browsers have three different implementations of scrollLeft in RTL mode, // dependent on the browser. The behavior is based off the max LTR // scrollLeft value and 0. // // * Default scrolling in RTL * // - Left-most value: 0 // - Right-most value: Max LTR scrollLeft value // // * Negative scrolling in RTL * // - Left-most value: Negated max LTR scrollLeft value // - Right-most value: 0 // // * Reverse scrolling in RTL * // - Left-most value: Max LTR scrollLeft value // - Right-most value: 0 // // We use those principles below to determine which RTL scrollLeft // behavior is implemented in the current browser. var initialScrollLeft = this.adapter_.getScrollAreaScrollLeft(); this.adapter_.setScrollAreaScrollLeft(initialScrollLeft - 1); var newScrollLeft = this.adapter_.getScrollAreaScrollLeft(); // If the newScrollLeft value is negative,then we know that the browser has // implemented negative RTL scrolling, since all other implementations have // only positive values. if (newScrollLeft < 0) { // Undo the scrollLeft test check this.adapter_.setScrollAreaScrollLeft(initialScrollLeft); return new MDCTabScrollerRTLNegative(this.adapter_); } var rootClientRect = this.adapter_.computeScrollAreaClientRect(); var contentClientRect = this.adapter_.computeScrollContentClientRect(); var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right); // Undo the scrollLeft test check this.adapter_.setScrollAreaScrollLeft(initialScrollLeft); // By calculating the clientRect of the root element and the clientRect of // the content element, we can determine how much the scroll value changed // when we performed the scrollLeft subtraction above. if (rightEdgeDelta === newScrollLeft) { return new MDCTabScrollerRTLReverse(this.adapter_); } return new MDCTabScrollerRTLDefault(this.adapter_); }; MDCTabScrollerFoundation.prototype.isRTL_ = function () { return this.adapter_.getScrollContentStyleValue('direction') === 'rtl'; }; return MDCTabScrollerFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScroller = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabScroller, _super); function MDCTabScroller() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabScroller.attachTo = function (root) { return new MDCTabScroller(root); }; MDCTabScroller.prototype.initialize = function () { this.area_ = this.root_.querySelector(MDCTabScrollerFoundation.strings.AREA_SELECTOR); this.content_ = this.root_.querySelector(MDCTabScrollerFoundation.strings.CONTENT_SELECTOR); }; MDCTabScroller.prototype.initialSyncWithDOM = function () { var _this = this; this.handleInteraction_ = function () { return _this.foundation_.handleInteraction(); }; this.handleTransitionEnd_ = function (evt) { return _this.foundation_.handleTransitionEnd(evt); }; this.area_.addEventListener('wheel', this.handleInteraction_); this.area_.addEventListener('touchstart', this.handleInteraction_); this.area_.addEventListener('pointerdown', this.handleInteraction_); this.area_.addEventListener('mousedown', this.handleInteraction_); this.area_.addEventListener('keydown', this.handleInteraction_); this.content_.addEventListener('transitionend', this.handleTransitionEnd_); }; MDCTabScroller.prototype.destroy = function () { _super.prototype.destroy.call(this); this.area_.removeEventListener('wheel', this.handleInteraction_); this.area_.removeEventListener('touchstart', this.handleInteraction_); this.area_.removeEventListener('pointerdown', this.handleInteraction_); this.area_.removeEventListener('mousedown', this.handleInteraction_); this.area_.removeEventListener('keydown', this.handleInteraction_); this.content_.removeEventListener('transitionend', this.handleTransitionEnd_); }; MDCTabScroller.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) { return matches(evtTarget, selector); }, addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, addScrollAreaClass: function addScrollAreaClass(className) { return _this.area_.classList.add(className); }, setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) { return _this.area_.style.setProperty(prop, value); }, setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) { return _this.content_.style.setProperty(prop, value); }, getScrollContentStyleValue: function getScrollContentStyleValue(propName) { return window.getComputedStyle(_this.content_).getPropertyValue(propName); }, setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) { return _this.area_.scrollLeft = scrollX; }, getScrollAreaScrollLeft: function getScrollAreaScrollLeft() { return _this.area_.scrollLeft; }, getScrollContentOffsetWidth: function getScrollContentOffsetWidth() { return _this.content_.offsetWidth; }, getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() { return _this.area_.offsetWidth; }, computeScrollAreaClientRect: function computeScrollAreaClientRect() { return _this.area_.getBoundingClientRect(); }, computeScrollContentClientRect: function computeScrollContentClientRect() { return _this.content_.getBoundingClientRect(); }, computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight$1() { return computeHorizontalScrollbarHeight(document); } }; // tslint:enable:object-literal-sort-keys return new MDCTabScrollerFoundation(adapter); }; /** * Returns the current visual scroll position */ MDCTabScroller.prototype.getScrollPosition = function () { return this.foundation_.getScrollPosition(); }; /** * Returns the width of the scroll content */ MDCTabScroller.prototype.getScrollContentWidth = function () { return this.content_.offsetWidth; }; /** * Increments the scroll value by the given amount * @param scrollXIncrement The pixel value by which to increment the scroll value */ MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) { this.foundation_.incrementScroll(scrollXIncrement); }; /** * Scrolls to the given pixel position * @param scrollX The pixel value to scroll to */ MDCTabScroller.prototype.scrollTo = function (scrollX) { this.foundation_.scrollTo(scrollX); }; return MDCTabScroller; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings$1 = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$2 = { ACTIVE: 'mdc-tab-indicator--active', FADE: 'mdc-tab-indicator--fade', NO_TRANSITION: 'mdc-tab-indicator--no-transition' }; var strings$2 = { CONTENT_SELECTOR: '.mdc-tab-indicator__content' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabIndicatorFoundation, _super); function MDCTabIndicatorFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__assign"])({}, MDCTabIndicatorFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", { get: function get() { return cssClasses$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabIndicatorFoundation, "strings", { get: function get() { return strings$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, computeContentClientRect: function computeContentClientRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, setContentStyleProperty: function setContentStyleProperty() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () { return this.adapter_.computeContentClientRect(); }; return MDCTabIndicatorFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* istanbul ignore next: subclass is not a branch statement */ var MDCFadingTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCFadingTabIndicatorFoundation, _super); function MDCFadingTabIndicatorFoundation() { return _super !== null && _super.apply(this, arguments) || this; } MDCFadingTabIndicatorFoundation.prototype.activate = function () { this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; MDCFadingTabIndicatorFoundation.prototype.deactivate = function () { this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; return MDCFadingTabIndicatorFoundation; }(MDCTabIndicatorFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* istanbul ignore next: subclass is not a branch statement */ var MDCSlidingTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCSlidingTabIndicatorFoundation, _super); function MDCSlidingTabIndicatorFoundation() { return _super !== null && _super.apply(this, arguments) || this; } MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) { // Early exit if no indicator is present to handle cases where an indicator // may be activated without a prior indicator state if (!previousIndicatorClientRect) { this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); return; } // This animation uses the FLIP approach. You can read more about it at the link below: // https://aerotwist.com/blog/flip-your-animations/ // Calculate the dimensions based on the dimensions of the previous indicator var currentClientRect = this.computeContentClientRect(); var widthDelta = previousIndicatorClientRect.width / currentClientRect.width; var xPosition = previousIndicatorClientRect.left - currentClientRect.left; this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); this.adapter_.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")"); // Force repaint before updating classes and transform to ensure the transform properly takes effect this.computeContentClientRect(); this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); this.adapter_.setContentStyleProperty('transform', ''); }; MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () { this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; return MDCSlidingTabIndicatorFoundation; }(MDCTabIndicatorFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabIndicator = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabIndicator, _super); function MDCTabIndicator() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabIndicator.attachTo = function (root) { return new MDCTabIndicator(root); }; MDCTabIndicator.prototype.initialize = function () { this.content_ = this.root_.querySelector(MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR); }; MDCTabIndicator.prototype.computeContentClientRect = function () { return this.foundation_.computeContentClientRect(); }; MDCTabIndicator.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, computeContentClientRect: function computeContentClientRect() { return _this.content_.getBoundingClientRect(); }, setContentStyleProperty: function setContentStyleProperty(prop, value) { return _this.content_.style.setProperty(prop, value); } }; // tslint:enable:object-literal-sort-keys if (this.root_.classList.contains(MDCTabIndicatorFoundation.cssClasses.FADE)) { return new MDCFadingTabIndicatorFoundation(adapter); } // Default to the sliding indicator return new MDCSlidingTabIndicatorFoundation(adapter); }; MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) { this.foundation_.activate(previousIndicatorClientRect); }; MDCTabIndicator.prototype.deactivate = function () { this.foundation_.deactivate(); }; return MDCTabIndicator; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$3 = { ACTIVE: 'mdc-tab--active' }; var strings$3 = { ARIA_SELECTED: 'aria-selected', CONTENT_SELECTOR: '.mdc-tab__content', INTERACTED_EVENT: 'MDCTab:interacted', RIPPLE_SELECTOR: '.mdc-tab__ripple', TABINDEX: 'tabIndex', TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabFoundation, _super); function MDCTabFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__assign"])({}, MDCTabFoundation.defaultAdapter, adapter)) || this; _this.focusOnActivate_ = true; return _this; } Object.defineProperty(MDCTabFoundation, "cssClasses", { get: function get() { return cssClasses$3; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabFoundation, "strings", { get: function get() { return strings$3; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setAttr: function setAttr() { return undefined; }, activateIndicator: function activateIndicator() { return undefined; }, deactivateIndicator: function deactivateIndicator() { return undefined; }, notifyInteracted: function notifyInteracted() { return undefined; }, getOffsetLeft: function getOffsetLeft() { return 0; }, getOffsetWidth: function getOffsetWidth() { return 0; }, getContentOffsetLeft: function getContentOffsetLeft() { return 0; }, getContentOffsetWidth: function getContentOffsetWidth() { return 0; }, focus: function focus() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTabFoundation.prototype.handleClick = function () { // It's up to the parent component to keep track of the active Tab and // ensure we don't activate a Tab that's already active. this.adapter_.notifyInteracted(); }; MDCTabFoundation.prototype.isActive = function () { return this.adapter_.hasClass(cssClasses$3.ACTIVE); }; /** * Sets whether the tab should focus itself when activated */ MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) { this.focusOnActivate_ = focusOnActivate; }; /** * Activates the Tab */ MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) { this.adapter_.addClass(cssClasses$3.ACTIVE); this.adapter_.setAttr(strings$3.ARIA_SELECTED, 'true'); this.adapter_.setAttr(strings$3.TABINDEX, '0'); this.adapter_.activateIndicator(previousIndicatorClientRect); if (this.focusOnActivate_) { this.adapter_.focus(); } }; /** * Deactivates the Tab */ MDCTabFoundation.prototype.deactivate = function () { // Early exit if (!this.isActive()) { return; } this.adapter_.removeClass(cssClasses$3.ACTIVE); this.adapter_.setAttr(strings$3.ARIA_SELECTED, 'false'); this.adapter_.setAttr(strings$3.TABINDEX, '-1'); this.adapter_.deactivateIndicator(); }; /** * Returns the dimensions of the Tab */ MDCTabFoundation.prototype.computeDimensions = function () { var rootWidth = this.adapter_.getOffsetWidth(); var rootLeft = this.adapter_.getOffsetLeft(); var contentWidth = this.adapter_.getContentOffsetWidth(); var contentLeft = this.adapter_.getContentOffsetLeft(); return { contentLeft: rootLeft + contentLeft, contentRight: rootLeft + contentLeft + contentWidth, rootLeft: rootLeft, rootRight: rootLeft + rootWidth }; }; return MDCTabFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTab = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTab, _super); function MDCTab() { return _super !== null && _super.apply(this, arguments) || this; } MDCTab.attachTo = function (root) { return new MDCTab(root); }; MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) { if (rippleFactory === void 0) { rippleFactory = function rippleFactory(el, foundation) { return new MDCRipple(el, foundation); }; } if (tabIndicatorFactory === void 0) { tabIndicatorFactory = function tabIndicatorFactory(el) { return new MDCTabIndicator(el); }; } this.id = this.root_.id; var rippleSurface = this.root_.querySelector(MDCTabFoundation.strings.RIPPLE_SELECTOR); var rippleAdapter = Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__assign"])({}, MDCRipple.createAdapter(this), { addClass: function addClass(className) { return rippleSurface.classList.add(className); }, removeClass: function removeClass(className) { return rippleSurface.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return rippleSurface.style.setProperty(varName, value); } }); var rippleFoundation = new MDCRippleFoundation(rippleAdapter); this.ripple_ = rippleFactory(this.root_, rippleFoundation); var tabIndicatorElement = this.root_.querySelector(MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR); this.tabIndicator_ = tabIndicatorFactory(tabIndicatorElement); this.content_ = this.root_.querySelector(MDCTabFoundation.strings.CONTENT_SELECTOR); }; MDCTab.prototype.initialSyncWithDOM = function () { var _this = this; this.handleClick_ = function () { return _this.foundation_.handleClick(); }; this.listen('click', this.handleClick_); }; MDCTab.prototype.destroy = function () { this.unlisten('click', this.handleClick_); this.ripple_.destroy(); _super.prototype.destroy.call(this); }; MDCTab.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { setAttr: function setAttr(attr, value) { return _this.root_.setAttribute(attr, value); }, addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, activateIndicator: function activateIndicator(previousIndicatorClientRect) { return _this.tabIndicator_.activate(previousIndicatorClientRect); }, deactivateIndicator: function deactivateIndicator() { return _this.tabIndicator_.deactivate(); }, notifyInteracted: function notifyInteracted() { return _this.emit(MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */ ); }, getOffsetLeft: function getOffsetLeft() { return _this.root_.offsetLeft; }, getOffsetWidth: function getOffsetWidth() { return _this.root_.offsetWidth; }, getContentOffsetLeft: function getContentOffsetLeft() { return _this.content_.offsetLeft; }, getContentOffsetWidth: function getContentOffsetWidth() { return _this.content_.offsetWidth; }, focus: function focus() { return _this.root_.focus(); } }; // tslint:enable:object-literal-sort-keys return new MDCTabFoundation(adapter); }; Object.defineProperty(MDCTab.prototype, "active", { /** * Getter for the active state of the tab */ get: function get() { return this.foundation_.isActive(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTab.prototype, "focusOnActivate", { set: function set(focusOnActivate) { this.foundation_.setFocusOnActivate(focusOnActivate); }, enumerable: true, configurable: true }); /** * Activates the tab */ MDCTab.prototype.activate = function (computeIndicatorClientRect) { this.foundation_.activate(computeIndicatorClientRect); }; /** * Deactivates the tab */ MDCTab.prototype.deactivate = function () { this.foundation_.deactivate(); }; /** * Returns the indicator's client rect */ MDCTab.prototype.computeIndicatorClientRect = function () { return this.tabIndicator_.computeContentClientRect(); }; MDCTab.prototype.computeDimensions = function () { return this.foundation_.computeDimensions(); }; /** * Focuses the tab */ MDCTab.prototype.focus = function () { this.root_.focus(); }; return MDCTab; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$4 = { ARROW_LEFT_KEY: 'ArrowLeft', ARROW_RIGHT_KEY: 'ArrowRight', END_KEY: 'End', ENTER_KEY: 'Enter', HOME_KEY: 'Home', SPACE_KEY: 'Space', TAB_ACTIVATED_EVENT: 'MDCTabBar:activated', TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller', TAB_SELECTOR: '.mdc-tab' }; var numbers$1 = { ARROW_LEFT_KEYCODE: 37, ARROW_RIGHT_KEYCODE: 39, END_KEYCODE: 35, ENTER_KEYCODE: 13, EXTRA_SCROLL_AMOUNT: 20, HOME_KEYCODE: 36, SPACE_KEYCODE: 32 }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACCEPTABLE_KEYS = new Set(); // IE11 has no support for new Set with iterable so we need to initialize this by hand ACCEPTABLE_KEYS.add(strings$4.ARROW_LEFT_KEY); ACCEPTABLE_KEYS.add(strings$4.ARROW_RIGHT_KEY); ACCEPTABLE_KEYS.add(strings$4.END_KEY); ACCEPTABLE_KEYS.add(strings$4.HOME_KEY); ACCEPTABLE_KEYS.add(strings$4.ENTER_KEY); ACCEPTABLE_KEYS.add(strings$4.SPACE_KEY); var KEYCODE_MAP = new Map(); // IE11 has no support for new Map with iterable so we need to initialize this by hand KEYCODE_MAP.set(numbers$1.ARROW_LEFT_KEYCODE, strings$4.ARROW_LEFT_KEY); KEYCODE_MAP.set(numbers$1.ARROW_RIGHT_KEYCODE, strings$4.ARROW_RIGHT_KEY); KEYCODE_MAP.set(numbers$1.END_KEYCODE, strings$4.END_KEY); KEYCODE_MAP.set(numbers$1.HOME_KEYCODE, strings$4.HOME_KEY); KEYCODE_MAP.set(numbers$1.ENTER_KEYCODE, strings$4.ENTER_KEY); KEYCODE_MAP.set(numbers$1.SPACE_KEYCODE, strings$4.SPACE_KEY); var MDCTabBarFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabBarFoundation, _super); function MDCTabBarFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__assign"])({}, MDCTabBarFoundation.defaultAdapter, adapter)) || this; _this.useAutomaticActivation_ = false; return _this; } Object.defineProperty(MDCTabBarFoundation, "strings", { get: function get() { return strings$4; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabBarFoundation, "numbers", { get: function get() { return numbers$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { scrollTo: function scrollTo() { return undefined; }, incrementScroll: function incrementScroll() { return undefined; }, getScrollPosition: function getScrollPosition() { return 0; }, getScrollContentWidth: function getScrollContentWidth() { return 0; }, getOffsetWidth: function getOffsetWidth() { return 0; }, isRTL: function isRTL() { return false; }, setActiveTab: function setActiveTab() { return undefined; }, activateTabAtIndex: function activateTabAtIndex() { return undefined; }, deactivateTabAtIndex: function deactivateTabAtIndex() { return undefined; }, focusTabAtIndex: function focusTabAtIndex() { return undefined; }, getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, getTabDimensionsAtIndex: function getTabDimensionsAtIndex() { return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 }; }, getPreviousActiveTabIndex: function getPreviousActiveTabIndex() { return -1; }, getFocusedTabIndex: function getFocusedTabIndex() { return -1; }, getIndexOfTabById: function getIndexOfTabById() { return -1; }, getTabListLength: function getTabListLength() { return 0; }, notifyTabActivated: function notifyTabActivated() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); /** * Switches between automatic and manual activation modes. * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples. */ MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) { this.useAutomaticActivation_ = useAutomaticActivation; }; MDCTabBarFoundation.prototype.activateTab = function (index) { var previousActiveIndex = this.adapter_.getPreviousActiveTabIndex(); if (!this.indexIsInRange_(index) || index === previousActiveIndex) { return; } this.adapter_.deactivateTabAtIndex(previousActiveIndex); this.adapter_.activateTabAtIndex(index, this.adapter_.getTabIndicatorClientRectAtIndex(previousActiveIndex)); this.scrollIntoView(index); this.adapter_.notifyTabActivated(index); }; MDCTabBarFoundation.prototype.handleKeyDown = function (evt) { // Get the key from the event var key = this.getKeyFromEvent_(evt); // Early exit if the event key isn't one of the keyboard navigation keys if (key === undefined) { return; } // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple if (!this.isActivationKey_(key)) { evt.preventDefault(); } if (this.useAutomaticActivation_) { if (this.isActivationKey_(key)) { return; } var index = this.determineTargetFromKey_(this.adapter_.getPreviousActiveTabIndex(), key); this.adapter_.setActiveTab(index); this.scrollIntoView(index); } else { var focusedTabIndex = this.adapter_.getFocusedTabIndex(); if (this.isActivationKey_(key)) { this.adapter_.setActiveTab(focusedTabIndex); } else { var index = this.determineTargetFromKey_(focusedTabIndex, key); this.adapter_.focusTabAtIndex(index); this.scrollIntoView(index); } } }; /** * Handles the MDCTab:interacted event */ MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) { this.adapter_.setActiveTab(this.adapter_.getIndexOfTabById(evt.detail.tabId)); }; /** * Scrolls the tab at the given index into view * @param index The tab index to make visible */ MDCTabBarFoundation.prototype.scrollIntoView = function (index) { // Early exit if the index is out of range if (!this.indexIsInRange_(index)) { return; } // Always scroll to 0 if scrolling to the 0th index if (index === 0) { return this.adapter_.scrollTo(0); } // Always scroll to the max value if scrolling to the Nth index // MDCTabScroller.scrollTo() will never scroll past the max possible value if (index === this.adapter_.getTabListLength() - 1) { return this.adapter_.scrollTo(this.adapter_.getScrollContentWidth()); } if (this.isRTL_()) { return this.scrollIntoViewRTL_(index); } this.scrollIntoView_(index); }; /** * Private method for determining the index of the destination tab based on what key was pressed * @param origin The original index from which to determine the destination * @param key The name of the key */ MDCTabBarFoundation.prototype.determineTargetFromKey_ = function (origin, key) { var isRTL = this.isRTL_(); var maxIndex = this.adapter_.getTabListLength() - 1; var shouldGoToEnd = key === strings$4.END_KEY; var shouldDecrement = key === strings$4.ARROW_LEFT_KEY && !isRTL || key === strings$4.ARROW_RIGHT_KEY && isRTL; var shouldIncrement = key === strings$4.ARROW_RIGHT_KEY && !isRTL || key === strings$4.ARROW_LEFT_KEY && isRTL; var index = origin; if (shouldGoToEnd) { index = maxIndex; } else if (shouldDecrement) { index -= 1; } else if (shouldIncrement) { index += 1; } else { index = 0; } if (index < 0) { index = maxIndex; } else if (index > maxIndex) { index = 0; } return index; }; /** * Calculates the scroll increment that will make the tab at the given index visible * @param index The index of the tab * @param nextIndex The index of the next tab * @param scrollPosition The current scroll position * @param barWidth The width of the Tab Bar */ MDCTabBarFoundation.prototype.calculateScrollIncrement_ = function (index, nextIndex, scrollPosition, barWidth) { var nextTabDimensions = this.adapter_.getTabDimensionsAtIndex(nextIndex); var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth; var relativeContentRight = nextTabDimensions.contentRight - scrollPosition; var leftIncrement = relativeContentRight - numbers$1.EXTRA_SCROLL_AMOUNT; var rightIncrement = relativeContentLeft + numbers$1.EXTRA_SCROLL_AMOUNT; if (nextIndex < index) { return Math.min(leftIncrement, 0); } return Math.max(rightIncrement, 0); }; /** * Calculates the scroll increment that will make the tab at the given index visible in RTL * @param index The index of the tab * @param nextIndex The index of the next tab * @param scrollPosition The current scroll position * @param barWidth The width of the Tab Bar * @param scrollContentWidth The width of the scroll content */ MDCTabBarFoundation.prototype.calculateScrollIncrementRTL_ = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) { var nextTabDimensions = this.adapter_.getTabDimensionsAtIndex(nextIndex); var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition; var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth; var leftIncrement = relativeContentRight + numbers$1.EXTRA_SCROLL_AMOUNT; var rightIncrement = relativeContentLeft - numbers$1.EXTRA_SCROLL_AMOUNT; if (nextIndex > index) { return Math.max(leftIncrement, 0); } return Math.min(rightIncrement, 0); }; /** * Determines the index of the adjacent tab closest to either edge of the Tab Bar * @param index The index of the tab * @param tabDimensions The dimensions of the tab * @param scrollPosition The current scroll position * @param barWidth The width of the tab bar */ MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge_ = function (index, tabDimensions, scrollPosition, barWidth) { /** * Tabs are laid out in the Tab Scroller like this: * * Scroll Position * +---+ * | | Bar Width * | +-----------------------------------+ * | | | * | V V * | +-----------------------------------+ * V | Tab Scroller | * +------------+--------------+-------------------+ * | Tab | Tab | Tab | * +------------+--------------+-------------------+ * | | * +-----------------------------------+ * * To determine the next adjacent index, we look at the Tab root left and * Tab root right, both relative to the scroll position. If the Tab root * left is less than 0, then we know it's out of view to the left. If the * Tab root right minus the bar width is greater than 0, we know the Tab is * out of view to the right. From there, we either increment or decrement * the index. */ var relativeRootLeft = tabDimensions.rootLeft - scrollPosition; var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth; var relativeRootDelta = relativeRootLeft + relativeRootRight; var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0; var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0; if (leftEdgeIsCloser) { return index - 1; } if (rightEdgeIsCloser) { return index + 1; } return -1; }; /** * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL * @param index The index of the tab * @param tabDimensions The dimensions of the tab * @param scrollPosition The current scroll position * @param barWidth The width of the tab bar * @param scrollContentWidth The width of the scroller content */ MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL_ = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) { var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition; var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition; var rootDelta = rootLeft + rootRight; var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0; var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0; if (leftEdgeIsCloser) { return index + 1; } if (rightEdgeIsCloser) { return index - 1; } return -1; }; /** * Returns the key associated with a keydown event * @param evt The keydown event */ MDCTabBarFoundation.prototype.getKeyFromEvent_ = function (evt) { if (ACCEPTABLE_KEYS.has(evt.key)) { return evt.key; } return KEYCODE_MAP.get(evt.keyCode); }; MDCTabBarFoundation.prototype.isActivationKey_ = function (key) { return key === strings$4.SPACE_KEY || key === strings$4.ENTER_KEY; }; /** * Returns whether a given index is inclusively between the ends * @param index The index to test */ MDCTabBarFoundation.prototype.indexIsInRange_ = function (index) { return index >= 0 && index < this.adapter_.getTabListLength(); }; /** * Returns the view's RTL property */ MDCTabBarFoundation.prototype.isRTL_ = function () { return this.adapter_.isRTL(); }; /** * Scrolls the tab at the given index into view for left-to-right user agents. * @param index The index of the tab to scroll into view */ MDCTabBarFoundation.prototype.scrollIntoView_ = function (index) { var scrollPosition = this.adapter_.getScrollPosition(); var barWidth = this.adapter_.getOffsetWidth(); var tabDimensions = this.adapter_.getTabDimensionsAtIndex(index); var nextIndex = this.findAdjacentTabIndexClosestToEdge_(index, tabDimensions, scrollPosition, barWidth); if (!this.indexIsInRange_(nextIndex)) { return; } var scrollIncrement = this.calculateScrollIncrement_(index, nextIndex, scrollPosition, barWidth); this.adapter_.incrementScroll(scrollIncrement); }; /** * Scrolls the tab at the given index into view in RTL * @param index The tab index to make visible */ MDCTabBarFoundation.prototype.scrollIntoViewRTL_ = function (index) { var scrollPosition = this.adapter_.getScrollPosition(); var barWidth = this.adapter_.getOffsetWidth(); var tabDimensions = this.adapter_.getTabDimensionsAtIndex(index); var scrollWidth = this.adapter_.getScrollContentWidth(); var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL_(index, tabDimensions, scrollPosition, barWidth, scrollWidth); if (!this.indexIsInRange_(nextIndex)) { return; } var scrollIncrement = this.calculateScrollIncrementRTL_(index, nextIndex, scrollPosition, barWidth, scrollWidth); this.adapter_.incrementScroll(scrollIncrement); }; return MDCTabBarFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$5 = MDCTabBarFoundation.strings; var tabIdCounter = 0; var MDCTabBar = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MDCTabBar, _super); function MDCTabBar() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabBar.attachTo = function (root) { return new MDCTabBar(root); }; Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", { set: function set(focusOnActivate) { this.tabList_.forEach(function (tab) { return tab.focusOnActivate = focusOnActivate; }); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", { set: function set(useAutomaticActivation) { this.foundation_.setUseAutomaticActivation(useAutomaticActivation); }, enumerable: true, configurable: true }); MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) { if (tabFactory === void 0) { tabFactory = function tabFactory(el) { return new MDCTab(el); }; } if (tabScrollerFactory === void 0) { tabScrollerFactory = function tabScrollerFactory(el) { return new MDCTabScroller(el); }; } this.tabList_ = this.instantiateTabs_(tabFactory); this.tabScroller_ = this.instantiateTabScroller_(tabScrollerFactory); }; MDCTabBar.prototype.initialSyncWithDOM = function () { var _this = this; this.handleTabInteraction_ = function (evt) { return _this.foundation_.handleTabInteraction(evt); }; this.handleKeyDown_ = function (evt) { return _this.foundation_.handleKeyDown(evt); }; this.listen(MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_); this.listen('keydown', this.handleKeyDown_); for (var i = 0; i < this.tabList_.length; i++) { if (this.tabList_[i].active) { this.scrollIntoView(i); break; } } }; MDCTabBar.prototype.destroy = function () { _super.prototype.destroy.call(this); this.unlisten(MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_); this.unlisten('keydown', this.handleKeyDown_); this.tabList_.forEach(function (tab) { return tab.destroy(); }); if (this.tabScroller_) { this.tabScroller_.destroy(); } }; MDCTabBar.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { scrollTo: function scrollTo(scrollX) { return _this.tabScroller_.scrollTo(scrollX); }, incrementScroll: function incrementScroll(scrollXIncrement) { return _this.tabScroller_.incrementScroll(scrollXIncrement); }, getScrollPosition: function getScrollPosition() { return _this.tabScroller_.getScrollPosition(); }, getScrollContentWidth: function getScrollContentWidth() { return _this.tabScroller_.getScrollContentWidth(); }, getOffsetWidth: function getOffsetWidth() { return _this.root_.offsetWidth; }, isRTL: function isRTL() { return window.getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl'; }, setActiveTab: function setActiveTab(index) { return _this.foundation_.activateTab(index); }, activateTabAtIndex: function activateTabAtIndex(index, clientRect) { return _this.tabList_[index].activate(clientRect); }, deactivateTabAtIndex: function deactivateTabAtIndex(index) { return _this.tabList_[index].deactivate(); }, focusTabAtIndex: function focusTabAtIndex(index) { return _this.tabList_[index].focus(); }, getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex(index) { return _this.tabList_[index].computeIndicatorClientRect(); }, getTabDimensionsAtIndex: function getTabDimensionsAtIndex(index) { return _this.tabList_[index].computeDimensions(); }, getPreviousActiveTabIndex: function getPreviousActiveTabIndex() { for (var i = 0; i < _this.tabList_.length; i++) { if (_this.tabList_[i].active) { return i; } } return -1; }, getFocusedTabIndex: function getFocusedTabIndex() { var tabElements = _this.getTabElements_(); var activeElement = document.activeElement; return tabElements.indexOf(activeElement); }, getIndexOfTabById: function getIndexOfTabById(id) { for (var i = 0; i < _this.tabList_.length; i++) { if (_this.tabList_[i].id === id) { return i; } } return -1; }, getTabListLength: function getTabListLength() { return _this.tabList_.length; }, notifyTabActivated: function notifyTabActivated(index) { return _this.emit(strings$5.TAB_ACTIVATED_EVENT, { index: index }, true); } }; // tslint:enable:object-literal-sort-keys return new MDCTabBarFoundation(adapter); }; /** * Activates the tab at the given index * @param index The index of the tab */ MDCTabBar.prototype.activateTab = function (index) { this.foundation_.activateTab(index); }; /** * Scrolls the tab at the given index into view * @param index THe index of the tab */ MDCTabBar.prototype.scrollIntoView = function (index) { this.foundation_.scrollIntoView(index); }; /** * Returns all the tab elements in a nice clean array */ MDCTabBar.prototype.getTabElements_ = function () { return [].slice.call(this.root_.querySelectorAll(strings$5.TAB_SELECTOR)); }; /** * Instantiates tab components on all child tab elements */ MDCTabBar.prototype.instantiateTabs_ = function (tabFactory) { return this.getTabElements_().map(function (el) { el.id = el.id || "mdc-tab-" + ++tabIdCounter; return tabFactory(el); }); }; /** * Instantiates tab scroller component on the child tab scroller element */ MDCTabBar.prototype.instantiateTabScroller_ = function (tabScrollerFactory) { var tabScrollerElement = this.root_.querySelector(strings$5.TAB_SCROLLER_SELECTOR); if (tabScrollerElement) { return tabScrollerFactory(tabScrollerElement); } return null; }; return MDCTabBar; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTabActivatedEvent = /** @class */ (function () { function MdcTabActivatedEvent(source, index, tab) { this.source = source; this.index = index; this.tab = tab; } return MdcTabActivatedEvent; }()); var MdcTabBar = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_4__["__extends"])(MdcTabBar, _super); function MdcTabBar(_platform, _changeDetectorRef, elementRef) { var _this = _super.call(this, elementRef) || this; _this._platform = _platform; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; /** * Emits whenever the component is destroyed. */ _this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_5__["Subject"](); _this._fade = false; _this._stacked = false; _this._fixed = false; _this._align = null; _this._iconIndicator = null; _this._useAutomaticActivation = true; _this._activeTabIndex = 0; _this._focusOnActivate = true; _this.activated = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * Subscription to changes in tabs. */ _this._changeSubscription = null; /** * Subscription to interaction events in tabs. */ _this._tabInteractionSubscription = null; return _this; } Object.defineProperty(MdcTabBar.prototype, "fade", { get: /** * @return {?} */ function () { return this._fade; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fade = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); this._syncTabs(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabBar.prototype, "stacked", { get: /** * @return {?} */ function () { return this._stacked; }, set: /** * @param {?} value * @return {?} */ function (value) { this._stacked = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); this._syncTabs(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabBar.prototype, "fixed", { get: /** * @return {?} */ function () { return this._fixed; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fixed = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); this._syncTabs(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabBar.prototype, "align", { get: /** * @return {?} */ function () { return this._align; }, set: /** * @param {?} value * @return {?} */ function (value) { this._align = value || 'start'; this.tabScroller.align = this.align; }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabBar.prototype, "iconIndicator", { get: /** * @return {?} */ function () { return this._iconIndicator; }, set: /** * @param {?} value * @return {?} */ function (value) { this._iconIndicator = value; this._syncTabs(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabBar.prototype, "useAutomaticActivation", { get: /** * @return {?} */ function () { return this._useAutomaticActivation; }, set: /** * @param {?} value * @return {?} */ function (value) { this._useAutomaticActivation = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); this._foundation.setUseAutomaticActivation(this._useAutomaticActivation); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabBar.prototype, "activeTabIndex", { get: /** * @return {?} */ function () { return this._activeTabIndex; }, set: /** * @param {?} value * @return {?} */ function (value) { if (this.activeTabIndex !== value) { this._activeTabIndex = value; this.activateTab(this.activeTabIndex); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabBar.prototype, "focusOnActivate", { get: /** * @return {?} */ function () { return this._focusOnActivate; }, set: /** * @param {?} value * @return {?} */ function (value) { this._focusOnActivate = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); this._syncTabs(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabBar.prototype, "tabInteractions", { /** Combined stream of all of the tab interaction events. */ get: /** * Combined stream of all of the tab interaction events. * @return {?} */ function () { return rxjs__WEBPACK_IMPORTED_MODULE_5__["merge"].apply(void 0, this.tabs.map((/** * @param {?} tab * @return {?} */ function (tab) { return tab.interacted; }))); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcTabBar.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { scrollTo: (/** * @param {?} scrollX * @return {?} */ function (scrollX) { return _this.tabScroller.scrollTo(scrollX); }), incrementScroll: (/** * @param {?} scrollXIncrement * @return {?} */ function (scrollXIncrement) { return _this.tabScroller.incrementScroll(scrollXIncrement); }), getScrollPosition: (/** * @return {?} */ function () { return _this.tabScroller.getScrollPosition(); }), getScrollContentWidth: (/** * @return {?} */ function () { return _this.tabScroller.getScrollContentWidth(); }), getOffsetWidth: (/** * @return {?} */ function () { return _this._getHostElement().offsetWidth; }), isRTL: (/** * @return {?} */ function () { return _this._platform.isBrowser ? window.getComputedStyle(_this._getHostElement()).getPropertyValue('direction') === 'rtl' : false; }), setActiveTab: (/** * @param {?} index * @return {?} */ function (index) { return _this.activateTab(index); }), activateTabAtIndex: (/** * @param {?} index * @param {?} clientRect * @return {?} */ function (index, clientRect) { if (_this._indexIsInRange(index)) { _this.tabs.toArray()[index].activate(clientRect); } }), deactivateTabAtIndex: (/** * @param {?} index * @return {?} */ function (index) { if (_this._indexIsInRange(index)) { _this.tabs.toArray()[index].deactivate(); } }), focusTabAtIndex: (/** * @param {?} index * @return {?} */ function (index) { return _this.tabs.toArray()[index].focus(); }), getTabIndicatorClientRectAtIndex: (/** * @param {?} previousActiveIndex * @return {?} */ function (previousActiveIndex) { if (!_this._platform.isBrowser) { return { height: 0, width: 0, bottom: 0, top: 0, left: 0, right: 0 }; } if (!_this._indexIsInRange(previousActiveIndex)) { previousActiveIndex = _this.activeTabIndex; } return _this.tabs.toArray()[previousActiveIndex].computeIndicatorClientRect(); }), getTabDimensionsAtIndex: (/** * @param {?} index * @return {?} */ function (index) { return _this.tabs.toArray()[index].computeDimensions(); }), getPreviousActiveTabIndex: (/** * @return {?} */ function () { return _this.tabs.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.active; })); }), getFocusedTabIndex: (/** * @return {?} */ function () { return _this._platform.isBrowser ? _this.tabs.toArray().findIndex((/** * @param {?} tab * @return {?} */ function (tab) { return tab.elementRef.nativeElement === (/** @type {?} */ (document.activeElement)); })) : -1; }), getIndexOfTabById: (/** * @param {?} id * @return {?} */ function (id) { return _this.tabs.toArray().findIndex((/** * @param {?} tab * @return {?} */ function (tab) { return id === tab.id; })); }), getTabListLength: (/** * @return {?} */ function () { return _this.tabs.length; }), notifyTabActivated: (/** * @param {?} index * @return {?} */ function (index) { return _this.activated.emit({ source: _this, index: index, tab: _this.tabs.toArray()[index] }); }) }; return new MDCTabBarFoundation(adapter); }; /** * @return {?} */ MdcTabBar.prototype.ngAfterContentInit = /** * @return {?} */ function () { var _this = this; this._foundation.init(); // When the list changes, re-subscribe this._changeSubscription = this.tabs.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__["startWith"])(null)).subscribe((/** * @return {?} */ function () { Promise.resolve().then((/** * @return {?} */ function () { if (_this.tabs.length) { _this._syncTabs(); _this.activateTab(_this.activeTabIndex); _this._resetTabSubscriptions(); } })); })); }; /** * @return {?} */ MdcTabBar.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); if (this._changeSubscription) { this._changeSubscription.unsubscribe(); } this._dropSubscriptions(); }; /** * @private * @return {?} */ MdcTabBar.prototype._syncTabs = /** * @private * @return {?} */ function () { var _this = this; if (!this.tabs) { return; } this.tabs.forEach((/** * @param {?} tab * @return {?} */ function (tab) { tab.stacked = _this._stacked; tab.fixed = _this._fixed; tab.tabIndicator.fade = _this._fade; tab.tabIndicator.icon = _this._iconIndicator; tab.focusOnActivate = _this._focusOnActivate; })); }; /** * @private * @return {?} */ MdcTabBar.prototype._resetTabSubscriptions = /** * @private * @return {?} */ function () { this._dropSubscriptions(); this._listenToTabInteraction(); }; /** * @private * @return {?} */ MdcTabBar.prototype._dropSubscriptions = /** * @private * @return {?} */ function () { if (this._tabInteractionSubscription) { this._tabInteractionSubscription.unsubscribe(); this._tabInteractionSubscription = null; } }; /** Listens to interaction events on each tab. */ /** * Listens to interaction events on each tab. * @private * @return {?} */ MdcTabBar.prototype._listenToTabInteraction = /** * Listens to interaction events on each tab. * @private * @return {?} */ function () { var _this = this; this._tabInteractionSubscription = this.tabInteractions.subscribe((/** * @param {?} event * @return {?} */ function (event) { /** @type {?} */ var previousTab = _this.getActiveTab(); if (previousTab) { previousTab.tabIndicator.active = false; } event.detail.tab.tabIndicator.active = true; _this._foundation.handleTabInteraction(event); })); }; /** Activates the tab at the given index */ /** * Activates the tab at the given index * @param {?} index * @return {?} */ MdcTabBar.prototype.activateTab = /** * Activates the tab at the given index * @param {?} index * @return {?} */ function (index) { if (!this.tabs) { return; } this.activeTabIndex = index; if (this._platform.isBrowser) { this._foundation.activateTab(index); } this._changeDetectorRef.markForCheck(); }; /** Scrolls the tab at the given index into view */ /** * Scrolls the tab at the given index into view * @param {?} index * @return {?} */ MdcTabBar.prototype.scrollIntoView = /** * Scrolls the tab at the given index into view * @param {?} index * @return {?} */ function (index) { this._foundation.scrollIntoView(index); }; /** * @return {?} */ MdcTabBar.prototype.getActiveTabIndex = /** * @return {?} */ function () { return this.tabs.toArray().findIndex((/** * @param {?} _ * @return {?} */ function (_) { return _.active; })); }; /** * @return {?} */ MdcTabBar.prototype.getActiveTab = /** * @return {?} */ function () { return this.tabs.toArray().find((/** * @param {?} _ * @return {?} */ function (_) { return _.active; })); }; /** Returns an index for given tab */ /** * Returns an index for given tab * @param {?} tab * @return {?} */ MdcTabBar.prototype.getTabIndex = /** * Returns an index for given tab * @param {?} tab * @return {?} */ function (tab) { return this.tabs.toArray().indexOf(tab); }; /** Disable or enable the tab at the given index */ /** * Disable or enable the tab at the given index * @param {?} index * @param {?} disabled * @return {?} */ MdcTabBar.prototype.disableTab = /** * Disable or enable the tab at the given index * @param {?} index * @param {?} disabled * @return {?} */ function (index, disabled) { if (!this.tabs) { return; } this.tabs.toArray()[index].disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(disabled); }; /** * @param {?} evt * @return {?} */ MdcTabBar.prototype._onKeydown = /** * @param {?} evt * @return {?} */ function (evt) { this._foundation.handleKeyDown(evt); }; /** * @private * @param {?} index * @return {?} */ MdcTabBar.prototype._indexIsInRange = /** * @private * @param {?} index * @return {?} */ function (index) { return index >= 0 && index < this.tabs.length; }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcTabBar.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcTabBar.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdcTabBar], mdc-tab-bar', exportAs: 'mdcTabBar', host: { 'role': 'tablist', 'class': 'mdc-tab-bar', '(keydown)': '_onKeydown($event)' }, template: '', changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, providers: [{ provide: _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_2__["MDC_TAB_BAR_PARENT_COMPONENT"], useExisting: MdcTabBar }] },] }, ]; /** @nocollapse */ MdcTabBar.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcTabBar.propDecorators = { fade: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], stacked: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fixed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], align: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], iconIndicator: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], useAutomaticActivation: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], activeTabIndex: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], focusOnActivate: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], activated: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], tabScroller: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [_angular_mdc_web_tab_scroller__WEBPACK_IMPORTED_MODULE_3__["MdcTabScroller"],] }], tabs: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [_angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_2__["MdcTab"], { descendants: true },] }] }; return MdcTabBar; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_7__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTabBarModule = /** @class */ (function () { function MdcTabBarModule() { } MdcTabBarModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_1__["MdcTabIndicatorModule"], _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_2__["MdcTabModule"], _angular_mdc_web_tab_scroller__WEBPACK_IMPORTED_MODULE_3__["MdcTabScrollerModule"] ], exports: [ MdcTabBar, _angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_1__["MdcTabIndicatorModule"], _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_2__["MdcTabModule"], _angular_mdc_web_tab_scroller__WEBPACK_IMPORTED_MODULE_3__["MdcTabScrollerModule"] ], declarations: [MdcTabBar] },] }, ]; return MdcTabBarModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=tab-bar.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/tab-indicator.es5.js": /*!*****************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/tab-indicator.es5.js ***! \*****************************************************************/ /*! exports provided: MdcTabIndicator, MdcTabIndicatorModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabIndicator", function() { return MdcTabIndicator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabIndicatorModule", function() { return MdcTabIndicatorModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { ACTIVE: 'mdc-tab-indicator--active', FADE: 'mdc-tab-indicator--fade', NO_TRANSITION: 'mdc-tab-indicator--no-transition' }; var strings = { CONTENT_SELECTOR: '.mdc-tab-indicator__content' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCTabIndicatorFoundation, _super); function MDCTabIndicatorFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCTabIndicatorFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabIndicatorFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, computeContentClientRect: function computeContentClientRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, setContentStyleProperty: function setContentStyleProperty() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () { return this.adapter_.computeContentClientRect(); }; return MDCTabIndicatorFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* istanbul ignore next: subclass is not a branch statement */ var MDCFadingTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCFadingTabIndicatorFoundation, _super); function MDCFadingTabIndicatorFoundation() { return _super !== null && _super.apply(this, arguments) || this; } MDCFadingTabIndicatorFoundation.prototype.activate = function () { this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; MDCFadingTabIndicatorFoundation.prototype.deactivate = function () { this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; return MDCFadingTabIndicatorFoundation; }(MDCTabIndicatorFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* istanbul ignore next: subclass is not a branch statement */ var MDCSlidingTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCSlidingTabIndicatorFoundation, _super); function MDCSlidingTabIndicatorFoundation() { return _super !== null && _super.apply(this, arguments) || this; } MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) { // Early exit if no indicator is present to handle cases where an indicator // may be activated without a prior indicator state if (!previousIndicatorClientRect) { this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); return; } // This animation uses the FLIP approach. You can read more about it at the link below: // https://aerotwist.com/blog/flip-your-animations/ // Calculate the dimensions based on the dimensions of the previous indicator var currentClientRect = this.computeContentClientRect(); var widthDelta = previousIndicatorClientRect.width / currentClientRect.width; var xPosition = previousIndicatorClientRect.left - currentClientRect.left; this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); this.adapter_.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")"); // Force repaint before updating classes and transform to ensure the transform properly takes effect this.computeContentClientRect(); this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); this.adapter_.setContentStyleProperty('transform', ''); }; MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () { this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; return MDCSlidingTabIndicatorFoundation; }(MDCTabIndicatorFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabIndicator = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCTabIndicator, _super); function MDCTabIndicator() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabIndicator.attachTo = function (root) { return new MDCTabIndicator(root); }; MDCTabIndicator.prototype.initialize = function () { this.content_ = this.root_.querySelector(MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR); }; MDCTabIndicator.prototype.computeContentClientRect = function () { return this.foundation_.computeContentClientRect(); }; MDCTabIndicator.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, computeContentClientRect: function computeContentClientRect() { return _this.content_.getBoundingClientRect(); }, setContentStyleProperty: function setContentStyleProperty(prop, value) { return _this.content_.style.setProperty(prop, value); } }; // tslint:enable:object-literal-sort-keys if (this.root_.classList.contains(MDCTabIndicatorFoundation.cssClasses.FADE)) { return new MDCFadingTabIndicatorFoundation(adapter); } // Default to the sliding indicator return new MDCSlidingTabIndicatorFoundation(adapter); }; MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) { this.foundation_.activate(previousIndicatorClientRect); }; MDCTabIndicator.prototype.deactivate = function () { this.foundation_.deactivate(); }; return MDCTabIndicator; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTabIndicator = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MdcTabIndicator, _super); function MdcTabIndicator(_platform, _changeDetectorRef, elementRef) { var _this = _super.call(this, elementRef) || this; _this._platform = _platform; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this._isFoundationInit = false; _this._active = false; _this._fade = false; _this._icon = null; return _this; } Object.defineProperty(MdcTabIndicator.prototype, "active", { get: /** * @return {?} */ function () { return this._active; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(value); if (this._active !== newValue) { this._active = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(newValue); this._active ? this.activate(this.computeContentClientRect()) : this.deactivate(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabIndicator.prototype, "fade", { get: /** * @return {?} */ function () { return this._fade; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["toBoolean"])(value); if (newValue !== this._fade) { this._fade = newValue; this._initFoundation(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabIndicator.prototype, "icon", { get: /** * @return {?} */ function () { return this._icon; }, set: /** * @param {?} value * @return {?} */ function (value) { this._icon = value; this._updateContentClasses(); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcTabIndicator.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), computeContentClientRect: (/** * @return {?} */ function () { if (!_this._platform.isBrowser) { return {}; } return _this.content.nativeElement.getBoundingClientRect(); }), setContentStyleProperty: (/** * @param {?} propName * @param {?} value * @return {?} */ function (propName, value) { return _this.content.nativeElement.style.setProperty(propName, value); }) }; if (this._fade) { return new MDCFadingTabIndicatorFoundation(adapter); } else { return new MDCSlidingTabIndicatorFoundation(adapter); } }; /** * @return {?} */ MdcTabIndicator.prototype.ngAfterViewInit = /** * @return {?} */ function () { if (!this._isFoundationInit) { this._initFoundation(); this._updateContentClasses(); } }; /** * @param {?} previousIndicatorClientRect * @return {?} */ MdcTabIndicator.prototype.activate = /** * @param {?} previousIndicatorClientRect * @return {?} */ function (previousIndicatorClientRect) { if (this._foundation) { this._foundation.activate(previousIndicatorClientRect); } }; /** * @return {?} */ MdcTabIndicator.prototype.deactivate = /** * @return {?} */ function () { if (this._foundation) { this._foundation.deactivate(); } }; /** * @return {?} */ MdcTabIndicator.prototype.computeContentClientRect = /** * @return {?} */ function () { return this._foundation.computeContentClientRect(); }; /** * @private * @return {?} */ MdcTabIndicator.prototype._initFoundation = /** * @private * @return {?} */ function () { this._foundation.init(); this._isFoundationInit = true; this._changeDetectorRef.markForCheck(); }; /** * @private * @return {?} */ MdcTabIndicator.prototype._updateContentClasses = /** * @private * @return {?} */ function () { this.content.nativeElement.classList.remove('mdc-tab-indicator__content--underline'); this.content.nativeElement.classList.remove('mdc-tab-indicator__content--icon'); if (this.icon) { this.content.nativeElement.classList.add('mdc-tab-indicator__content--icon'); this.content.nativeElement.classList.add('material-icons'); } else { this.content.nativeElement.classList.add('mdc-tab-indicator__content--underline'); } this._changeDetectorRef.markForCheck(); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcTabIndicator.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcTabIndicator.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdcTabIndicator], mdc-tab-indicator', exportAs: 'mdcTabIndicator', host: { 'class': 'mdc-tab-indicator', '[class.mdc-tab-indicator--active]': 'active', '[class.mdc-tab-indicator--fade]': 'fade' }, template: "\n \n {{icon}}\n \n ", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcTabIndicator.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_4__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcTabIndicator.propDecorators = { active: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fade: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], icon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], content: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['content',] }] }; return MdcTabIndicator; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_3__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTabIndicatorModule = /** @class */ (function () { function MdcTabIndicatorModule() { } MdcTabIndicatorModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"]], exports: [MdcTabIndicator], declarations: [MdcTabIndicator] },] }, ]; return MdcTabIndicatorModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=tab-indicator.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/tab-scroller.es5.js": /*!****************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/tab-scroller.es5.js ***! \****************************************************************/ /*! exports provided: MdcTabScroller, MdcTabScrollerModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabScroller", function() { return MdcTabScroller; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabScrollerModule", function() { return MdcTabScrollerModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { ANIMATING: 'mdc-tab-scroller--animating', SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll', SCROLL_TEST: 'mdc-tab-scroller__test' }; var strings = { AREA_SELECTOR: '.mdc-tab-scroller__scroll-area', CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing. */ var horizontalScrollbarHeight_; /** * Computes the height of browser-rendered horizontal scrollbars using a self-created test element. * May return 0 (e.g. on OS X browsers under default configuration). */ function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) { if (shouldCacheResult === void 0) { shouldCacheResult = true; } if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') { return horizontalScrollbarHeight_; } var el = documentObj.createElement('div'); el.classList.add(cssClasses.SCROLL_TEST); documentObj.body.appendChild(el); var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight; documentObj.body.removeChild(el); if (shouldCacheResult) { horizontalScrollbarHeight_ = horizontalScrollbarHeight; } return horizontalScrollbarHeight; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerRTL = /** @class */ function () { function MDCTabScrollerRTL(adapter) { this.adapter_ = adapter; } return MDCTabScrollerRTL; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerRTLDefault = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCTabScrollerRTLDefault, _super); function MDCTabScrollerRTLDefault() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var right = this.calculateScrollEdges_().right; // Scroll values on most browsers are ints instead of floats so we round return Math.round(right - currentScrollLeft); }; MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) { var edges = this.calculateScrollEdges_(); var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(edges.right - scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: clampedScrollLeft - currentScrollLeft }; }; MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: clampedScrollLeft - currentScrollLeft }; }; MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) { return scrollX; }; MDCTabScrollerRTLDefault.prototype.calculateScrollEdges_ = function () { var contentWidth = this.adapter_.getScrollContentOffsetWidth(); var rootWidth = this.adapter_.getScrollAreaOffsetWidth(); return { left: 0, right: contentWidth - rootWidth }; }; MDCTabScrollerRTLDefault.prototype.clampScrollValue_ = function (scrollX) { var edges = this.calculateScrollEdges_(); return Math.min(Math.max(edges.left, scrollX), edges.right); }; return MDCTabScrollerRTLDefault; }(MDCTabScrollerRTL); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerRTLNegative = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCTabScrollerRTLNegative, _super); function MDCTabScrollerRTLNegative() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); return Math.round(translateX - currentScrollLeft); }; MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(-scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: clampedScrollLeft - currentScrollLeft }; }; MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: clampedScrollLeft - currentScrollLeft }; }; MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) { return scrollX - translateX; }; MDCTabScrollerRTLNegative.prototype.calculateScrollEdges_ = function () { var contentWidth = this.adapter_.getScrollContentOffsetWidth(); var rootWidth = this.adapter_.getScrollAreaOffsetWidth(); return { left: rootWidth - contentWidth, right: 0 }; }; MDCTabScrollerRTLNegative.prototype.clampScrollValue_ = function (scrollX) { var edges = this.calculateScrollEdges_(); return Math.max(Math.min(edges.right, scrollX), edges.left); }; return MDCTabScrollerRTLNegative; }(MDCTabScrollerRTL); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerRTLReverse = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCTabScrollerRTLReverse, _super); function MDCTabScrollerRTLReverse() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); // Scroll values on most browsers are ints instead of floats so we round return Math.round(currentScrollLeft - translateX); }; MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: currentScrollLeft - clampedScrollLeft }; }; MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) { var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft(); var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft + scrollX); return { finalScrollPosition: clampedScrollLeft, scrollDelta: currentScrollLeft - clampedScrollLeft }; }; MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) { return scrollX + translateX; }; MDCTabScrollerRTLReverse.prototype.calculateScrollEdges_ = function () { var contentWidth = this.adapter_.getScrollContentOffsetWidth(); var rootWidth = this.adapter_.getScrollAreaOffsetWidth(); return { left: contentWidth - rootWidth, right: 0 }; }; MDCTabScrollerRTLReverse.prototype.clampScrollValue_ = function (scrollX) { var edges = this.calculateScrollEdges_(); return Math.min(Math.max(edges.right, scrollX), edges.left); }; return MDCTabScrollerRTLReverse; }(MDCTabScrollerRTL); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScrollerFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCTabScrollerFoundation, _super); function MDCTabScrollerFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, MDCTabScrollerFoundation.defaultAdapter, adapter)) || this; /** * Controls whether we should handle the transitionend and interaction events during the animation. */ _this.isAnimating_ = false; return _this; } Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabScrollerFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { eventTargetMatchesSelector: function eventTargetMatchesSelector() { return false; }, addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, addScrollAreaClass: function addScrollAreaClass() { return undefined; }, setScrollAreaStyleProperty: function setScrollAreaStyleProperty() { return undefined; }, setScrollContentStyleProperty: function setScrollContentStyleProperty() { return undefined; }, getScrollContentStyleValue: function getScrollContentStyleValue() { return ''; }, setScrollAreaScrollLeft: function setScrollAreaScrollLeft() { return undefined; }, getScrollAreaScrollLeft: function getScrollAreaScrollLeft() { return 0; }, getScrollContentOffsetWidth: function getScrollContentOffsetWidth() { return 0; }, getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() { return 0; }, computeScrollAreaClientRect: function computeScrollAreaClientRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, computeScrollContentClientRect: function computeScrollContentClientRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() { return 0; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTabScrollerFoundation.prototype.init = function () { // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs. var horizontalScrollbarHeight = this.adapter_.computeHorizontalScrollbarHeight(); this.adapter_.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px'); this.adapter_.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL); }; /** * Computes the current visual scroll position */ MDCTabScrollerFoundation.prototype.getScrollPosition = function () { if (this.isRTL_()) { return this.computeCurrentScrollPositionRTL_(); } var currentTranslateX = this.calculateCurrentTranslateX_(); var scrollLeft = this.adapter_.getScrollAreaScrollLeft(); return scrollLeft - currentTranslateX; }; /** * Handles interaction events that occur during transition */ MDCTabScrollerFoundation.prototype.handleInteraction = function () { // Early exit if we aren't animating if (!this.isAnimating_) { return; } // Prevent other event listeners from handling this event this.stopScrollAnimation_(); }; /** * Handles the transitionend event */ MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) { // Early exit if we aren't animating or the event was triggered by a different element. var evtTarget = evt.target; if (!this.isAnimating_ || !this.adapter_.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) { return; } this.isAnimating_ = false; this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); }; /** * Increment the scroll value by the scrollXIncrement * @param scrollXIncrement The value by which to increment the scroll position */ MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) { // Early exit for non-operational increment values if (scrollXIncrement === 0) { return; } if (this.isRTL_()) { return this.incrementScrollRTL_(scrollXIncrement); } this.incrementScroll_(scrollXIncrement); }; /** * Scrolls to the given scrollX value */ MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) { if (this.isRTL_()) { return this.scrollToRTL_(scrollX); } this.scrollTo_(scrollX); }; /** * @return Browser-specific {@link MDCTabScrollerRTL} instance. */ MDCTabScrollerFoundation.prototype.getRTLScroller = function () { if (!this.rtlScrollerInstance_) { this.rtlScrollerInstance_ = this.rtlScrollerFactory_(); } return this.rtlScrollerInstance_; }; /** * @return translateX value from a CSS matrix transform function string. */ MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX_ = function () { var transformValue = this.adapter_.getScrollContentStyleValue('transform'); // Early exit if no transform is present if (transformValue === 'none') { return 0; } // The transform value comes back as a matrix transformation in the form // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so // we're going to grab all the parenthesized values, strip out tx, and // parse it. var match = /\((.+?)\)/.exec(transformValue); if (!match) { return 0; } var matrixParams = match[1]; // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error. // @ts-ignore These unused variables should retain their semantic names for clarity. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(matrixParams.split(','), 6), a = _a[0], b = _a[1], c = _a[2], d = _a[3], tx = _a[4], ty = _a[5]; return parseFloat(tx); // tslint:disable-line:ban }; /** * Calculates a safe scroll value that is > 0 and < the max scroll value * @param scrollX The distance to scroll */ MDCTabScrollerFoundation.prototype.clampScrollValue_ = function (scrollX) { var edges = this.calculateScrollEdges_(); return Math.min(Math.max(edges.left, scrollX), edges.right); }; MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL_ = function () { var translateX = this.calculateCurrentTranslateX_(); return this.getRTLScroller().getScrollPositionRTL(translateX); }; MDCTabScrollerFoundation.prototype.calculateScrollEdges_ = function () { var contentWidth = this.adapter_.getScrollContentOffsetWidth(); var rootWidth = this.adapter_.getScrollAreaOffsetWidth(); return { left: 0, right: contentWidth - rootWidth }; }; /** * Internal scroll method * @param scrollX The new scroll position */ MDCTabScrollerFoundation.prototype.scrollTo_ = function (scrollX) { var currentScrollX = this.getScrollPosition(); var safeScrollX = this.clampScrollValue_(scrollX); var scrollDelta = safeScrollX - currentScrollX; this.animate_({ finalScrollPosition: safeScrollX, scrollDelta: scrollDelta }); }; /** * Internal RTL scroll method * @param scrollX The new scroll position */ MDCTabScrollerFoundation.prototype.scrollToRTL_ = function (scrollX) { var animation = this.getRTLScroller().scrollToRTL(scrollX); this.animate_(animation); }; /** * Internal increment scroll method * @param scrollX The new scroll position increment */ MDCTabScrollerFoundation.prototype.incrementScroll_ = function (scrollX) { var currentScrollX = this.getScrollPosition(); var targetScrollX = scrollX + currentScrollX; var safeScrollX = this.clampScrollValue_(targetScrollX); var scrollDelta = safeScrollX - currentScrollX; this.animate_({ finalScrollPosition: safeScrollX, scrollDelta: scrollDelta }); }; /** * Internal increment scroll RTL method * @param scrollX The new scroll position RTL increment */ MDCTabScrollerFoundation.prototype.incrementScrollRTL_ = function (scrollX) { var animation = this.getRTLScroller().incrementScrollRTL(scrollX); this.animate_(animation); }; /** * Animates the tab scrolling * @param animation The animation to apply */ MDCTabScrollerFoundation.prototype.animate_ = function (animation) { var _this = this; // Early exit if translateX is 0, which means there's no animation to perform if (animation.scrollDelta === 0) { return; } this.stopScrollAnimation_(); // This animation uses the FLIP approach. // Read more here: https://aerotwist.com/blog/flip-your-animations/ this.adapter_.setScrollAreaScrollLeft(animation.finalScrollPosition); this.adapter_.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)"); // Force repaint this.adapter_.computeScrollAreaClientRect(); requestAnimationFrame(function () { _this.adapter_.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); _this.adapter_.setScrollContentStyleProperty('transform', 'none'); }); this.isAnimating_ = true; }; /** * Stops scroll animation */ MDCTabScrollerFoundation.prototype.stopScrollAnimation_ = function () { this.isAnimating_ = false; var currentScrollPosition = this.getAnimatingScrollPosition_(); this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING); this.adapter_.setScrollContentStyleProperty('transform', 'translateX(0px)'); this.adapter_.setScrollAreaScrollLeft(currentScrollPosition); }; /** * Gets the current scroll position during animation */ MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition_ = function () { var currentTranslateX = this.calculateCurrentTranslateX_(); var scrollLeft = this.adapter_.getScrollAreaScrollLeft(); if (this.isRTL_()) { return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX); } return scrollLeft - currentTranslateX; }; /** * Determines the RTL Scroller to use */ MDCTabScrollerFoundation.prototype.rtlScrollerFactory_ = function () { // Browsers have three different implementations of scrollLeft in RTL mode, // dependent on the browser. The behavior is based off the max LTR // scrollLeft value and 0. // // * Default scrolling in RTL * // - Left-most value: 0 // - Right-most value: Max LTR scrollLeft value // // * Negative scrolling in RTL * // - Left-most value: Negated max LTR scrollLeft value // - Right-most value: 0 // // * Reverse scrolling in RTL * // - Left-most value: Max LTR scrollLeft value // - Right-most value: 0 // // We use those principles below to determine which RTL scrollLeft // behavior is implemented in the current browser. var initialScrollLeft = this.adapter_.getScrollAreaScrollLeft(); this.adapter_.setScrollAreaScrollLeft(initialScrollLeft - 1); var newScrollLeft = this.adapter_.getScrollAreaScrollLeft(); // If the newScrollLeft value is negative,then we know that the browser has // implemented negative RTL scrolling, since all other implementations have // only positive values. if (newScrollLeft < 0) { // Undo the scrollLeft test check this.adapter_.setScrollAreaScrollLeft(initialScrollLeft); return new MDCTabScrollerRTLNegative(this.adapter_); } var rootClientRect = this.adapter_.computeScrollAreaClientRect(); var contentClientRect = this.adapter_.computeScrollContentClientRect(); var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right); // Undo the scrollLeft test check this.adapter_.setScrollAreaScrollLeft(initialScrollLeft); // By calculating the clientRect of the root element and the clientRect of // the content element, we can determine how much the scroll value changed // when we performed the scrollLeft subtraction above. if (rightEdgeDelta === newScrollLeft) { return new MDCTabScrollerRTLReverse(this.adapter_); } return new MDCTabScrollerRTLDefault(this.adapter_); }; MDCTabScrollerFoundation.prototype.isRTL_ = function () { return this.adapter_.getScrollContentStyleValue('direction') === 'rtl'; }; return MDCTabScrollerFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabScroller = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MDCTabScroller, _super); function MDCTabScroller() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabScroller.attachTo = function (root) { return new MDCTabScroller(root); }; MDCTabScroller.prototype.initialize = function () { this.area_ = this.root_.querySelector(MDCTabScrollerFoundation.strings.AREA_SELECTOR); this.content_ = this.root_.querySelector(MDCTabScrollerFoundation.strings.CONTENT_SELECTOR); }; MDCTabScroller.prototype.initialSyncWithDOM = function () { var _this = this; this.handleInteraction_ = function () { return _this.foundation_.handleInteraction(); }; this.handleTransitionEnd_ = function (evt) { return _this.foundation_.handleTransitionEnd(evt); }; this.area_.addEventListener('wheel', this.handleInteraction_); this.area_.addEventListener('touchstart', this.handleInteraction_); this.area_.addEventListener('pointerdown', this.handleInteraction_); this.area_.addEventListener('mousedown', this.handleInteraction_); this.area_.addEventListener('keydown', this.handleInteraction_); this.content_.addEventListener('transitionend', this.handleTransitionEnd_); }; MDCTabScroller.prototype.destroy = function () { _super.prototype.destroy.call(this); this.area_.removeEventListener('wheel', this.handleInteraction_); this.area_.removeEventListener('touchstart', this.handleInteraction_); this.area_.removeEventListener('pointerdown', this.handleInteraction_); this.area_.removeEventListener('mousedown', this.handleInteraction_); this.area_.removeEventListener('keydown', this.handleInteraction_); this.content_.removeEventListener('transitionend', this.handleTransitionEnd_); }; MDCTabScroller.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) { return matches(evtTarget, selector); }, addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, addScrollAreaClass: function addScrollAreaClass(className) { return _this.area_.classList.add(className); }, setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) { return _this.area_.style.setProperty(prop, value); }, setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) { return _this.content_.style.setProperty(prop, value); }, getScrollContentStyleValue: function getScrollContentStyleValue(propName) { return window.getComputedStyle(_this.content_).getPropertyValue(propName); }, setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) { return _this.area_.scrollLeft = scrollX; }, getScrollAreaScrollLeft: function getScrollAreaScrollLeft() { return _this.area_.scrollLeft; }, getScrollContentOffsetWidth: function getScrollContentOffsetWidth() { return _this.content_.offsetWidth; }, getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() { return _this.area_.offsetWidth; }, computeScrollAreaClientRect: function computeScrollAreaClientRect() { return _this.area_.getBoundingClientRect(); }, computeScrollContentClientRect: function computeScrollContentClientRect() { return _this.content_.getBoundingClientRect(); }, computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight$1() { return computeHorizontalScrollbarHeight(document); } }; // tslint:enable:object-literal-sort-keys return new MDCTabScrollerFoundation(adapter); }; /** * Returns the current visual scroll position */ MDCTabScroller.prototype.getScrollPosition = function () { return this.foundation_.getScrollPosition(); }; /** * Returns the width of the scroll content */ MDCTabScroller.prototype.getScrollContentWidth = function () { return this.content_.offsetWidth; }; /** * Increments the scroll value by the given amount * @param scrollXIncrement The pixel value by which to increment the scroll value */ MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) { this.foundation_.incrementScroll(scrollXIncrement); }; /** * Scrolls to the given pixel position * @param scrollX The pixel value to scroll to */ MDCTabScroller.prototype.scrollTo = function (scrollX) { this.foundation_.scrollTo(scrollX); }; return MDCTabScroller; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var SCROLLER_EVENTS = [ 'keydown', 'mousedown', 'pointerdown', 'touchstart', 'wheel' ]; var MdcTabScroller = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(MdcTabScroller, _super); function MdcTabScroller(_ngZone, _platform, elementRef) { var _this = _super.call(this, elementRef) || this; _this._ngZone = _ngZone; _this._platform = _platform; _this.elementRef = elementRef; /** * Emits whenever the component is destroyed. */ _this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); _this._align = null; _this._scrollAreaEventsSubscription = null; return _this; } Object.defineProperty(MdcTabScroller.prototype, "align", { get: /** * @return {?} */ function () { return this._align; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setAlign(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTabScroller.prototype, "scrollAreaEvents", { /** Combined stream of all of the scroll area events. */ get: /** * Combined stream of all of the scroll area events. * @return {?} */ function () { var _this = this; return rxjs__WEBPACK_IMPORTED_MODULE_2__["merge"].apply(void 0, SCROLLER_EVENTS.map((/** * @param {?} evt * @return {?} */ function (evt) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["fromEvent"])(_this._getScrollArea(), evt); }))); }, enumerable: true, configurable: true }); /** * @return {?} */ MdcTabScroller.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { eventTargetMatchesSelector: (/** * @param {?} evtTarget * @param {?} selector * @return {?} */ function (evtTarget, selector) { return matches(evtTarget, selector); }), addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), addScrollAreaClass: (/** * @param {?} className * @return {?} */ function (className) { return _this.area.nativeElement.classList.add(className); }), setScrollAreaStyleProperty: (/** * @param {?} propName * @param {?} value * @return {?} */ function (propName, value) { return _this.area.nativeElement.style.setProperty(propName, value); }), setScrollContentStyleProperty: (/** * @param {?} propName * @param {?} value * @return {?} */ function (propName, value) { return _this.content.nativeElement.style.setProperty(propName, value); }), getScrollContentStyleValue: (/** * @param {?} propName * @return {?} */ function (propName) { return _this._platform.isBrowser ? window.getComputedStyle(_this.content.nativeElement).getPropertyValue(propName) : ''; }), setScrollAreaScrollLeft: (/** * @param {?} scrollX * @return {?} */ function (scrollX) { return _this.area.nativeElement.scrollLeft = scrollX; }), getScrollAreaScrollLeft: (/** * @return {?} */ function () { return _this.area.nativeElement.scrollLeft; }), getScrollContentOffsetWidth: (/** * @return {?} */ function () { return _this.content.nativeElement.offsetWidth; }), getScrollAreaOffsetWidth: (/** * @return {?} */ function () { return _this.area.nativeElement.offsetWidth; }), computeScrollAreaClientRect: (/** * @return {?} */ function () { return _this._platform.isBrowser ? _this.area.nativeElement.getBoundingClientRect() : {}; }), computeScrollContentClientRect: (/** * @return {?} */ function () { return _this._platform.isBrowser ? _this.content.nativeElement.getBoundingClientRect() : {}; }), computeHorizontalScrollbarHeight: (/** * @return {?} */ function () { return _this._platform.isBrowser ? computeHorizontalScrollbarHeight(document) : 0; }) }; return new MDCTabScrollerFoundation(adapter); }; /** * @return {?} */ MdcTabScroller.prototype.ngAfterViewInit = /** * @return {?} */ function () { this._foundation.init(); this._loadListeners(); }; /** * @return {?} */ MdcTabScroller.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); if (this._scrollAreaEventsSubscription) { this._scrollAreaEventsSubscription.unsubscribe(); } }; /** * @param {?} align * @return {?} */ MdcTabScroller.prototype.setAlign = /** * @param {?} align * @return {?} */ function (align) { this._getHostElement().classList.remove("mdc-tab-scroller--align-" + this._align); this._align = align; if (align) { this._getHostElement().classList.add("mdc-tab-scroller--align-" + align); } }; /** Returns the current visual scroll position */ /** * Returns the current visual scroll position * @return {?} */ MdcTabScroller.prototype.getScrollPosition = /** * Returns the current visual scroll position * @return {?} */ function () { if (!this._platform.isBrowser) { return -1; } return this._foundation.getScrollPosition(); }; /** Returns the width of the scroll content */ /** * Returns the width of the scroll content * @return {?} */ MdcTabScroller.prototype.getScrollContentWidth = /** * Returns the width of the scroll content * @return {?} */ function () { return this.content.nativeElement.offsetWidth; }; /** Increments the scroll value by the given amount */ /** * Increments the scroll value by the given amount * @param {?} scrollXIncrement * @return {?} */ MdcTabScroller.prototype.incrementScroll = /** * Increments the scroll value by the given amount * @param {?} scrollXIncrement * @return {?} */ function (scrollXIncrement) { if (!this._platform.isBrowser) { return -1; } this._foundation.incrementScroll(scrollXIncrement); }; /** Scrolls to the given pixel position */ /** * Scrolls to the given pixel position * @param {?} scrollX * @return {?} */ MdcTabScroller.prototype.scrollTo = /** * Scrolls to the given pixel position * @param {?} scrollX * @return {?} */ function (scrollX) { this._foundation.scrollTo(scrollX); }; /** * @private * @return {?} */ MdcTabScroller.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._scrollAreaEventsSubscription = this.scrollAreaEvents.pipe() .subscribe((/** * @return {?} */ function () { return _this._foundation.handleInteraction(); })); this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["fromEvent"])(_this._getScrollContent(), 'transitionend') .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(_this._destroy), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])((/** * @param {?} e * @return {?} */ function (e) { return e.target === _this._getScrollContent(); }))) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleTransitionEnd(evt); })); })); })); }; /** * @private * @return {?} */ MdcTabScroller.prototype._getScrollArea = /** * @private * @return {?} */ function () { return this.area.nativeElement; }; /** * @private * @return {?} */ MdcTabScroller.prototype._getScrollContent = /** * @private * @return {?} */ function () { return this.content.nativeElement; }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcTabScroller.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcTabScroller.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdcTabScroller], mdc-tab-scroller', exportAs: 'mdcTabScroller', host: { 'class': 'mdc-tab-scroller' }, template: "\n
\n
\n \n
\n
\n ", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcTabScroller.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_5__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcTabScroller.propDecorators = { align: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], area: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['area',] }], content: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['content',] }] }; return MdcTabScroller; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_4__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTabScrollerModule = /** @class */ (function () { function MdcTabScrollerModule() { } MdcTabScrollerModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: [MdcTabScroller], declarations: [MdcTabScroller] },] }, ]; return MdcTabScrollerModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=tab-scroller.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/tab.es5.js": /*!*******************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/tab.es5.js ***! \*******************************************************/ /*! exports provided: MDC_TAB_BAR_PARENT_COMPONENT, MdcTab, MdcTabIcon, MdcTabLabel, MdcTabModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_TAB_BAR_PARENT_COMPONENT", function() { return MDC_TAB_BAR_PARENT_COMPONENT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTab", function() { return MdcTab; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabIcon", function() { return MdcTabIcon; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabLabel", function() { return MdcTabLabel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTabModule", function() { return MdcTabModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/icon */ "./node_modules/@angular-mdc/web/esm5/icon.es5.js"); /* harmony import */ var _angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/tab-indicator */ "./node_modules/@angular-mdc/web/esm5/tab-indicator.es5.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { ACTIVE: 'mdc-tab-indicator--active', FADE: 'mdc-tab-indicator--fade', NO_TRANSITION: 'mdc-tab-indicator--no-transition' }; var strings$1 = { CONTENT_SELECTOR: '.mdc-tab-indicator__content' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__extends"])(MDCTabIndicatorFoundation, _super); function MDCTabIndicatorFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__assign"])({}, MDCTabIndicatorFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabIndicatorFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, computeContentClientRect: function computeContentClientRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, setContentStyleProperty: function setContentStyleProperty() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () { return this.adapter_.computeContentClientRect(); }; return MDCTabIndicatorFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* istanbul ignore next: subclass is not a branch statement */ var MDCFadingTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__extends"])(MDCFadingTabIndicatorFoundation, _super); function MDCFadingTabIndicatorFoundation() { return _super !== null && _super.apply(this, arguments) || this; } MDCFadingTabIndicatorFoundation.prototype.activate = function () { this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; MDCFadingTabIndicatorFoundation.prototype.deactivate = function () { this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; return MDCFadingTabIndicatorFoundation; }(MDCTabIndicatorFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* istanbul ignore next: subclass is not a branch statement */ var MDCSlidingTabIndicatorFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__extends"])(MDCSlidingTabIndicatorFoundation, _super); function MDCSlidingTabIndicatorFoundation() { return _super !== null && _super.apply(this, arguments) || this; } MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) { // Early exit if no indicator is present to handle cases where an indicator // may be activated without a prior indicator state if (!previousIndicatorClientRect) { this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); return; } // This animation uses the FLIP approach. You can read more about it at the link below: // https://aerotwist.com/blog/flip-your-animations/ // Calculate the dimensions based on the dimensions of the previous indicator var currentClientRect = this.computeContentClientRect(); var widthDelta = previousIndicatorClientRect.width / currentClientRect.width; var xPosition = previousIndicatorClientRect.left - currentClientRect.left; this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); this.adapter_.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")"); // Force repaint before updating classes and transform to ensure the transform properly takes effect this.computeContentClientRect(); this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION); this.adapter_.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); this.adapter_.setContentStyleProperty('transform', ''); }; MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () { this.adapter_.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE); }; return MDCSlidingTabIndicatorFoundation; }(MDCTabIndicatorFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabIndicator = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__extends"])(MDCTabIndicator, _super); function MDCTabIndicator() { return _super !== null && _super.apply(this, arguments) || this; } MDCTabIndicator.attachTo = function (root) { return new MDCTabIndicator(root); }; MDCTabIndicator.prototype.initialize = function () { this.content_ = this.root_.querySelector(MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR); }; MDCTabIndicator.prototype.computeContentClientRect = function () { return this.foundation_.computeContentClientRect(); }; MDCTabIndicator.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, computeContentClientRect: function computeContentClientRect() { return _this.content_.getBoundingClientRect(); }, setContentStyleProperty: function setContentStyleProperty(prop, value) { return _this.content_.style.setProperty(prop, value); } }; // tslint:enable:object-literal-sort-keys if (this.root_.classList.contains(MDCTabIndicatorFoundation.cssClasses.FADE)) { return new MDCFadingTabIndicatorFoundation(adapter); } // Default to the sliding indicator return new MDCSlidingTabIndicatorFoundation(adapter); }; MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) { this.foundation_.activate(previousIndicatorClientRect); }; MDCTabIndicator.prototype.deactivate = function () { this.foundation_.deactivate(); }; return MDCTabIndicator; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$2 = { ACTIVE: 'mdc-tab--active' }; var strings$2 = { ARIA_SELECTED: 'aria-selected', CONTENT_SELECTOR: '.mdc-tab__content', INTERACTED_EVENT: 'MDCTab:interacted', RIPPLE_SELECTOR: '.mdc-tab__ripple', TABINDEX: 'tabIndex', TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTabFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__extends"])(MDCTabFoundation, _super); function MDCTabFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__assign"])({}, MDCTabFoundation.defaultAdapter, adapter)) || this; _this.focusOnActivate_ = true; return _this; } Object.defineProperty(MDCTabFoundation, "cssClasses", { get: function get() { return cssClasses$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabFoundation, "strings", { get: function get() { return strings$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTabFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setAttr: function setAttr() { return undefined; }, activateIndicator: function activateIndicator() { return undefined; }, deactivateIndicator: function deactivateIndicator() { return undefined; }, notifyInteracted: function notifyInteracted() { return undefined; }, getOffsetLeft: function getOffsetLeft() { return 0; }, getOffsetWidth: function getOffsetWidth() { return 0; }, getContentOffsetLeft: function getContentOffsetLeft() { return 0; }, getContentOffsetWidth: function getContentOffsetWidth() { return 0; }, focus: function focus() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTabFoundation.prototype.handleClick = function () { // It's up to the parent component to keep track of the active Tab and // ensure we don't activate a Tab that's already active. this.adapter_.notifyInteracted(); }; MDCTabFoundation.prototype.isActive = function () { return this.adapter_.hasClass(cssClasses$2.ACTIVE); }; /** * Sets whether the tab should focus itself when activated */ MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) { this.focusOnActivate_ = focusOnActivate; }; /** * Activates the Tab */ MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) { this.adapter_.addClass(cssClasses$2.ACTIVE); this.adapter_.setAttr(strings$2.ARIA_SELECTED, 'true'); this.adapter_.setAttr(strings$2.TABINDEX, '0'); this.adapter_.activateIndicator(previousIndicatorClientRect); if (this.focusOnActivate_) { this.adapter_.focus(); } }; /** * Deactivates the Tab */ MDCTabFoundation.prototype.deactivate = function () { // Early exit if (!this.isActive()) { return; } this.adapter_.removeClass(cssClasses$2.ACTIVE); this.adapter_.setAttr(strings$2.ARIA_SELECTED, 'false'); this.adapter_.setAttr(strings$2.TABINDEX, '-1'); this.adapter_.deactivateIndicator(); }; /** * Returns the dimensions of the Tab */ MDCTabFoundation.prototype.computeDimensions = function () { var rootWidth = this.adapter_.getOffsetWidth(); var rootLeft = this.adapter_.getOffsetLeft(); var contentWidth = this.adapter_.getContentOffsetWidth(); var contentLeft = this.adapter_.getContentOffsetLeft(); return { contentLeft: rootLeft + contentLeft, contentRight: rootLeft + contentLeft + contentWidth, rootLeft: rootLeft, rootRight: rootLeft + rootWidth }; }; return MDCTabFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTab = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__extends"])(MDCTab, _super); function MDCTab() { return _super !== null && _super.apply(this, arguments) || this; } MDCTab.attachTo = function (root) { return new MDCTab(root); }; MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) { if (rippleFactory === void 0) { rippleFactory = function rippleFactory(el, foundation) { return new MDCRipple(el, foundation); }; } if (tabIndicatorFactory === void 0) { tabIndicatorFactory = function tabIndicatorFactory(el) { return new MDCTabIndicator(el); }; } this.id = this.root_.id; var rippleSurface = this.root_.querySelector(MDCTabFoundation.strings.RIPPLE_SELECTOR); var rippleAdapter = Object(tslib__WEBPACK_IMPORTED_MODULE_8__["__assign"])({}, MDCRipple.createAdapter(this), { addClass: function addClass(className) { return rippleSurface.classList.add(className); }, removeClass: function removeClass(className) { return rippleSurface.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return rippleSurface.style.setProperty(varName, value); } }); var rippleFoundation = new MDCRippleFoundation(rippleAdapter); this.ripple_ = rippleFactory(this.root_, rippleFoundation); var tabIndicatorElement = this.root_.querySelector(MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR); this.tabIndicator_ = tabIndicatorFactory(tabIndicatorElement); this.content_ = this.root_.querySelector(MDCTabFoundation.strings.CONTENT_SELECTOR); }; MDCTab.prototype.initialSyncWithDOM = function () { var _this = this; this.handleClick_ = function () { return _this.foundation_.handleClick(); }; this.listen('click', this.handleClick_); }; MDCTab.prototype.destroy = function () { this.unlisten('click', this.handleClick_); this.ripple_.destroy(); _super.prototype.destroy.call(this); }; MDCTab.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { setAttr: function setAttr(attr, value) { return _this.root_.setAttribute(attr, value); }, addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, activateIndicator: function activateIndicator(previousIndicatorClientRect) { return _this.tabIndicator_.activate(previousIndicatorClientRect); }, deactivateIndicator: function deactivateIndicator() { return _this.tabIndicator_.deactivate(); }, notifyInteracted: function notifyInteracted() { return _this.emit(MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */ ); }, getOffsetLeft: function getOffsetLeft() { return _this.root_.offsetLeft; }, getOffsetWidth: function getOffsetWidth() { return _this.root_.offsetWidth; }, getContentOffsetLeft: function getContentOffsetLeft() { return _this.content_.offsetLeft; }, getContentOffsetWidth: function getContentOffsetWidth() { return _this.content_.offsetWidth; }, focus: function focus() { return _this.root_.focus(); } }; // tslint:enable:object-literal-sort-keys return new MDCTabFoundation(adapter); }; Object.defineProperty(MDCTab.prototype, "active", { /** * Getter for the active state of the tab */ get: function get() { return this.foundation_.isActive(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTab.prototype, "focusOnActivate", { set: function set(focusOnActivate) { this.foundation_.setFocusOnActivate(focusOnActivate); }, enumerable: true, configurable: true }); /** * Activates the tab */ MDCTab.prototype.activate = function (computeIndicatorClientRect) { this.foundation_.activate(computeIndicatorClientRect); }; /** * Deactivates the tab */ MDCTab.prototype.deactivate = function () { this.foundation_.deactivate(); }; /** * Returns the indicator's client rect */ MDCTab.prototype.computeIndicatorClientRect = function () { return this.tabIndicator_.computeContentClientRect(); }; MDCTab.prototype.computeDimensions = function () { return this.foundation_.computeDimensions(); }; /** * Focuses the tab */ MDCTab.prototype.focus = function () { this.root_.focus(); }; return MDCTab; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Injection token used to provide the parent MdcTabBar component to MdcTab. * @type {?} */ var MDC_TAB_BAR_PARENT_COMPONENT = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('MDC_TAB_BAR_PARENT_COMPONENT'); /** @type {?} */ var nextUniqueId = 0; var MdcTabLabel = /** @class */ (function () { function MdcTabLabel(elementRef) { this.elementRef = elementRef; } MdcTabLabel.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-tab-label, [mdcTabLabel]', host: { 'class': 'mdc-tab__text-label' } },] }, ]; /** @nocollapse */ MdcTabLabel.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcTabLabel; }()); var MdcTabIcon = /** @class */ (function () { function MdcTabIcon(elementRef) { this.elementRef = elementRef; } MdcTabIcon.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-tab-icon, [mdcTabIcon]', host: { 'class': 'mdc-tab__icon' } },] }, ]; /** @nocollapse */ MdcTabIcon.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcTabIcon; }()); var MdcTab = /** @class */ (function () { function MdcTab(_ngZone, _changeDetectorRef, _ripple, elementRef, _parent) { this._ngZone = _ngZone; this._changeDetectorRef = _changeDetectorRef; this._ripple = _ripple; this.elementRef = elementRef; this._parent = _parent; /** * Emits whenever the component is destroyed. */ this._destroy = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"](); this._uniqueId = "mdc-tab-" + ++nextUniqueId; this.id = this._uniqueId; this._stacked = false; this._fixed = false; this._disabled = false; this._focusOnActivate = true; this.interacted = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); this._foundation = new MDCTabFoundation(this._createAdapter()); } Object.defineProperty(MdcTab.prototype, "stacked", { get: /** * @return {?} */ function () { return this._stacked; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(value); if (newValue !== this._stacked) { this._stacked = newValue; } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTab.prototype, "fixed", { get: /** * @return {?} */ function () { return this._fixed; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(value); if (newValue !== this._fixed) { this._fixed = newValue; this._changeDetectorRef.detectChanges(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTab.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this._disabled = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTab.prototype, "focusOnActivate", { get: /** * @return {?} */ function () { return this._focusOnActivate; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(value); if (newValue !== this._focusOnActivate) { this._focusOnActivate = newValue; this._foundation.setFocusOnActivate(this._focusOnActivate); } }, enumerable: true, configurable: true }); /** * @private * @return {?} */ MdcTab.prototype._createAdapter = /** * @private * @return {?} */ function () { var _this = this; return { setAttr: (/** * @param {?} attr * @param {?} value * @return {?} */ function (attr, value) { return _this._getHostElement().setAttribute(attr, value); }), addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), activateIndicator: (/** * @param {?} previousIndicatorClientRect * @return {?} */ function (previousIndicatorClientRect) { return _this.tabIndicator.activate(previousIndicatorClientRect); }), deactivateIndicator: (/** * @return {?} */ function () { return _this.tabIndicator.deactivate(); }), notifyInteracted: (/** * @return {?} */ function () { return _this.interacted.emit({ detail: { tabId: _this.id, tab: _this } }); }), getOffsetLeft: (/** * @return {?} */ function () { return _this._getHostElement().offsetLeft; }), getOffsetWidth: (/** * @return {?} */ function () { return _this._getHostElement().offsetWidth; }), getContentOffsetLeft: (/** * @return {?} */ function () { return _this.content.nativeElement.offsetLeft; }), getContentOffsetWidth: (/** * @return {?} */ function () { return _this.content.nativeElement.offsetWidth; }), focus: (/** * @return {?} */ function () { return _this._getHostElement().focus(); }) }; }; /** * @return {?} */ MdcTab.prototype.ngOnInit = /** * @return {?} */ function () { this._foundation.init(); this._initRipple(); this._loadListeners(); }; /** * @return {?} */ MdcTab.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); this._ripple.destroy(); }; Object.defineProperty(MdcTab.prototype, "active", { /** Getter for the active state of the tab */ get: /** * Getter for the active state of the tab * @return {?} */ function () { return this._foundation.isActive(); }, enumerable: true, configurable: true }); /** Activates the tab */ /** * Activates the tab * @param {?} computeIndicatorClientRect * @return {?} */ MdcTab.prototype.activate = /** * Activates the tab * @param {?} computeIndicatorClientRect * @return {?} */ function (computeIndicatorClientRect) { this._foundation.activate(computeIndicatorClientRect); }; /** Deactivates the tab */ /** * Deactivates the tab * @return {?} */ MdcTab.prototype.deactivate = /** * Deactivates the tab * @return {?} */ function () { this._foundation.deactivate(); }; /** Returns the indicator's client rect */ /** * Returns the indicator's client rect * @return {?} */ MdcTab.prototype.computeIndicatorClientRect = /** * Returns the indicator's client rect * @return {?} */ function () { return this.tabIndicator.computeContentClientRect(); }; /** * @return {?} */ MdcTab.prototype.computeDimensions = /** * @return {?} */ function () { return this._foundation.computeDimensions(); }; /** * @return {?} */ MdcTab.prototype.getTabBarParent = /** * @return {?} */ function () { return this._parent; }; /** * @return {?} */ MdcTab.prototype.focus = /** * @return {?} */ function () { this._getHostElement().focus(); }; /** * @private * @return {?} */ MdcTab.prototype._initRipple = /** * @private * @return {?} */ function () { var _this = this; this._ripple.init({ surface: this._getHostElement() }, Object.assign(this._ripple.createAdapter(), { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this.rippleSurface.nativeElement.classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this.rippleSurface.nativeElement.classList.remove(className); }), updateCssVariable: (/** * @param {?} varName * @param {?} value * @return {?} */ function (varName, value) { return _this.rippleSurface.nativeElement.style.setProperty(varName, value); }), })); }; /** * @private * @return {?} */ MdcTab.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_4__["fromEvent"])(_this._getHostElement(), 'click').pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["takeUntil"])(_this._destroy)) .subscribe((/** * @return {?} */ function () { return _this._ngZone.run((/** * @return {?} */ function () { if (!_this.active && !_this._disabled) { _this._foundation.handleClick(); } })); })); })); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcTab.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcTab.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: '[mdcTab], mdc-tab', exportAs: 'mdcTab', host: { '[id]': 'id', 'role': 'tab', 'class': 'mdc-tab', '[class.mdc-tab--stacked]': 'stacked', '[class.mdc-tab--min-width]': 'fixed', '[class.ngx-mdc-tab--disabled]': 'disabled' }, template: "\n
\n {{icon}}\n \n {{label}}\n \n \n \n \n
\n \n \n \n \n
\n ", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_7__["MdcRipple"]] },] }, ]; /** @nocollapse */ MdcTab.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_7__["MdcRipple"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [MDC_TAB_BAR_PARENT_COMPONENT,] }] } ]; }; MdcTab.propDecorators = { id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], label: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], icon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], stacked: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fixed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], focusOnActivate: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], interacted: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], content: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['content',] }], rippleSurface: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['ripplesurface',] }], tabIndicator: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_3__["MdcTabIndicator"],] }] }; return MdcTab; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TAB_DECLARATIONS = [ MdcTab, MdcTabIcon, MdcTabLabel ]; var MdcTabModule = /** @class */ (function () { function MdcTabModule() { } MdcTabModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"], _angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_3__["MdcTabIndicatorModule"], _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_2__["MdcIconModule"] ], exports: TAB_DECLARATIONS, declarations: TAB_DECLARATIONS },] }, ]; return MdcTabModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=tab.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/textfield.es5.js": /*!*************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/textfield.es5.js ***! \*************************************************************/ /*! exports provided: MDC_TEXT_FIELD_DEFAULT_OPTIONS, MdcTextField, MdcTextFieldIcon, MdcTextFieldModule, MdcTextarea */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDC_TEXT_FIELD_DEFAULT_OPTIONS", function() { return MDC_TEXT_FIELD_DEFAULT_OPTIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTextField", function() { return MdcTextField; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTextFieldIcon", function() { return MdcTextFieldIcon; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTextFieldModule", function() { return MdcTextFieldModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTextarea", function() { return MdcTextarea; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/floating-label */ "./node_modules/@angular-mdc/web/esm5/floating-label.es5.js"); /* harmony import */ var _angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/line-ripple */ "./node_modules/@angular-mdc/web/esm5/line-ripple.es5.js"); /* harmony import */ var _angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/notched-outline */ "./node_modules/@angular-mdc/web/esm5/notched-outline.es5.js"); /* harmony import */ var _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/form-field */ "./node_modules/@angular-mdc/web/esm5/form-field.es5.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /* harmony import */ var _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @angular-mdc/web/icon */ "./node_modules/@angular-mdc/web/esm5/icon.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTextFieldIcon = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MdcTextFieldIcon, _super); function MdcTextFieldIcon() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._leading = false; _this._trailing = false; return _this; } Object.defineProperty(MdcTextFieldIcon.prototype, "leading", { get: /** * @return {?} */ function () { return this._leading; }, set: /** * @param {?} value * @return {?} */ function (value) { this._leading = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextFieldIcon.prototype, "trailing", { get: /** * @return {?} */ function () { return this._trailing; }, set: /** * @param {?} value * @return {?} */ function (value) { this._trailing = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); }, enumerable: true, configurable: true }); MdcTextFieldIcon.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcTextFieldIcon]', exportAs: 'mdcTextFieldIcon', host: { 'class': 'mdc-text-field__icon' } },] }, ]; MdcTextFieldIcon.propDecorators = { leading: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], trailing: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcTextFieldIcon; }(_angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_10__["MdcIcon"])); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent', HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg', ROOT: 'mdc-text-field-helper-text' }; var strings = { ARIA_HIDDEN: 'aria-hidden', ROLE: 'role', ROOT_SELECTOR: "." + cssClasses.ROOT }; /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTextFieldHelperTextFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCTextFieldHelperTextFoundation, _super); function MDCTextFieldHelperTextFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCTextFieldHelperTextFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", { /** * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setAttr: function setAttr() { return undefined; }, removeAttr: function removeAttr() { return undefined; }, setContent: function setContent() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); /** * Sets the content of the helper text field. */ MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) { this.adapter_.setContent(content); }; /** * @param isPersistent Sets the persistency of the helper text. */ MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) { if (isPersistent) { this.adapter_.addClass(cssClasses.HELPER_TEXT_PERSISTENT); } else { this.adapter_.removeClass(cssClasses.HELPER_TEXT_PERSISTENT); } }; /** * @param isValidation True to make the helper text act as an error validation message. */ MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) { if (isValidation) { this.adapter_.addClass(cssClasses.HELPER_TEXT_VALIDATION_MSG); } else { this.adapter_.removeClass(cssClasses.HELPER_TEXT_VALIDATION_MSG); } }; /** * Makes the helper text visible to the screen reader. */ MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () { this.adapter_.removeAttr(strings.ARIA_HIDDEN); }; /** * Sets the validity of the helper text based on the input validity. */ MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) { var helperTextIsPersistent = this.adapter_.hasClass(cssClasses.HELPER_TEXT_PERSISTENT); var helperTextIsValidationMsg = this.adapter_.hasClass(cssClasses.HELPER_TEXT_VALIDATION_MSG); var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid; if (validationMsgNeedsDisplay) { this.adapter_.setAttr(strings.ROLE, 'alert'); } else { this.adapter_.removeAttr(strings.ROLE); } if (!helperTextIsPersistent && !validationMsgNeedsDisplay) { this.hide_(); } }; /** * Hides the help text from screen readers. */ MDCTextFieldHelperTextFoundation.prototype.hide_ = function () { this.adapter_.setAttr(strings.ARIA_HIDDEN, 'true'); }; return MDCTextFieldHelperTextFoundation; }(MDCFoundation); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTextFieldHelperText = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCTextFieldHelperText, _super); function MDCTextFieldHelperText() { return _super !== null && _super.apply(this, arguments) || this; } MDCTextFieldHelperText.attachTo = function (root) { return new MDCTextFieldHelperText(root); }; Object.defineProperty(MDCTextFieldHelperText.prototype, "foundation", { get: function get() { return this.foundation_; }, enumerable: true, configurable: true }); MDCTextFieldHelperText.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, setAttr: function setAttr(attr, value) { return _this.root_.setAttribute(attr, value); }, removeAttr: function removeAttr(attr) { return _this.root_.removeAttribute(attr); }, setContent: function setContent(content) { _this.root_.textContent = content; } }; // tslint:enable:object-literal-sort-keys return new MDCTextFieldHelperTextFoundation(adapter); }; return MDCTextFieldHelperText; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above', LABEL_SHAKE: 'mdc-floating-label--shake', ROOT: 'mdc-floating-label' }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFloatingLabelFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCFloatingLabelFoundation, _super); function MDCFloatingLabelFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCFloatingLabelFoundation.defaultAdapter, adapter)) || this; _this.shakeAnimationEndHandler_ = function () { return _this.handleShakeAnimationEnd_(); }; return _this; } Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", { /** * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, getWidth: function getWidth() { return 0; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCFloatingLabelFoundation.prototype.init = function () { this.adapter_.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; MDCFloatingLabelFoundation.prototype.destroy = function () { this.adapter_.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; /** * Returns the width of the label element. */ MDCFloatingLabelFoundation.prototype.getWidth = function () { return this.adapter_.getWidth(); }; /** * Styles the label to produce a shake animation to indicate an error. * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class. */ MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; if (shouldShake) { this.adapter_.addClass(LABEL_SHAKE); } else { this.adapter_.removeClass(LABEL_SHAKE); } }; /** * Styles the label to float or dock. * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label. */ MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) { var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE; if (shouldFloat) { this.adapter_.addClass(LABEL_FLOAT_ABOVE); } else { this.adapter_.removeClass(LABEL_FLOAT_ABOVE); this.adapter_.removeClass(LABEL_SHAKE); } }; MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; this.adapter_.removeClass(LABEL_SHAKE); }; return MDCFloatingLabelFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFloatingLabel = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCFloatingLabel, _super); function MDCFloatingLabel() { return _super !== null && _super.apply(this, arguments) || this; } MDCFloatingLabel.attachTo = function (root) { return new MDCFloatingLabel(root); }; /** * Styles the label to produce the label shake for errors. * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class. */ MDCFloatingLabel.prototype.shake = function (shouldShake) { this.foundation_.shake(shouldShake); }; /** * Styles the label to float/dock. * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class. */ MDCFloatingLabel.prototype.float = function (shouldFloat) { this.foundation_.float(shouldFloat); }; MDCFloatingLabel.prototype.getWidth = function () { return this.foundation_.getWidth(); }; MDCFloatingLabel.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, getWidth: function getWidth() { return _this.root_.scrollWidth; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.unlisten(evtType, handler); } }; // tslint:enable:object-literal-sort-keys return new MDCFloatingLabelFoundation(adapter); }; return MDCFloatingLabel; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$2 = { LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active', LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating' }; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCLineRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCLineRippleFoundation, _super); function MDCLineRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCLineRippleFoundation.defaultAdapter, adapter)) || this; _this.transitionEndHandler_ = function (evt) { return _this.handleTransitionEnd(evt); }; return _this; } Object.defineProperty(MDCLineRippleFoundation, "cssClasses", { get: function get() { return cssClasses$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", { /** * See {@link MDCLineRippleAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setStyle: function setStyle() { return undefined; }, registerEventHandler: function registerEventHandler() { return undefined; }, deregisterEventHandler: function deregisterEventHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCLineRippleFoundation.prototype.init = function () { this.adapter_.registerEventHandler('transitionend', this.transitionEndHandler_); }; MDCLineRippleFoundation.prototype.destroy = function () { this.adapter_.deregisterEventHandler('transitionend', this.transitionEndHandler_); }; MDCLineRippleFoundation.prototype.activate = function () { this.adapter_.removeClass(cssClasses$2.LINE_RIPPLE_DEACTIVATING); this.adapter_.addClass(cssClasses$2.LINE_RIPPLE_ACTIVE); }; MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) { this.adapter_.setStyle('transform-origin', xCoordinate + "px center"); }; MDCLineRippleFoundation.prototype.deactivate = function () { this.adapter_.addClass(cssClasses$2.LINE_RIPPLE_DEACTIVATING); }; MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) { // Wait for the line ripple to be either transparent or opaque // before emitting the animation end event var isDeactivating = this.adapter_.hasClass(cssClasses$2.LINE_RIPPLE_DEACTIVATING); if (evt.propertyName === 'opacity') { if (isDeactivating) { this.adapter_.removeClass(cssClasses$2.LINE_RIPPLE_ACTIVE); this.adapter_.removeClass(cssClasses$2.LINE_RIPPLE_DEACTIVATING); } } }; return MDCLineRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCLineRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCLineRipple, _super); function MDCLineRipple() { return _super !== null && _super.apply(this, arguments) || this; } MDCLineRipple.attachTo = function (root) { return new MDCLineRipple(root); }; /** * Activates the line ripple */ MDCLineRipple.prototype.activate = function () { this.foundation_.activate(); }; /** * Deactivates the line ripple */ MDCLineRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. */ MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) { this.foundation_.setRippleCenter(xCoordinate); }; MDCLineRipple.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, setStyle: function setStyle(propertyName, value) { return _this.root_.style.setProperty(propertyName, value); }, registerEventHandler: function registerEventHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterEventHandler: function deregisterEventHandler(evtType, handler) { return _this.unlisten(evtType, handler); } }; // tslint:enable:object-literal-sort-keys return new MDCLineRippleFoundation(adapter); }; return MDCLineRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$1 = { NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch' }; var numbers = { // This should stay in sync with $mdc-notched-outline-padding * 2. NOTCH_ELEMENT_PADDING: 8 }; var cssClasses$3 = { NO_LABEL: 'mdc-notched-outline--no-label', OUTLINE_NOTCHED: 'mdc-notched-outline--notched', OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded' }; /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCNotchedOutlineFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCNotchedOutlineFoundation, _super); function MDCNotchedOutlineFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCNotchedOutlineFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCNotchedOutlineFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", { get: function get() { return cssClasses$3; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", { /** * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, setNotchWidthProperty: function setNotchWidthProperty() { return undefined; }, removeNotchWidthProperty: function removeNotchWidthProperty() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); /** * Adds the outline notched selector and updates the notch width calculated based off of notchWidth. */ MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) { var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; if (notchWidth > 0) { notchWidth += numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right. } this.adapter_.setNotchWidthProperty(notchWidth); this.adapter_.addClass(OUTLINE_NOTCHED); }; /** * Removes notched outline selector to close the notch in the outline. */ MDCNotchedOutlineFoundation.prototype.closeNotch = function () { var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED; this.adapter_.removeClass(OUTLINE_NOTCHED); this.adapter_.removeNotchWidthProperty(); }; return MDCNotchedOutlineFoundation; }(MDCFoundation); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCNotchedOutline = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCNotchedOutline, _super); function MDCNotchedOutline() { return _super !== null && _super.apply(this, arguments) || this; } MDCNotchedOutline.attachTo = function (root) { return new MDCNotchedOutline(root); }; MDCNotchedOutline.prototype.initialSyncWithDOM = function () { this.notchElement_ = this.root_.querySelector(strings$1.NOTCH_ELEMENT_SELECTOR); var label = this.root_.querySelector('.' + MDCFloatingLabelFoundation.cssClasses.ROOT); if (label) { label.style.transitionDuration = '0s'; this.root_.classList.add(cssClasses$3.OUTLINE_UPGRADED); requestAnimationFrame(function () { label.style.transitionDuration = ''; }); } else { this.root_.classList.add(cssClasses$3.NO_LABEL); } }; /** * Updates classes and styles to open the notch to the specified width. * @param notchWidth The notch width in the outline. */ MDCNotchedOutline.prototype.notch = function (notchWidth) { this.foundation_.notch(notchWidth); }; /** * Updates classes and styles to close the notch. */ MDCNotchedOutline.prototype.closeNotch = function () { this.foundation_.closeNotch(); }; MDCNotchedOutline.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, setNotchWidthProperty: function setNotchWidthProperty(width) { return _this.notchElement_.style.setProperty('width', width + 'px'); }, removeNotchWidthProperty: function removeNotchWidthProperty() { return _this.notchElement_.style.removeProperty('width'); } }; // tslint:enable:object-literal-sort-keys return new MDCNotchedOutlineFoundation(adapter); }; return MDCNotchedOutline; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$4 = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings$2 = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers$1 = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses$4; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers$1.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$5 = { ROOT: 'mdc-text-field-character-counter' }; var strings$3 = { ROOT_SELECTOR: "." + cssClasses$5.ROOT }; /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTextFieldCharacterCounterFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCTextFieldCharacterCounterFoundation, _super); function MDCTextFieldCharacterCounterFoundation(adapter) { return _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter, adapter)) || this; } Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", { get: function get() { return cssClasses$5; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", { get: function get() { return strings$3; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", { /** * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types. */ get: function get() { return { setContent: function setContent() { return undefined; } }; }, enumerable: true, configurable: true }); MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) { currentLength = Math.min(currentLength, maxLength); this.adapter_.setContent(currentLength + " / " + maxLength); }; return MDCTextFieldCharacterCounterFoundation; }(MDCFoundation); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTextFieldCharacterCounter = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCTextFieldCharacterCounter, _super); function MDCTextFieldCharacterCounter() { return _super !== null && _super.apply(this, arguments) || this; } MDCTextFieldCharacterCounter.attachTo = function (root) { return new MDCTextFieldCharacterCounter(root); }; Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundation", { get: function get() { return this.foundation_; }, enumerable: true, configurable: true }); MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { setContent: function setContent(content) { _this.root_.textContent = content; } }; return new MDCTextFieldCharacterCounterFoundation(adapter); }; return MDCTextFieldCharacterCounter; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$4 = { ARIA_CONTROLS: 'aria-controls', ICON_SELECTOR: '.mdc-text-field__icon', INPUT_SELECTOR: '.mdc-text-field__input', LABEL_SELECTOR: '.mdc-floating-label', LINE_RIPPLE_SELECTOR: '.mdc-line-ripple', OUTLINE_SELECTOR: '.mdc-notched-outline' }; var cssClasses$6 = { DENSE: 'mdc-text-field--dense', DISABLED: 'mdc-text-field--disabled', FOCUSED: 'mdc-text-field--focused', HELPER_LINE: 'mdc-text-field-helper-line', INVALID: 'mdc-text-field--invalid', OUTLINED: 'mdc-text-field--outlined', ROOT: 'mdc-text-field', TEXTAREA: 'mdc-text-field--textarea', WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon' }; var numbers$2 = { DENSE_LABEL_SCALE: 0.923, LABEL_SCALE: 0.75 }; /** * Whitelist based off of https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation * under the "Validation-related attributes" section. */ var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength']; /** * Label should always float for these types as they show some UI even if value is empty. */ var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week']; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var POINTERDOWN_EVENTS = ['mousedown', 'touchstart']; var INTERACTION_EVENTS = ['click', 'keydown']; var MDCTextFieldFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCTextFieldFoundation, _super); /** * @param adapter * @param foundationMap Map from subcomponent names to their subfoundations. */ function MDCTextFieldFoundation(adapter, foundationMap) { if (foundationMap === void 0) { foundationMap = {}; } var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCTextFieldFoundation.defaultAdapter, adapter)) || this; _this.isFocused_ = false; _this.receivedUserInput_ = false; _this.isValid_ = true; _this.useNativeValidation_ = true; _this.helperText_ = foundationMap.helperText; _this.characterCounter_ = foundationMap.characterCounter; _this.leadingIcon_ = foundationMap.leadingIcon; _this.trailingIcon_ = foundationMap.trailingIcon; _this.inputFocusHandler_ = function () { return _this.activateFocus(); }; _this.inputBlurHandler_ = function () { return _this.deactivateFocus(); }; _this.inputInputHandler_ = function () { return _this.handleInput(); }; _this.setPointerXOffset_ = function (evt) { return _this.setTransformOrigin(evt); }; _this.textFieldInteractionHandler_ = function () { return _this.handleTextFieldInteraction(); }; // _this.validationAttributeChangeHandler_ = function (attributesList) { return _this.handleValidationAttributeChange(attributesList); }; return _this; } Object.defineProperty(MDCTextFieldFoundation, "cssClasses", { get: function get() { return cssClasses$6; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldFoundation, "strings", { get: function get() { return strings$4; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldFoundation, "numbers", { get: function get() { return numbers$2; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat_", { get: function get() { var type = this.getNativeInput_().type; return ALWAYS_FLOAT_TYPES.indexOf(type) >= 0; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", { get: function get() { return this.shouldAlwaysFloat_ || this.isFocused_ || Boolean(this.getValue()) || this.isBadInput_(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", { get: function get() { return !this.isFocused_ && !this.isValid() && Boolean(this.getValue()); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", { /** * See {@link MDCTextFieldAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return true; }, registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() { return undefined; }, deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() { return undefined; }, registerInputInteractionHandler: function registerInputInteractionHandler() { return undefined; }, deregisterInputInteractionHandler: function deregisterInputInteractionHandler() { return undefined; }, // registerValidationAttributeChangeHandler: function () { return new MutationObserver(function () { return undefined; }); }, // deregisterValidationAttributeChangeHandler: function () { return undefined; }, getNativeInput: function getNativeInput() { return null; }, isFocused: function isFocused() { return false; }, activateLineRipple: function activateLineRipple() { return undefined; }, deactivateLineRipple: function deactivateLineRipple() { return undefined; }, setLineRippleTransformOrigin: function setLineRippleTransformOrigin() { return undefined; }, shakeLabel: function shakeLabel() { return undefined; }, floatLabel: function floatLabel() { return undefined; }, hasLabel: function hasLabel() { return false; }, getLabelWidth: function getLabelWidth() { return 0; }, hasOutline: function hasOutline() { return false; }, notchOutline: function notchOutline() { return undefined; }, closeOutline: function closeOutline() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTextFieldFoundation.prototype.init = function () { var _this = this; if (this.adapter_.isFocused()) { this.inputFocusHandler_(); } else if (this.adapter_.hasLabel() && this.shouldFloat) { this.notchOutline(true); this.adapter_.floatLabel(true); } this.adapter_.registerInputInteractionHandler('focus', this.inputFocusHandler_); this.adapter_.registerInputInteractionHandler('blur', this.inputBlurHandler_); this.adapter_.registerInputInteractionHandler('input', this.inputInputHandler_); POINTERDOWN_EVENTS.forEach(function (evtType) { _this.adapter_.registerInputInteractionHandler(evtType, _this.setPointerXOffset_); }); INTERACTION_EVENTS.forEach(function (evtType) { _this.adapter_.registerTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_); }); // this.validationObserver_ = // this.adapter_.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_); this.setCharacterCounter_(this.getValue() ? this.getValue().length : 0); }; MDCTextFieldFoundation.prototype.destroy = function () { var _this = this; this.adapter_.deregisterInputInteractionHandler('focus', this.inputFocusHandler_); this.adapter_.deregisterInputInteractionHandler('blur', this.inputBlurHandler_); this.adapter_.deregisterInputInteractionHandler('input', this.inputInputHandler_); POINTERDOWN_EVENTS.forEach(function (evtType) { _this.adapter_.deregisterInputInteractionHandler(evtType, _this.setPointerXOffset_); }); INTERACTION_EVENTS.forEach(function (evtType) { _this.adapter_.deregisterTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_); }); }; /** * Handles user interactions with the Text Field. */ MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () { var nativeInput = this.adapter_.getNativeInput(); if (nativeInput && nativeInput.disabled) { return; } this.receivedUserInput_ = true; }; /** * Handles validation attribute changes */ MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) { var _this = this; attributesList.some(function (attributeName) { if (VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) { _this.styleValidity_(true); return true; } return false; }); if (attributesList.indexOf('maxlength') > -1) { this.setCharacterCounter_(this.getValue().length); } }; /** * Opens/closes the notched outline. */ MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) { if (!this.adapter_.hasOutline()) { return; } if (openNotch) { var isDense = this.adapter_.hasClass(cssClasses$6.DENSE); var labelScale = isDense ? numbers$2.DENSE_LABEL_SCALE : numbers$2.LABEL_SCALE; var labelWidth = this.adapter_.getLabelWidth() * labelScale; this.adapter_.notchOutline(labelWidth); } else { this.adapter_.closeOutline(); } }; /** * Activates the text field focus state. */ MDCTextFieldFoundation.prototype.activateFocus = function () { this.isFocused_ = true; this.styleFocused_(this.isFocused_); this.adapter_.activateLineRipple(); if (this.adapter_.hasLabel()) { this.notchOutline(this.shouldFloat); this.adapter_.floatLabel(this.shouldFloat); this.adapter_.shakeLabel(this.shouldShake); } if (this.helperText_) { this.helperText_.showToScreenReader(); } }; /** * Sets the line ripple's transform origin, so that the line ripple activate * animation will animate out from the user's click location. */ MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) { var touches = evt.touches; var targetEvent = touches ? touches[0] : evt; var targetClientRect = targetEvent.target.getBoundingClientRect(); var normalizedX = targetEvent.clientX - targetClientRect.left; this.adapter_.setLineRippleTransformOrigin(normalizedX); }; /** * Handles input change of text input and text area. */ MDCTextFieldFoundation.prototype.handleInput = function () { this.autoCompleteFocus(); this.setCharacterCounter_(this.getValue().length); }; /** * Activates the Text Field's focus state in cases when the input value * changes without user input (e.g. programmatically). */ MDCTextFieldFoundation.prototype.autoCompleteFocus = function () { if (!this.receivedUserInput_) { this.activateFocus(); } }; /** * Deactivates the Text Field's focus state. */ MDCTextFieldFoundation.prototype.deactivateFocus = function () { this.isFocused_ = false; this.adapter_.deactivateLineRipple(); var isValid = this.isValid(); this.styleValidity_(isValid); this.styleFocused_(this.isFocused_); if (this.adapter_.hasLabel()) { this.notchOutline(this.shouldFloat); this.adapter_.floatLabel(this.shouldFloat); this.adapter_.shakeLabel(this.shouldShake); } if (!this.shouldFloat) { this.receivedUserInput_ = false; } }; MDCTextFieldFoundation.prototype.getValue = function () { return this.getNativeInput_().value; }; /** * @param value The value to set on the input Element. */ MDCTextFieldFoundation.prototype.setValue = function (value) { // Prevent Safari from moving the caret to the end of the input when the value has not changed. if (this.getValue() !== value) { this.getNativeInput_().value = value; this.setCharacterCounter_(value.length); } var isValid = this.isValid(); this.styleValidity_(isValid); if (this.adapter_.hasLabel()) { this.notchOutline(this.shouldFloat); this.adapter_.floatLabel(this.shouldFloat); this.adapter_.shakeLabel(this.shouldShake); } }; /** * @return The custom validity state, if set; otherwise, the result of a native validity check. */ MDCTextFieldFoundation.prototype.isValid = function () { return this.useNativeValidation_ ? this.isNativeInputValid_() : this.isValid_; }; /** * @param isValid Sets the custom validity state of the Text Field. */ MDCTextFieldFoundation.prototype.setValid = function (isValid) { this.isValid_ = isValid; this.styleValidity_(isValid); var shouldShake = !isValid && !this.isFocused_; if (this.adapter_.hasLabel()) { this.adapter_.shakeLabel(shouldShake); } }; /** * Enables or disables the use of native validation. Use this for custom validation. * @param useNativeValidation Set this to false to ignore native input validation. */ MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) { this.useNativeValidation_ = useNativeValidation; }; MDCTextFieldFoundation.prototype.isDisabled = function () { return this.getNativeInput_().disabled; }; /** * @param disabled Sets the text-field disabled or enabled. */ MDCTextFieldFoundation.prototype.setDisabled = function (disabled) { this.getNativeInput_().disabled = disabled; this.styleDisabled_(disabled); }; /** * @param content Sets the content of the helper text. */ MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) { if (this.helperText_) { this.helperText_.setContent(content); } }; /** * Sets the aria label of the leading icon. */ MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) { if (this.leadingIcon_) { this.leadingIcon_.setAriaLabel(label); } }; /** * Sets the text content of the leading icon. */ MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) { if (this.leadingIcon_) { this.leadingIcon_.setContent(content); } }; /** * Sets the aria label of the trailing icon. */ MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) { if (this.trailingIcon_) { this.trailingIcon_.setAriaLabel(label); } }; /** * Sets the text content of the trailing icon. */ MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) { if (this.trailingIcon_) { this.trailingIcon_.setContent(content); } }; /** * Sets character counter values that shows characters used and the total character limit. */ MDCTextFieldFoundation.prototype.setCharacterCounter_ = function (currentLength) { if (!this.characterCounter_) { return; } var maxLength = this.getNativeInput_().maxLength; if (maxLength === -1) { throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.'); } this.characterCounter_.setCounterValue(currentLength, maxLength); }; /** * @return True if the Text Field input fails in converting the user-supplied value. */ MDCTextFieldFoundation.prototype.isBadInput_ = function () { // The badInput property is not supported in IE 11 💩. return this.getNativeInput_().validity.badInput || false; }; /** * @return The result of native validity checking (ValidityState.valid). */ MDCTextFieldFoundation.prototype.isNativeInputValid_ = function () { return this.getNativeInput_().validity.valid; }; /** * Styles the component based on the validity state. */ MDCTextFieldFoundation.prototype.styleValidity_ = function (isValid) { var INVALID = MDCTextFieldFoundation.cssClasses.INVALID; if (isValid) { this.adapter_.removeClass(INVALID); } else { this.adapter_.addClass(INVALID); } if (this.helperText_) { this.helperText_.setValidity(isValid); } }; /** * Styles the component based on the focused state. */ MDCTextFieldFoundation.prototype.styleFocused_ = function (isFocused) { var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED; if (isFocused) { this.adapter_.addClass(FOCUSED); } else { this.adapter_.removeClass(FOCUSED); } }; /** * Styles the component based on the disabled state. */ MDCTextFieldFoundation.prototype.styleDisabled_ = function (isDisabled) { var _a = MDCTextFieldFoundation.cssClasses, DISABLED = _a.DISABLED, INVALID = _a.INVALID; if (isDisabled) { this.adapter_.addClass(DISABLED); this.adapter_.removeClass(INVALID); } else { this.adapter_.removeClass(DISABLED); } if (this.leadingIcon_) { this.leadingIcon_.setDisabled(isDisabled); } if (this.trailingIcon_) { this.trailingIcon_.setDisabled(isDisabled); } }; /** * @return The native text input element from the host environment, or an object with the same shape for unit tests. */ MDCTextFieldFoundation.prototype.getNativeInput_ = function () { // this.adapter_ may be undefined in foundation unit tests. This happens when testdouble is creating a mock object // and invokes the shouldShake/shouldFloat getters (which in turn call getValue(), which calls this method) before // init() has been called from the MDCTextField constructor. To work around that issue, we return a dummy object. var nativeInput = this.adapter_ ? this.adapter_.getNativeInput() : null; return nativeInput || { disabled: false, maxLength: -1, type: 'input', validity: { badInput: false, valid: true }, value: '' }; }; return MDCTextFieldFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var strings$5 = { ICON_EVENT: 'MDCTextField:icon', ICON_ROLE: 'button' }; /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var INTERACTION_EVENTS$1 = ['click', 'keydown']; var MDCTextFieldIconFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCTextFieldIconFoundation, _super); function MDCTextFieldIconFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCTextFieldIconFoundation.defaultAdapter, adapter)) || this; _this.savedTabIndex_ = null; _this.interactionHandler_ = function (evt) { return _this.handleInteraction(evt); }; return _this; } Object.defineProperty(MDCTextFieldIconFoundation, "strings", { get: function get() { return strings$5; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", { /** * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { getAttr: function getAttr() { return null; }, setAttr: function setAttr() { return undefined; }, removeAttr: function removeAttr() { return undefined; }, setContent: function setContent() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, notifyIconAction: function notifyIconAction() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTextFieldIconFoundation.prototype.init = function () { var _this = this; this.savedTabIndex_ = this.adapter_.getAttr('tabindex'); INTERACTION_EVENTS$1.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.interactionHandler_); }); }; MDCTextFieldIconFoundation.prototype.destroy = function () { var _this = this; INTERACTION_EVENTS$1.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.interactionHandler_); }); }; MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) { if (!this.savedTabIndex_) { return; } if (disabled) { this.adapter_.setAttr('tabindex', '-1'); this.adapter_.removeAttr('role'); } else { this.adapter_.setAttr('tabindex', this.savedTabIndex_); this.adapter_.setAttr('role', strings$5.ICON_ROLE); } }; MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) { this.adapter_.setAttr('aria-label', label); }; MDCTextFieldIconFoundation.prototype.setContent = function (content) { this.adapter_.setContent(content); }; MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) { var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13; if (evt.type === 'click' || isEnterKey) { this.adapter_.notifyIconAction(); } }; return MDCTextFieldIconFoundation; }(MDCFoundation); /** * @license * Copyright 2017 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTextFieldIcon = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCTextFieldIcon, _super); function MDCTextFieldIcon() { return _super !== null && _super.apply(this, arguments) || this; } MDCTextFieldIcon.attachTo = function (root) { return new MDCTextFieldIcon(root); }; Object.defineProperty(MDCTextFieldIcon.prototype, "foundation", { get: function get() { return this.foundation_; }, enumerable: true, configurable: true }); MDCTextFieldIcon.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { getAttr: function getAttr(attr) { return _this.root_.getAttribute(attr); }, setAttr: function setAttr(attr, value) { return _this.root_.setAttribute(attr, value); }, removeAttr: function removeAttr(attr) { return _this.root_.removeAttribute(attr); }, setContent: function setContent(content) { _this.root_.textContent = content; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.unlisten(evtType, handler); }, notifyIconAction: function notifyIconAction() { return _this.emit(MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */ , true /* shouldBubble */ ); } }; // tslint:enable:object-literal-sort-keys return new MDCTextFieldIconFoundation(adapter); }; return MDCTextFieldIcon; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTextField = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MDCTextField, _super); function MDCTextField() { return _super !== null && _super.apply(this, arguments) || this; } MDCTextField.attachTo = function (root) { return new MDCTextField(root); }; MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) { if (rippleFactory === void 0) { rippleFactory = function rippleFactory(el, foundation) { return new MDCRipple(el, foundation); }; } if (lineRippleFactory === void 0) { lineRippleFactory = function lineRippleFactory(el) { return new MDCLineRipple(el); }; } if (helperTextFactory === void 0) { helperTextFactory = function helperTextFactory(el) { return new MDCTextFieldHelperText(el); }; } if (characterCounterFactory === void 0) { characterCounterFactory = function characterCounterFactory(el) { return new MDCTextFieldCharacterCounter(el); }; } if (iconFactory === void 0) { iconFactory = function iconFactory(el) { return new MDCTextFieldIcon(el); }; } if (labelFactory === void 0) { labelFactory = function labelFactory(el) { return new MDCFloatingLabel(el); }; } if (outlineFactory === void 0) { outlineFactory = function outlineFactory(el) { return new MDCNotchedOutline(el); }; } this.input_ = this.root_.querySelector(strings$4.INPUT_SELECTOR); var labelElement = this.root_.querySelector(strings$4.LABEL_SELECTOR); this.label_ = labelElement ? labelFactory(labelElement) : null; var lineRippleElement = this.root_.querySelector(strings$4.LINE_RIPPLE_SELECTOR); this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null; var outlineElement = this.root_.querySelector(strings$4.OUTLINE_SELECTOR); this.outline_ = outlineElement ? outlineFactory(outlineElement) : null; // Helper text var helperTextStrings = MDCTextFieldHelperTextFoundation.strings; var nextElementSibling = this.root_.nextElementSibling; var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(cssClasses$6.HELPER_LINE); var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR); this.helperText_ = helperTextEl ? helperTextFactory(helperTextEl) : null; // Character counter var characterCounterStrings = MDCTextFieldCharacterCounterFoundation.strings; var characterCounterEl = this.root_.querySelector(characterCounterStrings.ROOT_SELECTOR); // If character counter is not found in root element search in sibling element. if (!characterCounterEl && hasHelperLine && nextElementSibling) { characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR); } this.characterCounter_ = characterCounterEl ? characterCounterFactory(characterCounterEl) : null; this.leadingIcon_ = null; this.trailingIcon_ = null; var iconElements = this.root_.querySelectorAll(strings$4.ICON_SELECTOR); if (iconElements.length > 0) { if (iconElements.length > 1) { // Has both icons. this.leadingIcon_ = iconFactory(iconElements[0]); this.trailingIcon_ = iconFactory(iconElements[1]); } else { if (this.root_.classList.contains(cssClasses$6.WITH_LEADING_ICON)) { this.leadingIcon_ = iconFactory(iconElements[0]); } else { this.trailingIcon_ = iconFactory(iconElements[0]); } } } this.ripple = this.createRipple_(rippleFactory); }; MDCTextField.prototype.destroy = function () { if (this.ripple) { this.ripple.destroy(); } if (this.lineRipple_) { this.lineRipple_.destroy(); } if (this.helperText_) { this.helperText_.destroy(); } if (this.characterCounter_) { this.characterCounter_.destroy(); } if (this.leadingIcon_) { this.leadingIcon_.destroy(); } if (this.trailingIcon_) { this.trailingIcon_.destroy(); } if (this.label_) { this.label_.destroy(); } if (this.outline_) { this.outline_.destroy(); } _super.prototype.destroy.call(this); }; /** * Initializes the Text Field's internal state based on the environment's * state. */ MDCTextField.prototype.initialSyncWithDOM = function () { this.disabled = this.input_.disabled; }; Object.defineProperty(MDCTextField.prototype, "value", { get: function get() { return this.foundation_.getValue(); }, /** * @param value The value to set on the input. */ set: function set(value) { this.foundation_.setValue(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "disabled", { get: function get() { return this.foundation_.isDisabled(); }, /** * @param disabled Sets the Text Field disabled or enabled. */ set: function set(disabled) { this.foundation_.setDisabled(disabled); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "valid", { get: function get() { return this.foundation_.isValid(); }, /** * @param valid Sets the Text Field valid or invalid. */ set: function set(valid) { this.foundation_.setValid(valid); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "required", { get: function get() { return this.input_.required; }, /** * @param required Sets the Text Field to required. */ set: function set(required) { this.input_.required = required; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "pattern", { get: function get() { return this.input_.pattern; }, /** * @param pattern Sets the input element's validation pattern. */ set: function set(pattern) { this.input_.pattern = pattern; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "minLength", { get: function get() { return this.input_.minLength; }, /** * @param minLength Sets the input element's minLength. */ set: function set(minLength) { this.input_.minLength = minLength; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "maxLength", { get: function get() { return this.input_.maxLength; }, /** * @param maxLength Sets the input element's maxLength. */ set: function set(maxLength) { // Chrome throws exception if maxLength is set to a value less than zero if (maxLength < 0) { this.input_.removeAttribute('maxLength'); } else { this.input_.maxLength = maxLength; } }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "min", { get: function get() { return this.input_.min; }, /** * @param min Sets the input element's min. */ set: function set(min) { this.input_.min = min; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "max", { get: function get() { return this.input_.max; }, /** * @param max Sets the input element's max. */ set: function set(max) { this.input_.max = max; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "step", { get: function get() { return this.input_.step; }, /** * @param step Sets the input element's step. */ set: function set(step) { this.input_.step = step; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "helperTextContent", { /** * Sets the helper text element content. */ set: function set(content) { this.foundation_.setHelperTextContent(content); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", { /** * Sets the aria label of the leading icon. */ set: function set(label) { this.foundation_.setLeadingIconAriaLabel(label); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "leadingIconContent", { /** * Sets the text content of the leading icon. */ set: function set(content) { this.foundation_.setLeadingIconContent(content); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", { /** * Sets the aria label of the trailing icon. */ set: function set(label) { this.foundation_.setTrailingIconAriaLabel(label); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "trailingIconContent", { /** * Sets the text content of the trailing icon. */ set: function set(content) { this.foundation_.setTrailingIconContent(content); }, enumerable: true, configurable: true }); Object.defineProperty(MDCTextField.prototype, "useNativeValidation", { /** * Enables or disables the use of native validation. Use this for custom validation. * @param useNativeValidation Set this to false to ignore native input validation. */ set: function set(useNativeValidation) { this.foundation_.setUseNativeValidation(useNativeValidation); }, enumerable: true, configurable: true }); /** * Focuses the input element. */ MDCTextField.prototype.focus = function () { this.input_.focus(); }; /** * Recomputes the outline SVG path for the outline element. */ MDCTextField.prototype.layout = function () { var openNotch = this.foundation_.shouldFloat; this.foundation_.notchOutline(openNotch); }; MDCTextField.prototype.getDefaultFoundation = function () { // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, this.getRootAdapterMethods_(), this.getInputAdapterMethods_(), this.getLabelAdapterMethods_(), this.getLineRippleAdapterMethods_(), this.getOutlineAdapterMethods_()); // tslint:enable:object-literal-sort-keys return new MDCTextFieldFoundation(adapter, this.getFoundationMap_()); }; MDCTextField.prototype.getRootAdapterMethods_ = function () { var _this = this; // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) { return _this.unlisten(evtType, handler); }, registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) { var getAttributesList = function getAttributesList(mutationsList) { return mutationsList.map(function (mutation) { return mutation.attributeName; }).filter(function (attributeName) { return attributeName; }); }; var observer = new MutationObserver(function (mutationsList) { return handler(getAttributesList(mutationsList)); }); var config = { attributes: true }; observer.observe(_this.input_, config); return observer; }, deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) { return observer.disconnect(); } }; // tslint:enable:object-literal-sort-keys }; MDCTextField.prototype.getInputAdapterMethods_ = function () { var _this = this; // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { getNativeInput: function getNativeInput() { return _this.input_; }, isFocused: function isFocused() { return document.activeElement === _this.input_; }, registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) { return _this.input_.addEventListener(evtType, handler); }, deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) { return _this.input_.removeEventListener(evtType, handler); } }; // tslint:enable:object-literal-sort-keys }; MDCTextField.prototype.getLabelAdapterMethods_ = function () { var _this = this; return { floatLabel: function floatLabel(shouldFloat) { return _this.label_ && _this.label_.float(shouldFloat); }, getLabelWidth: function getLabelWidth() { return _this.label_ ? _this.label_.getWidth() : 0; }, hasLabel: function hasLabel() { return Boolean(_this.label_); }, shakeLabel: function shakeLabel(shouldShake) { return _this.label_ && _this.label_.shake(shouldShake); } }; }; MDCTextField.prototype.getLineRippleAdapterMethods_ = function () { var _this = this; return { activateLineRipple: function activateLineRipple() { if (_this.lineRipple_) { _this.lineRipple_.activate(); } }, deactivateLineRipple: function deactivateLineRipple() { if (_this.lineRipple_) { _this.lineRipple_.deactivate(); } }, setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) { if (_this.lineRipple_) { _this.lineRipple_.setRippleCenter(normalizedX); } } }; }; MDCTextField.prototype.getOutlineAdapterMethods_ = function () { var _this = this; return { closeOutline: function closeOutline() { return _this.outline_ && _this.outline_.closeNotch(); }, hasOutline: function hasOutline() { return Boolean(_this.outline_); }, notchOutline: function notchOutline(labelWidth) { return _this.outline_ && _this.outline_.notch(labelWidth); } }; }; /** * @return A map of all subcomponents to subfoundations. */ MDCTextField.prototype.getFoundationMap_ = function () { return { characterCounter: this.characterCounter_ ? this.characterCounter_.foundation : undefined, helperText: this.helperText_ ? this.helperText_.foundation : undefined, leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundation : undefined, trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundation : undefined }; }; MDCTextField.prototype.createRipple_ = function (rippleFactory) { var _this = this; var isTextArea = this.root_.classList.contains(cssClasses$6.TEXTAREA); var isOutlined = this.root_.classList.contains(cssClasses$6.OUTLINED); if (isTextArea || isOutlined) { return null; } // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__assign"])({}, MDCRipple.createAdapter(this), { isSurfaceActive: function isSurfaceActive() { return matches(_this.input_, ':active'); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.input_.addEventListener(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.input_.removeEventListener(evtType, handler); } }); // tslint:enable:object-literal-sort-keys return rippleFactory(this.root_, new MDCRippleFoundation(adapter)); }; return MDCTextField; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Injection token that can be used to configure the default options for all * mdc-text-field usage within an app. * @type {?} */ var MDC_TEXT_FIELD_DEFAULT_OPTIONS = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('MDC_TEXT_FIELD_DEFAULT_OPTIONS'); var MdcTextFieldBase = /** @class */ (function () { function MdcTextFieldBase(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) { this._defaultErrorStateMatcher = _defaultErrorStateMatcher; this._parentForm = _parentForm; this._parentFormGroup = _parentFormGroup; this.ngControl = ngControl; } return MdcTextFieldBase; }()); /** @type {?} */ var _MdcTextFieldMixinBase = Object(_angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["mixinErrorState"])(MdcTextFieldBase); /** @type {?} */ var nextUniqueId = 0; /** * Time in milliseconds for which to ignore mouse events, after * receiving a touch event. Used to avoid doing double work for * touch devices where the browser fires fake mouse events, in * addition to touch events. * @type {?} */ var MOUSE_EVENT_IGNORE_TIME = 800; var MdcTextField = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MdcTextField, _super); function MdcTextField(_platform, _changeDetectorRef, elementRef, _defaultErrorStateMatcher, _parentFormField, _ripple, ngControl, _parentForm, _parentFormGroup, _defaults) { var _this = _super.call(this, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this; _this._platform = _platform; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; _this._defaultErrorStateMatcher = _defaultErrorStateMatcher; _this._parentFormField = _parentFormField; _this._ripple = _ripple; _this.ngControl = ngControl; _this._defaults = _defaults; _this._uid = "mdc-input-" + nextUniqueId++; _this._initialized = false; /** * Time in milliseconds when the last touchstart event happened. */ _this._lastTouchStartEvent = 0; _this.controlType = 'mdc-text-field'; _this.label = null; _this.placeholder = null; _this.tabIndex = 0; _this._id = ''; _this._type = 'text'; _this._outlined = false; _this._disabled = false; _this._required = false; _this._readonly = false; _this._fullwidth = false; _this._dense = false; _this._helperText = null; _this._useNativeValidation = true; _this._characterCounter = false; _this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); _this.input = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); _this.blur = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * View to model callback called when value changes */ _this._onChange = (/** * @return {?} */ function () { }); /** * View to model callback called when text field has been touched */ _this._onTouched = (/** * @return {?} */ function () { }); _this._foundation = new MDCTextFieldFoundation(_this._createAdapter()); if (_this.ngControl) { // Note: we provide the value accessor through here, instead of // the `providers` to avoid running into a circular import. _this.ngControl.valueAccessor = _this; } if (_this._parentFormField) { _parentFormField.elementRef.nativeElement.classList.add('ngx-form-field-text-field'); } // Force setter to be called in case id was not specified. _this.id = _this.id; return _this; } Object.defineProperty(MdcTextField.prototype, "id", { get: /** * @return {?} */ function () { return this._id; }, set: /** * @param {?} value * @return {?} */ function (value) { this._id = value || this._uid; }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "type", { /** Input type of the element. */ get: /** * Input type of the element. * @return {?} */ function () { return this._type; }, set: /** * @param {?} value * @return {?} */ function (value) { this._type = value || 'text'; }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "outlined", { get: /** * @return {?} */ function () { return this._outlined; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); if (newValue !== this._outlined) { this._outlined = newValue || (this._defaults && this._defaults.outlined) || false; this.layout(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "disabled", { get: /** * @return {?} */ function () { return this._disabled; }, set: /** * @param {?} value * @return {?} */ function (value) { this.setDisabledState(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "required", { get: /** * @return {?} */ function () { return this._required; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); if (newValue !== this._required) { this._required = newValue; if (this._initialized) { if (!this.valid) { this._foundation.setValid(true); this._changeDetectorRef.markForCheck(); } if (this.ngControl) { this._required ? this._getInputElement().setAttribute('required', '') : this._getInputElement().removeAttribute('required'); } } } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "readonly", { get: /** * @return {?} */ function () { return this._readonly; }, set: /** * @param {?} value * @return {?} */ function (value) { this._readonly = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "fullwidth", { get: /** * @return {?} */ function () { return this._fullwidth; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); if (newValue !== this._fullwidth) { this._fullwidth = newValue; this.placeholder = this.fullwidth ? this.label : ''; } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "dense", { get: /** * @return {?} */ function () { return this._dense; }, set: /** * @param {?} value * @return {?} */ function (value) { this._dense = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "helperText", { get: /** * @return {?} */ function () { return this._helperText; }, set: /** * @param {?} helperText * @return {?} */ function (helperText) { this._helperText = helperText; if (this._helperText) { this._initHelperText(); this._helperText.characterCounter = this._characterCounter; } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "valid", { /** Sets the Text Field valid or invalid. */ get: /** * Sets the Text Field valid or invalid. * @return {?} */ function () { return this._valid; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); if (newValue !== this._valid) { this._valid = value; this._foundation.setValid(newValue); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "useNativeValidation", { /** Enables or disables the use of native validation. Use this for custom validation. */ get: /** * Enables or disables the use of native validation. Use this for custom validation. * @return {?} */ function () { return this._useNativeValidation; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); if (newValue !== this._useNativeValidation) { this._useNativeValidation = newValue; this._foundation.setUseNativeValidation(this._useNativeValidation); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "characterCounter", { get: /** * @return {?} */ function () { return this._characterCounter; }, set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(value); if (newValue !== this._characterCounter) { this._characterCounter = newValue; if (this.helperText) { this.helperText.characterCounter = this._characterCounter; } } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "value", { get: /** * @return {?} */ function () { return this._value; }, set: /** * @param {?} newValue * @return {?} */ function (newValue) { if (!this._initialized) { this.ngControl ? this._initializeValue() : this._initializeValue(newValue); } else { this.setValue(newValue, true); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "textarea", { get: /** * @return {?} */ function () { return this._getHostElement().nodeName.toLowerCase() === 'mdc-textarea'; }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "focused", { get: /** * @return {?} */ function () { return this._platform.isBrowser ? (/** @type {?} */ (document.activeElement)) === this._getInputElement() : false; }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "leadingIcon", { get: /** * @return {?} */ function () { return this._icons ? this._icons.find((/** * @param {?} icon * @return {?} */ function (icon) { return icon.leading; })) : undefined; }, enumerable: true, configurable: true }); Object.defineProperty(MdcTextField.prototype, "trailingIcon", { get: /** * @return {?} */ function () { return this._icons ? this._icons.find((/** * @param {?} icon * @return {?} */ function (icon) { return icon.trailing; })) : undefined; }, enumerable: true, configurable: true }); /** * @private * @return {?} */ MdcTextField.prototype._createAdapter = /** * @private * @return {?} */ function () { var _this = this; return Object.assign({ addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), isFocused: (/** * @return {?} */ function () { return _this._platform.isBrowser ? (/** @type {?} */ (document.activeElement)) === _this._getInputElement() : false; }) }, this._getInputAdapterMethods(), this._getLabelAdapterMethods(), this._getLineRippleAdapterMethods(), this._getOutlineAdapterMethods()); }; /** * @private * @return {?} */ MdcTextField.prototype._getInputAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { getNativeInput: (/** * @return {?} */ function () { return { maxLength: _this.maxlength, type: _this._type, value: _this._platform.isBrowser ? _this._input.nativeElement.value : _this._value, disabled: _this._disabled, validity: { valid: _this._isValid(), badInput: _this._platform.isBrowser ? _this._input.nativeElement.validity.badInput : false } }; }) }; }; /** * @private * @return {?} */ MdcTextField.prototype._getLabelAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { shakeLabel: (/** * @param {?} shouldShake * @return {?} */ function (shouldShake) { return _this._getFloatingLabel().shake(shouldShake); }), floatLabel: (/** * @param {?} shouldFloat * @return {?} */ function (shouldFloat) { return _this._getFloatingLabel().float(shouldFloat); }), hasLabel: (/** * @return {?} */ function () { return _this._hasFloatingLabel(); }), getLabelWidth: (/** * @return {?} */ function () { return _this._hasFloatingLabel() ? _this._getFloatingLabel().getWidth() : 0; }) }; }; /** * @private * @return {?} */ MdcTextField.prototype._getLineRippleAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { activateLineRipple: (/** * @return {?} */ function () { if (_this._lineRipple) { _this._lineRipple.activate(); } }), deactivateLineRipple: (/** * @return {?} */ function () { if (_this._lineRipple) { _this._lineRipple.deactivate(); } }), setLineRippleTransformOrigin: (/** * @param {?} normalizedX * @return {?} */ function (normalizedX) { if (_this._lineRipple) { _this._lineRipple.setRippleCenter(normalizedX); } }) }; }; /** * @private * @return {?} */ MdcTextField.prototype._getOutlineAdapterMethods = /** * @private * @return {?} */ function () { var _this = this; return { hasOutline: (/** * @return {?} */ function () { return !!_this._notchedOutline; }), notchOutline: (/** * @param {?} labelWidth * @return {?} */ function (labelWidth) { return (/** @type {?} */ (_this._notchedOutline)).notch(labelWidth); }), closeOutline: (/** * @return {?} */ function () { return (/** @type {?} */ (_this._notchedOutline)).closeNotch(); }) }; }; /** Returns a map of all subcomponents to subfoundations.*/ /** * Returns a map of all subcomponents to subfoundations. * @private * @return {?} */ MdcTextField.prototype._getFoundationMap = /** * Returns a map of all subcomponents to subfoundations. * @private * @return {?} */ function () { return { helperText: this._helperText ? this._helperText.foundation : undefined, characterCounter: this.characterCounterFoundation() }; }; /** * @return {?} */ MdcTextField.prototype.ngAfterContentInit = /** * @return {?} */ function () { this._setDefaultOptions(); this.init(); }; /** * @return {?} */ MdcTextField.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroy(); }; /** * @return {?} */ MdcTextField.prototype.ngDoCheck = /** * @return {?} */ function () { if (this.ngControl) { // We need to re-evaluate this on every change detection cycle, because there are some // error triggers that we can't subscribe to (e.g. parent form submissions). This means // that whatever logic is in here has to be super lean or we risk destroying the performance. this.updateErrorState(); } }; /** * @return {?} */ MdcTextField.prototype.init = /** * @return {?} */ function () { var _this = this; setTimeout((/** * @return {?} */ function () { _this._foundation = new MDCTextFieldFoundation(_this._createAdapter(), _this._getFoundationMap()); _this._foundation.init(); })); this._initRipple(); this._checkCustomValidity(); this._initialized = true; }; /** * @return {?} */ MdcTextField.prototype.onTextFieldInteraction = /** * @return {?} */ function () { if (this._initialized) { this._foundation.handleTextFieldInteraction(); } }; /** * @param {?} evt * @return {?} */ MdcTextField.prototype.onInputInteraction = /** * @param {?} evt * @return {?} */ function (evt) { if (evt instanceof MouseEvent) { /** @type {?} */ var isSyntheticEvent = this._lastTouchStartEvent && Date.now() < this._lastTouchStartEvent + MOUSE_EVENT_IGNORE_TIME; if (isSyntheticEvent) { return; } } else { this._lastTouchStartEvent = Date.now(); } this._foundation.setTransformOrigin(evt); }; /** * @param {?} evt * @return {?} */ MdcTextField.prototype.onInput = /** * @param {?} evt * @return {?} */ function (evt) { /** @type {?} */ var value = ((/** @type {?} */ (evt.target))).value; this.setValue(value, true); this._foundation.handleInput(); this.input.emit(value); evt.stopPropagation(); }; /** * @return {?} */ MdcTextField.prototype.onFocus = /** * @return {?} */ function () { if (this._initialized) { this._foundation.activateFocus(); } }; /** * @param {?} evt * @return {?} */ MdcTextField.prototype.onChange = /** * @param {?} evt * @return {?} */ function (evt) { /** @type {?} */ var value = ((/** @type {?} */ (evt.target))).value; this.setValue(value, true); this.change.emit(value); evt.stopPropagation(); }; /** * @return {?} */ MdcTextField.prototype.onBlur = /** * @return {?} */ function () { this._onTouched(); this._foundation.deactivateFocus(); this.blur.emit(this.value); }; /** * @param {?} value * @return {?} */ MdcTextField.prototype.writeValue = /** * @param {?} value * @return {?} */ function (value) { this.setValue(value); }; /** * @param {?} fn * @return {?} */ MdcTextField.prototype.registerOnChange = /** * @param {?} fn * @return {?} */ function (fn) { this._onChange = fn; }; /** * @param {?} fn * @return {?} */ MdcTextField.prototype.registerOnTouched = /** * @param {?} fn * @return {?} */ function (fn) { this._onTouched = fn; }; /** * @private * @param {?=} value * @return {?} */ MdcTextField.prototype._initializeValue = /** * @private * @param {?=} value * @return {?} */ function (value) { var _this = this; // Defer setting the value in order to avoid the "Expression // has changed after it was checked" errors from Angular. Promise.resolve().then((/** * @return {?} */ function () { _this.setValue(_this.ngControl ? _this.ngControl.value : value); })); }; /** * @param {?} value * @param {?=} isUserInput * @return {?} */ MdcTextField.prototype.setValue = /** * @param {?} value * @param {?=} isUserInput * @return {?} */ function (value, isUserInput) { /** @type {?} */ var newValue = this.type === 'number' ? Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toNumber"])(value, null) : value; if (this._value === newValue) { // Reset validity for numeric form inputs if (newValue === null) { this.valid = true; } return; } this._value = newValue !== undefined ? newValue : null; if (this._getInputElement().value !== this._value) { this._getInputElement().value = this._value; } this._foundation.setValue(this._value || ''); if (isUserInput) { this._onChange(this._value); } this._changeDetectorRef.markForCheck(); }; /** * @return {?} */ MdcTextField.prototype.isBadInput = /** * @return {?} */ function () { /** @type {?} */ var validity = this._getInputElement().validity; return validity && validity.badInput; }; /** * @return {?} */ MdcTextField.prototype.focus = /** * @return {?} */ function () { if (!this.disabled) { this._getInputElement().focus(); } }; /** Initializes Text Field's internal state based on the environment state */ /** * Initializes Text Field's internal state based on the environment state * @private * @return {?} */ MdcTextField.prototype.layout = /** * Initializes Text Field's internal state based on the environment state * @private * @return {?} */ function () { var _this = this; this._destroy(); this.init(); this._changeDetectorRef.markForCheck(); setTimeout((/** * @return {?} */ function () { if (_this._outlined) { _this._foundation.notchOutline(_this._foundation.shouldFloat); } if (_this._hasFloatingLabel()) { _this._getFloatingLabel().float(_this._foundation.shouldFloat); } })); }; /** Implemented as part of ControlValueAccessor. */ /** * Implemented as part of ControlValueAccessor. * @param {?} isDisabled * @return {?} */ MdcTextField.prototype.setDisabledState = /** * Implemented as part of ControlValueAccessor. * @param {?} isDisabled * @return {?} */ function (isDisabled) { /** @type {?} */ var newValue = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["toBoolean"])(isDisabled); if (newValue !== this._disabled) { this._disabled = newValue; this._foundation.setDisabled(this._disabled); } this._changeDetectorRef.markForCheck(); }; /** Set the default options here. */ /** * Set the default options here. * @private * @return {?} */ MdcTextField.prototype._setDefaultOptions = /** * Set the default options here. * @private * @return {?} */ function () { if (this._defaults && this._defaults.outlined) { this._outlined = this._defaults.outlined; } }; /** * @private * @return {?} */ MdcTextField.prototype._checkCustomValidity = /** * @private * @return {?} */ function () { var _this = this; Promise.resolve().then((/** * @return {?} */ function () { if (_this._valid !== undefined) { _this._foundation.setValid(_this._valid); } })); }; /** * @private * @return {?} */ MdcTextField.prototype._initHelperText = /** * @private * @return {?} */ function () { /** @type {?} */ var helper = this.helperText; if (helper) { helper.addHelperTextClass(this.controlType); helper.init(MDCTextFieldHelperTextFoundation); } }; /** * @private * @return {?} */ MdcTextField.prototype._initRipple = /** * @private * @return {?} */ function () { if (!this._ripple || this._ripple.initialized) { return; } if (!this.fullwidth && !this.outlined && !this.textarea) { this._ripple.init({ surface: this.elementRef.nativeElement, activator: this._getInputElement() }); } else { this._ripple.destroy(); } }; /** * @private * @return {?} */ MdcTextField.prototype._destroy = /** * @private * @return {?} */ function () { if (this._lineRipple) { this._lineRipple.destroy(); } if (this._ripple) { this._ripple.destroy(); } this._foundation.destroy(); }; /** * @private * @return {?} */ MdcTextField.prototype._isValid = /** * @private * @return {?} */ function () { if (this.ngControl) { return !this.errorState; } return this._valid ? this._valid : this._platform.isBrowser ? this._input.nativeElement.validity.valid : true; }; /** * @private * @return {?} */ MdcTextField.prototype._hasFloatingLabel = /** * @private * @return {?} */ function () { return this.label && (this._floatingLabel || this._notchedOutline) ? true : false; }; /** * @private * @return {?} */ MdcTextField.prototype._getFloatingLabel = /** * @private * @return {?} */ function () { return this._floatingLabel || (/** @type {?} */ (this._notchedOutline)).floatingLabel; }; /** * @protected * @return {?} */ MdcTextField.prototype.characterCounterFoundation = /** * @protected * @return {?} */ function () { return this.helperText && this.characterCounter ? (/** @type {?} */ (this.helperText._characterCounterElement)).getDefaultFoundation() : undefined; }; /** * @private * @return {?} */ MdcTextField.prototype._getInputElement = /** * @private * @return {?} */ function () { return this._input.nativeElement; }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcTextField.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcTextField.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-text-field', exportAs: 'mdcTextField', host: { 'class': 'mdc-text-field', '[class.mdc-text-field--disabled]': 'disabled', '[class.mdc-text-field--outlined]': 'outlined', '[class.mdc-text-field--dense]': 'dense', '[class.mdc-text-field--fullwidth]': 'fullwidth', '[class.mdc-text-field--with-leading-icon]': 'leadingIcon', '[class.mdc-text-field--with-trailing-icon]': 'trailingIcon', '[class.mdc-text-field--no-label]': '!label || label && fullwidth', '[class.mdc-text-field--invalid]': 'errorState', '(click)': 'onTextFieldInteraction()', '(keydown)': 'onTextFieldInteraction()' }, template: "\n \n \n \n \n \n ", providers: [ _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_9__["MdcRipple"], { provide: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcFormFieldControl"], useExisting: MdcTextField } ], encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None, changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcTextField.ctorParameters = function () { return [ { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_8__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["ErrorStateMatcher"] }, { type: _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcFormField"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_9__["MdcRipple"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_7__["NgControl"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_7__["NgForm"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: _angular_forms__WEBPACK_IMPORTED_MODULE_7__["FormGroupDirective"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [MDC_TEXT_FIELD_DEFAULT_OPTIONS,] }] } ]; }; MdcTextField.propDecorators = { label: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], maxlength: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], minlength: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], pattern: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], autocomplete: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], max: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], min: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], size: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], step: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], placeholder: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], tabIndex: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], id: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], type: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], outlined: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], disabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], required: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], readonly: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fullwidth: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], dense: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], helperText: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], valid: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], useNativeValidation: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], characterCounter: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], errorStateMatcher: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], change: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], input: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], blur: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], _input: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: ['inputElement',] }], _lineRipple: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_3__["MdcLineRipple"],] }], _notchedOutline: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_4__["MdcNotchedOutline"],] }], _floatingLabel: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_2__["MdcFloatingLabel"],] }], _icons: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [MdcTextFieldIcon, { descendants: true },] }] }; return MdcTextField; }(_MdcTextFieldMixinBase)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTextarea = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_6__["__extends"])(MdcTextarea, _super); function MdcTextarea() { return _super !== null && _super.apply(this, arguments) || this; } /** * @protected * @return {?} */ MdcTextarea.prototype.characterCounterFoundation = /** * @protected * @return {?} */ function () { return this.characterCounter ? this._characterCounterElement.getDefaultFoundation() : undefined; }; MdcTextarea.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-textarea', exportAs: 'mdcTextarea', host: { 'class': 'mdc-text-field', '[class.mdc-text-field--textarea]': 'true', '[class.mdc-text-field--no-label]': '!label', '[class.mdc-text-field--dense]': 'dense', '[class.mdc-text-field--fullwidth]': 'fullwidth', '[class.mdc-text-field--invalid]': 'errorState' }, template: "\n
\n \n ", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; MdcTextarea.propDecorators = { rows: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], cols: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], _characterCounterElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"], args: [_angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcCharacterCounter"],] }] }; return MdcTextarea; }(MdcTextField)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TEXTFIELD_DECLARATIONS = [ MdcTextarea, MdcTextField, MdcTextFieldIcon ]; var MdcTextFieldModule = /** @class */ (function () { function MdcTextFieldModule() { } MdcTextFieldModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [ _angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"], _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcFormFieldModule"], _angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_3__["MdcLineRippleModule"], _angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_2__["MdcFloatingLabelModule"], _angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_4__["MdcNotchedOutlineModule"] ], exports: [ _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_5__["MdcFormFieldModule"], TEXTFIELD_DECLARATIONS ], declarations: TEXTFIELD_DECLARATIONS },] }, ]; return MdcTextFieldModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=textfield.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/top-app-bar.es5.js": /*!***************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/top-app-bar.es5.js ***! \***************************************************************/ /*! exports provided: MdcTopAppBar, MdcTopAppBarActionItem, MdcTopAppBarFixedAdjust, MdcTopAppBarModule, MdcTopAppBarNavSelected, MdcTopAppBarNavigationIcon, MdcTopAppBarRow, MdcTopAppBarSection, MdcTopAppBarTitle */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBar", function() { return MdcTopAppBar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarActionItem", function() { return MdcTopAppBarActionItem; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarFixedAdjust", function() { return MdcTopAppBarFixedAdjust; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarModule", function() { return MdcTopAppBarModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarNavSelected", function() { return MdcTopAppBarNavSelected; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarNavigationIcon", function() { return MdcTopAppBarNavigationIcon; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarRow", function() { return MdcTopAppBarRow; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarSection", function() { return MdcTopAppBarSection; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarTitle", function() { return MdcTopAppBarTitle; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTopAppBarFixedAdjust = /** @class */ (function () { function MdcTopAppBarFixedAdjust(elementRef) { this.elementRef = elementRef; } MdcTopAppBarFixedAdjust.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcTopAppBarFixedAdjust]', host: { 'class': 'mdc-top-app-bar--fixed-adjust' } },] }, ]; /** @nocollapse */ MdcTopAppBarFixedAdjust.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcTopAppBarFixedAdjust; }()); var MdcTopAppBarRow = /** @class */ (function () { function MdcTopAppBarRow(elementRef) { this.elementRef = elementRef; } MdcTopAppBarRow.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-top-app-bar-row, [mdcTopAppBarRow]', exportAs: 'mdcTopAppBarRow', host: { 'class': 'mdc-top-app-bar__row' } },] }, ]; /** @nocollapse */ MdcTopAppBarRow.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcTopAppBarRow; }()); var MdcTopAppBarSection = /** @class */ (function () { function MdcTopAppBarSection(elementRef) { this.elementRef = elementRef; } MdcTopAppBarSection.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{selector: 'mdc-top-app-bar-section, [mdcTopAppBarSection]', exportAs: 'mdcTopAppBarSection', host: { 'role': 'toolbar', 'class': 'mdc-top-app-bar__section', '[class.mdc-top-app-bar__section--align-start]': 'align === "start"', '[class.mdc-top-app-bar__section--align-end]': 'align === "end"' }, template: "\n \n {{title}}", changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush },] }, ]; /** @nocollapse */ MdcTopAppBarSection.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcTopAppBarSection.propDecorators = { title: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], align: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; return MdcTopAppBarSection; }()); var MdcTopAppBarActionItem = /** @class */ (function () { function MdcTopAppBarActionItem(elementRef, _ripple) { this.elementRef = elementRef; this._ripple = _ripple; this._ripple.init({ surface: this.elementRef.nativeElement, unbounded: true }); } /** * @return {?} */ MdcTopAppBarActionItem.prototype.ngOnDestroy = /** * @return {?} */ function () { this._ripple.destroy(); }; MdcTopAppBarActionItem.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcTopAppBarActionItem], mdc-top-app-bar-action-item', exportAs: 'mdcTopAppBarActionItem', host: { 'role': 'button', 'class': 'mdc-top-app-bar__action-item' }, providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_7__["MdcRipple"]] },] }, ]; /** @nocollapse */ MdcTopAppBarActionItem.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_7__["MdcRipple"] } ]; }; return MdcTopAppBarActionItem; }()); var MdcTopAppBarNavigationIcon = /** @class */ (function () { function MdcTopAppBarNavigationIcon(elementRef, _ripple) { this.elementRef = elementRef; this._ripple = _ripple; _ripple.init({ surface: this.elementRef.nativeElement, unbounded: true }); } /** * @return {?} */ MdcTopAppBarNavigationIcon.prototype.ngOnDestroy = /** * @return {?} */ function () { this._ripple.destroy(); }; MdcTopAppBarNavigationIcon.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcTopAppBarNavIcon], mdc-icon[mdcTopAppBarNavigationIcon]', exportAs: 'mdcTopAppBarNavigationIcon', host: { 'role': 'button', 'class': 'mdc-top-app-bar__navigation-icon' }, providers: [_angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_7__["MdcRipple"]] },] }, ]; /** @nocollapse */ MdcTopAppBarNavigationIcon.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_7__["MdcRipple"] } ]; }; return MdcTopAppBarNavigationIcon; }()); var MdcTopAppBarTitle = /** @class */ (function () { function MdcTopAppBarTitle(elementRef) { this.elementRef = elementRef; } MdcTopAppBarTitle.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'mdc-top-app-bar-title, [mdcTopAppBarTitle]', exportAs: 'mdcTopAppBarTitle', host: { 'class': 'mdc-top-app-bar__title' }, },] }, ]; /** @nocollapse */ MdcTopAppBarTitle.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; return MdcTopAppBarTitle; }()); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses = { FIXED_CLASS: 'mdc-top-app-bar--fixed', FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled', SHORT_CLASS: 'mdc-top-app-bar--short', SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed', SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item' }; var numbers = { DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100, MAX_TOP_APP_BAR_HEIGHT: 128 }; var strings = { ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item', NAVIGATION_EVENT: 'MDCTopAppBar:nav', NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon', ROOT_SELECTOR: '.mdc-top-app-bar', TITLE_SELECTOR: '.mdc-top-app-bar__title' }; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFoundation = /** @class */ function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter_ = adapter; } Object.defineProperty(MDCFoundation, "cssClasses", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports every // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { get: function get() { // Classes extending MDCFoundation should implement this method to return an object which exports all // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { get: function get() { // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter // validation. return {}; }, enumerable: true, configurable: true }); MDCFoundation.prototype.init = function () {// Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCComponent = /** @class */ function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root_ = root; this.initialize.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(args)); // Note that we initialize foundation here and not within the constructor's default param so that // this.root_ is defined and can be used within the foundation class. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation_.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () {// Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation_.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler) { this.root_.addEventListener(evtType, handler); }; MDCComponent.prototype.unlisten = function (evtType, handler) { this.root_.removeEventListener(evtType, handler); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root_.dispatchEvent(evt); }; return MDCComponent; }(); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var cssClasses$1 = { // Ripple is a special case where the "root" component is really a "mixin" of sorts, // given that it's an 'upgrade' to an existing component. That being said it is the root // CSS class that all other CSS classes derive from. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', ROOT: 'mdc-ripple-upgraded', UNBOUNDED: 'mdc-ripple-upgraded--unbounded' }; var strings$1 = { VAR_FG_SCALE: '--mdc-ripple-fg-scale', VAR_FG_SIZE: '--mdc-ripple-fg-size', VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', VAR_LEFT: '--mdc-ripple-left', VAR_TOP: '--mdc-ripple-top' }; var numbers$1 = { DEACTIVATION_TIMEOUT_MS: 225, FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, TAP_DELAY_MS: 300 }; /** * Stores result from supportsCssVariables to avoid redundant processing to * detect CSS custom variable support. */ var supportsCssVariables_; /** * Stores result from applyPassive to avoid redundant processing to detect * passive event listener support. */ var supportsPassive_; function detectEdgePseudoVarBug(windowObj) { // Detect versions of Edge with buggy var() support // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/ var document = windowObj.document; var node = document.createElement('div'); node.className = 'mdc-ripple-surface--test-edge-var-bug'; document.body.appendChild(node); // The bug exists if ::before style ends up propagating to the parent element. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox, // but Firefox is known to support CSS custom properties correctly. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = windowObj.getComputedStyle(node); var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid'; node.remove(); return hasPseudoVarBug; } function supportsCssVariables(windowObj, forceRefresh) { if (forceRefresh === void 0) { forceRefresh = false; } var CSS = windowObj.CSS; var supportsCssVars = supportsCssVariables_; if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { return supportsCssVariables_; } var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; if (!supportsFunctionPresent) { return false; } var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); // See: https://bugs.webkit.org/show_bug.cgi?id=154669 // See: README section on Safari var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) { supportsCssVars = !detectEdgePseudoVarBug(windowObj); } else { supportsCssVars = false; } if (!forceRefresh) { supportsCssVariables_ = supportsCssVars; } return supportsCssVars; } /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj, forceRefresh) { if (globalObj === void 0) { globalObj = window; } if (forceRefresh === void 0) { forceRefresh = false; } if (supportsPassive_ === undefined || forceRefresh) { var isSupported_1 = false; try { globalObj.document.addEventListener('test', function () { return undefined; }, { get passive() { isSupported_1 = true; return isSupported_1; } }); } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log. supportsPassive_ = isSupported_1; } return supportsPassive_ ? { passive: true } : false; } function getNormalizedEventCoords(evt, pageOffset, clientRect) { if (!evt) { return { x: 0, y: 0 }; } var x = pageOffset.x, y = pageOffset.y; var documentX = x + clientRect.left; var documentY = y + clientRect.top; var normalizedX; var normalizedY; // Determine touch point relative to the ripple container. if (evt.type === 'touchstart') { var touchEvent = evt; normalizedX = touchEvent.changedTouches[0].pageX - documentX; normalizedY = touchEvent.changedTouches[0].pageY - documentY; } else { var mouseEvent = evt; normalizedX = mouseEvent.pageX - documentX; normalizedY = mouseEvent.pageY - documentY; } return { x: normalizedX, y: normalizedY }; } /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; // Deactivation events registered on documentElement when a pointer-related down event occurs var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; // simultaneous nested activations var activatedTargets = []; var MDCRippleFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCRippleFoundation.defaultAdapter, adapter)) || this; _this.activationAnimationHasEnded_ = false; _this.activationTimer_ = 0; _this.fgDeactivationRemovalTimer_ = 0; _this.fgScale_ = '0'; _this.frame_ = { width: 0, height: 0 }; _this.initialSize_ = 0; _this.layoutFrame_ = 0; _this.maxRadius_ = 0; _this.unboundedCoords_ = { left: 0, top: 0 }; _this.activationState_ = _this.defaultActivationState_(); _this.activationTimerCallback_ = function () { _this.activationAnimationHasEnded_ = true; _this.runDeactivationUXLogicIfReady_(); }; _this.activateHandler_ = function (e) { return _this.activate_(e); }; _this.deactivateHandler_ = function () { return _this.deactivate_(); }; _this.focusHandler_ = function () { return _this.handleFocus(); }; _this.blurHandler_ = function () { return _this.handleBlur(); }; _this.resizeHandler_ = function () { return _this.layout(); }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function get() { return cssClasses$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function get() { return strings$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function get() { return numbers$1; }, enumerable: true, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, browserSupportsCssVars: function browserSupportsCssVars() { return true; }, computeBoundingRect: function computeBoundingRect() { return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; }, containsEventTarget: function containsEventTarget() { return true; }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getWindowPageOffset: function getWindowPageOffset() { return { x: 0, y: 0 }; }, isSurfaceActive: function isSurfaceActive() { return true; }, isSurfaceDisabled: function isSurfaceDisabled() { return true; }, isUnbounded: function isUnbounded() { return true; }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, removeClass: function removeClass() { return undefined; }, updateCssVariable: function updateCssVariable() { return undefined; } }; }, enumerable: true, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; var supportsPressRipple = this.supportsPressRipple_(); this.registerRootHandlers_(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.addClass(ROOT_1); if (_this.adapter_.isUnbounded()) { _this.adapter_.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple _this.layoutInternal_(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; if (this.supportsPressRipple_()) { if (this.activationTimer_) { clearTimeout(this.activationTimer_); this.activationTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } if (this.fgDeactivationRemovalTimer_) { clearTimeout(this.fgDeactivationRemovalTimer_); this.fgDeactivationRemovalTimer_ = 0; this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter_.removeClass(ROOT_2); _this.adapter_.removeClass(UNBOUNDED_2); _this.removeCssVars_(); }); } this.deregisterRootHandlers_(); this.deregisterDeactivationHandlers_(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { this.activate_(evt); }; MDCRippleFoundation.prototype.deactivate = function () { this.deactivate_(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; if (unbounded) { this.adapter_.addClass(UNBOUNDED); } else { this.adapter_.removeClass(UNBOUNDED); } }; MDCRippleFoundation.prototype.handleFocus = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; MDCRippleFoundation.prototype.handleBlur = function () { var _this = this; requestAnimationFrame(function () { return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); }); }; /** * We compute this property so that we are not querying information about the client * until the point in time where the foundation requests it. This prevents scenarios where * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ MDCRippleFoundation.prototype.supportsPressRipple_ = function () { return this.adapter_.browserSupportsCssVars(); }; MDCRippleFoundation.prototype.defaultActivationState_ = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, isActivated: false, isProgrammatic: false, wasActivatedByPointer: false, wasElementMadeActive: false }; }; /** * supportsPressRipple Passed from init to save a redundant function call */ MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { var _this = this; if (supportsPressRipple) { ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_); }); if (this.adapter_.isUnbounded()) { this.adapter_.registerResizeHandler(this.resizeHandler_); } } this.adapter_.registerInteractionHandler('focus', this.focusHandler_); this.adapter_.registerInteractionHandler('blur', this.blurHandler_); }; MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { var _this = this; if (evt.type === 'keydown') { this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_); } else { POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); } }; MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { var _this = this; ACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_); }); this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); if (this.adapter_.isUnbounded()) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { var _this = this; this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_); POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); }); }; MDCRippleFoundation.prototype.removeCssVars_ = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); keys.forEach(function (key) { if (key.indexOf('VAR_') === 0) { _this.adapter_.updateCssVariable(rippleStrings[key], null); } }); }; MDCRippleFoundation.prototype.activate_ = function (evt) { var _this = this; if (this.adapter_.isSurfaceDisabled()) { return; } var activationState = this.activationState_; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction var previousActivationEvent = this.previousActivationEvent_; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; } activationState.isActivated = true; activationState.isProgrammatic = evt === undefined; activationState.activationEvent = evt; activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { return _this.adapter_.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events this.resetActivationState_(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); this.registerDeactivationHandlers_(evt); } activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { this.animateActivation_(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples activatedTargets = []; if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { // If space was pressed, try again within an rAF call to detect :active, because different UAs report // active states inconsistently when they're called within event handling code: // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); if (activationState.wasElementMadeActive) { _this.animateActivation_(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. _this.activationState_ = _this.defaultActivationState_(); } }); }; MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true; }; MDCRippleFoundation.prototype.animateActivation_ = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; this.layoutInternal_(); var translateStart = ''; var translateEnd = ''; if (!this.adapter_.isUnbounded()) { var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations clearTimeout(this.activationTimer_); clearTimeout(this.fgDeactivationRemovalTimer_); this.rmBoundedActivationClasses_(); this.adapter_.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter_.computeBoundingRect(); this.adapter_.addClass(FG_ACTIVATION); this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); }; MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()); } else { startPoint = { x: this.frame_.width / 2, y: this.frame_.height / 2 }; } // Center the element around the start point. startPoint = { x: startPoint.x - this.initialSize_ / 2, y: startPoint.y - this.initialSize_ / 2 }; var endPoint = { x: this.frame_.width / 2 - this.initialSize_ / 2, y: this.frame_.height / 2 - this.initialSize_ / 2 }; return { startPoint: startPoint, endPoint: endPoint }; }; MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; if (activationHasEnded && this.activationAnimationHasEnded_) { this.rmBoundedActivationClasses_(); this.adapter_.addClass(FG_DEACTIVATION); this.fgDeactivationRemovalTimer_ = setTimeout(function () { _this.adapter_.removeClass(FG_DEACTIVATION); }, numbers$1.FG_DEACTIVATION_MS); } }; MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter_.removeClass(FG_ACTIVATION); this.activationAnimationHasEnded_ = false; this.adapter_.computeBoundingRect(); }; MDCRippleFoundation.prototype.resetActivationState_ = function () { var _this = this; this.previousActivationEvent_ = this.activationState_.activationEvent; this.activationState_ = this.defaultActivationState_(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; MDCRippleFoundation.prototype.deactivate_ = function () { var _this = this; var activationState = this.activationState_; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, activationState); if (activationState.isProgrammatic) { requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); this.resetActivationState_(); } else { this.deregisterDeactivationHandlers_(); requestAnimationFrame(function () { _this.activationState_.hasDeactivationUXRun = true; _this.animateDeactivation_(state); _this.resetActivationState_(); }); } }; MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { this.runDeactivationUXLogicIfReady_(); } }; MDCRippleFoundation.prototype.layoutInternal_ = function () { var _this = this; this.frame_ = this.adapter_.computeBoundingRect(); var maxDim = Math.max(this.frame_.height, this.frame_.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function getBoundedRadius() { var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; this.updateLayoutCssVars_(); }; MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_); if (this.adapter_.isUnbounded()) { this.unboundedCoords_ = { left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) }; this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); } }; return MDCRippleFoundation; }(MDCFoundation); /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCRipple = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root_.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root_.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root_.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root_.removeEventListener(evtType, handler, applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return matches(instance.root_, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root_.addEventListener(evtType, handler, applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root_.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root_.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.unbounded_); }, set: function set(unbounded) { this.unbounded_ = Boolean(unbounded); this.setUnbounded_(); }, enumerable: true, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation_.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation_.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation_.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root_; this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded_ = function () { this.foundation_.setUnbounded(Boolean(this.unbounded_)); }; return MDCRipple; }(MDCComponent); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTopAppBarBaseFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCTopAppBarBaseFoundation, _super); /* istanbul ignore next: optional argument is not a branch statement */ function MDCTopAppBarBaseFoundation(adapter) { var _this = _super.call(this, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, MDCTopAppBarBaseFoundation.defaultAdapter, adapter)) || this; _this.navClickHandler_ = function () { return _this.adapter_.notifyNavigationIconClicked(); }; return _this; } Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", { get: function get() { return strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", { get: function get() { return cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", { get: function get() { return numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", { /** * See {@link MDCTopAppBarAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setStyle: function setStyle() { return undefined; }, getTopAppBarHeight: function getTopAppBarHeight() { return 0; }, registerNavigationIconInteractionHandler: function registerNavigationIconInteractionHandler() { return undefined; }, deregisterNavigationIconInteractionHandler: function deregisterNavigationIconInteractionHandler() { return undefined; }, notifyNavigationIconClicked: function notifyNavigationIconClicked() { return undefined; }, registerScrollHandler: function registerScrollHandler() { return undefined; }, deregisterScrollHandler: function deregisterScrollHandler() { return undefined; }, registerResizeHandler: function registerResizeHandler() { return undefined; }, deregisterResizeHandler: function deregisterResizeHandler() { return undefined; }, getViewportScrollY: function getViewportScrollY() { return 0; }, getTotalActionItems: function getTotalActionItems() { return 0; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCTopAppBarBaseFoundation.prototype.init = function () { this.initScrollHandler(); this.initResizeHandler_(); this.adapter_.registerNavigationIconInteractionHandler('click', this.navClickHandler_); }; MDCTopAppBarBaseFoundation.prototype.destroy = function () { this.destroyScrollHandler(); this.destroyResizeHandler_(); this.adapter_.deregisterNavigationIconInteractionHandler('click', this.navClickHandler_); }; MDCTopAppBarBaseFoundation.prototype.initScrollHandler = function () { if (this.scrollHandler_) { this.adapter_.registerScrollHandler(this.scrollHandler_); } }; MDCTopAppBarBaseFoundation.prototype.destroyScrollHandler = function () { if (this.scrollHandler_) { this.adapter_.deregisterScrollHandler(this.scrollHandler_); } }; MDCTopAppBarBaseFoundation.prototype.initResizeHandler_ = function () { if (this.resizeHandler_) { this.adapter_.registerResizeHandler(this.resizeHandler_); } }; MDCTopAppBarBaseFoundation.prototype.destroyResizeHandler_ = function () { if (this.resizeHandler_) { this.adapter_.deregisterResizeHandler(this.resizeHandler_); } }; return MDCTopAppBarBaseFoundation; }(MDCFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var INITIAL_VALUE = 0; var MDCTopAppBarFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCTopAppBarFoundation, _super); /* istanbul ignore next: optional argument is not a branch statement */ function MDCTopAppBarFoundation(adapter) { var _this = _super.call(this, adapter) || this; /** * Indicates if the top app bar was docked in the previous scroll handler iteration. */ _this.wasDocked_ = true; /** * Indicates if the top app bar is docked in the fully shown position. */ _this.isDockedShowing_ = true; /** * Variable for current scroll position of the top app bar */ _this.currentAppBarOffsetTop_ = 0; /** * Used to prevent the top app bar from being scrolled out of view during resize events */ _this.isCurrentlyBeingResized_ = false; /** * The timeout that's used to throttle the resize events */ _this.resizeThrottleId_ = INITIAL_VALUE; /** * The timeout that's used to debounce toggling the isCurrentlyBeingResized_ variable after a resize */ _this.resizeDebounceId_ = INITIAL_VALUE; _this.lastScrollPosition_ = _this.adapter_.getViewportScrollY(); _this.topAppBarHeight_ = _this.adapter_.getTopAppBarHeight(); _this.scrollHandler_ = function () { return _this.topAppBarScrollHandler_(); }; _this.resizeHandler_ = function () { return _this.topAppBarResizeHandler_(); }; return _this; } MDCTopAppBarFoundation.prototype.destroy = function () { _super.prototype.destroy.call(this); this.adapter_.setStyle('top', ''); }; /** * Function to determine if the DOM needs to update. */ MDCTopAppBarFoundation.prototype.checkForUpdate_ = function () { var offscreenBoundaryTop = -this.topAppBarHeight_; var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop_ < 0; var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop_ > offscreenBoundaryTop; var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen; // If it's partially showing, it can't be docked. if (partiallyShowing) { this.wasDocked_ = false; } else { // Not previously docked and not partially showing, it's now docked. if (!this.wasDocked_) { this.wasDocked_ = true; return true; } else if (this.isDockedShowing_ !== hasAnyPixelsOnscreen) { this.isDockedShowing_ = hasAnyPixelsOnscreen; return true; } } return partiallyShowing; }; /** * Function to move the top app bar if needed. */ MDCTopAppBarFoundation.prototype.moveTopAppBar_ = function () { if (this.checkForUpdate_()) { // Once the top app bar is fully hidden we use the max potential top app bar height as our offset // so the top app bar doesn't show if the window resizes and the new height > the old height. var offset = this.currentAppBarOffsetTop_; if (Math.abs(offset) >= this.topAppBarHeight_) { offset = -numbers.MAX_TOP_APP_BAR_HEIGHT; } this.adapter_.setStyle('top', offset + 'px'); } }; /** * Scroll handler for the default scroll behavior of the top app bar. */ MDCTopAppBarFoundation.prototype.topAppBarScrollHandler_ = function () { var currentScrollPosition = Math.max(this.adapter_.getViewportScrollY(), 0); var diff = currentScrollPosition - this.lastScrollPosition_; this.lastScrollPosition_ = currentScrollPosition; // If the window is being resized the lastScrollPosition_ needs to be updated but the // current scroll of the top app bar should stay in the same position. if (!this.isCurrentlyBeingResized_) { this.currentAppBarOffsetTop_ -= diff; if (this.currentAppBarOffsetTop_ > 0) { this.currentAppBarOffsetTop_ = 0; } else if (Math.abs(this.currentAppBarOffsetTop_) > this.topAppBarHeight_) { this.currentAppBarOffsetTop_ = -this.topAppBarHeight_; } this.moveTopAppBar_(); } }; /** * Top app bar resize handler that throttle/debounce functions that execute updates. */ MDCTopAppBarFoundation.prototype.topAppBarResizeHandler_ = function () { var _this = this; // Throttle resize events 10 p/s if (!this.resizeThrottleId_) { this.resizeThrottleId_ = setTimeout(function () { _this.resizeThrottleId_ = INITIAL_VALUE; _this.throttledResizeHandler_(); }, numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS); } this.isCurrentlyBeingResized_ = true; if (this.resizeDebounceId_) { clearTimeout(this.resizeDebounceId_); } this.resizeDebounceId_ = setTimeout(function () { _this.topAppBarScrollHandler_(); _this.isCurrentlyBeingResized_ = false; _this.resizeDebounceId_ = INITIAL_VALUE; }, numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS); }; /** * Throttled function that updates the top app bar scrolled values if the * top app bar height changes. */ MDCTopAppBarFoundation.prototype.throttledResizeHandler_ = function () { var currentHeight = this.adapter_.getTopAppBarHeight(); if (this.topAppBarHeight_ !== currentHeight) { this.wasDocked_ = false; // Since the top app bar has a different height depending on the screen width, this // will ensure that the top app bar remains in the correct location if // completely hidden and a resize makes the top app bar a different height. this.currentAppBarOffsetTop_ -= this.topAppBarHeight_ - currentHeight; this.topAppBarHeight_ = currentHeight; } this.topAppBarScrollHandler_(); }; return MDCTopAppBarFoundation; }(MDCTopAppBarBaseFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCFixedTopAppBarFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCFixedTopAppBarFoundation, _super); /* istanbul ignore next: optional argument is not a branch statement */ function MDCFixedTopAppBarFoundation(adapter) { var _this = _super.call(this, adapter) || this; /** * State variable for the previous scroll iteration top app bar state */ _this.wasScrolled_ = false; _this.scrollHandler_ = function () { return _this.fixedScrollHandler_(); }; return _this; } /** * Scroll handler for applying/removing the modifier class on the fixed top app bar. */ MDCFixedTopAppBarFoundation.prototype.fixedScrollHandler_ = function () { var currentScroll = this.adapter_.getViewportScrollY(); if (currentScroll <= 0) { if (this.wasScrolled_) { this.adapter_.removeClass(cssClasses.FIXED_SCROLLED_CLASS); this.wasScrolled_ = false; } } else { if (!this.wasScrolled_) { this.adapter_.addClass(cssClasses.FIXED_SCROLLED_CLASS); this.wasScrolled_ = true; } } }; return MDCFixedTopAppBarFoundation; }(MDCTopAppBarFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCShortTopAppBarFoundation = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCShortTopAppBarFoundation, _super); /* istanbul ignore next: optional argument is not a branch statement */ function MDCShortTopAppBarFoundation(adapter) { var _this = _super.call(this, adapter) || this; _this.isCollapsed_ = false; return _this; } Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", { // Public visibility for backward compatibility. get: function get() { return this.isCollapsed_; }, enumerable: true, configurable: true }); MDCShortTopAppBarFoundation.prototype.init = function () { var _this = this; _super.prototype.init.call(this); if (this.adapter_.getTotalActionItems() > 0) { this.adapter_.addClass(cssClasses.SHORT_HAS_ACTION_ITEM_CLASS); } if (!this.adapter_.hasClass(cssClasses.SHORT_COLLAPSED_CLASS)) { this.scrollHandler_ = function () { return _this.shortAppBarScrollHandler_(); }; this.adapter_.registerScrollHandler(this.scrollHandler_); this.shortAppBarScrollHandler_(); } }; MDCShortTopAppBarFoundation.prototype.destroy = function () { _super.prototype.destroy.call(this); }; /** * Scroll handler for applying/removing the collapsed modifier class on the short top app bar. */ MDCShortTopAppBarFoundation.prototype.shortAppBarScrollHandler_ = function () { var currentScroll = this.adapter_.getViewportScrollY(); if (currentScroll <= 0) { if (this.isCollapsed_) { this.adapter_.removeClass(cssClasses.SHORT_COLLAPSED_CLASS); this.isCollapsed_ = false; } } else { if (!this.isCollapsed_) { this.adapter_.addClass(cssClasses.SHORT_COLLAPSED_CLASS); this.isCollapsed_ = true; } } }; return MDCShortTopAppBarFoundation; }(MDCTopAppBarBaseFoundation); /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var MDCTopAppBar = /** @class */ function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MDCTopAppBar, _super); function MDCTopAppBar() { return _super !== null && _super.apply(this, arguments) || this; } MDCTopAppBar.attachTo = function (root) { return new MDCTopAppBar(root); }; MDCTopAppBar.prototype.initialize = function (rippleFactory) { if (rippleFactory === void 0) { rippleFactory = function rippleFactory(el) { return MDCRipple.attachTo(el); }; } this.navIcon_ = this.root_.querySelector(strings.NAVIGATION_ICON_SELECTOR); // Get all icons in the toolbar and instantiate the ripples var icons = [].slice.call(this.root_.querySelectorAll(strings.ACTION_ITEM_SELECTOR)); if (this.navIcon_) { icons.push(this.navIcon_); } this.iconRipples_ = icons.map(function (icon) { var ripple = rippleFactory(icon); ripple.unbounded = true; return ripple; }); this.scrollTarget_ = window; }; MDCTopAppBar.prototype.destroy = function () { this.iconRipples_.forEach(function (iconRipple) { return iconRipple.destroy(); }); _super.prototype.destroy.call(this); }; MDCTopAppBar.prototype.setScrollTarget = function (target) { // Remove scroll handler from the previous scroll target this.foundation_.destroyScrollHandler(); this.scrollTarget_ = target; // Initialize scroll handler on the new scroll target this.foundation_.initScrollHandler(); }; MDCTopAppBar.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { hasClass: function hasClass(className) { return _this.root_.classList.contains(className); }, addClass: function addClass(className) { return _this.root_.classList.add(className); }, removeClass: function removeClass(className) { return _this.root_.classList.remove(className); }, setStyle: function setStyle(property, value) { return _this.root_.style.setProperty(property, value); }, getTopAppBarHeight: function getTopAppBarHeight() { return _this.root_.clientHeight; }, registerNavigationIconInteractionHandler: function registerNavigationIconInteractionHandler(evtType, handler) { if (_this.navIcon_) { _this.navIcon_.addEventListener(evtType, handler); } }, deregisterNavigationIconInteractionHandler: function deregisterNavigationIconInteractionHandler(evtType, handler) { if (_this.navIcon_) { _this.navIcon_.removeEventListener(evtType, handler); } }, notifyNavigationIconClicked: function notifyNavigationIconClicked() { return _this.emit(strings.NAVIGATION_EVENT, {}); }, registerScrollHandler: function registerScrollHandler(handler) { return _this.scrollTarget_.addEventListener('scroll', handler); }, deregisterScrollHandler: function deregisterScrollHandler(handler) { return _this.scrollTarget_.removeEventListener('scroll', handler); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getViewportScrollY: function getViewportScrollY() { var win = _this.scrollTarget_; var el = _this.scrollTarget_; return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop; }, getTotalActionItems: function getTotalActionItems() { return _this.root_.querySelectorAll(strings.ACTION_ITEM_SELECTOR).length; } }; // tslint:enable:object-literal-sort-keys var foundation; if (this.root_.classList.contains(cssClasses.SHORT_CLASS)) { foundation = new MDCShortTopAppBarFoundation(adapter); } else if (this.root_.classList.contains(cssClasses.FIXED_CLASS)) { foundation = new MDCFixedTopAppBarFoundation(adapter); } else { foundation = new MDCTopAppBarFoundation(adapter); } return foundation; }; return MDCTopAppBar; }(MDCComponent); /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Event object emitted by MdcTopAppBar navigation icon selected. */ var /** * Event object emitted by MdcTopAppBar navigation icon selected. */ MdcTopAppBarNavSelected = /** @class */ (function () { function MdcTopAppBarNavSelected(source) { this.source = source; } return MdcTopAppBarNavSelected; }()); var MdcTopAppBar = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(MdcTopAppBar, _super); function MdcTopAppBar(_ngZone, _platform, _changeDetectorRef, elementRef) { var _this = _super.call(this, elementRef) || this; _this._ngZone = _ngZone; _this._platform = _platform; _this._changeDetectorRef = _changeDetectorRef; _this.elementRef = elementRef; /** * Emits whenever the component is destroyed. */ _this._destroyed = new rxjs__WEBPACK_IMPORTED_MODULE_3__["Subject"](); _this._fixed = false; _this._prominent = false; _this._short = false; _this._shortCollapsed = false; _this._dense = false; _this._fixedAdjustElement = null; _this._scrollTarget = _this._platform.isBrowser ? _this._scrollTarget || window : undefined; /** * Event emitted when the navigation icon is selected. */ _this.navigationSelected = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); _this._scrollTargetSubscription = null; return _this; } Object.defineProperty(MdcTopAppBar.prototype, "fixed", { get: /** * @return {?} */ function () { return this._fixed; }, set: /** * @param {?} value * @return {?} */ function (value) { if (value !== this._fixed) { this.setFixed(value); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTopAppBar.prototype, "prominent", { get: /** * @return {?} */ function () { return this._prominent; }, set: /** * @param {?} value * @return {?} */ function (value) { if (value !== this._prominent) { this.setProminent(value); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTopAppBar.prototype, "short", { get: /** * @return {?} */ function () { return this._short; }, set: /** * @param {?} value * @return {?} */ function (value) { if (value !== this._short) { this.setShort(value); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTopAppBar.prototype, "shortCollapsed", { get: /** * @return {?} */ function () { return this._shortCollapsed; }, set: /** * @param {?} value * @return {?} */ function (value) { if (value !== this._shortCollapsed) { this.setShortCollapsed(value); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTopAppBar.prototype, "dense", { get: /** * @return {?} */ function () { return this._dense; }, set: /** * @param {?} value * @return {?} */ function (value) { if (value !== this._dense) { this.setDense(value); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTopAppBar.prototype, "fixedAdjustElement", { get: /** * @return {?} */ function () { return this._fixedAdjustElement; }, set: /** * @param {?} element * @return {?} */ function (element) { if (this._fixedAdjustElement !== element) { this._fixedAdjustElement = element; this._initTopAppBar(); } }, enumerable: true, configurable: true }); Object.defineProperty(MdcTopAppBar.prototype, "scrollTarget", { get: /** * @return {?} */ function () { return this._scrollTarget; }, set: /** * @param {?} target * @return {?} */ function (target) { if (target !== this._scrollTarget) { this._scrollTarget = target ? target : this._platform.isBrowser ? window : undefined; this._initScrollHandler(); } }, enumerable: true, configurable: true }); /** * @return {?} */ MdcTopAppBar.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { if (className === cssClasses.SHORT_COLLAPSED_CLASS && _this.shortCollapsed) { return; } _this._getHostElement().classList.remove(className); }), setStyle: (/** * @param {?} property * @param {?} value * @return {?} */ function (property, value) { return _this._getHostElement().style.setProperty(property, value); }), getTopAppBarHeight: (/** * @return {?} */ function () { return _this._getHostElement().clientHeight; }), registerNavigationIconInteractionHandler: (/** * @return {?} */ function () { }), deregisterNavigationIconInteractionHandler: (/** * @return {?} */ function () { }), notifyNavigationIconClicked: (/** * @return {?} */ function () { return _this.navigationSelected.emit({ source: _this }); }), registerScrollHandler: (/** * @return {?} */ function () { }), deregisterScrollHandler: (/** * @return {?} */ function () { }), registerResizeHandler: (/** * @param {?} handler * @return {?} */ function (handler) { if (!_this._platform.isBrowser) { return; } window.addEventListener('resize', handler); }), deregisterResizeHandler: (/** * @param {?} handler * @return {?} */ function (handler) { if (!_this._platform.isBrowser) { return; } window.removeEventListener('resize', handler); }), getViewportScrollY: (/** * @return {?} */ function () { if (!_this._platform.isBrowser) { return 0; } return _this._scrollTarget[_this._scrollTarget === window ? 'pageYOffset' : 'scrollTop']; }), getTotalActionItems: (/** * @return {?} */ function () { return _this.actions ? _this.actions.length : 0; }) }; /** @type {?} */ var foundation; if (!this.elementRef) { return new MDCTopAppBarBaseFoundation(adapter); } if (this.short) { foundation = new MDCShortTopAppBarFoundation(adapter); } else if (this.fixed) { foundation = new MDCFixedTopAppBarFoundation(adapter); } else { foundation = new MDCTopAppBarFoundation(adapter); } return foundation; }; /** * @return {?} */ MdcTopAppBar.prototype.ngAfterContentInit = /** * @return {?} */ function () { var _this = this; this.actions.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["startWith"])(null), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(this._destroyed)) .subscribe((/** * @return {?} */ function () { if (_this.short && _this.actions.length) { _this._getHostElement().classList.toggle(cssClasses.SHORT_HAS_ACTION_ITEM_CLASS); } })); }; /** * @return {?} */ MdcTopAppBar.prototype.ngAfterViewInit = /** * @return {?} */ function () { this._initFoundation(); }; /** * @return {?} */ MdcTopAppBar.prototype.ngOnDestroy = /** * @return {?} */ function () { this._destroyed.next(); this._destroyed.complete(); if (this._scrollTargetSubscription) { this._scrollTargetSubscription.unsubscribe(); } this._destroyFoundation(); }; /** Sets the top app bar to fixed or not. */ /** * Sets the top app bar to fixed or not. * @param {?} fixed * @param {?=} isUserInput * @return {?} */ MdcTopAppBar.prototype.setFixed = /** * Sets the top app bar to fixed or not. * @param {?} fixed * @param {?=} isUserInput * @return {?} */ function (fixed, isUserInput) { if (isUserInput === void 0) { isUserInput = false; } this._fixed = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(fixed); if (this.fixed && this.short) { this.setShort(false); } if (isUserInput) { this._initFoundation(); } }; /** Sets the top app bar to prominent or not. */ /** * Sets the top app bar to prominent or not. * @param {?} prominent * @param {?=} isUserInput * @return {?} */ MdcTopAppBar.prototype.setProminent = /** * Sets the top app bar to prominent or not. * @param {?} prominent * @param {?=} isUserInput * @return {?} */ function (prominent, isUserInput) { if (isUserInput === void 0) { isUserInput = false; } this._prominent = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(prominent); if (this.prominent && this.short) { this.setShort(false); } if (isUserInput) { this._initFoundation(); } }; /** Sets the top app bar to dense variant. */ /** * Sets the top app bar to dense variant. * @param {?} dense * @param {?=} isUserInput * @return {?} */ MdcTopAppBar.prototype.setDense = /** * Sets the top app bar to dense variant. * @param {?} dense * @param {?=} isUserInput * @return {?} */ function (dense, isUserInput) { if (isUserInput === void 0) { isUserInput = false; } this._dense = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(dense); if (this.dense && this.short) { this.setShort(false); } if (isUserInput) { this._initFoundation(); } }; /** Sets the top app bar to short or not. */ /** * Sets the top app bar to short or not. * @param {?} short * @param {?=} isUserInput * @return {?} */ MdcTopAppBar.prototype.setShort = /** * Sets the top app bar to short or not. * @param {?} short * @param {?=} isUserInput * @return {?} */ function (short, isUserInput) { if (isUserInput === void 0) { isUserInput = false; } this._short = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(short); if (this.short) { this.setProminent(false); this.setDense(false); this.setFixed(false); } else { this.setShortCollapsed(false); } if (isUserInput) { this._initFoundation(); } }; /** Sets the top app bar to short-collapsed or not. */ /** * Sets the top app bar to short-collapsed or not. * @param {?} shortCollapsed * @param {?=} isUserInput * @return {?} */ MdcTopAppBar.prototype.setShortCollapsed = /** * Sets the top app bar to short-collapsed or not. * @param {?} shortCollapsed * @param {?=} isUserInput * @return {?} */ function (shortCollapsed, isUserInput) { if (isUserInput === void 0) { isUserInput = false; } this._shortCollapsed = Object(_angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"])(shortCollapsed); if (this.shortCollapsed && !this.short) { this.setShort(true); } if (isUserInput) { this._initFoundation(); } }; /** * @return {?} */ MdcTopAppBar.prototype.isCollapsed = /** * @return {?} */ function () { return this._getHostElement().classList.contains(cssClasses.SHORT_COLLAPSED_CLASS); }; /** * @private * @return {?} */ MdcTopAppBar.prototype._initFoundation = /** * @private * @return {?} */ function () { this._destroyFoundation(); this._getHostElement().style.top = '0px'; this._resetFixedShort(); this._foundation = this.getDefaultFoundation(); this._foundation.init(); this._initTopAppBar(); this._initScrollHandler(); this._changeDetectorRef.markForCheck(); }; /** * @private * @return {?} */ MdcTopAppBar.prototype._resetFixedShort = /** * @private * @return {?} */ function () { this._getHostElement().classList.remove(cssClasses.SHORT_HAS_ACTION_ITEM_CLASS); this._getHostElement().classList.remove(cssClasses.SHORT_COLLAPSED_CLASS); this._getHostElement().classList.remove(cssClasses.FIXED_SCROLLED_CLASS); }; /** * @private * @return {?} */ MdcTopAppBar.prototype._initTopAppBar = /** * @private * @return {?} */ function () { if (!this.fixed) { this._getHostElement().classList.remove(cssClasses.FIXED_SCROLLED_CLASS); } if (this.fixed && this._getScrollOffset() > 0) { this._getHostElement().classList.add(cssClasses.FIXED_SCROLLED_CLASS); } if (!this.short) { this._getHostElement().classList.remove(cssClasses.SHORT_HAS_ACTION_ITEM_CLASS); this._getHostElement().classList.remove(cssClasses.SHORT_COLLAPSED_CLASS); } if (this.short && this._getScrollOffset() > 0) { this._getHostElement().classList.add(cssClasses.SHORT_COLLAPSED_CLASS); } if (this.shortCollapsed) { this._getHostElement().classList.add(cssClasses.SHORT_COLLAPSED_CLASS); } if (this.fixedAdjustElement) { this._removeFixedAdjustClasses(); this._addFixedAdjustClass(); } }; /** * @private * @return {?} */ MdcTopAppBar.prototype._removeFixedAdjustClasses = /** * @private * @return {?} */ function () { (/** @type {?} */ (this.fixedAdjustElement)).classList.remove('mdc-top-app-bar--short-fixed-adjust'); (/** @type {?} */ (this.fixedAdjustElement)).classList.remove('mdc-top-app-bar--fixed-adjust'); (/** @type {?} */ (this.fixedAdjustElement)).classList.remove('mdc-top-app-bar--dense-fixed-adjust'); (/** @type {?} */ (this.fixedAdjustElement)).classList.remove('mdc-top-app-bar--prominent-fixed-adjust'); (/** @type {?} */ (this.fixedAdjustElement)).classList.remove('mdc-top-app-bar--dense-prominent-fixed-adjust'); }; /** * @private * @return {?} */ MdcTopAppBar.prototype._addFixedAdjustClass = /** * @private * @return {?} */ function () { if (this._short) { (/** @type {?} */ (this.fixedAdjustElement)).classList.add('mdc-top-app-bar--short-fixed-adjust'); } else if (this._dense && this._prominent) { (/** @type {?} */ (this.fixedAdjustElement)).classList.add('mdc-top-app-bar--dense-prominent-fixed-adjust'); } else if (this._dense) { (/** @type {?} */ (this.fixedAdjustElement)).classList.add('mdc-top-app-bar--dense-fixed-adjust'); } else if (this._prominent) { (/** @type {?} */ (this.fixedAdjustElement)).classList.add('mdc-top-app-bar--prominent-fixed-adjust'); } else { (/** @type {?} */ (this.fixedAdjustElement)).classList.add('mdc-top-app-bar--fixed-adjust'); } }; /** * @private * @return {?} */ MdcTopAppBar.prototype._destroyFoundation = /** * @private * @return {?} */ function () { if (this._foundation) { this._foundation.destroy(); } }; /** * @private * @return {?} */ MdcTopAppBar.prototype._initScrollHandler = /** * @private * @return {?} */ function () { var _this = this; if (this._scrollTargetSubscription) { this._scrollTargetSubscription.unsubscribe(); } if (!this._platform.isBrowser) { return; } this._scrollTargetSubscription = this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["fromEvent"])(_this.scrollTarget || window, 'scroll') .subscribe((/** * @return {?} */ function () { return _this._ngZone.run((/** * @return {?} */ function () { if (_this.fixed) { _this._foundation.fixedScrollHandler_(); } else if (_this.short) { _this._foundation.shortAppBarScrollHandler_(); } else { _this._foundation.topAppBarScrollHandler_(); } })); })); })); }; /** * @private * @return {?} */ MdcTopAppBar.prototype._getScrollOffset = /** * @private * @return {?} */ function () { if (!this._platform.isBrowser) { return 0; } return this.scrollTarget ? this.scrollTarget.scrollTop : window.pageYOffset; }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcTopAppBar.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcTopAppBar.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{ selector: 'mdc-top-app-bar, [mdc-top-app-bar]', exportAs: 'mdcTopAppBar', host: { 'class': 'mdc-top-app-bar', '[class.mdc-top-app-bar--prominent]': 'prominent', '[class.mdc-top-app-bar--dense]': 'dense', '[class.mdc-top-app-bar--short]': 'short', '[class.mdc-top-app-bar--fixed]': 'fixed' }, template: '', changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush, encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None },] }, ]; /** @nocollapse */ MdcTopAppBar.ctorParameters = function () { return [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgZone"] }, { type: _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["Platform"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] } ]; }; MdcTopAppBar.propDecorators = { fixed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], prominent: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], short: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], shortCollapsed: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], dense: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], fixedAdjustElement: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], scrollTarget: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], navigationSelected: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }], navigationIcon: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChild"], args: [MdcTopAppBarNavigationIcon,] }], actions: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ContentChildren"], args: [MdcTopAppBarActionItem, { descendants: true },] }] }; return MdcTopAppBar; }(_angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_5__["MDCComponent"])); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TOP_APP_BAR_DECLARATIONS = [ MdcTopAppBar, MdcTopAppBarActionItem, MdcTopAppBarFixedAdjust, MdcTopAppBarNavigationIcon, MdcTopAppBarRow, MdcTopAppBarSection, MdcTopAppBarTitle ]; var MdcTopAppBarModule = /** @class */ (function () { function MdcTopAppBarModule() { } MdcTopAppBarModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ imports: [_angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"]], exports: TOP_APP_BAR_DECLARATIONS, declarations: TOP_APP_BAR_DECLARATIONS },] }, ]; return MdcTopAppBarModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=top-app-bar.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/typography.es5.js": /*!**************************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/typography.es5.js ***! \**************************************************************/ /*! exports provided: MdcBody1, MdcBody2, MdcCaption, MdcHeadline1, MdcHeadline2, MdcHeadline3, MdcHeadline4, MdcHeadline5, MdcHeadline6, MdcOverline, MdcSubtitle1, MdcSubtitle2, MdcTypography, MdcTypographyButton, MdcTypographyModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcBody1", function() { return MdcBody1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcBody2", function() { return MdcBody2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcCaption", function() { return MdcCaption; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline1", function() { return MdcHeadline1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline2", function() { return MdcHeadline2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline3", function() { return MdcHeadline3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline4", function() { return MdcHeadline4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline5", function() { return MdcHeadline5; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline6", function() { return MdcHeadline6; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcOverline", function() { return MdcOverline; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSubtitle1", function() { return MdcSubtitle1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcSubtitle2", function() { return MdcSubtitle2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTypography", function() { return MdcTypography; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTypographyButton", function() { return MdcTypographyButton; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MdcTypographyModule", function() { return MdcTypographyModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcTypography = /** @class */ (function () { function MdcTypography() { } MdcTypography.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdc-typography], [mdcTypography]', host: { 'class': 'mdc-typography' } },] }, ]; return MdcTypography; }()); var MdcHeadline1 = /** @class */ (function () { function MdcHeadline1() { } MdcHeadline1.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcHeadline1]', host: { 'class': 'mdc-typography--headline1' } },] }, ]; return MdcHeadline1; }()); var MdcHeadline2 = /** @class */ (function () { function MdcHeadline2() { } MdcHeadline2.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcHeadline2]', host: { 'class': 'mdc-typography--headline2' } },] }, ]; return MdcHeadline2; }()); var MdcHeadline3 = /** @class */ (function () { function MdcHeadline3() { } MdcHeadline3.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcHeadline3]', host: { 'class': 'mdc-typography--headline3' } },] }, ]; return MdcHeadline3; }()); var MdcHeadline4 = /** @class */ (function () { function MdcHeadline4() { } MdcHeadline4.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcHeadline4]', host: { 'class': 'mdc-typography--headline4' } },] }, ]; return MdcHeadline4; }()); var MdcHeadline5 = /** @class */ (function () { function MdcHeadline5() { } MdcHeadline5.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcHeadline5]', host: { 'class': 'mdc-typography--headline5' } },] }, ]; return MdcHeadline5; }()); var MdcHeadline6 = /** @class */ (function () { function MdcHeadline6() { } MdcHeadline6.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcHeadline6]', host: { 'class': 'mdc-typography--headline6' } },] }, ]; return MdcHeadline6; }()); var MdcSubtitle1 = /** @class */ (function () { function MdcSubtitle1() { } MdcSubtitle1.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcSubtitle1]', host: { 'class': 'mdc-typography--subtitle1' } },] }, ]; return MdcSubtitle1; }()); var MdcSubtitle2 = /** @class */ (function () { function MdcSubtitle2() { } MdcSubtitle2.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcSubtitle2]', host: { 'class': 'mdc-typography--subtitle2' } },] }, ]; return MdcSubtitle2; }()); var MdcBody2 = /** @class */ (function () { function MdcBody2() { } MdcBody2.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcBody2]', host: { 'class': 'mdc-typography--body2' } },] }, ]; return MdcBody2; }()); var MdcBody1 = /** @class */ (function () { function MdcBody1() { } MdcBody1.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcBody1]', host: { 'class': 'mdc-typography--body1' } },] }, ]; return MdcBody1; }()); var MdcCaption = /** @class */ (function () { function MdcCaption() { } MdcCaption.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcCaption]', host: { 'class': 'mdc-typography--caption' } },] }, ]; return MdcCaption; }()); var MdcTypographyButton = /** @class */ (function () { function MdcTypographyButton() { } MdcTypographyButton.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcButton]', host: { 'class': 'mdc-typography--button' } },] }, ]; return MdcTypographyButton; }()); var MdcOverline = /** @class */ (function () { function MdcOverline() { } MdcOverline.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[mdcOverline]', host: { 'class': 'mdc-typography--overline' } },] }, ]; return MdcOverline; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TYPOGRAPHY_DECLARATIONS = [ MdcTypography, MdcBody1, MdcBody2, MdcTypographyButton, MdcCaption, MdcHeadline1, MdcHeadline2, MdcHeadline3, MdcHeadline4, MdcHeadline5, MdcHeadline6, MdcOverline, MdcSubtitle1, MdcSubtitle2 ]; var MdcTypographyModule = /** @class */ (function () { function MdcTypographyModule() { } MdcTypographyModule.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ exports: TYPOGRAPHY_DECLARATIONS, declarations: TYPOGRAPHY_DECLARATIONS },] }, ]; return MdcTypographyModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=typography.es5.js.map /***/ }), /***/ "./node_modules/@angular-mdc/web/esm5/web.es5.js": /*!*******************************************************!*\ !*** ./node_modules/@angular-mdc/web/esm5/web.es5.js ***! \*******************************************************/ /*! exports provided: MDCComponent, MdcButton, MdcButtonLabel, MdcButtonModule, MdcCard, MdcCardAction, MdcCardActionButtons, MdcCardActionIcons, MdcCardActions, MdcCardMedia, MdcCardMediaContent, MdcCardModule, MdcCardPrimaryAction, MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR, MdcCheckbox, MdcCheckboxChange, MdcCheckboxModule, CHIP_DECLARATIONS, MDC_CHIPSET_PARENT_COMPONENT, MdcChip, MdcChipCheckmark, MdcChipIcon, MdcChipSet, MdcChipSetChange, MdcChipText, MdcChipsModule, A, BACKSPACE, COMMA, DELETE, DOWN_ARROW, END, ENTER, ESCAPE, HOME, LEFT_ARROW, NINE, PAGE_DOWN, PAGE_UP, Platform, RIGHT_ARROW, SPACE, TAB, UP_ARROW, UniqueSelectionDispatcher, Z, ZERO, _isNumberValue, toBoolean, toNumber, MDC_DIALOG_DATA, MDC_DIALOG_DEFAULT_OPTIONS, MdcDialog, MdcDialogAction, MdcDialogActions, MdcDialogButton, MdcDialogComponent, MdcDialogConfig, MdcDialogContainer, MdcDialogContent, MdcDialogModule, MdcDialogPortal, MdcDialogRef, MdcDialogScrim, MdcDialogSurface, MdcDialogTitle, throwMdcDialogContentAlreadyAttachedError, MdcDrawer, MdcDrawerAppContent, MdcDrawerContent, MdcDrawerHeader, MdcDrawerModule, MdcDrawerSubtitle, MdcDrawerTitle, MdcElevation, MdcElevationModule, MdcFab, MdcFabLabel, MdcFabModule, MdcFloatingLabel, MdcFloatingLabelModule, ErrorStateMatcher, MdcCharacterCounter, MdcFormField, MdcFormFieldControl, MdcFormFieldModule, MdcHelperText, mixinErrorState, ICON_REGISTRY_PROVIDER, ICON_REGISTRY_PROVIDER_FACTORY, MDC_ICON_LOCATION, MDC_ICON_LOCATION_FACTORY, MdcIcon, MdcIconModule, MdcIconRegistry, MdcMaterialIcons, getMdcIconFailedToSanitizeLiteralError, getMdcIconFailedToSanitizeUrlError, getMdcIconNameNotFoundError, getMdcIconNoHttpProviderError, MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR, MdcIconButton, MdcIconButtonChange, MdcIconButtonModule, MdcIconOn, MdcImageList, MdcImageListImage, MdcImageListImageAspect, MdcImageListItem, MdcImageListLabel, MdcImageListModule, MdcImageListSupporting, MdcLineRipple, MdcLineRippleModule, MdcLinearProgress, MdcLinearProgressModule, MDC_LIST_PARENT_COMPONENT, MdcList, MdcListDivider, MdcListGroup, MdcListGroupSubheader, MdcListItem, MdcListItemChange, MdcListItemGraphic, MdcListItemMeta, MdcListItemSecondary, MdcListItemText, MdcListModule, MdcListSelectionChange, MdcMenu, MdcMenuModule, MdcMenuSelectedEvent, MdcMenuSelectionGroup, MdcMenuSelectionGroupIcon, MdcMenuSurface, MdcMenuSurfaceAnchor, MdcMenuSurfaceBase, MdcMenuSurfaceModule, MdcNotchedOutline, MdcNotchedOutlineModule, Overlay, OverlayConfig, OverlayContainer, OverlayModule, OverlayRef, BasePortalHost, BasePortalOutlet, CdkPortal, CdkPortalOutlet, ComponentPortal, DomPortalHost, DomPortalOutlet, Portal, PortalHostDirective, PortalInjector, PortalModule, TemplatePortal, TemplatePortalDirective, MDC_RADIO_GROUP_CONTROL_VALUE_ACCESSOR, MdcRadio, MdcRadioChange, MdcRadioGroup, MdcRadioModule, MdcRipple, MdcRippleComponent, MdcRippleConfig, MdcRippleDirective, MdcRippleModule, MDC_SELECT_DEFAULT_OPTIONS, MdcSelect, MdcSelectChange, MdcSelectIcon, MdcSelectModule, MdcSelectOption, MDC_SLIDER_CONTROL_VALUE_ACCESSOR, MdcSlider, MdcSliderChange, MdcSliderModule, MDC_SNACKBAR_DATA, MDC_SNACKBAR_DEFAULT_OPTIONS, MDC_SNACKBAR_DEFAULT_OPTIONS_FACTORY, MdcSnackbar, MdcSnackbarComponent, MdcSnackbarConfig, MdcSnackbarContainer, MdcSnackbarModule, MdcSnackbarRef, MDC_SWITCH_CONTROL_VALUE_ACCESSOR, MdcSwitch, MdcSwitchChange, MdcSwitchModule, MDC_TAB_BAR_PARENT_COMPONENT, MdcTab, MdcTabIcon, MdcTabLabel, MdcTabModule, MdcTabActivatedEvent, MdcTabBar, MdcTabBarModule, MdcTabIndicator, MdcTabIndicatorModule, MdcTabScroller, MdcTabScrollerModule, MDC_TEXT_FIELD_DEFAULT_OPTIONS, MdcTextField, MdcTextFieldIcon, MdcTextFieldModule, MdcTextarea, MdcTopAppBar, MdcTopAppBarActionItem, MdcTopAppBarFixedAdjust, MdcTopAppBarModule, MdcTopAppBarNavSelected, MdcTopAppBarNavigationIcon, MdcTopAppBarRow, MdcTopAppBarSection, MdcTopAppBarTitle, MdcBody1, MdcBody2, MdcCaption, MdcHeadline1, MdcHeadline2, MdcHeadline3, MdcHeadline4, MdcHeadline5, MdcHeadline6, MdcOverline, MdcSubtitle1, MdcSubtitle2, MdcTypography, MdcTypographyButton, MdcTypographyModule, VERSION */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular-mdc/web/base */ "./node_modules/@angular-mdc/web/esm5/base.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCComponent", function() { return _angular_mdc_web_base__WEBPACK_IMPORTED_MODULE_1__["MDCComponent"]; }); /* harmony import */ var _angular_mdc_web_button__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular-mdc/web/button */ "./node_modules/@angular-mdc/web/esm5/button.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcButton", function() { return _angular_mdc_web_button__WEBPACK_IMPORTED_MODULE_2__["MdcButton"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcButtonLabel", function() { return _angular_mdc_web_button__WEBPACK_IMPORTED_MODULE_2__["MdcButtonLabel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcButtonModule", function() { return _angular_mdc_web_button__WEBPACK_IMPORTED_MODULE_2__["MdcButtonModule"]; }); /* harmony import */ var _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular-mdc/web/card */ "./node_modules/@angular-mdc/web/esm5/card.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCard", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCard"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCardAction", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCardAction"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCardActionButtons", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCardActionButtons"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCardActionIcons", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCardActionIcons"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCardActions", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCardActions"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCardMedia", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCardMedia"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCardMediaContent", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCardMediaContent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCardModule", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCardModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCardPrimaryAction", function() { return _angular_mdc_web_card__WEBPACK_IMPORTED_MODULE_3__["MdcCardPrimaryAction"]; }); /* harmony import */ var _angular_mdc_web_checkbox__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular-mdc/web/checkbox */ "./node_modules/@angular-mdc/web/esm5/checkbox.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR", function() { return _angular_mdc_web_checkbox__WEBPACK_IMPORTED_MODULE_4__["MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCheckbox", function() { return _angular_mdc_web_checkbox__WEBPACK_IMPORTED_MODULE_4__["MdcCheckbox"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCheckboxChange", function() { return _angular_mdc_web_checkbox__WEBPACK_IMPORTED_MODULE_4__["MdcCheckboxChange"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCheckboxModule", function() { return _angular_mdc_web_checkbox__WEBPACK_IMPORTED_MODULE_4__["MdcCheckboxModule"]; }); /* harmony import */ var _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular-mdc/web/chips */ "./node_modules/@angular-mdc/web/esm5/chips.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CHIP_DECLARATIONS", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["CHIP_DECLARATIONS"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_CHIPSET_PARENT_COMPONENT", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["MDC_CHIPSET_PARENT_COMPONENT"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcChip", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["MdcChip"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcChipCheckmark", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["MdcChipCheckmark"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcChipIcon", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["MdcChipIcon"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcChipSet", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["MdcChipSet"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcChipSetChange", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["MdcChipSetChange"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcChipText", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["MdcChipText"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcChipsModule", function() { return _angular_mdc_web_chips__WEBPACK_IMPORTED_MODULE_5__["MdcChipsModule"]; }); /* harmony import */ var _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular-mdc/web/common */ "./node_modules/@angular-mdc/web/esm5/common.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "A", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["A"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BACKSPACE", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["BACKSPACE"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "COMMA", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["COMMA"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DELETE", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["DELETE"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DOWN_ARROW", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["DOWN_ARROW"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "END", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["END"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ENTER", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["ENTER"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ESCAPE", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["ESCAPE"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HOME", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["HOME"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LEFT_ARROW", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["LEFT_ARROW"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NINE", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["NINE"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PAGE_DOWN", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["PAGE_DOWN"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PAGE_UP", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["PAGE_UP"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Platform", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["Platform"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RIGHT_ARROW", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["RIGHT_ARROW"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SPACE", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["SPACE"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TAB", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["TAB"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UP_ARROW", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["UP_ARROW"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UniqueSelectionDispatcher", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["UniqueSelectionDispatcher"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["Z"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ZERO", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["ZERO"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_isNumberValue", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["_isNumberValue"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toBoolean", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toBoolean"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toNumber", function() { return _angular_mdc_web_common__WEBPACK_IMPORTED_MODULE_6__["toNumber"]; }); /* harmony import */ var _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular-mdc/web/dialog */ "./node_modules/@angular-mdc/web/esm5/dialog.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_DIALOG_DATA", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MDC_DIALOG_DATA"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_DIALOG_DEFAULT_OPTIONS", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MDC_DIALOG_DEFAULT_OPTIONS"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialog", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialog"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogAction", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogAction"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogActions", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogActions"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogButton", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogButton"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogComponent", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogComponent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogConfig", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogConfig"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogContainer", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogContainer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogContent", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogContent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogModule", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogPortal", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogPortal"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogRef", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogRef"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogScrim", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogScrim"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogSurface", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogSurface"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDialogTitle", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["MdcDialogTitle"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwMdcDialogContentAlreadyAttachedError", function() { return _angular_mdc_web_dialog__WEBPACK_IMPORTED_MODULE_7__["throwMdcDialogContentAlreadyAttachedError"]; }); /* harmony import */ var _angular_mdc_web_drawer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular-mdc/web/drawer */ "./node_modules/@angular-mdc/web/esm5/drawer.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDrawer", function() { return _angular_mdc_web_drawer__WEBPACK_IMPORTED_MODULE_8__["MdcDrawer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerAppContent", function() { return _angular_mdc_web_drawer__WEBPACK_IMPORTED_MODULE_8__["MdcDrawerAppContent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerContent", function() { return _angular_mdc_web_drawer__WEBPACK_IMPORTED_MODULE_8__["MdcDrawerContent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerHeader", function() { return _angular_mdc_web_drawer__WEBPACK_IMPORTED_MODULE_8__["MdcDrawerHeader"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerModule", function() { return _angular_mdc_web_drawer__WEBPACK_IMPORTED_MODULE_8__["MdcDrawerModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerSubtitle", function() { return _angular_mdc_web_drawer__WEBPACK_IMPORTED_MODULE_8__["MdcDrawerSubtitle"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcDrawerTitle", function() { return _angular_mdc_web_drawer__WEBPACK_IMPORTED_MODULE_8__["MdcDrawerTitle"]; }); /* harmony import */ var _angular_mdc_web_elevation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @angular-mdc/web/elevation */ "./node_modules/@angular-mdc/web/esm5/elevation.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcElevation", function() { return _angular_mdc_web_elevation__WEBPACK_IMPORTED_MODULE_9__["MdcElevation"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcElevationModule", function() { return _angular_mdc_web_elevation__WEBPACK_IMPORTED_MODULE_9__["MdcElevationModule"]; }); /* harmony import */ var _angular_mdc_web_fab__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @angular-mdc/web/fab */ "./node_modules/@angular-mdc/web/esm5/fab.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcFab", function() { return _angular_mdc_web_fab__WEBPACK_IMPORTED_MODULE_10__["MdcFab"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcFabLabel", function() { return _angular_mdc_web_fab__WEBPACK_IMPORTED_MODULE_10__["MdcFabLabel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcFabModule", function() { return _angular_mdc_web_fab__WEBPACK_IMPORTED_MODULE_10__["MdcFabModule"]; }); /* harmony import */ var _angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @angular-mdc/web/floating-label */ "./node_modules/@angular-mdc/web/esm5/floating-label.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcFloatingLabel", function() { return _angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_11__["MdcFloatingLabel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcFloatingLabelModule", function() { return _angular_mdc_web_floating_label__WEBPACK_IMPORTED_MODULE_11__["MdcFloatingLabelModule"]; }); /* harmony import */ var _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @angular-mdc/web/form-field */ "./node_modules/@angular-mdc/web/esm5/form-field.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ErrorStateMatcher", function() { return _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_12__["ErrorStateMatcher"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCharacterCounter", function() { return _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_12__["MdcCharacterCounter"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcFormField", function() { return _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_12__["MdcFormField"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcFormFieldControl", function() { return _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_12__["MdcFormFieldControl"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcFormFieldModule", function() { return _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_12__["MdcFormFieldModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcHelperText", function() { return _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_12__["MdcHelperText"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mixinErrorState", function() { return _angular_mdc_web_form_field__WEBPACK_IMPORTED_MODULE_12__["mixinErrorState"]; }); /* harmony import */ var _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @angular-mdc/web/icon */ "./node_modules/@angular-mdc/web/esm5/icon.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ICON_REGISTRY_PROVIDER", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["ICON_REGISTRY_PROVIDER"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ICON_REGISTRY_PROVIDER_FACTORY", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["ICON_REGISTRY_PROVIDER_FACTORY"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_ICON_LOCATION", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["MDC_ICON_LOCATION"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_ICON_LOCATION_FACTORY", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["MDC_ICON_LOCATION_FACTORY"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcIcon", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["MdcIcon"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcIconModule", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["MdcIconModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcIconRegistry", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["MdcIconRegistry"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMaterialIcons", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["MdcMaterialIcons"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMdcIconFailedToSanitizeLiteralError", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["getMdcIconFailedToSanitizeLiteralError"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMdcIconFailedToSanitizeUrlError", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["getMdcIconFailedToSanitizeUrlError"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMdcIconNameNotFoundError", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["getMdcIconNameNotFoundError"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMdcIconNoHttpProviderError", function() { return _angular_mdc_web_icon__WEBPACK_IMPORTED_MODULE_13__["getMdcIconNoHttpProviderError"]; }); /* harmony import */ var _angular_mdc_web_icon_button__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @angular-mdc/web/icon-button */ "./node_modules/@angular-mdc/web/esm5/icon-button.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR", function() { return _angular_mdc_web_icon_button__WEBPACK_IMPORTED_MODULE_14__["MDC_ICON_BUTTON_CONTROL_VALUE_ACCESSOR"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcIconButton", function() { return _angular_mdc_web_icon_button__WEBPACK_IMPORTED_MODULE_14__["MdcIconButton"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcIconButtonChange", function() { return _angular_mdc_web_icon_button__WEBPACK_IMPORTED_MODULE_14__["MdcIconButtonChange"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcIconButtonModule", function() { return _angular_mdc_web_icon_button__WEBPACK_IMPORTED_MODULE_14__["MdcIconButtonModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcIconOn", function() { return _angular_mdc_web_icon_button__WEBPACK_IMPORTED_MODULE_14__["MdcIconOn"]; }); /* harmony import */ var _angular_mdc_web_image_list__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @angular-mdc/web/image-list */ "./node_modules/@angular-mdc/web/esm5/image-list.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcImageList", function() { return _angular_mdc_web_image_list__WEBPACK_IMPORTED_MODULE_15__["MdcImageList"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcImageListImage", function() { return _angular_mdc_web_image_list__WEBPACK_IMPORTED_MODULE_15__["MdcImageListImage"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcImageListImageAspect", function() { return _angular_mdc_web_image_list__WEBPACK_IMPORTED_MODULE_15__["MdcImageListImageAspect"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcImageListItem", function() { return _angular_mdc_web_image_list__WEBPACK_IMPORTED_MODULE_15__["MdcImageListItem"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcImageListLabel", function() { return _angular_mdc_web_image_list__WEBPACK_IMPORTED_MODULE_15__["MdcImageListLabel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcImageListModule", function() { return _angular_mdc_web_image_list__WEBPACK_IMPORTED_MODULE_15__["MdcImageListModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcImageListSupporting", function() { return _angular_mdc_web_image_list__WEBPACK_IMPORTED_MODULE_15__["MdcImageListSupporting"]; }); /* harmony import */ var _angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @angular-mdc/web/line-ripple */ "./node_modules/@angular-mdc/web/esm5/line-ripple.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcLineRipple", function() { return _angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_16__["MdcLineRipple"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcLineRippleModule", function() { return _angular_mdc_web_line_ripple__WEBPACK_IMPORTED_MODULE_16__["MdcLineRippleModule"]; }); /* harmony import */ var _angular_mdc_web_linear_progress__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @angular-mdc/web/linear-progress */ "./node_modules/@angular-mdc/web/esm5/linear-progress.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcLinearProgress", function() { return _angular_mdc_web_linear_progress__WEBPACK_IMPORTED_MODULE_17__["MdcLinearProgress"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcLinearProgressModule", function() { return _angular_mdc_web_linear_progress__WEBPACK_IMPORTED_MODULE_17__["MdcLinearProgressModule"]; }); /* harmony import */ var _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @angular-mdc/web/list */ "./node_modules/@angular-mdc/web/esm5/list.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_LIST_PARENT_COMPONENT", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MDC_LIST_PARENT_COMPONENT"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcList", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcList"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListDivider", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListDivider"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListGroup", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListGroup"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListGroupSubheader", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListGroupSubheader"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListItem", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListItem"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListItemChange", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListItemChange"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListItemGraphic", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListItemGraphic"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListItemMeta", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListItemMeta"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListItemSecondary", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListItemSecondary"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListItemText", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListItemText"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListModule", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcListSelectionChange", function() { return _angular_mdc_web_list__WEBPACK_IMPORTED_MODULE_18__["MdcListSelectionChange"]; }); /* harmony import */ var _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @angular-mdc/web/menu */ "./node_modules/@angular-mdc/web/esm5/menu.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenu", function() { return _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_19__["MdcMenu"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenuModule", function() { return _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_19__["MdcMenuModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSelectedEvent", function() { return _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_19__["MdcMenuSelectedEvent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSelectionGroup", function() { return _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_19__["MdcMenuSelectionGroup"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSelectionGroupIcon", function() { return _angular_mdc_web_menu__WEBPACK_IMPORTED_MODULE_19__["MdcMenuSelectionGroupIcon"]; }); /* harmony import */ var _angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @angular-mdc/web/menu-surface */ "./node_modules/@angular-mdc/web/esm5/menu-surface.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSurface", function() { return _angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_20__["MdcMenuSurface"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSurfaceAnchor", function() { return _angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_20__["MdcMenuSurfaceAnchor"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSurfaceBase", function() { return _angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_20__["MdcMenuSurfaceBase"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcMenuSurfaceModule", function() { return _angular_mdc_web_menu_surface__WEBPACK_IMPORTED_MODULE_20__["MdcMenuSurfaceModule"]; }); /* harmony import */ var _angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @angular-mdc/web/notched-outline */ "./node_modules/@angular-mdc/web/esm5/notched-outline.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcNotchedOutline", function() { return _angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_21__["MdcNotchedOutline"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcNotchedOutlineModule", function() { return _angular_mdc_web_notched_outline__WEBPACK_IMPORTED_MODULE_21__["MdcNotchedOutlineModule"]; }); /* harmony import */ var _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! @angular-mdc/web/overlay */ "./node_modules/@angular-mdc/web/esm5/overlay.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Overlay", function() { return _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_22__["Overlay"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OverlayConfig", function() { return _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_22__["OverlayConfig"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OverlayContainer", function() { return _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_22__["OverlayContainer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OverlayModule", function() { return _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_22__["OverlayModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OverlayRef", function() { return _angular_mdc_web_overlay__WEBPACK_IMPORTED_MODULE_22__["OverlayRef"]; }); /* harmony import */ var _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! @angular-mdc/web/portal */ "./node_modules/@angular-mdc/web/esm5/portal.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BasePortalHost", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["BasePortalHost"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BasePortalOutlet", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["BasePortalOutlet"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CdkPortal", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["CdkPortal"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CdkPortalOutlet", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["CdkPortalOutlet"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ComponentPortal", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["ComponentPortal"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DomPortalHost", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["DomPortalHost"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DomPortalOutlet", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["DomPortalOutlet"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Portal", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["Portal"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PortalHostDirective", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["PortalHostDirective"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PortalInjector", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["PortalInjector"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PortalModule", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["PortalModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TemplatePortal", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["TemplatePortal"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TemplatePortalDirective", function() { return _angular_mdc_web_portal__WEBPACK_IMPORTED_MODULE_23__["TemplatePortalDirective"]; }); /* harmony import */ var _angular_mdc_web_radio__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! @angular-mdc/web/radio */ "./node_modules/@angular-mdc/web/esm5/radio.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_RADIO_GROUP_CONTROL_VALUE_ACCESSOR", function() { return _angular_mdc_web_radio__WEBPACK_IMPORTED_MODULE_24__["MDC_RADIO_GROUP_CONTROL_VALUE_ACCESSOR"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRadio", function() { return _angular_mdc_web_radio__WEBPACK_IMPORTED_MODULE_24__["MdcRadio"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRadioChange", function() { return _angular_mdc_web_radio__WEBPACK_IMPORTED_MODULE_24__["MdcRadioChange"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRadioGroup", function() { return _angular_mdc_web_radio__WEBPACK_IMPORTED_MODULE_24__["MdcRadioGroup"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRadioModule", function() { return _angular_mdc_web_radio__WEBPACK_IMPORTED_MODULE_24__["MdcRadioModule"]; }); /* harmony import */ var _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! @angular-mdc/web/ripple */ "./node_modules/@angular-mdc/web/esm5/ripple.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRipple", function() { return _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_25__["MdcRipple"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRippleComponent", function() { return _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_25__["MdcRippleComponent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRippleConfig", function() { return _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_25__["MdcRippleConfig"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRippleDirective", function() { return _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_25__["MdcRippleDirective"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcRippleModule", function() { return _angular_mdc_web_ripple__WEBPACK_IMPORTED_MODULE_25__["MdcRippleModule"]; }); /* harmony import */ var _angular_mdc_web_select__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @angular-mdc/web/select */ "./node_modules/@angular-mdc/web/esm5/select.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_SELECT_DEFAULT_OPTIONS", function() { return _angular_mdc_web_select__WEBPACK_IMPORTED_MODULE_26__["MDC_SELECT_DEFAULT_OPTIONS"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSelect", function() { return _angular_mdc_web_select__WEBPACK_IMPORTED_MODULE_26__["MdcSelect"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSelectChange", function() { return _angular_mdc_web_select__WEBPACK_IMPORTED_MODULE_26__["MdcSelectChange"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSelectIcon", function() { return _angular_mdc_web_select__WEBPACK_IMPORTED_MODULE_26__["MdcSelectIcon"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSelectModule", function() { return _angular_mdc_web_select__WEBPACK_IMPORTED_MODULE_26__["MdcSelectModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSelectOption", function() { return _angular_mdc_web_select__WEBPACK_IMPORTED_MODULE_26__["MdcSelectOption"]; }); /* harmony import */ var _angular_mdc_web_slider__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! @angular-mdc/web/slider */ "./node_modules/@angular-mdc/web/esm5/slider.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_SLIDER_CONTROL_VALUE_ACCESSOR", function() { return _angular_mdc_web_slider__WEBPACK_IMPORTED_MODULE_27__["MDC_SLIDER_CONTROL_VALUE_ACCESSOR"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSlider", function() { return _angular_mdc_web_slider__WEBPACK_IMPORTED_MODULE_27__["MdcSlider"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSliderChange", function() { return _angular_mdc_web_slider__WEBPACK_IMPORTED_MODULE_27__["MdcSliderChange"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSliderModule", function() { return _angular_mdc_web_slider__WEBPACK_IMPORTED_MODULE_27__["MdcSliderModule"]; }); /* harmony import */ var _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! @angular-mdc/web/snackbar */ "./node_modules/@angular-mdc/web/esm5/snackbar.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_SNACKBAR_DATA", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MDC_SNACKBAR_DATA"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_SNACKBAR_DEFAULT_OPTIONS", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MDC_SNACKBAR_DEFAULT_OPTIONS"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_SNACKBAR_DEFAULT_OPTIONS_FACTORY", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MDC_SNACKBAR_DEFAULT_OPTIONS_FACTORY"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbar", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MdcSnackbar"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarComponent", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MdcSnackbarComponent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarConfig", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MdcSnackbarConfig"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarContainer", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MdcSnackbarContainer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarModule", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MdcSnackbarModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSnackbarRef", function() { return _angular_mdc_web_snackbar__WEBPACK_IMPORTED_MODULE_28__["MdcSnackbarRef"]; }); /* harmony import */ var _angular_mdc_web_switch__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! @angular-mdc/web/switch */ "./node_modules/@angular-mdc/web/esm5/switch.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_SWITCH_CONTROL_VALUE_ACCESSOR", function() { return _angular_mdc_web_switch__WEBPACK_IMPORTED_MODULE_29__["MDC_SWITCH_CONTROL_VALUE_ACCESSOR"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSwitch", function() { return _angular_mdc_web_switch__WEBPACK_IMPORTED_MODULE_29__["MdcSwitch"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSwitchChange", function() { return _angular_mdc_web_switch__WEBPACK_IMPORTED_MODULE_29__["MdcSwitchChange"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSwitchModule", function() { return _angular_mdc_web_switch__WEBPACK_IMPORTED_MODULE_29__["MdcSwitchModule"]; }); /* harmony import */ var _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! @angular-mdc/web/tab */ "./node_modules/@angular-mdc/web/esm5/tab.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_TAB_BAR_PARENT_COMPONENT", function() { return _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_30__["MDC_TAB_BAR_PARENT_COMPONENT"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTab", function() { return _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_30__["MdcTab"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabIcon", function() { return _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_30__["MdcTabIcon"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabLabel", function() { return _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_30__["MdcTabLabel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabModule", function() { return _angular_mdc_web_tab__WEBPACK_IMPORTED_MODULE_30__["MdcTabModule"]; }); /* harmony import */ var _angular_mdc_web_tab_bar__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! @angular-mdc/web/tab-bar */ "./node_modules/@angular-mdc/web/esm5/tab-bar.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabActivatedEvent", function() { return _angular_mdc_web_tab_bar__WEBPACK_IMPORTED_MODULE_31__["MdcTabActivatedEvent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabBar", function() { return _angular_mdc_web_tab_bar__WEBPACK_IMPORTED_MODULE_31__["MdcTabBar"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabBarModule", function() { return _angular_mdc_web_tab_bar__WEBPACK_IMPORTED_MODULE_31__["MdcTabBarModule"]; }); /* harmony import */ var _angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! @angular-mdc/web/tab-indicator */ "./node_modules/@angular-mdc/web/esm5/tab-indicator.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabIndicator", function() { return _angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_32__["MdcTabIndicator"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabIndicatorModule", function() { return _angular_mdc_web_tab_indicator__WEBPACK_IMPORTED_MODULE_32__["MdcTabIndicatorModule"]; }); /* harmony import */ var _angular_mdc_web_tab_scroller__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! @angular-mdc/web/tab-scroller */ "./node_modules/@angular-mdc/web/esm5/tab-scroller.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabScroller", function() { return _angular_mdc_web_tab_scroller__WEBPACK_IMPORTED_MODULE_33__["MdcTabScroller"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTabScrollerModule", function() { return _angular_mdc_web_tab_scroller__WEBPACK_IMPORTED_MODULE_33__["MdcTabScrollerModule"]; }); /* harmony import */ var _angular_mdc_web_textfield__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! @angular-mdc/web/textfield */ "./node_modules/@angular-mdc/web/esm5/textfield.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDC_TEXT_FIELD_DEFAULT_OPTIONS", function() { return _angular_mdc_web_textfield__WEBPACK_IMPORTED_MODULE_34__["MDC_TEXT_FIELD_DEFAULT_OPTIONS"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTextField", function() { return _angular_mdc_web_textfield__WEBPACK_IMPORTED_MODULE_34__["MdcTextField"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTextFieldIcon", function() { return _angular_mdc_web_textfield__WEBPACK_IMPORTED_MODULE_34__["MdcTextFieldIcon"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTextFieldModule", function() { return _angular_mdc_web_textfield__WEBPACK_IMPORTED_MODULE_34__["MdcTextFieldModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTextarea", function() { return _angular_mdc_web_textfield__WEBPACK_IMPORTED_MODULE_34__["MdcTextarea"]; }); /* harmony import */ var _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! @angular-mdc/web/top-app-bar */ "./node_modules/@angular-mdc/web/esm5/top-app-bar.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBar", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBar"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarActionItem", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBarActionItem"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarFixedAdjust", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBarFixedAdjust"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarModule", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBarModule"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarNavSelected", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBarNavSelected"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarNavigationIcon", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBarNavigationIcon"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarRow", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBarRow"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarSection", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBarSection"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTopAppBarTitle", function() { return _angular_mdc_web_top_app_bar__WEBPACK_IMPORTED_MODULE_35__["MdcTopAppBarTitle"]; }); /* harmony import */ var _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! @angular-mdc/web/typography */ "./node_modules/@angular-mdc/web/esm5/typography.es5.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcBody1", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcBody1"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcBody2", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcBody2"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcCaption", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcCaption"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline1", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcHeadline1"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline2", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcHeadline2"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline3", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcHeadline3"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline4", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcHeadline4"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline5", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcHeadline5"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcHeadline6", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcHeadline6"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcOverline", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcOverline"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSubtitle1", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcSubtitle1"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcSubtitle2", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcSubtitle2"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTypography", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcTypography"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTypographyButton", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcTypographyButton"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MdcTypographyModule", function() { return _angular_mdc_web_typography__WEBPACK_IMPORTED_MODULE_36__["MdcTypographyModule"]; }); /** * @license * Copyright (c) 2018 Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Current version of Angular MDC. * @type {?} */ var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Version"]('1.0.3'); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ //# sourceMappingURL=web.es5.js.map /***/ }), /***/ "./node_modules/@angular/animations/fesm5/animations.js": /*!**************************************************************!*\ !*** ./node_modules/@angular/animations/fesm5/animations.js ***! \**************************************************************/ /*! exports provided: AnimationBuilder, AnimationFactory, AUTO_STYLE, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, NoopAnimationPlayer, ɵPRE_STYLE, ɵAnimationGroupPlayer */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationBuilder", function() { return AnimationBuilder; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationFactory", function() { return AnimationFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AUTO_STYLE", function() { return AUTO_STYLE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animate", function() { return animate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animateChild", function() { return animateChild; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animation", function() { return animation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "group", function() { return group; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyframes", function() { return keyframes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "query", function() { return query; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sequence", function() { return sequence; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stagger", function() { return stagger; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "state", function() { return state; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "style", function() { return style; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transition", function() { return transition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trigger", function() { return trigger; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useAnimation", function() { return useAnimation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoopAnimationPlayer", function() { return NoopAnimationPlayer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPRE_STYLE", function() { return ɵPRE_STYLE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationGroupPlayer", function() { return AnimationGroupPlayer; }); /** * @license Angular v7.1.4 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * An injectable service that produces an animation sequence programmatically within an * Angular component or directive. * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`. * * @usageNotes * * To use this service, add it to your component or directive as a dependency. * The service is instantiated along with your component. * * Apps do not typically need to create their own animation players, but if you * do need to, follow these steps: * * 1. Use the `build()` method to create a programmatic animation using the * `animate()` function. The method returns an `AnimationFactory` instance. * * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element. * * 3. Use the player object to control the animation programmatically. * * For example: * * ```ts * // import the service from BrowserAnimationsModule * import {AnimationBuilder} from '@angular/animations'; * // require the service as a dependency * class MyCmp { * constructor(private _builder: AnimationBuilder) {} * * makeAnimation(element: any) { * // first define a reusable animation * const myAnimation = this._builder.build([ * style({ width: 0 }), * animate(1000, style({ width: '100px' })) * ]); * * // use the returned factory object to create a player * const player = myAnimation.create(element); * * player.play(); * } * } * ``` * * @publicApi */ var AnimationBuilder = /** @class */ (function () { function AnimationBuilder() { } return AnimationBuilder; }()); /** * A factory object returned from the `AnimationBuilder`.`build()` method. * * @publicApi */ var AnimationFactory = /** @class */ (function () { function AnimationFactory() { } return AnimationFactory; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Specifies automatic styling. * * @publicApi */ var AUTO_STYLE = '*'; /** * Creates a named animation trigger, containing a list of `state()` * and `transition()` entries to be evaluated when the expression * bound to the trigger changes. * * @param name An identifying string. * @param definitions An animation definition object, containing an array of `state()` * and `transition()` declarations. * * @return An object that encapsulates the trigger data. * * @usageNotes * Define an animation trigger in the `animations` section of `@Component` metadata. * In the template, reference the trigger by name and bind it to a trigger expression that * evaluates to a defined animation state, using the following format: * * `[@triggerName]="expression"` * * Animation trigger bindings convert all values to strings, and then match the * previous and current values against any linked transitions. * Booleans can be specified as `1` or `true` and `0` or `false`. * * ### Usage Example * * The following example creates an animation trigger reference based on the provided * name value. * The provided animation value is expected to be an array consisting of state and * transition declarations. * * ```typescript * @Component({ * selector: "my-component", * templateUrl: "my-component-tpl.html", * animations: [ * trigger("myAnimationTrigger", [ * state(...), * state(...), * transition(...), * transition(...) * ]) * ] * }) * class MyComponent { * myStatusExp = "something"; * } * ``` * * The template associated with this component makes use of the defined trigger * by binding to an element within its template code. * * ```html * *
...
* ``` * * ### Using an inline function * The `transition` animation method also supports reading an inline function which can decide * if its associated animation should be run. * * ```typescript * // this method is run each time the `myAnimationTrigger` trigger value changes. * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key: string]: any}): boolean { * // notice that `element` and `params` are also available here * return toState == 'yes-please-animate'; * } * * @Component({ * selector: 'my-component', * templateUrl: 'my-component-tpl.html', * animations: [ * trigger('myAnimationTrigger', [ * transition(myInlineMatcherFn, [ * // the animation sequence code * ]), * ]) * ] * }) * class MyComponent { * myStatusExp = "yes-please-animate"; * } * ``` * * ### Disabling Animations * When true, the special animation control binding `@.disabled` binding prevents * all animations from rendering. * Place the `@.disabled` binding on an element to disable * animations on the element itself, as well as any inner animation triggers * within the element. * * The following example shows how to use this feature: * * ```typescript * @Component({ * selector: 'my-component', * template: ` *
*
*
* `, * animations: [ * trigger("childAnimation", [ * // ... * ]) * ] * }) * class MyComponent { * isDisabled = true; * exp = '...'; * } * ``` * * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating, * along with any inner animations. * * ### Disable animations application-wide * When an area of the template is set to have animations disabled, * **all** inner components have their animations disabled as well. * This means that you can disable all animations for an app * by placing a host binding set on `@.disabled` on the topmost Angular component. * * ```typescript * import {Component, HostBinding} from '@angular/core'; * * @Component({ * selector: 'app-component', * templateUrl: 'app.component.html', * }) * class AppComponent { * @HostBinding('@.disabled') * public animationsDisabled = true; * } * ``` * * ### Overriding disablement of inner animations * Despite inner animations being disabled, a parent animation can `query()` * for inner elements located in disabled areas of the template and still animate * them if needed. This is also the case for when a sub animation is * queried by a parent and then later animated using `animateChild()`. * * ### Detecting when an animation is disabled * If a region of the DOM (or the entire application) has its animations disabled, the animation * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides * an instance of an `AnimationEvent`. If animations are disabled, * the `.disabled` flag on the event is true. * * @publicApi */ function trigger(name, definitions) { return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} }; } /** * Defines an animation step that combines styling information with timing information. * * @param timings Sets `AnimateTimings` for the parent animation. * A string in the format "duration [delay] [easing]". * - Duration and delay are expressed as a number and optional time unit, * such as "1s" or "10ms" for one second and 10 milliseconds, respectively. * The default unit is milliseconds. * - The easing value controls how the animation accelerates and decelerates * during its runtime. Value is one of `ease`, `ease-in`, `ease-out`, * `ease-in-out`, or a `cubic-bezier()` function call. * If not supplied, no easing is applied. * * For example, the string "1s 100ms ease-out" specifies a duration of * 1000 milliseconds, and delay of 100 ms, and the "ease-out" easing style, * which decelerates near the end of the duration. * @param styles Sets AnimationStyles for the parent animation. * A function call to either `style()` or `keyframes()` * that returns a collection of CSS style entries to be applied to the parent animation. * When null, uses the styles from the destination state. * This is useful when describing an animation step that will complete an animation; * see "Animating to the final state" in `transitions()`. * @returns An object that encapsulates the animation step. * * @usageNotes * Call within an animation `sequence()`, `{@link animations/group group()}`, or * `transition()` call to specify an animation step * that applies given style data to the parent animation for a given amount of time. * * ### Syntax Examples * **Timing examples** * * The following examples show various `timings` specifications. * - `animate(500)` : Duration is 500 milliseconds. * - `animate("1s")` : Duration is 1000 milliseconds. * - `animate("100ms 0.5s")` : Duration is 100 milliseconds, delay is 500 milliseconds. * - `animate("5s ease-in")` : Duration is 5000 milliseconds, easing in. * - `animate("5s 10ms cubic-bezier(.17,.67,.88,.1)")` : Duration is 5000 milliseconds, delay is 10 * milliseconds, easing according to a bezier curve. * * **Style examples** * * The following example calls `style()` to set a single CSS style. * ```typescript * animate(500, style({ background: "red" })) * ``` * The following example calls `keyframes()` to set a CSS style * to different values for successive keyframes. * ```typescript * animate(500, keyframes( * [ * style({ background: "blue" })), * style({ background: "red" })) * ]) * ``` * * @publicApi */ function animate(timings, styles) { if (styles === void 0) { styles = null; } return { type: 4 /* Animate */, styles: styles, timings: timings }; } /** * @description Defines a list of animation steps to be run in parallel. * * @param steps An array of animation step objects. * - When steps are defined by `style()` or `animate()` * function calls, each call within the group is executed instantly. * - To specify offset styles to be applied at a later time, define steps with * `keyframes()`, or use `animate()` calls with a delay value. * For example: * * ```typescript * group([ * animate("1s", { background: "black" })) * animate("2s", { color: "white" })) * ]) * ``` * * @param options An options object containing a delay and * developer-defined parameters that provide styling defaults and * can be overridden on invocation. * * @return An object that encapsulates the group data. * * @usageNotes * Grouped animations are useful when a series of styles must be * animated at different starting times and closed off at different ending times. * * When called within a `sequence()` or a * `transition()` call, does not continue to the next * instruction until all of the inner animation steps have completed. * * @publicApi */ function group(steps, options) { if (options === void 0) { options = null; } return { type: 3 /* Group */, steps: steps, options: options }; } /** * Defines a list of animation steps to be run sequentially, one by one. * * @param steps An array of animation step objects. * - Steps defined by `style()` calls apply the styling data immediately. * - Steps defined by `animate()` calls apply the styling data over time * as specified by the timing data. * * ```typescript * sequence([ * style({ opacity: 0 })), * animate("1s", { opacity: 1 })) * ]) * ``` * * @param options An options object containing a delay and * developer-defined parameters that provide styling defaults and * can be overridden on invocation. * * @return An object that encapsulates the sequence data. * * @usageNotes * When you pass an array of steps to a * `transition()` call, the steps run sequentially by default. * Compare this to the `{@link animations/group group()}` call, which runs animation steps in parallel. * * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call, * execution continues to the next instruction only after each of the inner animation * steps have completed. * * @publicApi **/ function sequence(steps, options) { if (options === void 0) { options = null; } return { type: 2 /* Sequence */, steps: steps, options: options }; } /** * Declares a key/value object containing CSS properties/styles that * can then be used for an animation `state`, within an animation `sequence`, * or as styling data for calls to `animate()` and `keyframes()`. * * @param tokens A set of CSS styles or HTML styles associated with an animation state. * The value can be any of the following: * - A key-value style pair associating a CSS property with a value. * - An array of key-value style pairs. * - An asterisk (*), to use auto-styling, where styles are derived from the element * being animated and applied to the animation when it starts. * * Auto-styling can be used to define a state that depends on layout or other * environmental factors. * * @return An object that encapsulates the style data. * * @usageNotes * The following examples create animation styles that collect a set of * CSS property values: * * ```typescript * // string values for CSS properties * style({ background: "red", color: "blue" }) * * // numerical pixel values * style({ width: 100, height: 0 }) * ``` * * The following example uses auto-styling to allow a component to animate from * a height of 0 up to the height of the parent element: * * ``` * style({ height: 0 }), * animate("1s", style({ height: "*" })) * ``` * * @publicApi **/ function style(tokens) { return { type: 6 /* Style */, styles: tokens, offset: null }; } /** * Declares an animation state within a trigger attached to an element. * * @param name One or more names for the defined state in a comma-separated string. * The following reserved state names can be supplied to define a style for specific use * cases: * * - `void` You can associate styles with this name to be used when * the element is detached from the application. For example, when an `ngIf` evaluates * to false, the state of the associated element is void. * - `*` (asterisk) Indicates the default state. You can associate styles with this name * to be used as the fallback when the state that is being animated is not declared * within the trigger. * * @param styles A set of CSS styles associated with this state, created using the * `style()` function. * This set of styles persists on the element once the state has been reached. * @param options Parameters that can be passed to the state when it is invoked. * 0 or more key-value pairs. * @return An object that encapsulates the new state data. * * @usageNotes * Use the `trigger()` function to register states to an animation trigger. * Use the `transition()` function to animate between states. * When a state is active within a component, its associated styles persist on the element, * even when the animation ends. * * @publicApi **/ function state(name, styles, options) { return { type: 0 /* State */, name: name, styles: styles, options: options }; } /** * Defines a set of animation styles, associating each style with an optional `offset` value. * * @param steps A set of animation styles with optional offset data. * The optional `offset` value for a style specifies a percentage of the total animation * time at which that style is applied. * @returns An object that encapsulates the keyframes data. * * @usageNotes * Use with the `animate()` call. Instead of applying animations * from the current state * to the destination state, keyframes describe how each style entry is applied and at what point * within the animation arc. * Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp). * * ### Usage * * In the following example, the offset values describe * when each `backgroundColor` value is applied. The color is red at the start, and changes to * blue when 20% of the total time has elapsed. * * ```typescript * // the provided offset values * animate("5s", keyframes([ * style({ backgroundColor: "red", offset: 0 }), * style({ backgroundColor: "blue", offset: 0.2 }), * style({ backgroundColor: "orange", offset: 0.3 }), * style({ backgroundColor: "black", offset: 1 }) * ])) * ``` * * If there are no `offset` values specified in the style entries, the offsets * are calculated automatically. * * ```typescript * animate("5s", keyframes([ * style({ backgroundColor: "red" }) // offset = 0 * style({ backgroundColor: "blue" }) // offset = 0.33 * style({ backgroundColor: "orange" }) // offset = 0.66 * style({ backgroundColor: "black" }) // offset = 1 * ])) *``` * @publicApi */ function keyframes(steps) { return { type: 5 /* Keyframes */, steps: steps }; } /** * Declares an animation transition as a sequence of animation steps to run when a given * condition is satisfied. The condition is a Boolean expression or function that compares * the previous and current animation states, and returns true if this transition should occur. * When the state criteria of a defined transition are met, the associated animation is * triggered. * * @param stateChangeExpr A Boolean expression or function that compares the previous and current * animation states, and returns true if this transition should occur. Note that "true" and "false" * match 1 and 0, respectively. An expression is evaluated each time a state change occurs in the * animation trigger element. * The animation steps run when the expression evaluates to true. * * - A state-change string takes the form "state1 => state2", where each side is a defined animation * state, or an asterix (*) to refer to a dynamic start or end state. * - The expression string can contain multiple comma-separated statements; * for example "state1 => state2, state3 => state4". * - Special values `:enter` and `:leave` initiate a transition on the entry and exit states, * equivalent to "void => *" and "* => void". * - Special values `:increment` and `:decrement` initiate a transition when a numeric value has * increased or decreased in value. * - A function is executed each time a state change occurs in the animation trigger element. * The animation steps run when the function returns true. * * @param steps One or more animation objects, as returned by the `animate()` or * `sequence()` function, that form a transformation from one state to another. * A sequence is used by default when you pass an array. * @param options An options object that can contain a delay value for the start of the animation, * and additional developer-defined parameters. Provided values for additional parameters are used * as defaults, and override values can be passed to the caller on invocation. * @returns An object that encapsulates the transition data. * * @usageNotes * The template associated with a component binds an animation trigger to an element. * * ```HTML * *
...
* ``` * * All transitions are defined within an animation trigger, * along with named states that the transitions change to and from. * * ```typescript * trigger("myAnimationTrigger", [ * // define states * state("on", style({ background: "green" })), * state("off", style({ background: "grey" })), * ...] * ``` * * Note that when you call the `sequence()` function within a `{@link animations/group group()}` * or a `transition()` call, execution does not continue to the next instruction * until each of the inner animation steps have completed. * * ### Syntax examples * * The following examples define transitions between the two defined states (and default states), * using various options: * * ```typescript * // Transition occurs when the state value * // bound to "myAnimationTrigger" changes from "on" to "off" * transition("on => off", animate(500)) * // Run the same animation for both directions * transition("on <=> off", animate(500)) * // Define multiple state-change pairs separated by commas * transition("on => off, off => void", animate(500)) * ``` * * ### Special values for state-change expressions * * - Catch-all state change for when an element is inserted into the page and the * destination state is unknown: * * ```typescript * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]) * ``` * * - Capture a state change between any states: * * `transition("* => *", animate("1s 0s"))` * * - Entry and exit transitions: * * ```typescript * transition(":enter", [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * transition(":leave", [ * animate(500, style({ opacity: 0 })) * ]) * ``` * * - Use `:increment` and `:decrement` to initiate transitions: * * ```typescript * transition(":increment", group([ * query(':enter', [ * style({ left: '100%' }), * animate('0.5s ease-out', style('*')) * ]), * query(':leave', [ * animate('0.5s ease-out', style({ left: '-100%' })) * ]) * ])) * * transition(":decrement", group([ * query(':enter', [ * style({ left: '100%' }), * animate('0.5s ease-out', style('*')) * ]), * query(':leave', [ * animate('0.5s ease-out', style({ left: '-100%' })) * ]) * ])) * ``` * * ### State-change functions * * Here is an example of a `fromState` specified as a state-change function that invokes an * animation when true: * * ```typescript * transition((fromState, toState) => * { * return fromState == "off" && toState == "on"; * }, * animate("1s 0s")) * ``` * * ### Animating to the final state * * If the final step in a transition is a call to `animate()` that uses a timing value * with no style data, that step is automatically considered the final animation arc, * for the element to reach the final state. Angular automatically adds or removes * CSS styles to ensure that the element is in the correct final state. * * The following example defines a transition that starts by hiding the element, * then makes sure that it animates properly to whatever state is currently active for trigger: * * ```typescript * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]) * ``` * ### Boolean value matching * If a trigger binding value is a Boolean, it can be matched using a transition expression * that compares true and false or 1 and 0. For example: * * ``` * // in the template *
...
* // in the component metadata * trigger('openClose', [ * state('true', style({ height: '*' })), * state('false', style({ height: '0px' })), * transition('false <=> true', animate(500)) * ]) * ``` * * @publicApi **/ function transition(stateChangeExpr, steps, options) { if (options === void 0) { options = null; } return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options }; } /** * Produces a reusable animation that can be invoked in another animation or sequence, * by calling the `useAnimation()` function. * * @param steps One or more animation objects, as returned by the `animate()` * or `sequence()` function, that form a transformation from one state to another. * A sequence is used by default when you pass an array. * @param options An options object that can contain a delay value for the start of the * animation, and additional developer-defined parameters. * Provided values for additional parameters are used as defaults, * and override values can be passed to the caller on invocation. * @returns An object that encapsulates the animation data. * * @usageNotes * The following example defines a reusable animation, providing some default parameter * values. * * ```typescript * var fadeAnimation = animation([ * style({ opacity: '{{ start }}' }), * animate('{{ time }}', * style({ opacity: '{{ end }}'})) * ], * { params: { time: '1000ms', start: 0, end: 1 }}); * ``` * * The following invokes the defined animation with a call to `useAnimation()`, * passing in override parameter values. * * ```js * useAnimation(fadeAnimation, { * params: { * time: '2s', * start: 1, * end: 0 * } * }) * ``` * * If any of the passed-in parameter values are missing from this call, * the default values are used. If one or more parameter values are missing before a step is * animated, `useAnimation()` throws an error. * * @publicApi */ function animation(steps, options) { if (options === void 0) { options = null; } return { type: 8 /* Reference */, animation: steps, options: options }; } /** * Executes a queried inner animation element within an animation sequence. * * @param options An options object that can contain a delay value for the start of the * animation, and additional override values for developer-defined parameters. * @return An object that encapsulates the child animation data. * * @usageNotes * Each time an animation is triggered in Angular, the parent animation * has priority and any child animations are blocked. In order * for a child animation to run, the parent animation must query each of the elements * containing child animations, and run them using this function. * * Note that this feature designed to be used with `query()` and it will only work * with animations that are assigned using the Angular animation library. CSS keyframes * and transitions are not handled by this API. * * @publicApi */ function animateChild(options) { if (options === void 0) { options = null; } return { type: 9 /* AnimateChild */, options: options }; } /** * Starts a reusable animation that is created using the `animation()` function. * * @param animation The reusable animation to start. * @param options An options object that can contain a delay value for the start of * the animation, and additional override values for developer-defined parameters. * @return An object that contains the animation parameters. * * @publicApi */ function useAnimation(animation, options) { if (options === void 0) { options = null; } return { type: 10 /* AnimateRef */, animation: animation, options: options }; } /** * Finds one or more inner elements within the current element that is * being animated within a sequence. Use with `animate()`. * * @param selector The element to query, or a set of elements that contain Angular-specific * characteristics, specified with one or more of the following tokens. * - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements. * - `query(":animating")` : Query all currently animating elements. * - `query("@triggerName")` : Query elements that contain an animation trigger. * - `query("@*")` : Query all elements that contain an animation triggers. * - `query(":self")` : Include the current element into the animation sequence. * * @param animation One or more animation steps to apply to the queried element or elements. * An array is treated as an animation sequence. * @param options An options object. Use the 'limit' field to limit the total number of * items to collect. * @return An object that encapsulates the query data. * * @usageNotes * Tokens can be merged into a combined query selector string. For example: * * ```typescript * query(':self, .record:enter, .record:leave, @subTrigger', [...]) * ``` * * The `query()` function collects multiple elements and works internally by using * `element.querySelectorAll`. Use the `limit` field of an options object to limit * the total number of items to be collected. For example: * * ```js * query('div', [ * animate(...), * animate(...) * ], { limit: 1 }) * ``` * * By default, throws an error when zero items are found. Set the * `optional` flag to ignore this error. For example: * * ```js * query('.some-element-that-may-not-be-there', [ * animate(...), * animate(...) * ], { optional: true }) * ``` * * ### Usage Example * * The following example queries for inner elements and animates them * individually using `animate()`. * * ```typescript * @Component({ * selector: 'inner', * template: ` *
*

Title

*
* Blah blah blah *
*
* `, * animations: [ * trigger('queryAnimation', [ * transition('* => goAnimate', [ * // hide the inner elements * query('h1', style({ opacity: 0 })), * query('.content', style({ opacity: 0 })), * * // animate the inner elements in, one by one * query('h1', animate(1000, style({ opacity: 1 })), * query('.content', animate(1000, style({ opacity: 1 })), * ]) * ]) * ] * }) * class Cmp { * exp = ''; * * goAnimate() { * this.exp = 'goAnimate'; * } * } * ``` * * @publicApi */ function query(selector, animation, options) { if (options === void 0) { options = null; } return { type: 11 /* Query */, selector: selector, animation: animation, options: options }; } /** * Use within an animation `query()` call to issue a timing gap after * each queried item is animated. * * @param timings A delay value. * @param animation One ore more animation steps. * @returns An object that encapsulates the stagger data. * * @usageNotes * In the following example, a container element wraps a list of items stamped out * by an `ngFor`. The container element contains an animation trigger that will later be set * to query for each of the inner items. * * Each time items are added, the opacity fade-in animation runs, * and each removed item is faded out. * When either of these animations occur, the stagger effect is * applied after each item's animation is started. * * ```html * * *
*
*
* {{ item }} *
*
* ``` * * Here is the component code: * * ```typescript * import {trigger, transition, style, animate, query, stagger} from '@angular/animations'; * @Component({ * templateUrl: 'list.component.html', * animations: [ * trigger('listAnimation', [ * ... * ]) * ] * }) * class ListComponent { * items = []; * * showItems() { * this.items = [0,1,2,3,4]; * } * * hideItems() { * this.items = []; * } * * toggle() { * this.items.length ? this.hideItems() : this.showItems(); * } * } * ``` * * Here is the animation trigger code: * * ```typescript * trigger('listAnimation', [ * transition('* => *', [ // each time the binding value changes * query(':leave', [ * stagger(100, [ * animate('0.5s', style({ opacity: 0 })) * ]) * ]), * query(':enter', [ * style({ opacity: 0 }), * stagger(100, [ * animate('0.5s', style({ opacity: 1 })) * ]) * ]) * ]) * ]) * ``` * * @publicApi */ function stagger(timings, animation) { return { type: 12 /* Stagger */, timings: timings, animation: animation }; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ function scheduleMicroTask(cb) { Promise.resolve(null).then(cb); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An empty programmatic controller for reusable animations. * Used internally when animations are disabled, to avoid * checking for the null case when an animation player is expected. * * @see `animate()` * @see `AnimationPlayer` * @see `GroupPlayer` * * @publicApi */ var NoopAnimationPlayer = /** @class */ (function () { function NoopAnimationPlayer(duration, delay) { if (duration === void 0) { duration = 0; } if (delay === void 0) { delay = 0; } this._onDoneFns = []; this._onStartFns = []; this._onDestroyFns = []; this._started = false; this._destroyed = false; this._finished = false; this.parentPlayer = null; this.totalTime = duration + delay; } NoopAnimationPlayer.prototype._onFinish = function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; NoopAnimationPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; NoopAnimationPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; NoopAnimationPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; NoopAnimationPlayer.prototype.hasStarted = function () { return this._started; }; NoopAnimationPlayer.prototype.init = function () { }; NoopAnimationPlayer.prototype.play = function () { if (!this.hasStarted()) { this._onStart(); this.triggerMicrotask(); } this._started = true; }; /** @internal */ NoopAnimationPlayer.prototype.triggerMicrotask = function () { var _this = this; scheduleMicroTask(function () { return _this._onFinish(); }); }; NoopAnimationPlayer.prototype._onStart = function () { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; }; NoopAnimationPlayer.prototype.pause = function () { }; NoopAnimationPlayer.prototype.restart = function () { }; NoopAnimationPlayer.prototype.finish = function () { this._onFinish(); }; NoopAnimationPlayer.prototype.destroy = function () { if (!this._destroyed) { this._destroyed = true; if (!this.hasStarted()) { this._onStart(); } this.finish(); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; NoopAnimationPlayer.prototype.reset = function () { }; NoopAnimationPlayer.prototype.setPosition = function (position) { }; NoopAnimationPlayer.prototype.getPosition = function () { return 0; }; /** @internal */ NoopAnimationPlayer.prototype.triggerCallback = function (phaseName) { var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return NoopAnimationPlayer; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A programmatic controller for a group of reusable animations. * Used internally to control animations. * * @see `AnimationPlayer` * @see `{@link animations/group group()}` * */ var AnimationGroupPlayer = /** @class */ (function () { function AnimationGroupPlayer(_players) { var _this = this; this._onDoneFns = []; this._onStartFns = []; this._finished = false; this._started = false; this._destroyed = false; this._onDestroyFns = []; this.parentPlayer = null; this.totalTime = 0; this.players = _players; var doneCount = 0; var destroyCount = 0; var startCount = 0; var total = this.players.length; if (total == 0) { scheduleMicroTask(function () { return _this._onFinish(); }); } else { this.players.forEach(function (player) { player.onDone(function () { if (++doneCount == total) { _this._onFinish(); } }); player.onDestroy(function () { if (++destroyCount == total) { _this._onDestroy(); } }); player.onStart(function () { if (++startCount == total) { _this._onStart(); } }); }); } this.totalTime = this.players.reduce(function (time, player) { return Math.max(time, player.totalTime); }, 0); } AnimationGroupPlayer.prototype._onFinish = function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; AnimationGroupPlayer.prototype.init = function () { this.players.forEach(function (player) { return player.init(); }); }; AnimationGroupPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; AnimationGroupPlayer.prototype._onStart = function () { if (!this.hasStarted()) { this._started = true; this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; } }; AnimationGroupPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; AnimationGroupPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; AnimationGroupPlayer.prototype.hasStarted = function () { return this._started; }; AnimationGroupPlayer.prototype.play = function () { if (!this.parentPlayer) { this.init(); } this._onStart(); this.players.forEach(function (player) { return player.play(); }); }; AnimationGroupPlayer.prototype.pause = function () { this.players.forEach(function (player) { return player.pause(); }); }; AnimationGroupPlayer.prototype.restart = function () { this.players.forEach(function (player) { return player.restart(); }); }; AnimationGroupPlayer.prototype.finish = function () { this._onFinish(); this.players.forEach(function (player) { return player.finish(); }); }; AnimationGroupPlayer.prototype.destroy = function () { this._onDestroy(); }; AnimationGroupPlayer.prototype._onDestroy = function () { if (!this._destroyed) { this._destroyed = true; this._onFinish(); this.players.forEach(function (player) { return player.destroy(); }); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; AnimationGroupPlayer.prototype.reset = function () { this.players.forEach(function (player) { return player.reset(); }); this._destroyed = false; this._finished = false; this._started = false; }; AnimationGroupPlayer.prototype.setPosition = function (p) { var timeAtPosition = p * this.totalTime; this.players.forEach(function (player) { var position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1; player.setPosition(position); }); }; AnimationGroupPlayer.prototype.getPosition = function () { var min = 0; this.players.forEach(function (player) { var p = player.getPosition(); min = Math.min(p, min); }); return min; }; AnimationGroupPlayer.prototype.beforeDestroy = function () { this.players.forEach(function (player) { if (player.beforeDestroy) { player.beforeDestroy(); } }); }; /** @internal */ AnimationGroupPlayer.prototype.triggerCallback = function (phaseName) { var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return AnimationGroupPlayer; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ɵPRE_STYLE = '!'; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=animations.js.map /***/ }), /***/ "./node_modules/@angular/animations/fesm5/browser.js": /*!***********************************************************!*\ !*** ./node_modules/@angular/animations/fesm5/browser.js ***! \***********************************************************/ /*! exports provided: AnimationDriver, ɵAnimation, ɵAnimationStyleNormalizer, ɵNoopAnimationStyleNormalizer, ɵWebAnimationsStyleNormalizer, ɵAnimationDriver, ɵNoopAnimationDriver, ɵAnimationEngine, ɵCssKeyframesDriver, ɵCssKeyframesPlayer, ɵcontainsElement, ɵinvokeQuery, ɵmatchesElement, ɵvalidateStyleProperty, ɵWebAnimationsDriver, ɵsupportsWebAnimations, ɵWebAnimationsPlayer, ɵallowPreviousPlayerStylesMerge */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationDriver", function() { return AnimationDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimation", function() { return Animation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationStyleNormalizer", function() { return AnimationStyleNormalizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNoopAnimationStyleNormalizer", function() { return NoopAnimationStyleNormalizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵWebAnimationsStyleNormalizer", function() { return WebAnimationsStyleNormalizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationDriver", function() { return AnimationDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNoopAnimationDriver", function() { return NoopAnimationDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationEngine", function() { return AnimationEngine; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCssKeyframesDriver", function() { return CssKeyframesDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCssKeyframesPlayer", function() { return CssKeyframesPlayer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcontainsElement", function() { return containsElement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinvokeQuery", function() { return invokeQuery; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmatchesElement", function() { return matchesElement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵvalidateStyleProperty", function() { return validateStyleProperty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵWebAnimationsDriver", function() { return WebAnimationsDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsupportsWebAnimations", function() { return supportsWebAnimations; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵWebAnimationsPlayer", function() { return WebAnimationsPlayer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵallowPreviousPlayerStylesMerge", function() { return allowPreviousPlayerStylesMerge; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_animations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/animations */ "./node_modules/@angular/animations/fesm5/animations.js"); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /** * @license Angular v7.1.4 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ function isBrowser() { return (typeof window !== 'undefined' && typeof window.document !== 'undefined'); } function isNode() { return (typeof process !== 'undefined'); } function optimizeGroupPlayer(players) { switch (players.length) { case 0: return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](); case 1: return players[0]; default: return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵAnimationGroupPlayer"](players); } } function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles, postStyles) { if (preStyles === void 0) { preStyles = {}; } if (postStyles === void 0) { postStyles = {}; } var errors = []; var normalizedKeyframes = []; var previousOffset = -1; var previousKeyframe = null; keyframes.forEach(function (kf) { var offset = kf['offset']; var isSameOffset = offset == previousOffset; var normalizedKeyframe = (isSameOffset && previousKeyframe) || {}; Object.keys(kf).forEach(function (prop) { var normalizedProp = prop; var normalizedValue = kf[prop]; if (prop !== 'offset') { normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors); switch (normalizedValue) { case _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵPRE_STYLE"]: normalizedValue = preStyles[prop]; break; case _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]: normalizedValue = postStyles[prop]; break; default: normalizedValue = normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors); break; } } normalizedKeyframe[normalizedProp] = normalizedValue; }); if (!isSameOffset) { normalizedKeyframes.push(normalizedKeyframe); } previousKeyframe = normalizedKeyframe; previousOffset = offset; }); if (errors.length) { var LINE_START = '\n - '; throw new Error("Unable to animate due to the following errors:" + LINE_START + errors.join(LINE_START)); } return normalizedKeyframes; } function listenOnPlayer(player, eventName, event, callback) { switch (eventName) { case 'start': player.onStart(function () { return callback(event && copyAnimationEvent(event, 'start', player)); }); break; case 'done': player.onDone(function () { return callback(event && copyAnimationEvent(event, 'done', player)); }); break; case 'destroy': player.onDestroy(function () { return callback(event && copyAnimationEvent(event, 'destroy', player)); }); break; } } function copyAnimationEvent(e, phaseName, player) { var totalTime = player.totalTime; var disabled = player.disabled ? true : false; var event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime, disabled); var data = e['_data']; if (data != null) { event['_data'] = data; } return event; } function makeAnimationEvent(element, triggerName, fromState, toState, phaseName, totalTime, disabled) { if (phaseName === void 0) { phaseName = ''; } if (totalTime === void 0) { totalTime = 0; } return { element: element, triggerName: triggerName, fromState: fromState, toState: toState, phaseName: phaseName, totalTime: totalTime, disabled: !!disabled }; } function getOrSetAsInMap(map, key, defaultValue) { var value; if (map instanceof Map) { value = map.get(key); if (!value) { map.set(key, value = defaultValue); } } else { value = map[key]; if (!value) { value = map[key] = defaultValue; } } return value; } function parseTimelineCommand(command) { var separatorPos = command.indexOf(':'); var id = command.substring(1, separatorPos); var action = command.substr(separatorPos + 1); return [id, action]; } var _contains = function (elm1, elm2) { return false; }; var _matches = function (element, selector) { return false; }; var _query = function (element, selector, multi) { return []; }; // Define utility methods for browsers and platform-server(domino) where Element // and utility methods exist. var _isNode = isNode(); if (_isNode || typeof Element !== 'undefined') { // this is well supported in all browsers _contains = function (elm1, elm2) { return elm1.contains(elm2); }; if (_isNode || Element.prototype.matches) { _matches = function (element, selector) { return element.matches(selector); }; } else { var proto = Element.prototype; var fn_1 = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; if (fn_1) { _matches = function (element, selector) { return fn_1.apply(element, [selector]); }; } } _query = function (element, selector, multi) { var results = []; if (multi) { results.push.apply(results, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(element.querySelectorAll(selector))); } else { var elm = element.querySelector(selector); if (elm) { results.push(elm); } } return results; }; } function containsVendorPrefix(prop) { // Webkit is the only real popular vendor prefix nowadays // cc: http://shouldiprefix.com/ return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit } var _CACHED_BODY = null; var _IS_WEBKIT = false; function validateStyleProperty(prop) { if (!_CACHED_BODY) { _CACHED_BODY = getBodyNode() || {}; _IS_WEBKIT = _CACHED_BODY.style ? ('WebkitAppearance' in _CACHED_BODY.style) : false; } var result = true; if (_CACHED_BODY.style && !containsVendorPrefix(prop)) { result = prop in _CACHED_BODY.style; if (!result && _IS_WEBKIT) { var camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.substr(1); result = camelProp in _CACHED_BODY.style; } } return result; } function getBodyNode() { if (typeof document != 'undefined') { return document.body; } return null; } var matchesElement = _matches; var containsElement = _contains; var invokeQuery = _query; function hypenatePropsObject(object) { var newObj = {}; Object.keys(object).forEach(function (prop) { var newProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2'); newObj[newProp] = object[prop]; }); return newObj; } /** * @publicApi */ var NoopAnimationDriver = /** @class */ (function () { function NoopAnimationDriver() { } NoopAnimationDriver.prototype.validateStyleProperty = function (prop) { return validateStyleProperty(prop); }; NoopAnimationDriver.prototype.matchesElement = function (element, selector) { return matchesElement(element, selector); }; NoopAnimationDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; NoopAnimationDriver.prototype.query = function (element, selector, multi) { return invokeQuery(element, selector, multi); }; NoopAnimationDriver.prototype.computeStyle = function (element, prop, defaultValue) { return defaultValue || ''; }; NoopAnimationDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers, scrubberAccessRequested) { if (previousPlayers === void 0) { previousPlayers = []; } return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](duration, delay); }; NoopAnimationDriver = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([ Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])() ], NoopAnimationDriver); return NoopAnimationDriver; }()); /** * @publicApi */ var AnimationDriver = /** @class */ (function () { function AnimationDriver() { } AnimationDriver.NOOP = new NoopAnimationDriver(); return AnimationDriver; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ONE_SECOND = 1000; var SUBSTITUTION_EXPR_START = '{{'; var SUBSTITUTION_EXPR_END = '}}'; var ENTER_CLASSNAME = 'ng-enter'; var LEAVE_CLASSNAME = 'ng-leave'; var NG_TRIGGER_CLASSNAME = 'ng-trigger'; var NG_TRIGGER_SELECTOR = '.ng-trigger'; var NG_ANIMATING_CLASSNAME = 'ng-animating'; var NG_ANIMATING_SELECTOR = '.ng-animating'; function resolveTimingValue(value) { if (typeof value == 'number') return value; var matches = value.match(/^(-?[\.\d]+)(m?s)/); if (!matches || matches.length < 2) return 0; return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); } function _convertTimeValueToMS(value, unit) { switch (unit) { case 's': return value * ONE_SECOND; default: // ms or something else return value; } } function resolveTiming(timings, errors, allowNegativeValues) { return timings.hasOwnProperty('duration') ? timings : parseTimeExpression(timings, errors, allowNegativeValues); } function parseTimeExpression(exp, errors, allowNegativeValues) { var regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i; var duration; var delay = 0; var easing = ''; if (typeof exp === 'string') { var matches = exp.match(regex); if (matches === null) { errors.push("The provided timing value \"" + exp + "\" is invalid."); return { duration: 0, delay: 0, easing: '' }; } duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); var delayMatch = matches[3]; if (delayMatch != null) { delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]); } var easingVal = matches[5]; if (easingVal) { easing = easingVal; } } else { duration = exp; } if (!allowNegativeValues) { var containsErrors = false; var startIndex = errors.length; if (duration < 0) { errors.push("Duration values below 0 are not allowed for this animation step."); containsErrors = true; } if (delay < 0) { errors.push("Delay values below 0 are not allowed for this animation step."); containsErrors = true; } if (containsErrors) { errors.splice(startIndex, 0, "The provided timing value \"" + exp + "\" is invalid."); } } return { duration: duration, delay: delay, easing: easing }; } function copyObj(obj, destination) { if (destination === void 0) { destination = {}; } Object.keys(obj).forEach(function (prop) { destination[prop] = obj[prop]; }); return destination; } function normalizeStyles(styles) { var normalizedStyles = {}; if (Array.isArray(styles)) { styles.forEach(function (data) { return copyStyles(data, false, normalizedStyles); }); } else { copyStyles(styles, false, normalizedStyles); } return normalizedStyles; } function copyStyles(styles, readPrototype, destination) { if (destination === void 0) { destination = {}; } if (readPrototype) { // we make use of a for-in loop so that the // prototypically inherited properties are // revealed from the backFill map for (var prop in styles) { destination[prop] = styles[prop]; } } else { copyObj(styles, destination); } return destination; } function getStyleAttributeString(element, key, value) { // Return the key-value pair string to be added to the style attribute for the // given CSS style key. if (value) { return key + ':' + value + ';'; } else { return ''; } } function writeStyleAttribute(element) { // Read the style property of the element and manually reflect it to the // style attribute. This is needed because Domino on platform-server doesn't // understand the full set of allowed CSS properties and doesn't reflect some // of them automatically. var styleAttrValue = ''; for (var i = 0; i < element.style.length; i++) { var key = element.style.item(i); styleAttrValue += getStyleAttributeString(element, key, element.style.getPropertyValue(key)); } for (var key in element.style) { // Skip internal Domino properties that don't need to be reflected. if (!element.style.hasOwnProperty(key) || key.startsWith('_')) { continue; } var dashKey = camelCaseToDashCase(key); styleAttrValue += getStyleAttributeString(element, dashKey, element.style[key]); } element.setAttribute('style', styleAttrValue); } function setStyles(element, styles) { if (element['style']) { Object.keys(styles).forEach(function (prop) { var camelProp = dashCaseToCamelCase(prop); element.style[camelProp] = styles[prop]; }); // On the server set the 'style' attribute since it's not automatically reflected. if (isNode()) { writeStyleAttribute(element); } } } function eraseStyles(element, styles) { if (element['style']) { Object.keys(styles).forEach(function (prop) { var camelProp = dashCaseToCamelCase(prop); element.style[camelProp] = ''; }); // On the server set the 'style' attribute since it's not automatically reflected. if (isNode()) { writeStyleAttribute(element); } } } function normalizeAnimationEntry(steps) { if (Array.isArray(steps)) { if (steps.length == 1) return steps[0]; return Object(_angular_animations__WEBPACK_IMPORTED_MODULE_1__["sequence"])(steps); } return steps; } function validateStyleParams(value, options, errors) { var params = options.params || {}; var matches = extractStyleParams(value); if (matches.length) { matches.forEach(function (varName) { if (!params.hasOwnProperty(varName)) { errors.push("Unable to resolve the local animation param " + varName + " in the given list of values"); } }); } } var PARAM_REGEX = new RegExp(SUBSTITUTION_EXPR_START + "\\s*(.+?)\\s*" + SUBSTITUTION_EXPR_END, 'g'); function extractStyleParams(value) { var params = []; if (typeof value === 'string') { var val = value.toString(); var match = void 0; while (match = PARAM_REGEX.exec(val)) { params.push(match[1]); } PARAM_REGEX.lastIndex = 0; } return params; } function interpolateParams(value, params, errors) { var original = value.toString(); var str = original.replace(PARAM_REGEX, function (_, varName) { var localVal = params[varName]; // this means that the value was never overridden by the data passed in by the user if (!params.hasOwnProperty(varName)) { errors.push("Please provide a value for the animation param " + varName); localVal = ''; } return localVal.toString(); }); // we do this to assert that numeric values stay as they are return str == original ? value : str; } function iteratorToArray(iterator) { var arr = []; var item = iterator.next(); while (!item.done) { arr.push(item.value); item = iterator.next(); } return arr; } var DASH_CASE_REGEXP = /-+([a-z0-9])/g; function dashCaseToCamelCase(input) { return input.replace(DASH_CASE_REGEXP, function () { var m = []; for (var _i = 0; _i < arguments.length; _i++) { m[_i] = arguments[_i]; } return m[1].toUpperCase(); }); } function camelCaseToDashCase(input) { return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); } function allowPreviousPlayerStylesMerge(duration, delay) { return duration === 0 || delay === 0; } function balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles) { var previousStyleProps = Object.keys(previousStyles); if (previousStyleProps.length && keyframes.length) { var startingKeyframe_1 = keyframes[0]; var missingStyleProps_1 = []; previousStyleProps.forEach(function (prop) { if (!startingKeyframe_1.hasOwnProperty(prop)) { missingStyleProps_1.push(prop); } startingKeyframe_1[prop] = previousStyles[prop]; }); if (missingStyleProps_1.length) { var _loop_1 = function () { var kf = keyframes[i]; missingStyleProps_1.forEach(function (prop) { kf[prop] = computeStyle(element, prop); }); }; // tslint:disable-next-line for (var i = 1; i < keyframes.length; i++) { _loop_1(); } } } return keyframes; } function visitDslNode(visitor, node, context) { switch (node.type) { case 7 /* Trigger */: return visitor.visitTrigger(node, context); case 0 /* State */: return visitor.visitState(node, context); case 1 /* Transition */: return visitor.visitTransition(node, context); case 2 /* Sequence */: return visitor.visitSequence(node, context); case 3 /* Group */: return visitor.visitGroup(node, context); case 4 /* Animate */: return visitor.visitAnimate(node, context); case 5 /* Keyframes */: return visitor.visitKeyframes(node, context); case 6 /* Style */: return visitor.visitStyle(node, context); case 8 /* Reference */: return visitor.visitReference(node, context); case 9 /* AnimateChild */: return visitor.visitAnimateChild(node, context); case 10 /* AnimateRef */: return visitor.visitAnimateRef(node, context); case 11 /* Query */: return visitor.visitQuery(node, context); case 12 /* Stagger */: return visitor.visitStagger(node, context); default: throw new Error("Unable to resolve animation metadata node #" + node.type); } } function computeStyle(element, prop) { return window.getComputedStyle(element)[prop]; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ANY_STATE = '*'; function parseTransitionExpr(transitionValue, errors) { var expressions = []; if (typeof transitionValue == 'string') { transitionValue .split(/\s*,\s*/) .forEach(function (str) { return parseInnerTransitionStr(str, expressions, errors); }); } else { expressions.push(transitionValue); } return expressions; } function parseInnerTransitionStr(eventStr, expressions, errors) { if (eventStr[0] == ':') { var result = parseAnimationAlias(eventStr, errors); if (typeof result == 'function') { expressions.push(result); return; } eventStr = result; } var match = eventStr.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/); if (match == null || match.length < 4) { errors.push("The provided transition expression \"" + eventStr + "\" is not supported"); return expressions; } var fromState = match[1]; var separator = match[2]; var toState = match[3]; expressions.push(makeLambdaFromStates(fromState, toState)); var isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; if (separator[0] == '<' && !isFullAnyStateExpr) { expressions.push(makeLambdaFromStates(toState, fromState)); } } function parseAnimationAlias(alias, errors) { switch (alias) { case ':enter': return 'void => *'; case ':leave': return '* => void'; case ':increment': return function (fromState, toState) { return parseFloat(toState) > parseFloat(fromState); }; case ':decrement': return function (fromState, toState) { return parseFloat(toState) < parseFloat(fromState); }; default: errors.push("The transition alias value \"" + alias + "\" is not supported"); return '* => *'; } } // DO NOT REFACTOR ... keep the follow set instantiations // with the values intact (closure compiler for some reason // removes follow-up lines that add the values outside of // the constructor... var TRUE_BOOLEAN_VALUES = new Set(['true', '1']); var FALSE_BOOLEAN_VALUES = new Set(['false', '0']); function makeLambdaFromStates(lhs, rhs) { var LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs); var RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs); return function (fromState, toState) { var lhsMatch = lhs == ANY_STATE || lhs == fromState; var rhsMatch = rhs == ANY_STATE || rhs == toState; if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') { lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs); } if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') { rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs); } return lhsMatch && rhsMatch; }; } var SELF_TOKEN = ':self'; var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g'); /* * [Validation] * The visitor code below will traverse the animation AST generated by the animation verb functions * (the output is a tree of objects) and attempt to perform a series of validations on the data. The * following corner-cases will be validated: * * 1. Overlap of animations * Given that a CSS property cannot be animated in more than one place at the same time, it's * important that this behaviour is detected and validated. The way in which this occurs is that * each time a style property is examined, a string-map containing the property will be updated with * the start and end times for when the property is used within an animation step. * * If there are two or more parallel animations that are currently running (these are invoked by the * group()) on the same element then the validator will throw an error. Since the start/end timing * values are collected for each property then if the current animation step is animating the same * property and its timing values fall anywhere into the window of time that the property is * currently being animated within then this is what causes an error. * * 2. Timing values * The validator will validate to see if a timing value of `duration delay easing` or * `durationNumber` is valid or not. * * (note that upon validation the code below will replace the timing data with an object containing * {duration,delay,easing}. * * 3. Offset Validation * Each of the style() calls are allowed to have an offset value when placed inside of keyframes(). * Offsets within keyframes() are considered valid when: * * - No offsets are used at all * - Each style() entry contains an offset value * - Each offset is between 0 and 1 * - Each offset is greater to or equal than the previous one * * Otherwise an error will be thrown. */ function buildAnimationAst(driver, metadata, errors) { return new AnimationAstBuilderVisitor(driver).build(metadata, errors); } var ROOT_SELECTOR = ''; var AnimationAstBuilderVisitor = /** @class */ (function () { function AnimationAstBuilderVisitor(_driver) { this._driver = _driver; } AnimationAstBuilderVisitor.prototype.build = function (metadata, errors) { var context = new AnimationAstBuilderContext(errors); this._resetContextStyleTimingState(context); return visitDslNode(this, normalizeAnimationEntry(metadata), context); }; AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState = function (context) { context.currentQuerySelector = ROOT_SELECTOR; context.collectedStyles = {}; context.collectedStyles[ROOT_SELECTOR] = {}; context.currentTime = 0; }; AnimationAstBuilderVisitor.prototype.visitTrigger = function (metadata, context) { var _this = this; var queryCount = context.queryCount = 0; var depCount = context.depCount = 0; var states = []; var transitions = []; if (metadata.name.charAt(0) == '@') { context.errors.push('animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))'); } metadata.definitions.forEach(function (def) { _this._resetContextStyleTimingState(context); if (def.type == 0 /* State */) { var stateDef_1 = def; var name_1 = stateDef_1.name; name_1.toString().split(/\s*,\s*/).forEach(function (n) { stateDef_1.name = n; states.push(_this.visitState(stateDef_1, context)); }); stateDef_1.name = name_1; } else if (def.type == 1 /* Transition */) { var transition = _this.visitTransition(def, context); queryCount += transition.queryCount; depCount += transition.depCount; transitions.push(transition); } else { context.errors.push('only state() and transition() definitions can sit inside of a trigger()'); } }); return { type: 7 /* Trigger */, name: metadata.name, states: states, transitions: transitions, queryCount: queryCount, depCount: depCount, options: null }; }; AnimationAstBuilderVisitor.prototype.visitState = function (metadata, context) { var styleAst = this.visitStyle(metadata.styles, context); var astParams = (metadata.options && metadata.options.params) || null; if (styleAst.containsDynamicStyles) { var missingSubs_1 = new Set(); var params_1 = astParams || {}; styleAst.styles.forEach(function (value) { if (isObject(value)) { var stylesObj_1 = value; Object.keys(stylesObj_1).forEach(function (prop) { extractStyleParams(stylesObj_1[prop]).forEach(function (sub) { if (!params_1.hasOwnProperty(sub)) { missingSubs_1.add(sub); } }); }); } }); if (missingSubs_1.size) { var missingSubsArr = iteratorToArray(missingSubs_1.values()); context.errors.push("state(\"" + metadata.name + "\", ...) must define default values for all the following style substitutions: " + missingSubsArr.join(', ')); } } return { type: 0 /* State */, name: metadata.name, style: styleAst, options: astParams ? { params: astParams } : null }; }; AnimationAstBuilderVisitor.prototype.visitTransition = function (metadata, context) { context.queryCount = 0; context.depCount = 0; var animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); var matchers = parseTransitionExpr(metadata.expr, context.errors); return { type: 1 /* Transition */, matchers: matchers, animation: animation, queryCount: context.queryCount, depCount: context.depCount, options: normalizeAnimationOptions(metadata.options) }; }; AnimationAstBuilderVisitor.prototype.visitSequence = function (metadata, context) { var _this = this; return { type: 2 /* Sequence */, steps: metadata.steps.map(function (s) { return visitDslNode(_this, s, context); }), options: normalizeAnimationOptions(metadata.options) }; }; AnimationAstBuilderVisitor.prototype.visitGroup = function (metadata, context) { var _this = this; var currentTime = context.currentTime; var furthestTime = 0; var steps = metadata.steps.map(function (step) { context.currentTime = currentTime; var innerAst = visitDslNode(_this, step, context); furthestTime = Math.max(furthestTime, context.currentTime); return innerAst; }); context.currentTime = furthestTime; return { type: 3 /* Group */, steps: steps, options: normalizeAnimationOptions(metadata.options) }; }; AnimationAstBuilderVisitor.prototype.visitAnimate = function (metadata, context) { var timingAst = constructTimingAst(metadata.timings, context.errors); context.currentAnimateTimings = timingAst; var styleAst; var styleMetadata = metadata.styles ? metadata.styles : Object(_angular_animations__WEBPACK_IMPORTED_MODULE_1__["style"])({}); if (styleMetadata.type == 5 /* Keyframes */) { styleAst = this.visitKeyframes(styleMetadata, context); } else { var styleMetadata_1 = metadata.styles; var isEmpty = false; if (!styleMetadata_1) { isEmpty = true; var newStyleData = {}; if (timingAst.easing) { newStyleData['easing'] = timingAst.easing; } styleMetadata_1 = Object(_angular_animations__WEBPACK_IMPORTED_MODULE_1__["style"])(newStyleData); } context.currentTime += timingAst.duration + timingAst.delay; var _styleAst = this.visitStyle(styleMetadata_1, context); _styleAst.isEmptyStep = isEmpty; styleAst = _styleAst; } context.currentAnimateTimings = null; return { type: 4 /* Animate */, timings: timingAst, style: styleAst, options: null }; }; AnimationAstBuilderVisitor.prototype.visitStyle = function (metadata, context) { var ast = this._makeStyleAst(metadata, context); this._validateStyleAst(ast, context); return ast; }; AnimationAstBuilderVisitor.prototype._makeStyleAst = function (metadata, context) { var styles = []; if (Array.isArray(metadata.styles)) { metadata.styles.forEach(function (styleTuple) { if (typeof styleTuple == 'string') { if (styleTuple == _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]) { styles.push(styleTuple); } else { context.errors.push("The provided style string value " + styleTuple + " is not allowed."); } } else { styles.push(styleTuple); } }); } else { styles.push(metadata.styles); } var containsDynamicStyles = false; var collectedEasing = null; styles.forEach(function (styleData) { if (isObject(styleData)) { var styleMap = styleData; var easing = styleMap['easing']; if (easing) { collectedEasing = easing; delete styleMap['easing']; } if (!containsDynamicStyles) { for (var prop in styleMap) { var value = styleMap[prop]; if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) { containsDynamicStyles = true; break; } } } } }); return { type: 6 /* Style */, styles: styles, easing: collectedEasing, offset: metadata.offset, containsDynamicStyles: containsDynamicStyles, options: null }; }; AnimationAstBuilderVisitor.prototype._validateStyleAst = function (ast, context) { var _this = this; var timings = context.currentAnimateTimings; var endTime = context.currentTime; var startTime = context.currentTime; if (timings && startTime > 0) { startTime -= timings.duration + timings.delay; } ast.styles.forEach(function (tuple) { if (typeof tuple == 'string') return; Object.keys(tuple).forEach(function (prop) { if (!_this._driver.validateStyleProperty(prop)) { context.errors.push("The provided animation property \"" + prop + "\" is not a supported CSS property for animations"); return; } var collectedStyles = context.collectedStyles[context.currentQuerySelector]; var collectedEntry = collectedStyles[prop]; var updateCollectedStyle = true; if (collectedEntry) { if (startTime != endTime && startTime >= collectedEntry.startTime && endTime <= collectedEntry.endTime) { context.errors.push("The CSS property \"" + prop + "\" that exists between the times of \"" + collectedEntry.startTime + "ms\" and \"" + collectedEntry.endTime + "ms\" is also being animated in a parallel animation between the times of \"" + startTime + "ms\" and \"" + endTime + "ms\""); updateCollectedStyle = false; } // we always choose the smaller start time value since we // want to have a record of the entire animation window where // the style property is being animated in between startTime = collectedEntry.startTime; } if (updateCollectedStyle) { collectedStyles[prop] = { startTime: startTime, endTime: endTime }; } if (context.options) { validateStyleParams(tuple[prop], context.options, context.errors); } }); }); }; AnimationAstBuilderVisitor.prototype.visitKeyframes = function (metadata, context) { var _this = this; var ast = { type: 5 /* Keyframes */, styles: [], options: null }; if (!context.currentAnimateTimings) { context.errors.push("keyframes() must be placed inside of a call to animate()"); return ast; } var MAX_KEYFRAME_OFFSET = 1; var totalKeyframesWithOffsets = 0; var offsets = []; var offsetsOutOfOrder = false; var keyframesOutOfRange = false; var previousOffset = 0; var keyframes = metadata.steps.map(function (styles) { var style$$1 = _this._makeStyleAst(styles, context); var offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles); var offset = 0; if (offsetVal != null) { totalKeyframesWithOffsets++; offset = style$$1.offset = offsetVal; } keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; previousOffset = offset; offsets.push(offset); return style$$1; }); if (keyframesOutOfRange) { context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"); } if (offsetsOutOfOrder) { context.errors.push("Please ensure that all keyframe offsets are in order"); } var length = metadata.steps.length; var generatedOffset = 0; if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { context.errors.push("Not all style() steps within the declared keyframes() contain offsets"); } else if (totalKeyframesWithOffsets == 0) { generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); } var limit = length - 1; var currentTime = context.currentTime; var currentAnimateTimings = context.currentAnimateTimings; var animateDuration = currentAnimateTimings.duration; keyframes.forEach(function (kf, i) { var offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i]; var durationUpToThisFrame = offset * animateDuration; context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; currentAnimateTimings.duration = durationUpToThisFrame; _this._validateStyleAst(kf, context); kf.offset = offset; ast.styles.push(kf); }); return ast; }; AnimationAstBuilderVisitor.prototype.visitReference = function (metadata, context) { return { type: 8 /* Reference */, animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), options: normalizeAnimationOptions(metadata.options) }; }; AnimationAstBuilderVisitor.prototype.visitAnimateChild = function (metadata, context) { context.depCount++; return { type: 9 /* AnimateChild */, options: normalizeAnimationOptions(metadata.options) }; }; AnimationAstBuilderVisitor.prototype.visitAnimateRef = function (metadata, context) { return { type: 10 /* AnimateRef */, animation: this.visitReference(metadata.animation, context), options: normalizeAnimationOptions(metadata.options) }; }; AnimationAstBuilderVisitor.prototype.visitQuery = function (metadata, context) { var parentSelector = context.currentQuerySelector; var options = (metadata.options || {}); context.queryCount++; context.currentQuery = metadata; var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(normalizeSelector(metadata.selector), 2), selector = _a[0], includeSelf = _a[1]; context.currentQuerySelector = parentSelector.length ? (parentSelector + ' ' + selector) : selector; getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {}); var animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); context.currentQuery = null; context.currentQuerySelector = parentSelector; return { type: 11 /* Query */, selector: selector, limit: options.limit || 0, optional: !!options.optional, includeSelf: includeSelf, animation: animation, originalSelector: metadata.selector, options: normalizeAnimationOptions(metadata.options) }; }; AnimationAstBuilderVisitor.prototype.visitStagger = function (metadata, context) { if (!context.currentQuery) { context.errors.push("stagger() can only be used inside of query()"); } var timings = metadata.timings === 'full' ? { duration: 0, delay: 0, easing: 'full' } : resolveTiming(metadata.timings, context.errors, true); return { type: 12 /* Stagger */, animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), timings: timings, options: null }; }; return AnimationAstBuilderVisitor; }()); function normalizeSelector(selector) { var hasAmpersand = selector.split(/\s*,\s*/).find(function (token) { return token == SELF_TOKEN; }) ? true : false; if (hasAmpersand) { selector = selector.replace(SELF_TOKEN_REGEX, ''); } // the :enter and :leave selectors are filled in at runtime during timeline building selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR) .replace(/@\w+/g, function (match) { return NG_TRIGGER_SELECTOR + '-' + match.substr(1); }) .replace(/:animating/g, NG_ANIMATING_SELECTOR); return [selector, hasAmpersand]; } function normalizeParams(obj) { return obj ? copyObj(obj) : null; } var AnimationAstBuilderContext = /** @class */ (function () { function AnimationAstBuilderContext(errors) { this.errors = errors; this.queryCount = 0; this.depCount = 0; this.currentTransition = null; this.currentQuery = null; this.currentQuerySelector = null; this.currentAnimateTimings = null; this.currentTime = 0; this.collectedStyles = {}; this.options = null; } return AnimationAstBuilderContext; }()); function consumeOffset(styles) { if (typeof styles == 'string') return null; var offset = null; if (Array.isArray(styles)) { styles.forEach(function (styleTuple) { if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) { var obj = styleTuple; offset = parseFloat(obj['offset']); delete obj['offset']; } }); } else if (isObject(styles) && styles.hasOwnProperty('offset')) { var obj = styles; offset = parseFloat(obj['offset']); delete obj['offset']; } return offset; } function isObject(value) { return !Array.isArray(value) && typeof value == 'object'; } function constructTimingAst(value, errors) { var timings = null; if (value.hasOwnProperty('duration')) { timings = value; } else if (typeof value == 'number') { var duration = resolveTiming(value, errors).duration; return makeTimingAst(duration, 0, ''); } var strValue = value; var isDynamic = strValue.split(/\s+/).some(function (v) { return v.charAt(0) == '{' && v.charAt(1) == '{'; }); if (isDynamic) { var ast = makeTimingAst(0, 0, ''); ast.dynamic = true; ast.strValue = strValue; return ast; } timings = timings || resolveTiming(strValue, errors); return makeTimingAst(timings.duration, timings.delay, timings.easing); } function normalizeAnimationOptions(options) { if (options) { options = copyObj(options); if (options['params']) { options['params'] = normalizeParams(options['params']); } } else { options = {}; } return options; } function makeTimingAst(duration, delay, easing) { return { duration: duration, delay: delay, easing: easing }; } function createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing, subTimeline) { if (easing === void 0) { easing = null; } if (subTimeline === void 0) { subTimeline = false; } return { type: 1 /* TimelineAnimation */, element: element, keyframes: keyframes, preStyleProps: preStyleProps, postStyleProps: postStyleProps, duration: duration, delay: delay, totalTime: duration + delay, easing: easing, subTimeline: subTimeline }; } var ElementInstructionMap = /** @class */ (function () { function ElementInstructionMap() { this._map = new Map(); } ElementInstructionMap.prototype.consume = function (element) { var instructions = this._map.get(element); if (instructions) { this._map.delete(element); } else { instructions = []; } return instructions; }; ElementInstructionMap.prototype.append = function (element, instructions) { var existingInstructions = this._map.get(element); if (!existingInstructions) { this._map.set(element, existingInstructions = []); } existingInstructions.push.apply(existingInstructions, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(instructions)); }; ElementInstructionMap.prototype.has = function (element) { return this._map.has(element); }; ElementInstructionMap.prototype.clear = function () { this._map.clear(); }; return ElementInstructionMap; }()); var ONE_FRAME_IN_MILLISECONDS = 1; var ENTER_TOKEN = ':enter'; var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g'); var LEAVE_TOKEN = ':leave'; var LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g'); /* * The code within this file aims to generate web-animations-compatible keyframes from Angular's * animation DSL code. * * The code below will be converted from: * * ``` * sequence([ * style({ opacity: 0 }), * animate(1000, style({ opacity: 0 })) * ]) * ``` * * To: * ``` * keyframes = [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }] * duration = 1000 * delay = 0 * easing = '' * ``` * * For this operation to cover the combination of animation verbs (style, animate, group, etc...) a * combination of prototypical inheritance, AST traversal and merge-sort-like algorithms are used. * * [AST Traversal] * Each of the animation verbs, when executed, will return an string-map object representing what * type of action it is (style, animate, group, etc...) and the data associated with it. This means * that when functional composition mix of these functions is evaluated (like in the example above) * then it will end up producing a tree of objects representing the animation itself. * * When this animation object tree is processed by the visitor code below it will visit each of the * verb statements within the visitor. And during each visit it will build the context of the * animation keyframes by interacting with the `TimelineBuilder`. * * [TimelineBuilder] * This class is responsible for tracking the styles and building a series of keyframe objects for a * timeline between a start and end time. The builder starts off with an initial timeline and each * time the AST comes across a `group()`, `keyframes()` or a combination of the two wihtin a * `sequence()` then it will generate a sub timeline for each step as well as a new one after * they are complete. * * As the AST is traversed, the timing state on each of the timelines will be incremented. If a sub * timeline was created (based on one of the cases above) then the parent timeline will attempt to * merge the styles used within the sub timelines into itself (only with group() this will happen). * This happens with a merge operation (much like how the merge works in mergesort) and it will only * copy the most recently used styles from the sub timelines into the parent timeline. This ensures * that if the styles are used later on in another phase of the animation then they will be the most * up-to-date values. * * [How Missing Styles Are Updated] * Each timeline has a `backFill` property which is responsible for filling in new styles into * already processed keyframes if a new style shows up later within the animation sequence. * * ``` * sequence([ * style({ width: 0 }), * animate(1000, style({ width: 100 })), * animate(1000, style({ width: 200 })), * animate(1000, style({ width: 300 })) * animate(1000, style({ width: 400, height: 400 })) // notice how `height` doesn't exist anywhere * else * ]) * ``` * * What is happening here is that the `height` value is added later in the sequence, but is missing * from all previous animation steps. Therefore when a keyframe is created it would also be missing * from all previous keyframes up until where it is first used. For the timeline keyframe generation * to properly fill in the style it will place the previous value (the value from the parent * timeline) or a default value of `*` into the backFill object. Given that each of the keyframe * styles are objects that prototypically inhert from the backFill object, this means that if a * value is added into the backFill then it will automatically propagate any missing values to all * keyframes. Therefore the missing `height` value will be properly filled into the already * processed keyframes. * * When a sub-timeline is created it will have its own backFill property. This is done so that * styles present within the sub-timeline do not accidentally seep into the previous/future timeline * keyframes * * (For prototypically-inherited contents to be detected a `for(i in obj)` loop must be used.) * * [Validation] * The code in this file is not responsible for validation. That functionality happens with within * the `AnimationValidatorVisitor` code. */ function buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) { if (startingStyles === void 0) { startingStyles = {}; } if (finalStyles === void 0) { finalStyles = {}; } if (errors === void 0) { errors = []; } return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors); } var AnimationTimelineBuilderVisitor = /** @class */ (function () { function AnimationTimelineBuilderVisitor() { } AnimationTimelineBuilderVisitor.prototype.buildKeyframes = function (driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) { if (errors === void 0) { errors = []; } subInstructions = subInstructions || new ElementInstructionMap(); var context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []); context.options = options; context.currentTimeline.setStyles([startingStyles], null, context.errors, options); visitDslNode(this, ast, context); // this checks to see if an actual animation happened var timelines = context.timelines.filter(function (timeline) { return timeline.containsAnimation(); }); if (timelines.length && Object.keys(finalStyles).length) { var tl = timelines[timelines.length - 1]; if (!tl.allowOnlyTimelineStyles()) { tl.setStyles([finalStyles], null, context.errors, options); } } return timelines.length ? timelines.map(function (timeline) { return timeline.buildKeyframes(); }) : [createTimelineInstruction(rootElement, [], [], [], 0, 0, '', false)]; }; AnimationTimelineBuilderVisitor.prototype.visitTrigger = function (ast, context) { // these values are not visited in this AST }; AnimationTimelineBuilderVisitor.prototype.visitState = function (ast, context) { // these values are not visited in this AST }; AnimationTimelineBuilderVisitor.prototype.visitTransition = function (ast, context) { // these values are not visited in this AST }; AnimationTimelineBuilderVisitor.prototype.visitAnimateChild = function (ast, context) { var elementInstructions = context.subInstructions.consume(context.element); if (elementInstructions) { var innerContext = context.createSubContext(ast.options); var startTime = context.currentTimeline.currentTime; var endTime = this._visitSubInstructions(elementInstructions, innerContext, innerContext.options); if (startTime != endTime) { // we do this on the upper context because we created a sub context for // the sub child animations context.transformIntoNewTimeline(endTime); } } context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype.visitAnimateRef = function (ast, context) { var innerContext = context.createSubContext(ast.options); innerContext.transformIntoNewTimeline(); this.visitReference(ast.animation, innerContext); context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime); context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype._visitSubInstructions = function (instructions, context, options) { var startTime = context.currentTimeline.currentTime; var furthestTime = startTime; // this is a special-case for when a user wants to skip a sub // animation from being fired entirely. var duration = options.duration != null ? resolveTimingValue(options.duration) : null; var delay = options.delay != null ? resolveTimingValue(options.delay) : null; if (duration !== 0) { instructions.forEach(function (instruction) { var instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay); furthestTime = Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay); }); } return furthestTime; }; AnimationTimelineBuilderVisitor.prototype.visitReference = function (ast, context) { context.updateOptions(ast.options, true); visitDslNode(this, ast.animation, context); context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype.visitSequence = function (ast, context) { var _this = this; var subContextCount = context.subContextCount; var ctx = context; var options = ast.options; if (options && (options.params || options.delay)) { ctx = context.createSubContext(options); ctx.transformIntoNewTimeline(); if (options.delay != null) { if (ctx.previousNode.type == 6 /* Style */) { ctx.currentTimeline.snapshotCurrentStyles(); ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } var delay = resolveTimingValue(options.delay); ctx.delayNextStep(delay); } } if (ast.steps.length) { ast.steps.forEach(function (s) { return visitDslNode(_this, s, ctx); }); // this is here just incase the inner steps only contain or end with a style() call ctx.currentTimeline.applyStylesToKeyframe(); // this means that some animation function within the sequence // ended up creating a sub timeline (which means the current // timeline cannot overlap with the contents of the sequence) if (ctx.subContextCount > subContextCount) { ctx.transformIntoNewTimeline(); } } context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype.visitGroup = function (ast, context) { var _this = this; var innerTimelines = []; var furthestTime = context.currentTimeline.currentTime; var delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0; ast.steps.forEach(function (s) { var innerContext = context.createSubContext(ast.options); if (delay) { innerContext.delayNextStep(delay); } visitDslNode(_this, s, innerContext); furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime); innerTimelines.push(innerContext.currentTimeline); }); // this operation is run after the AST loop because otherwise // if the parent timeline's collected styles were updated then // it would pass in invalid data into the new-to-be forked items innerTimelines.forEach(function (timeline) { return context.currentTimeline.mergeTimelineCollectedStyles(timeline); }); context.transformIntoNewTimeline(furthestTime); context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype._visitTiming = function (ast, context) { if (ast.dynamic) { var strValue = ast.strValue; var timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue; return resolveTiming(timingValue, context.errors); } else { return { duration: ast.duration, delay: ast.delay, easing: ast.easing }; } }; AnimationTimelineBuilderVisitor.prototype.visitAnimate = function (ast, context) { var timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context); var timeline = context.currentTimeline; if (timings.delay) { context.incrementTime(timings.delay); timeline.snapshotCurrentStyles(); } var style$$1 = ast.style; if (style$$1.type == 5 /* Keyframes */) { this.visitKeyframes(style$$1, context); } else { context.incrementTime(timings.duration); this.visitStyle(style$$1, context); timeline.applyStylesToKeyframe(); } context.currentAnimateTimings = null; context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype.visitStyle = function (ast, context) { var timeline = context.currentTimeline; var timings = context.currentAnimateTimings; // this is a special case for when a style() call // directly follows an animate() call (but not inside of an animate() call) if (!timings && timeline.getCurrentStyleProperties().length) { timeline.forwardFrame(); } var easing = (timings && timings.easing) || ast.easing; if (ast.isEmptyStep) { timeline.applyEmptyStep(easing); } else { timeline.setStyles(ast.styles, easing, context.errors, context.options); } context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype.visitKeyframes = function (ast, context) { var currentAnimateTimings = context.currentAnimateTimings; var startTime = (context.currentTimeline).duration; var duration = currentAnimateTimings.duration; var innerContext = context.createSubContext(); var innerTimeline = innerContext.currentTimeline; innerTimeline.easing = currentAnimateTimings.easing; ast.styles.forEach(function (step) { var offset = step.offset || 0; innerTimeline.forwardTime(offset * duration); innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options); innerTimeline.applyStylesToKeyframe(); }); // this will ensure that the parent timeline gets all the styles from // the child even if the new timeline below is not used context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline); // we do this because the window between this timeline and the sub timeline // should ensure that the styles within are exactly the same as they were before context.transformIntoNewTimeline(startTime + duration); context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype.visitQuery = function (ast, context) { var _this = this; // in the event that the first step before this is a style step we need // to ensure the styles are applied before the children are animated var startTime = context.currentTimeline.currentTime; var options = (ast.options || {}); var delay = options.delay ? resolveTimingValue(options.delay) : 0; if (delay && (context.previousNode.type === 6 /* Style */ || (startTime == 0 && context.currentTimeline.getCurrentStyleProperties().length))) { context.currentTimeline.snapshotCurrentStyles(); context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } var furthestTime = startTime; var elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors); context.currentQueryTotal = elms.length; var sameElementTimeline = null; elms.forEach(function (element, i) { context.currentQueryIndex = i; var innerContext = context.createSubContext(ast.options, element); if (delay) { innerContext.delayNextStep(delay); } if (element === context.element) { sameElementTimeline = innerContext.currentTimeline; } visitDslNode(_this, ast.animation, innerContext); // this is here just incase the inner steps only contain or end // with a style() call (which is here to signal that this is a preparatory // call to style an element before it is animated again) innerContext.currentTimeline.applyStylesToKeyframe(); var endTime = innerContext.currentTimeline.currentTime; furthestTime = Math.max(furthestTime, endTime); }); context.currentQueryIndex = 0; context.currentQueryTotal = 0; context.transformIntoNewTimeline(furthestTime); if (sameElementTimeline) { context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline); context.currentTimeline.snapshotCurrentStyles(); } context.previousNode = ast; }; AnimationTimelineBuilderVisitor.prototype.visitStagger = function (ast, context) { var parentContext = context.parentContext; var tl = context.currentTimeline; var timings = ast.timings; var duration = Math.abs(timings.duration); var maxTime = duration * (context.currentQueryTotal - 1); var delay = duration * context.currentQueryIndex; var staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing; switch (staggerTransformer) { case 'reverse': delay = maxTime - delay; break; case 'full': delay = parentContext.currentStaggerTime; break; } var timeline = context.currentTimeline; if (delay) { timeline.delayNextStep(delay); } var startingTime = timeline.currentTime; visitDslNode(this, ast.animation, context); context.previousNode = ast; // time = duration + delay // the reason why this computation is so complex is because // the inner timeline may either have a delay value or a stretched // keyframe depending on if a subtimeline is not used or is used. parentContext.currentStaggerTime = (tl.currentTime - startingTime) + (tl.startTime - parentContext.currentTimeline.startTime); }; return AnimationTimelineBuilderVisitor; }()); var DEFAULT_NOOP_PREVIOUS_NODE = {}; var AnimationTimelineContext = /** @class */ (function () { function AnimationTimelineContext(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) { this._driver = _driver; this.element = element; this.subInstructions = subInstructions; this._enterClassName = _enterClassName; this._leaveClassName = _leaveClassName; this.errors = errors; this.timelines = timelines; this.parentContext = null; this.currentAnimateTimings = null; this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; this.subContextCount = 0; this.options = {}; this.currentQueryIndex = 0; this.currentQueryTotal = 0; this.currentStaggerTime = 0; this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0); timelines.push(this.currentTimeline); } Object.defineProperty(AnimationTimelineContext.prototype, "params", { get: function () { return this.options.params; }, enumerable: true, configurable: true }); AnimationTimelineContext.prototype.updateOptions = function (options, skipIfExists) { var _this = this; if (!options) return; var newOptions = options; var optionsToUpdate = this.options; // NOTE: this will get patched up when other animation methods support duration overrides if (newOptions.duration != null) { optionsToUpdate.duration = resolveTimingValue(newOptions.duration); } if (newOptions.delay != null) { optionsToUpdate.delay = resolveTimingValue(newOptions.delay); } var newParams = newOptions.params; if (newParams) { var paramsToUpdate_1 = optionsToUpdate.params; if (!paramsToUpdate_1) { paramsToUpdate_1 = this.options.params = {}; } Object.keys(newParams).forEach(function (name) { if (!skipIfExists || !paramsToUpdate_1.hasOwnProperty(name)) { paramsToUpdate_1[name] = interpolateParams(newParams[name], paramsToUpdate_1, _this.errors); } }); } }; AnimationTimelineContext.prototype._copyOptions = function () { var options = {}; if (this.options) { var oldParams_1 = this.options.params; if (oldParams_1) { var params_1 = options['params'] = {}; Object.keys(oldParams_1).forEach(function (name) { params_1[name] = oldParams_1[name]; }); } } return options; }; AnimationTimelineContext.prototype.createSubContext = function (options, element, newTime) { if (options === void 0) { options = null; } var target = element || this.element; var context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0)); context.previousNode = this.previousNode; context.currentAnimateTimings = this.currentAnimateTimings; context.options = this._copyOptions(); context.updateOptions(options); context.currentQueryIndex = this.currentQueryIndex; context.currentQueryTotal = this.currentQueryTotal; context.parentContext = this; this.subContextCount++; return context; }; AnimationTimelineContext.prototype.transformIntoNewTimeline = function (newTime) { this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; this.currentTimeline = this.currentTimeline.fork(this.element, newTime); this.timelines.push(this.currentTimeline); return this.currentTimeline; }; AnimationTimelineContext.prototype.appendInstructionToTimeline = function (instruction, duration, delay) { var updatedTimings = { duration: duration != null ? duration : instruction.duration, delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay, easing: '' }; var builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); this.timelines.push(builder); return updatedTimings; }; AnimationTimelineContext.prototype.incrementTime = function (time) { this.currentTimeline.forwardTime(this.currentTimeline.duration + time); }; AnimationTimelineContext.prototype.delayNextStep = function (delay) { // negative delays are not yet supported if (delay > 0) { this.currentTimeline.delayNextStep(delay); } }; AnimationTimelineContext.prototype.invokeQuery = function (selector, originalSelector, limit, includeSelf, optional, errors) { var results = []; if (includeSelf) { results.push(this.element); } if (selector.length > 0) { // if :self is only used then the selector is empty selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName); selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName); var multi = limit != 1; var elements = this._driver.query(this.element, selector, multi); if (limit !== 0) { elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) : elements.slice(0, limit); } results.push.apply(results, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(elements)); } if (!optional && results.length == 0) { errors.push("`query(\"" + originalSelector + "\")` returned zero elements. (Use `query(\"" + originalSelector + "\", { optional: true })` if you wish to allow this.)"); } return results; }; return AnimationTimelineContext; }()); var TimelineBuilder = /** @class */ (function () { function TimelineBuilder(_driver, element, startTime, _elementTimelineStylesLookup) { this._driver = _driver; this.element = element; this.startTime = startTime; this._elementTimelineStylesLookup = _elementTimelineStylesLookup; this.duration = 0; this._previousKeyframe = {}; this._currentKeyframe = {}; this._keyframes = new Map(); this._styleSummary = {}; this._pendingStyles = {}; this._backFill = {}; this._currentEmptyStepKeyframe = null; if (!this._elementTimelineStylesLookup) { this._elementTimelineStylesLookup = new Map(); } this._localTimelineStyles = Object.create(this._backFill, {}); this._globalTimelineStyles = this._elementTimelineStylesLookup.get(element); if (!this._globalTimelineStyles) { this._globalTimelineStyles = this._localTimelineStyles; this._elementTimelineStylesLookup.set(element, this._localTimelineStyles); } this._loadKeyframe(); } TimelineBuilder.prototype.containsAnimation = function () { switch (this._keyframes.size) { case 0: return false; case 1: return this.getCurrentStyleProperties().length > 0; default: return true; } }; TimelineBuilder.prototype.getCurrentStyleProperties = function () { return Object.keys(this._currentKeyframe); }; Object.defineProperty(TimelineBuilder.prototype, "currentTime", { get: function () { return this.startTime + this.duration; }, enumerable: true, configurable: true }); TimelineBuilder.prototype.delayNextStep = function (delay) { // in the event that a style() step is placed right before a stagger() // and that style() step is the very first style() value in the animation // then we need to make a copy of the keyframe [0, copy, 1] so that the delay // properly applies the style() values to work with the stagger... var hasPreStyleStep = this._keyframes.size == 1 && Object.keys(this._pendingStyles).length; if (this.duration || hasPreStyleStep) { this.forwardTime(this.currentTime + delay); if (hasPreStyleStep) { this.snapshotCurrentStyles(); } } else { this.startTime += delay; } }; TimelineBuilder.prototype.fork = function (element, currentTime) { this.applyStylesToKeyframe(); return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup); }; TimelineBuilder.prototype._loadKeyframe = function () { if (this._currentKeyframe) { this._previousKeyframe = this._currentKeyframe; } this._currentKeyframe = this._keyframes.get(this.duration); if (!this._currentKeyframe) { this._currentKeyframe = Object.create(this._backFill, {}); this._keyframes.set(this.duration, this._currentKeyframe); } }; TimelineBuilder.prototype.forwardFrame = function () { this.duration += ONE_FRAME_IN_MILLISECONDS; this._loadKeyframe(); }; TimelineBuilder.prototype.forwardTime = function (time) { this.applyStylesToKeyframe(); this.duration = time; this._loadKeyframe(); }; TimelineBuilder.prototype._updateStyle = function (prop, value) { this._localTimelineStyles[prop] = value; this._globalTimelineStyles[prop] = value; this._styleSummary[prop] = { time: this.currentTime, value: value }; }; TimelineBuilder.prototype.allowOnlyTimelineStyles = function () { return this._currentEmptyStepKeyframe !== this._currentKeyframe; }; TimelineBuilder.prototype.applyEmptyStep = function (easing) { var _this = this; if (easing) { this._previousKeyframe['easing'] = easing; } // special case for animate(duration): // all missing styles are filled with a `*` value then // if any destination styles are filled in later on the same // keyframe then they will override the overridden styles // We use `_globalTimelineStyles` here because there may be // styles in previous keyframes that are not present in this timeline Object.keys(this._globalTimelineStyles).forEach(function (prop) { _this._backFill[prop] = _this._globalTimelineStyles[prop] || _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]; _this._currentKeyframe[prop] = _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]; }); this._currentEmptyStepKeyframe = this._currentKeyframe; }; TimelineBuilder.prototype.setStyles = function (input, easing, errors, options) { var _this = this; if (easing) { this._previousKeyframe['easing'] = easing; } var params = (options && options.params) || {}; var styles = flattenStyles(input, this._globalTimelineStyles); Object.keys(styles).forEach(function (prop) { var val = interpolateParams(styles[prop], params, errors); _this._pendingStyles[prop] = val; if (!_this._localTimelineStyles.hasOwnProperty(prop)) { _this._backFill[prop] = _this._globalTimelineStyles.hasOwnProperty(prop) ? _this._globalTimelineStyles[prop] : _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]; } _this._updateStyle(prop, val); }); }; TimelineBuilder.prototype.applyStylesToKeyframe = function () { var _this = this; var styles = this._pendingStyles; var props = Object.keys(styles); if (props.length == 0) return; this._pendingStyles = {}; props.forEach(function (prop) { var val = styles[prop]; _this._currentKeyframe[prop] = val; }); Object.keys(this._localTimelineStyles).forEach(function (prop) { if (!_this._currentKeyframe.hasOwnProperty(prop)) { _this._currentKeyframe[prop] = _this._localTimelineStyles[prop]; } }); }; TimelineBuilder.prototype.snapshotCurrentStyles = function () { var _this = this; Object.keys(this._localTimelineStyles).forEach(function (prop) { var val = _this._localTimelineStyles[prop]; _this._pendingStyles[prop] = val; _this._updateStyle(prop, val); }); }; TimelineBuilder.prototype.getFinalKeyframe = function () { return this._keyframes.get(this.duration); }; Object.defineProperty(TimelineBuilder.prototype, "properties", { get: function () { var properties = []; for (var prop in this._currentKeyframe) { properties.push(prop); } return properties; }, enumerable: true, configurable: true }); TimelineBuilder.prototype.mergeTimelineCollectedStyles = function (timeline) { var _this = this; Object.keys(timeline._styleSummary).forEach(function (prop) { var details0 = _this._styleSummary[prop]; var details1 = timeline._styleSummary[prop]; if (!details0 || details1.time > details0.time) { _this._updateStyle(prop, details1.value); } }); }; TimelineBuilder.prototype.buildKeyframes = function () { var _this = this; this.applyStylesToKeyframe(); var preStyleProps = new Set(); var postStyleProps = new Set(); var isEmpty = this._keyframes.size === 1 && this.duration === 0; var finalKeyframes = []; this._keyframes.forEach(function (keyframe, time) { var finalKeyframe = copyStyles(keyframe, true); Object.keys(finalKeyframe).forEach(function (prop) { var value = finalKeyframe[prop]; if (value == _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵPRE_STYLE"]) { preStyleProps.add(prop); } else if (value == _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]) { postStyleProps.add(prop); } }); if (!isEmpty) { finalKeyframe['offset'] = time / _this.duration; } finalKeyframes.push(finalKeyframe); }); var preProps = preStyleProps.size ? iteratorToArray(preStyleProps.values()) : []; var postProps = postStyleProps.size ? iteratorToArray(postStyleProps.values()) : []; // special case for a 0-second animation (which is designed just to place styles onscreen) if (isEmpty) { var kf0 = finalKeyframes[0]; var kf1 = copyObj(kf0); kf0['offset'] = 0; kf1['offset'] = 1; finalKeyframes = [kf0, kf1]; } return createTimelineInstruction(this.element, finalKeyframes, preProps, postProps, this.duration, this.startTime, this.easing, false); }; return TimelineBuilder; }()); var SubTimelineBuilder = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SubTimelineBuilder, _super); function SubTimelineBuilder(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe) { if (_stretchStartingKeyframe === void 0) { _stretchStartingKeyframe = false; } var _this = _super.call(this, driver, element, timings.delay) || this; _this.element = element; _this.keyframes = keyframes; _this.preStyleProps = preStyleProps; _this.postStyleProps = postStyleProps; _this._stretchStartingKeyframe = _stretchStartingKeyframe; _this.timings = { duration: timings.duration, delay: timings.delay, easing: timings.easing }; return _this; } SubTimelineBuilder.prototype.containsAnimation = function () { return this.keyframes.length > 1; }; SubTimelineBuilder.prototype.buildKeyframes = function () { var keyframes = this.keyframes; var _a = this.timings, delay = _a.delay, duration = _a.duration, easing = _a.easing; if (this._stretchStartingKeyframe && delay) { var newKeyframes = []; var totalTime = duration + delay; var startingGap = delay / totalTime; // the original starting keyframe now starts once the delay is done var newFirstKeyframe = copyStyles(keyframes[0], false); newFirstKeyframe['offset'] = 0; newKeyframes.push(newFirstKeyframe); var oldFirstKeyframe = copyStyles(keyframes[0], false); oldFirstKeyframe['offset'] = roundOffset(startingGap); newKeyframes.push(oldFirstKeyframe); /* When the keyframe is stretched then it means that the delay before the animation starts is gone. Instead the first keyframe is placed at the start of the animation and it is then copied to where it starts when the original delay is over. This basically means nothing animates during that delay, but the styles are still renderered. For this to work the original offset values that exist in the original keyframes must be "warped" so that they can take the new keyframe + delay into account. delay=1000, duration=1000, keyframes = 0 .5 1 turns into delay=0, duration=2000, keyframes = 0 .33 .66 1 */ // offsets between 1 ... n -1 are all warped by the keyframe stretch var limit = keyframes.length - 1; for (var i = 1; i <= limit; i++) { var kf = copyStyles(keyframes[i], false); var oldOffset = kf['offset']; var timeAtKeyframe = delay + oldOffset * duration; kf['offset'] = roundOffset(timeAtKeyframe / totalTime); newKeyframes.push(kf); } // the new starting keyframe should be added at the start duration = totalTime; delay = 0; easing = ''; keyframes = newKeyframes; } return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true); }; return SubTimelineBuilder; }(TimelineBuilder)); function roundOffset(offset, decimalPoints) { if (decimalPoints === void 0) { decimalPoints = 3; } var mult = Math.pow(10, decimalPoints - 1); return Math.round(offset * mult) / mult; } function flattenStyles(input, allStyles) { var styles = {}; var allProperties; input.forEach(function (token) { if (token === '*') { allProperties = allProperties || Object.keys(allStyles); allProperties.forEach(function (prop) { styles[prop] = _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]; }); } else { copyStyles(token, false, styles); } }); return styles; } var Animation = /** @class */ (function () { function Animation(_driver, input) { this._driver = _driver; var errors = []; var ast = buildAnimationAst(_driver, input, errors); if (errors.length) { var errorMessage = "animation validation failed:\n" + errors.join("\n"); throw new Error(errorMessage); } this._animationAst = ast; } Animation.prototype.buildTimelines = function (element, startingStyles, destinationStyles, options, subInstructions) { var start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : startingStyles; var dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : destinationStyles; var errors = []; subInstructions = subInstructions || new ElementInstructionMap(); var result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors); if (errors.length) { var errorMessage = "animation building failed:\n" + errors.join("\n"); throw new Error(errorMessage); } return result; }; return Animation; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @publicApi */ var AnimationStyleNormalizer = /** @class */ (function () { function AnimationStyleNormalizer() { } return AnimationStyleNormalizer; }()); /** * @publicApi */ var NoopAnimationStyleNormalizer = /** @class */ (function () { function NoopAnimationStyleNormalizer() { } NoopAnimationStyleNormalizer.prototype.normalizePropertyName = function (propertyName, errors) { return propertyName; }; NoopAnimationStyleNormalizer.prototype.normalizeStyleValue = function (userProvidedProperty, normalizedProperty, value, errors) { return value; }; return NoopAnimationStyleNormalizer; }()); var WebAnimationsStyleNormalizer = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WebAnimationsStyleNormalizer, _super); function WebAnimationsStyleNormalizer() { return _super !== null && _super.apply(this, arguments) || this; } WebAnimationsStyleNormalizer.prototype.normalizePropertyName = function (propertyName, errors) { return dashCaseToCamelCase(propertyName); }; WebAnimationsStyleNormalizer.prototype.normalizeStyleValue = function (userProvidedProperty, normalizedProperty, value, errors) { var unit = ''; var strVal = value.toString().trim(); if (DIMENSIONAL_PROP_MAP[normalizedProperty] && value !== 0 && value !== '0') { if (typeof value === 'number') { unit = 'px'; } else { var valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/); if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { errors.push("Please provide a CSS unit value for " + userProvidedProperty + ":" + value); } } } return strVal + unit; }; return WebAnimationsStyleNormalizer; }(AnimationStyleNormalizer)); var DIMENSIONAL_PROP_MAP = makeBooleanMap('width,height,minWidth,minHeight,maxWidth,maxHeight,left,top,bottom,right,fontSize,outlineWidth,outlineOffset,paddingTop,paddingLeft,paddingBottom,paddingRight,marginTop,marginLeft,marginBottom,marginRight,borderRadius,borderWidth,borderTopWidth,borderLeftWidth,borderRightWidth,borderBottomWidth,textIndent,perspective' .split(',')); function makeBooleanMap(keys) { var map = {}; keys.forEach(function (key) { return map[key] = true; }); return map; } function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, totalTime, errors) { return { type: 0 /* TransitionAnimation */, element: element, triggerName: triggerName, isRemovalTransition: isRemovalTransition, fromState: fromState, fromStyles: fromStyles, toState: toState, toStyles: toStyles, timelines: timelines, queriedElements: queriedElements, preStyleProps: preStyleProps, postStyleProps: postStyleProps, totalTime: totalTime, errors: errors }; } var EMPTY_OBJECT = {}; var AnimationTransitionFactory = /** @class */ (function () { function AnimationTransitionFactory(_triggerName, ast, _stateStyles) { this._triggerName = _triggerName; this.ast = ast; this._stateStyles = _stateStyles; } AnimationTransitionFactory.prototype.match = function (currentState, nextState, element, params) { return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState, element, params); }; AnimationTransitionFactory.prototype.buildStyles = function (stateName, params, errors) { var backupStateStyler = this._stateStyles['*']; var stateStyler = this._stateStyles[stateName]; var backupStyles = backupStateStyler ? backupStateStyler.buildStyles(params, errors) : {}; return stateStyler ? stateStyler.buildStyles(params, errors) : backupStyles; }; AnimationTransitionFactory.prototype.build = function (driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions, skipAstBuild) { var errors = []; var transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT; var currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT; var currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors); var nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT; var nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors); var queriedElements = new Set(); var preStyleMap = new Map(); var postStyleMap = new Map(); var isRemoval = nextState === 'void'; var animationOptions = { params: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, transitionAnimationParams, nextAnimationParams) }; var timelines = skipAstBuild ? [] : buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors); var totalTime = 0; timelines.forEach(function (tl) { totalTime = Math.max(tl.duration + tl.delay, totalTime); }); if (errors.length) { return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, totalTime, errors); } timelines.forEach(function (tl) { var elm = tl.element; var preProps = getOrSetAsInMap(preStyleMap, elm, {}); tl.preStyleProps.forEach(function (prop) { return preProps[prop] = true; }); var postProps = getOrSetAsInMap(postStyleMap, elm, {}); tl.postStyleProps.forEach(function (prop) { return postProps[prop] = true; }); if (elm !== element) { queriedElements.add(elm); } }); var queriedElementsList = iteratorToArray(queriedElements.values()); return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, queriedElementsList, preStyleMap, postStyleMap, totalTime); }; return AnimationTransitionFactory; }()); function oneOrMoreTransitionsMatch(matchFns, currentState, nextState, element, params) { return matchFns.some(function (fn) { return fn(currentState, nextState, element, params); }); } var AnimationStateStyles = /** @class */ (function () { function AnimationStateStyles(styles, defaultParams) { this.styles = styles; this.defaultParams = defaultParams; } AnimationStateStyles.prototype.buildStyles = function (params, errors) { var finalStyles = {}; var combinedParams = copyObj(this.defaultParams); Object.keys(params).forEach(function (key) { var value = params[key]; if (value != null) { combinedParams[key] = value; } }); this.styles.styles.forEach(function (value) { if (typeof value !== 'string') { var styleObj_1 = value; Object.keys(styleObj_1).forEach(function (prop) { var val = styleObj_1[prop]; if (val.length > 1) { val = interpolateParams(val, combinedParams, errors); } finalStyles[prop] = val; }); } }); return finalStyles; }; return AnimationStateStyles; }()); /** * @publicApi */ function buildTrigger(name, ast) { return new AnimationTrigger(name, ast); } /** * @publicApi */ var AnimationTrigger = /** @class */ (function () { function AnimationTrigger(name, ast) { var _this = this; this.name = name; this.ast = ast; this.transitionFactories = []; this.states = {}; ast.states.forEach(function (ast) { var defaultParams = (ast.options && ast.options.params) || {}; _this.states[ast.name] = new AnimationStateStyles(ast.style, defaultParams); }); balanceProperties(this.states, 'true', '1'); balanceProperties(this.states, 'false', '0'); ast.transitions.forEach(function (ast) { _this.transitionFactories.push(new AnimationTransitionFactory(name, ast, _this.states)); }); this.fallbackTransition = createFallbackTransition(name, this.states); } Object.defineProperty(AnimationTrigger.prototype, "containsQueries", { get: function () { return this.ast.queryCount > 0; }, enumerable: true, configurable: true }); AnimationTrigger.prototype.matchTransition = function (currentState, nextState, element, params) { var entry = this.transitionFactories.find(function (f) { return f.match(currentState, nextState, element, params); }); return entry || null; }; AnimationTrigger.prototype.matchStyles = function (currentState, params, errors) { return this.fallbackTransition.buildStyles(currentState, params, errors); }; return AnimationTrigger; }()); function createFallbackTransition(triggerName, states) { var matchers = [function (fromState, toState) { return true; }]; var animation = { type: 2 /* Sequence */, steps: [], options: null }; var transition = { type: 1 /* Transition */, animation: animation, matchers: matchers, options: null, queryCount: 0, depCount: 0 }; return new AnimationTransitionFactory(triggerName, transition, states); } function balanceProperties(obj, key1, key2) { if (obj.hasOwnProperty(key1)) { if (!obj.hasOwnProperty(key2)) { obj[key2] = obj[key1]; } } else if (obj.hasOwnProperty(key2)) { obj[key1] = obj[key2]; } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var EMPTY_INSTRUCTION_MAP = new ElementInstructionMap(); var TimelineAnimationEngine = /** @class */ (function () { function TimelineAnimationEngine(bodyNode, _driver, _normalizer) { this.bodyNode = bodyNode; this._driver = _driver; this._normalizer = _normalizer; this._animations = {}; this._playersById = {}; this.players = []; } TimelineAnimationEngine.prototype.register = function (id, metadata) { var errors = []; var ast = buildAnimationAst(this._driver, metadata, errors); if (errors.length) { throw new Error("Unable to build the animation due to the following errors: " + errors.join("\n")); } else { this._animations[id] = ast; } }; TimelineAnimationEngine.prototype._buildPlayer = function (i, preStyles, postStyles) { var element = i.element; var keyframes = normalizeKeyframes(this._driver, this._normalizer, element, i.keyframes, preStyles, postStyles); return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, [], true); }; TimelineAnimationEngine.prototype.create = function (id, element, options) { var _this = this; if (options === void 0) { options = {}; } var errors = []; var ast = this._animations[id]; var instructions; var autoStylesMap = new Map(); if (ast) { instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, {}, {}, options, EMPTY_INSTRUCTION_MAP, errors); instructions.forEach(function (inst) { var styles = getOrSetAsInMap(autoStylesMap, inst.element, {}); inst.postStyleProps.forEach(function (prop) { return styles[prop] = null; }); }); } else { errors.push('The requested animation doesn\'t exist or has already been destroyed'); instructions = []; } if (errors.length) { throw new Error("Unable to create the animation due to the following errors: " + errors.join("\n")); } autoStylesMap.forEach(function (styles, element) { Object.keys(styles).forEach(function (prop) { styles[prop] = _this._driver.computeStyle(element, prop, _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]); }); }); var players = instructions.map(function (i) { var styles = autoStylesMap.get(i.element); return _this._buildPlayer(i, {}, styles); }); var player = optimizeGroupPlayer(players); this._playersById[id] = player; player.onDestroy(function () { return _this.destroy(id); }); this.players.push(player); return player; }; TimelineAnimationEngine.prototype.destroy = function (id) { var player = this._getPlayer(id); player.destroy(); delete this._playersById[id]; var index = this.players.indexOf(player); if (index >= 0) { this.players.splice(index, 1); } }; TimelineAnimationEngine.prototype._getPlayer = function (id) { var player = this._playersById[id]; if (!player) { throw new Error("Unable to find the timeline player referenced by " + id); } return player; }; TimelineAnimationEngine.prototype.listen = function (id, element, eventName, callback) { // triggerName, fromState, toState are all ignored for timeline animations var baseEvent = makeAnimationEvent(element, '', '', ''); listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback); return function () { }; }; TimelineAnimationEngine.prototype.command = function (id, element, command, args) { if (command == 'register') { this.register(id, args[0]); return; } if (command == 'create') { var options = (args[0] || {}); this.create(id, element, options); return; } var player = this._getPlayer(id); switch (command) { case 'play': player.play(); break; case 'pause': player.pause(); break; case 'reset': player.reset(); break; case 'restart': player.restart(); break; case 'finish': player.finish(); break; case 'init': player.init(); break; case 'setPosition': player.setPosition(parseFloat(args[0])); break; case 'destroy': this.destroy(id); break; } }; return TimelineAnimationEngine; }()); var QUEUED_CLASSNAME = 'ng-animate-queued'; var QUEUED_SELECTOR = '.ng-animate-queued'; var DISABLED_CLASSNAME = 'ng-animate-disabled'; var DISABLED_SELECTOR = '.ng-animate-disabled'; var STAR_CLASSNAME = 'ng-star-inserted'; var STAR_SELECTOR = '.ng-star-inserted'; var EMPTY_PLAYER_ARRAY = []; var NULL_REMOVAL_STATE = { namespaceId: '', setForRemoval: false, setForMove: false, hasAnimation: false, removedBeforeQueried: false }; var NULL_REMOVED_QUERIED_STATE = { namespaceId: '', setForMove: false, setForRemoval: false, hasAnimation: false, removedBeforeQueried: true }; var REMOVAL_FLAG = '__ng_removed'; var StateValue = /** @class */ (function () { function StateValue(input, namespaceId) { if (namespaceId === void 0) { namespaceId = ''; } this.namespaceId = namespaceId; var isObj = input && input.hasOwnProperty('value'); var value = isObj ? input['value'] : input; this.value = normalizeTriggerValue(value); if (isObj) { var options = copyObj(input); delete options['value']; this.options = options; } else { this.options = {}; } if (!this.options.params) { this.options.params = {}; } } Object.defineProperty(StateValue.prototype, "params", { get: function () { return this.options.params; }, enumerable: true, configurable: true }); StateValue.prototype.absorbOptions = function (options) { var newParams = options.params; if (newParams) { var oldParams_1 = this.options.params; Object.keys(newParams).forEach(function (prop) { if (oldParams_1[prop] == null) { oldParams_1[prop] = newParams[prop]; } }); } }; return StateValue; }()); var VOID_VALUE = 'void'; var DEFAULT_STATE_VALUE = new StateValue(VOID_VALUE); var AnimationTransitionNamespace = /** @class */ (function () { function AnimationTransitionNamespace(id, hostElement, _engine) { this.id = id; this.hostElement = hostElement; this._engine = _engine; this.players = []; this._triggers = {}; this._queue = []; this._elementListeners = new Map(); this._hostClassName = 'ng-tns-' + id; addClass(hostElement, this._hostClassName); } AnimationTransitionNamespace.prototype.listen = function (element, name, phase, callback) { var _this = this; if (!this._triggers.hasOwnProperty(name)) { throw new Error("Unable to listen on the animation trigger event \"" + phase + "\" because the animation trigger \"" + name + "\" doesn't exist!"); } if (phase == null || phase.length == 0) { throw new Error("Unable to listen on the animation trigger \"" + name + "\" because the provided event is undefined!"); } if (!isTriggerEventValid(phase)) { throw new Error("The provided animation trigger event \"" + phase + "\" for the animation trigger \"" + name + "\" is not supported!"); } var listeners = getOrSetAsInMap(this._elementListeners, element, []); var data = { name: name, phase: phase, callback: callback }; listeners.push(data); var triggersWithStates = getOrSetAsInMap(this._engine.statesByElement, element, {}); if (!triggersWithStates.hasOwnProperty(name)) { addClass(element, NG_TRIGGER_CLASSNAME); addClass(element, NG_TRIGGER_CLASSNAME + '-' + name); triggersWithStates[name] = DEFAULT_STATE_VALUE; } return function () { // the event listener is removed AFTER the flush has occurred such // that leave animations callbacks can fire (otherwise if the node // is removed in between then the listeners would be deregistered) _this._engine.afterFlush(function () { var index = listeners.indexOf(data); if (index >= 0) { listeners.splice(index, 1); } if (!_this._triggers[name]) { delete triggersWithStates[name]; } }); }; }; AnimationTransitionNamespace.prototype.register = function (name, ast) { if (this._triggers[name]) { // throw return false; } else { this._triggers[name] = ast; return true; } }; AnimationTransitionNamespace.prototype._getTrigger = function (name) { var trigger = this._triggers[name]; if (!trigger) { throw new Error("The provided animation trigger \"" + name + "\" has not been registered!"); } return trigger; }; AnimationTransitionNamespace.prototype.trigger = function (element, triggerName, value, defaultToFallback) { var _this = this; if (defaultToFallback === void 0) { defaultToFallback = true; } var trigger = this._getTrigger(triggerName); var player = new TransitionAnimationPlayer(this.id, triggerName, element); var triggersWithStates = this._engine.statesByElement.get(element); if (!triggersWithStates) { addClass(element, NG_TRIGGER_CLASSNAME); addClass(element, NG_TRIGGER_CLASSNAME + '-' + triggerName); this._engine.statesByElement.set(element, triggersWithStates = {}); } var fromState = triggersWithStates[triggerName]; var toState = new StateValue(value, this.id); var isObj = value && value.hasOwnProperty('value'); if (!isObj && fromState) { toState.absorbOptions(fromState.options); } triggersWithStates[triggerName] = toState; if (!fromState) { fromState = DEFAULT_STATE_VALUE; } var isRemoval = toState.value === VOID_VALUE; // normally this isn't reached by here, however, if an object expression // is passed in then it may be a new object each time. Comparing the value // is important since that will stay the same despite there being a new object. // The removal arc here is special cased because the same element is triggered // twice in the event that it contains animations on the outer/inner portions // of the host container if (!isRemoval && fromState.value === toState.value) { // this means that despite the value not changing, some inner params // have changed which means that the animation final styles need to be applied if (!objEquals(fromState.params, toState.params)) { var errors = []; var fromStyles_1 = trigger.matchStyles(fromState.value, fromState.params, errors); var toStyles_1 = trigger.matchStyles(toState.value, toState.params, errors); if (errors.length) { this._engine.reportError(errors); } else { this._engine.afterFlush(function () { eraseStyles(element, fromStyles_1); setStyles(element, toStyles_1); }); } } return; } var playersOnElement = getOrSetAsInMap(this._engine.playersByElement, element, []); playersOnElement.forEach(function (player) { // only remove the player if it is queued on the EXACT same trigger/namespace // we only also deal with queued players here because if the animation has // started then we want to keep the player alive until the flush happens // (which is where the previousPlayers are passed into the new palyer) if (player.namespaceId == _this.id && player.triggerName == triggerName && player.queued) { player.destroy(); } }); var transition = trigger.matchTransition(fromState.value, toState.value, element, toState.params); var isFallbackTransition = false; if (!transition) { if (!defaultToFallback) return; transition = trigger.fallbackTransition; isFallbackTransition = true; } this._engine.totalQueuedPlayers++; this._queue.push({ element: element, triggerName: triggerName, transition: transition, fromState: fromState, toState: toState, player: player, isFallbackTransition: isFallbackTransition }); if (!isFallbackTransition) { addClass(element, QUEUED_CLASSNAME); player.onStart(function () { removeClass(element, QUEUED_CLASSNAME); }); } player.onDone(function () { var index = _this.players.indexOf(player); if (index >= 0) { _this.players.splice(index, 1); } var players = _this._engine.playersByElement.get(element); if (players) { var index_1 = players.indexOf(player); if (index_1 >= 0) { players.splice(index_1, 1); } } }); this.players.push(player); playersOnElement.push(player); return player; }; AnimationTransitionNamespace.prototype.deregister = function (name) { var _this = this; delete this._triggers[name]; this._engine.statesByElement.forEach(function (stateMap, element) { delete stateMap[name]; }); this._elementListeners.forEach(function (listeners, element) { _this._elementListeners.set(element, listeners.filter(function (entry) { return entry.name != name; })); }); }; AnimationTransitionNamespace.prototype.clearElementCache = function (element) { this._engine.statesByElement.delete(element); this._elementListeners.delete(element); var elementPlayers = this._engine.playersByElement.get(element); if (elementPlayers) { elementPlayers.forEach(function (player) { return player.destroy(); }); this._engine.playersByElement.delete(element); } }; AnimationTransitionNamespace.prototype._signalRemovalForInnerTriggers = function (rootElement, context, animate) { var _this = this; if (animate === void 0) { animate = false; } // emulate a leave animation for all inner nodes within this node. // If there are no animations found for any of the nodes then clear the cache // for the element. this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true).forEach(function (elm) { // this means that an inner remove() operation has already kicked off // the animation on this element... if (elm[REMOVAL_FLAG]) return; var namespaces = _this._engine.fetchNamespacesByElement(elm); if (namespaces.size) { namespaces.forEach(function (ns) { return ns.triggerLeaveAnimation(elm, context, false, true); }); } else { _this.clearElementCache(elm); } }); }; AnimationTransitionNamespace.prototype.triggerLeaveAnimation = function (element, context, destroyAfterComplete, defaultToFallback) { var _this = this; var triggerStates = this._engine.statesByElement.get(element); if (triggerStates) { var players_1 = []; Object.keys(triggerStates).forEach(function (triggerName) { // this check is here in the event that an element is removed // twice (both on the host level and the component level) if (_this._triggers[triggerName]) { var player = _this.trigger(element, triggerName, VOID_VALUE, defaultToFallback); if (player) { players_1.push(player); } } }); if (players_1.length) { this._engine.markElementAsRemoved(this.id, element, true, context); if (destroyAfterComplete) { optimizeGroupPlayer(players_1).onDone(function () { return _this._engine.processLeaveNode(element); }); } return true; } } return false; }; AnimationTransitionNamespace.prototype.prepareLeaveAnimationListeners = function (element) { var _this = this; var listeners = this._elementListeners.get(element); if (listeners) { var visitedTriggers_1 = new Set(); listeners.forEach(function (listener) { var triggerName = listener.name; if (visitedTriggers_1.has(triggerName)) return; visitedTriggers_1.add(triggerName); var trigger = _this._triggers[triggerName]; var transition = trigger.fallbackTransition; var elementStates = _this._engine.statesByElement.get(element); var fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE; var toState = new StateValue(VOID_VALUE); var player = new TransitionAnimationPlayer(_this.id, triggerName, element); _this._engine.totalQueuedPlayers++; _this._queue.push({ element: element, triggerName: triggerName, transition: transition, fromState: fromState, toState: toState, player: player, isFallbackTransition: true }); }); } }; AnimationTransitionNamespace.prototype.removeNode = function (element, context) { var _this = this; var engine = this._engine; if (element.childElementCount) { this._signalRemovalForInnerTriggers(element, context, true); } // this means that a * => VOID animation was detected and kicked off if (this.triggerLeaveAnimation(element, context, true)) return; // find the player that is animating and make sure that the // removal is delayed until that player has completed var containsPotentialParentTransition = false; if (engine.totalAnimations) { var currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : []; // when this `if statement` does not continue forward it means that // a previous animation query has selected the current element and // is animating it. In this situation want to continue forwards and // allow the element to be queued up for animation later. if (currentPlayers && currentPlayers.length) { containsPotentialParentTransition = true; } else { var parent_1 = element; while (parent_1 = parent_1.parentNode) { var triggers = engine.statesByElement.get(parent_1); if (triggers) { containsPotentialParentTransition = true; break; } } } } // at this stage we know that the element will either get removed // during flush or will be picked up by a parent query. Either way // we need to fire the listeners for this element when it DOES get // removed (once the query parent animation is done or after flush) this.prepareLeaveAnimationListeners(element); // whether or not a parent has an animation we need to delay the deferral of the leave // operation until we have more information (which we do after flush() has been called) if (containsPotentialParentTransition) { engine.markElementAsRemoved(this.id, element, false, context); } else { // we do this after the flush has occurred such // that the callbacks can be fired engine.afterFlush(function () { return _this.clearElementCache(element); }); engine.destroyInnerAnimations(element); engine._onRemovalComplete(element, context); } }; AnimationTransitionNamespace.prototype.insertNode = function (element, parent) { addClass(element, this._hostClassName); }; AnimationTransitionNamespace.prototype.drainQueuedTransitions = function (microtaskId) { var _this = this; var instructions = []; this._queue.forEach(function (entry) { var player = entry.player; if (player.destroyed) return; var element = entry.element; var listeners = _this._elementListeners.get(element); if (listeners) { listeners.forEach(function (listener) { if (listener.name == entry.triggerName) { var baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value); baseEvent['_data'] = microtaskId; listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback); } }); } if (player.markedForDestroy) { _this._engine.afterFlush(function () { // now we can destroy the element properly since the event listeners have // been bound to the player player.destroy(); }); } else { instructions.push(entry); } }); this._queue = []; return instructions.sort(function (a, b) { // if depCount == 0 them move to front // otherwise if a contains b then move back var d0 = a.transition.ast.depCount; var d1 = b.transition.ast.depCount; if (d0 == 0 || d1 == 0) { return d0 - d1; } return _this._engine.driver.containsElement(a.element, b.element) ? 1 : -1; }); }; AnimationTransitionNamespace.prototype.destroy = function (context) { this.players.forEach(function (p) { return p.destroy(); }); this._signalRemovalForInnerTriggers(this.hostElement, context); }; AnimationTransitionNamespace.prototype.elementContainsData = function (element) { var containsData = false; if (this._elementListeners.has(element)) containsData = true; containsData = (this._queue.find(function (entry) { return entry.element === element; }) ? true : false) || containsData; return containsData; }; return AnimationTransitionNamespace; }()); var TransitionAnimationEngine = /** @class */ (function () { function TransitionAnimationEngine(bodyNode, driver, _normalizer) { this.bodyNode = bodyNode; this.driver = driver; this._normalizer = _normalizer; this.players = []; this.newHostElements = new Map(); this.playersByElement = new Map(); this.playersByQueriedElement = new Map(); this.statesByElement = new Map(); this.disabledNodes = new Set(); this.totalAnimations = 0; this.totalQueuedPlayers = 0; this._namespaceLookup = {}; this._namespaceList = []; this._flushFns = []; this._whenQuietFns = []; this.namespacesByHostElement = new Map(); this.collectedEnterElements = []; this.collectedLeaveElements = []; // this method is designed to be overridden by the code that uses this engine this.onRemovalComplete = function (element, context) { }; } /** @internal */ TransitionAnimationEngine.prototype._onRemovalComplete = function (element, context) { this.onRemovalComplete(element, context); }; Object.defineProperty(TransitionAnimationEngine.prototype, "queuedPlayers", { get: function () { var players = []; this._namespaceList.forEach(function (ns) { ns.players.forEach(function (player) { if (player.queued) { players.push(player); } }); }); return players; }, enumerable: true, configurable: true }); TransitionAnimationEngine.prototype.createNamespace = function (namespaceId, hostElement) { var ns = new AnimationTransitionNamespace(namespaceId, hostElement, this); if (hostElement.parentNode) { this._balanceNamespaceList(ns, hostElement); } else { // defer this later until flush during when the host element has // been inserted so that we know exactly where to place it in // the namespace list this.newHostElements.set(hostElement, ns); // given that this host element is apart of the animation code, it // may or may not be inserted by a parent node that is an of an // animation renderer type. If this happens then we can still have // access to this item when we query for :enter nodes. If the parent // is a renderer then the set data-structure will normalize the entry this.collectEnterElement(hostElement); } return this._namespaceLookup[namespaceId] = ns; }; TransitionAnimationEngine.prototype._balanceNamespaceList = function (ns, hostElement) { var limit = this._namespaceList.length - 1; if (limit >= 0) { var found = false; for (var i = limit; i >= 0; i--) { var nextNamespace = this._namespaceList[i]; if (this.driver.containsElement(nextNamespace.hostElement, hostElement)) { this._namespaceList.splice(i + 1, 0, ns); found = true; break; } } if (!found) { this._namespaceList.splice(0, 0, ns); } } else { this._namespaceList.push(ns); } this.namespacesByHostElement.set(hostElement, ns); return ns; }; TransitionAnimationEngine.prototype.register = function (namespaceId, hostElement) { var ns = this._namespaceLookup[namespaceId]; if (!ns) { ns = this.createNamespace(namespaceId, hostElement); } return ns; }; TransitionAnimationEngine.prototype.registerTrigger = function (namespaceId, name, trigger) { var ns = this._namespaceLookup[namespaceId]; if (ns && ns.register(name, trigger)) { this.totalAnimations++; } }; TransitionAnimationEngine.prototype.destroy = function (namespaceId, context) { var _this = this; if (!namespaceId) return; var ns = this._fetchNamespace(namespaceId); this.afterFlush(function () { _this.namespacesByHostElement.delete(ns.hostElement); delete _this._namespaceLookup[namespaceId]; var index = _this._namespaceList.indexOf(ns); if (index >= 0) { _this._namespaceList.splice(index, 1); } }); this.afterFlushAnimationsDone(function () { return ns.destroy(context); }); }; TransitionAnimationEngine.prototype._fetchNamespace = function (id) { return this._namespaceLookup[id]; }; TransitionAnimationEngine.prototype.fetchNamespacesByElement = function (element) { // normally there should only be one namespace per element, however // if @triggers are placed on both the component element and then // its host element (within the component code) then there will be // two namespaces returned. We use a set here to simply the dedupe // of namespaces incase there are multiple triggers both the elm and host var namespaces = new Set(); var elementStates = this.statesByElement.get(element); if (elementStates) { var keys = Object.keys(elementStates); for (var i = 0; i < keys.length; i++) { var nsId = elementStates[keys[i]].namespaceId; if (nsId) { var ns = this._fetchNamespace(nsId); if (ns) { namespaces.add(ns); } } } } return namespaces; }; TransitionAnimationEngine.prototype.trigger = function (namespaceId, element, name, value) { if (isElementNode(element)) { var ns = this._fetchNamespace(namespaceId); if (ns) { ns.trigger(element, name, value); return true; } } return false; }; TransitionAnimationEngine.prototype.insertNode = function (namespaceId, element, parent, insertBefore) { if (!isElementNode(element)) return; // special case for when an element is removed and reinserted (move operation) // when this occurs we do not want to use the element for deletion later var details = element[REMOVAL_FLAG]; if (details && details.setForRemoval) { details.setForRemoval = false; details.setForMove = true; var index = this.collectedLeaveElements.indexOf(element); if (index >= 0) { this.collectedLeaveElements.splice(index, 1); } } // in the event that the namespaceId is blank then the caller // code does not contain any animation code in it, but it is // just being called so that the node is marked as being inserted if (namespaceId) { var ns = this._fetchNamespace(namespaceId); // This if-statement is a workaround for router issue #21947. // The router sometimes hits a race condition where while a route // is being instantiated a new navigation arrives, triggering leave // animation of DOM that has not been fully initialized, until this // is resolved, we need to handle the scenario when DOM is not in a // consistent state during the animation. if (ns) { ns.insertNode(element, parent); } } // only *directives and host elements are inserted before if (insertBefore) { this.collectEnterElement(element); } }; TransitionAnimationEngine.prototype.collectEnterElement = function (element) { this.collectedEnterElements.push(element); }; TransitionAnimationEngine.prototype.markElementAsDisabled = function (element, value) { if (value) { if (!this.disabledNodes.has(element)) { this.disabledNodes.add(element); addClass(element, DISABLED_CLASSNAME); } } else if (this.disabledNodes.has(element)) { this.disabledNodes.delete(element); removeClass(element, DISABLED_CLASSNAME); } }; TransitionAnimationEngine.prototype.removeNode = function (namespaceId, element, context) { if (!isElementNode(element)) { this._onRemovalComplete(element, context); return; } var ns = namespaceId ? this._fetchNamespace(namespaceId) : null; if (ns) { ns.removeNode(element, context); } else { this.markElementAsRemoved(namespaceId, element, false, context); } }; TransitionAnimationEngine.prototype.markElementAsRemoved = function (namespaceId, element, hasAnimation, context) { this.collectedLeaveElements.push(element); element[REMOVAL_FLAG] = { namespaceId: namespaceId, setForRemoval: context, hasAnimation: hasAnimation, removedBeforeQueried: false }; }; TransitionAnimationEngine.prototype.listen = function (namespaceId, element, name, phase, callback) { if (isElementNode(element)) { return this._fetchNamespace(namespaceId).listen(element, name, phase, callback); } return function () { }; }; TransitionAnimationEngine.prototype._buildInstruction = function (entry, subTimelines, enterClassName, leaveClassName, skipBuildAst) { return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines, skipBuildAst); }; TransitionAnimationEngine.prototype.destroyInnerAnimations = function (containerElement) { var _this = this; var elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true); elements.forEach(function (element) { return _this.destroyActiveAnimationsForElement(element); }); if (this.playersByQueriedElement.size == 0) return; elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true); elements.forEach(function (element) { return _this.finishActiveQueriedAnimationOnElement(element); }); }; TransitionAnimationEngine.prototype.destroyActiveAnimationsForElement = function (element) { var players = this.playersByElement.get(element); if (players) { players.forEach(function (player) { // special case for when an element is set for destruction, but hasn't started. // in this situation we want to delay the destruction until the flush occurs // so that any event listeners attached to the player are triggered. if (player.queued) { player.markedForDestroy = true; } else { player.destroy(); } }); } }; TransitionAnimationEngine.prototype.finishActiveQueriedAnimationOnElement = function (element) { var players = this.playersByQueriedElement.get(element); if (players) { players.forEach(function (player) { return player.finish(); }); } }; TransitionAnimationEngine.prototype.whenRenderingDone = function () { var _this = this; return new Promise(function (resolve) { if (_this.players.length) { return optimizeGroupPlayer(_this.players).onDone(function () { return resolve(); }); } else { resolve(); } }); }; TransitionAnimationEngine.prototype.processLeaveNode = function (element) { var _this = this; var details = element[REMOVAL_FLAG]; if (details && details.setForRemoval) { // this will prevent it from removing it twice element[REMOVAL_FLAG] = NULL_REMOVAL_STATE; if (details.namespaceId) { this.destroyInnerAnimations(element); var ns = this._fetchNamespace(details.namespaceId); if (ns) { ns.clearElementCache(element); } } this._onRemovalComplete(element, details.setForRemoval); } if (this.driver.matchesElement(element, DISABLED_SELECTOR)) { this.markElementAsDisabled(element, false); } this.driver.query(element, DISABLED_SELECTOR, true).forEach(function (node) { _this.markElementAsDisabled(node, false); }); }; TransitionAnimationEngine.prototype.flush = function (microtaskId) { var _this = this; if (microtaskId === void 0) { microtaskId = -1; } var players = []; if (this.newHostElements.size) { this.newHostElements.forEach(function (ns, element) { return _this._balanceNamespaceList(ns, element); }); this.newHostElements.clear(); } if (this.totalAnimations && this.collectedEnterElements.length) { for (var i = 0; i < this.collectedEnterElements.length; i++) { var elm = this.collectedEnterElements[i]; addClass(elm, STAR_CLASSNAME); } } if (this._namespaceList.length && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) { var cleanupFns = []; try { players = this._flushAnimations(cleanupFns, microtaskId); } finally { for (var i = 0; i < cleanupFns.length; i++) { cleanupFns[i](); } } } else { for (var i = 0; i < this.collectedLeaveElements.length; i++) { var element = this.collectedLeaveElements[i]; this.processLeaveNode(element); } } this.totalQueuedPlayers = 0; this.collectedEnterElements.length = 0; this.collectedLeaveElements.length = 0; this._flushFns.forEach(function (fn) { return fn(); }); this._flushFns = []; if (this._whenQuietFns.length) { // we move these over to a variable so that // if any new callbacks are registered in another // flush they do not populate the existing set var quietFns_1 = this._whenQuietFns; this._whenQuietFns = []; if (players.length) { optimizeGroupPlayer(players).onDone(function () { quietFns_1.forEach(function (fn) { return fn(); }); }); } else { quietFns_1.forEach(function (fn) { return fn(); }); } } }; TransitionAnimationEngine.prototype.reportError = function (errors) { throw new Error("Unable to process animations due to the following failed trigger transitions\n " + errors.join('\n')); }; TransitionAnimationEngine.prototype._flushAnimations = function (cleanupFns, microtaskId) { var _this = this; var subTimelines = new ElementInstructionMap(); var skippedPlayers = []; var skippedPlayersMap = new Map(); var queuedInstructions = []; var queriedElements = new Map(); var allPreStyleElements = new Map(); var allPostStyleElements = new Map(); var disabledElementsSet = new Set(); this.disabledNodes.forEach(function (node) { disabledElementsSet.add(node); var nodesThatAreDisabled = _this.driver.query(node, QUEUED_SELECTOR, true); for (var i_1 = 0; i_1 < nodesThatAreDisabled.length; i_1++) { disabledElementsSet.add(nodesThatAreDisabled[i_1]); } }); var bodyNode = this.bodyNode; var allTriggerElements = Array.from(this.statesByElement.keys()); var enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements); // this must occur before the instructions are built below such that // the :enter queries match the elements (since the timeline queries // are fired during instruction building). var enterNodeMapIds = new Map(); var i = 0; enterNodeMap.forEach(function (nodes, root) { var className = ENTER_CLASSNAME + i++; enterNodeMapIds.set(root, className); nodes.forEach(function (node) { return addClass(node, className); }); }); var allLeaveNodes = []; var mergedLeaveNodes = new Set(); var leaveNodesWithoutAnimations = new Set(); for (var i_2 = 0; i_2 < this.collectedLeaveElements.length; i_2++) { var element = this.collectedLeaveElements[i_2]; var details = element[REMOVAL_FLAG]; if (details && details.setForRemoval) { allLeaveNodes.push(element); mergedLeaveNodes.add(element); if (details.hasAnimation) { this.driver.query(element, STAR_SELECTOR, true).forEach(function (elm) { return mergedLeaveNodes.add(elm); }); } else { leaveNodesWithoutAnimations.add(element); } } } var leaveNodeMapIds = new Map(); var leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes)); leaveNodeMap.forEach(function (nodes, root) { var className = LEAVE_CLASSNAME + i++; leaveNodeMapIds.set(root, className); nodes.forEach(function (node) { return addClass(node, className); }); }); cleanupFns.push(function () { enterNodeMap.forEach(function (nodes, root) { var className = enterNodeMapIds.get(root); nodes.forEach(function (node) { return removeClass(node, className); }); }); leaveNodeMap.forEach(function (nodes, root) { var className = leaveNodeMapIds.get(root); nodes.forEach(function (node) { return removeClass(node, className); }); }); allLeaveNodes.forEach(function (element) { _this.processLeaveNode(element); }); }); var allPlayers = []; var erroneousTransitions = []; for (var i_3 = this._namespaceList.length - 1; i_3 >= 0; i_3--) { var ns = this._namespaceList[i_3]; ns.drainQueuedTransitions(microtaskId).forEach(function (entry) { var player = entry.player; var element = entry.element; allPlayers.push(player); if (_this.collectedEnterElements.length) { var details = element[REMOVAL_FLAG]; // move animations are currently not supported... if (details && details.setForMove) { player.destroy(); return; } } var nodeIsOrphaned = !bodyNode || !_this.driver.containsElement(bodyNode, element); var leaveClassName = leaveNodeMapIds.get(element); var enterClassName = enterNodeMapIds.get(element); var instruction = _this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName, nodeIsOrphaned); if (instruction.errors && instruction.errors.length) { erroneousTransitions.push(instruction); return; } // even though the element may not be apart of the DOM, it may // still be added at a later point (due to the mechanics of content // projection and/or dynamic component insertion) therefore it's // important we still style the element. if (nodeIsOrphaned) { player.onStart(function () { return eraseStyles(element, instruction.fromStyles); }); player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); skippedPlayers.push(player); return; } // if a unmatched transition is queued to go then it SHOULD NOT render // an animation and cancel the previously running animations. if (entry.isFallbackTransition) { player.onStart(function () { return eraseStyles(element, instruction.fromStyles); }); player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); skippedPlayers.push(player); return; } // this means that if a parent animation uses this animation as a sub trigger // then it will instruct the timeline builder to not add a player delay, but // instead stretch the first keyframe gap up until the animation starts. The // reason this is important is to prevent extra initialization styles from being // required by the user in the animation. instruction.timelines.forEach(function (tl) { return tl.stretchStartingKeyframe = true; }); subTimelines.append(element, instruction.timelines); var tuple = { instruction: instruction, player: player, element: element }; queuedInstructions.push(tuple); instruction.queriedElements.forEach(function (element) { return getOrSetAsInMap(queriedElements, element, []).push(player); }); instruction.preStyleProps.forEach(function (stringMap, element) { var props = Object.keys(stringMap); if (props.length) { var setVal_1 = allPreStyleElements.get(element); if (!setVal_1) { allPreStyleElements.set(element, setVal_1 = new Set()); } props.forEach(function (prop) { return setVal_1.add(prop); }); } }); instruction.postStyleProps.forEach(function (stringMap, element) { var props = Object.keys(stringMap); var setVal = allPostStyleElements.get(element); if (!setVal) { allPostStyleElements.set(element, setVal = new Set()); } props.forEach(function (prop) { return setVal.add(prop); }); }); }); } if (erroneousTransitions.length) { var errors_1 = []; erroneousTransitions.forEach(function (instruction) { errors_1.push("@" + instruction.triggerName + " has failed due to:\n"); instruction.errors.forEach(function (error) { return errors_1.push("- " + error + "\n"); }); }); allPlayers.forEach(function (player) { return player.destroy(); }); this.reportError(errors_1); } var allPreviousPlayersMap = new Map(); // this map works to tell which element in the DOM tree is contained by // which animation. Further down below this map will get populated once // the players are built and in doing so it can efficiently figure out // if a sub player is skipped due to a parent player having priority. var animationElementMap = new Map(); queuedInstructions.forEach(function (entry) { var element = entry.element; if (subTimelines.has(element)) { animationElementMap.set(element, element); _this._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap); } }); skippedPlayers.forEach(function (player) { var element = player.element; var previousPlayers = _this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null); previousPlayers.forEach(function (prevPlayer) { getOrSetAsInMap(allPreviousPlayersMap, element, []).push(prevPlayer); prevPlayer.destroy(); }); }); // this is a special case for nodes that will be removed (either by) // having their own leave animations or by being queried in a container // that will be removed once a parent animation is complete. The idea // here is that * styles must be identical to ! styles because of // backwards compatibility (* is also filled in by default in many places). // Otherwise * styles will return an empty value or auto since the element // that is being getComputedStyle'd will not be visible (since * = destination) var replaceNodes = allLeaveNodes.filter(function (node) { return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements); }); // POST STAGE: fill the * styles var postStylesMap = new Map(); var allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]); allLeaveQueriedNodes.forEach(function (node) { if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) { replaceNodes.push(node); } }); // PRE STAGE: fill the ! styles var preStylesMap = new Map(); enterNodeMap.forEach(function (nodes, root) { cloakAndComputeStyles(preStylesMap, _this.driver, new Set(nodes), allPreStyleElements, _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵPRE_STYLE"]); }); replaceNodes.forEach(function (node) { var post = postStylesMap.get(node); var pre = preStylesMap.get(node); postStylesMap.set(node, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, post, pre)); }); var rootPlayers = []; var subPlayers = []; var NO_PARENT_ANIMATION_ELEMENT_DETECTED = {}; queuedInstructions.forEach(function (entry) { var element = entry.element, player = entry.player, instruction = entry.instruction; // this means that it was never consumed by a parent animation which // means that it is independent and therefore should be set for animation if (subTimelines.has(element)) { if (disabledElementsSet.has(element)) { player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); player.disabled = true; player.overrideTotalTime(instruction.totalTime); skippedPlayers.push(player); return; } // this will flow up the DOM and query the map to figure out // if a parent animation has priority over it. In the situation // that a parent is detected then it will cancel the loop. If // nothing is detected, or it takes a few hops to find a parent, // then it will fill in the missing nodes and signal them as having // a detected parent (or a NO_PARENT value via a special constant). var parentWithAnimation_1 = NO_PARENT_ANIMATION_ELEMENT_DETECTED; if (animationElementMap.size > 1) { var elm = element; var parentsToAdd = []; while (elm = elm.parentNode) { var detectedParent = animationElementMap.get(elm); if (detectedParent) { parentWithAnimation_1 = detectedParent; break; } parentsToAdd.push(elm); } parentsToAdd.forEach(function (parent) { return animationElementMap.set(parent, parentWithAnimation_1); }); } var innerPlayer = _this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap); player.setRealPlayer(innerPlayer); if (parentWithAnimation_1 === NO_PARENT_ANIMATION_ELEMENT_DETECTED) { rootPlayers.push(player); } else { var parentPlayers = _this.playersByElement.get(parentWithAnimation_1); if (parentPlayers && parentPlayers.length) { player.parentPlayer = optimizeGroupPlayer(parentPlayers); } skippedPlayers.push(player); } } else { eraseStyles(element, instruction.fromStyles); player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); // there still might be a ancestor player animating this // element therefore we will still add it as a sub player // even if its animation may be disabled subPlayers.push(player); if (disabledElementsSet.has(element)) { skippedPlayers.push(player); } } }); // find all of the sub players' corresponding inner animation player subPlayers.forEach(function (player) { // even if any players are not found for a sub animation then it // will still complete itself after the next tick since it's Noop var playersForElement = skippedPlayersMap.get(player.element); if (playersForElement && playersForElement.length) { var innerPlayer = optimizeGroupPlayer(playersForElement); player.setRealPlayer(innerPlayer); } }); // the reason why we don't actually play the animation is // because all that a skipped player is designed to do is to // fire the start/done transition callback events skippedPlayers.forEach(function (player) { if (player.parentPlayer) { player.syncPlayerEvents(player.parentPlayer); } else { player.destroy(); } }); // run through all of the queued removals and see if they // were picked up by a query. If not then perform the removal // operation right away unless a parent animation is ongoing. for (var i_4 = 0; i_4 < allLeaveNodes.length; i_4++) { var element = allLeaveNodes[i_4]; var details = element[REMOVAL_FLAG]; removeClass(element, LEAVE_CLASSNAME); // this means the element has a removal animation that is being // taken care of and therefore the inner elements will hang around // until that animation is over (or the parent queried animation) if (details && details.hasAnimation) continue; var players = []; // if this element is queried or if it contains queried children // then we want for the element not to be removed from the page // until the queried animations have finished if (queriedElements.size) { var queriedPlayerResults = queriedElements.get(element); if (queriedPlayerResults && queriedPlayerResults.length) { players.push.apply(players, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(queriedPlayerResults)); } var queriedInnerElements = this.driver.query(element, NG_ANIMATING_SELECTOR, true); for (var j = 0; j < queriedInnerElements.length; j++) { var queriedPlayers = queriedElements.get(queriedInnerElements[j]); if (queriedPlayers && queriedPlayers.length) { players.push.apply(players, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(queriedPlayers)); } } } var activePlayers = players.filter(function (p) { return !p.destroyed; }); if (activePlayers.length) { removeNodesAfterAnimationDone(this, element, activePlayers); } else { this.processLeaveNode(element); } } // this is required so the cleanup method doesn't remove them allLeaveNodes.length = 0; rootPlayers.forEach(function (player) { _this.players.push(player); player.onDone(function () { player.destroy(); var index = _this.players.indexOf(player); _this.players.splice(index, 1); }); player.play(); }); return rootPlayers; }; TransitionAnimationEngine.prototype.elementContainsData = function (namespaceId, element) { var containsData = false; var details = element[REMOVAL_FLAG]; if (details && details.setForRemoval) containsData = true; if (this.playersByElement.has(element)) containsData = true; if (this.playersByQueriedElement.has(element)) containsData = true; if (this.statesByElement.has(element)) containsData = true; return this._fetchNamespace(namespaceId).elementContainsData(element) || containsData; }; TransitionAnimationEngine.prototype.afterFlush = function (callback) { this._flushFns.push(callback); }; TransitionAnimationEngine.prototype.afterFlushAnimationsDone = function (callback) { this._whenQuietFns.push(callback); }; TransitionAnimationEngine.prototype._getPreviousPlayers = function (element, isQueriedElement, namespaceId, triggerName, toStateValue) { var players = []; if (isQueriedElement) { var queriedElementPlayers = this.playersByQueriedElement.get(element); if (queriedElementPlayers) { players = queriedElementPlayers; } } else { var elementPlayers = this.playersByElement.get(element); if (elementPlayers) { var isRemovalAnimation_1 = !toStateValue || toStateValue == VOID_VALUE; elementPlayers.forEach(function (player) { if (player.queued) return; if (!isRemovalAnimation_1 && player.triggerName != triggerName) return; players.push(player); }); } } if (namespaceId || triggerName) { players = players.filter(function (player) { if (namespaceId && namespaceId != player.namespaceId) return false; if (triggerName && triggerName != player.triggerName) return false; return true; }); } return players; }; TransitionAnimationEngine.prototype._beforeAnimationBuild = function (namespaceId, instruction, allPreviousPlayersMap) { var e_1, _a; var triggerName = instruction.triggerName; var rootElement = instruction.element; // when a removal animation occurs, ALL previous players are collected // and destroyed (even if they are outside of the current namespace) var targetNameSpaceId = instruction.isRemovalTransition ? undefined : namespaceId; var targetTriggerName = instruction.isRemovalTransition ? undefined : triggerName; var _loop_1 = function (timelineInstruction) { var element = timelineInstruction.element; var isQueriedElement = element !== rootElement; var players = getOrSetAsInMap(allPreviousPlayersMap, element, []); var previousPlayers = this_1._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState); previousPlayers.forEach(function (player) { var realPlayer = player.getRealPlayer(); if (realPlayer.beforeDestroy) { realPlayer.beforeDestroy(); } player.destroy(); players.push(player); }); }; var this_1 = this; try { for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(instruction.timelines), _c = _b.next(); !_c.done; _c = _b.next()) { var timelineInstruction = _c.value; _loop_1(timelineInstruction); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } // this needs to be done so that the PRE/POST styles can be // computed properly without interfering with the previous animation eraseStyles(rootElement, instruction.fromStyles); }; TransitionAnimationEngine.prototype._buildAnimation = function (namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) { var _this = this; var triggerName = instruction.triggerName; var rootElement = instruction.element; // we first run this so that the previous animation player // data can be passed into the successive animation players var allQueriedPlayers = []; var allConsumedElements = new Set(); var allSubElements = new Set(); var allNewPlayers = instruction.timelines.map(function (timelineInstruction) { var element = timelineInstruction.element; allConsumedElements.add(element); // FIXME (matsko): make sure to-be-removed animations are removed properly var details = element[REMOVAL_FLAG]; if (details && details.removedBeforeQueried) return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](timelineInstruction.duration, timelineInstruction.delay); var isQueriedElement = element !== rootElement; var previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY) .map(function (p) { return p.getRealPlayer(); })) .filter(function (p) { // the `element` is not apart of the AnimationPlayer definition, but // Mock/WebAnimations // use the element within their implementation. This will be added in Angular5 to // AnimationPlayer var pp = p; return pp.element ? pp.element === element : false; }); var preStyles = preStylesMap.get(element); var postStyles = postStylesMap.get(element); var keyframes = normalizeKeyframes(_this.driver, _this._normalizer, element, timelineInstruction.keyframes, preStyles, postStyles); var player = _this._buildPlayer(timelineInstruction, keyframes, previousPlayers); // this means that this particular player belongs to a sub trigger. It is // important that we match this player up with the corresponding (@trigger.listener) if (timelineInstruction.subTimeline && skippedPlayersMap) { allSubElements.add(element); } if (isQueriedElement) { var wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element); wrappedPlayer.setRealPlayer(player); allQueriedPlayers.push(wrappedPlayer); } return player; }); allQueriedPlayers.forEach(function (player) { getOrSetAsInMap(_this.playersByQueriedElement, player.element, []).push(player); player.onDone(function () { return deleteOrUnsetInMap(_this.playersByQueriedElement, player.element, player); }); }); allConsumedElements.forEach(function (element) { return addClass(element, NG_ANIMATING_CLASSNAME); }); var player = optimizeGroupPlayer(allNewPlayers); player.onDestroy(function () { allConsumedElements.forEach(function (element) { return removeClass(element, NG_ANIMATING_CLASSNAME); }); setStyles(rootElement, instruction.toStyles); }); // this basically makes all of the callbacks for sub element animations // be dependent on the upper players for when they finish allSubElements.forEach(function (element) { getOrSetAsInMap(skippedPlayersMap, element, []).push(player); }); return player; }; TransitionAnimationEngine.prototype._buildPlayer = function (instruction, keyframes, previousPlayers) { if (keyframes.length > 0) { return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers); } // special case for when an empty transition|definition is provided // ... there is no point in rendering an empty animation return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](instruction.duration, instruction.delay); }; return TransitionAnimationEngine; }()); var TransitionAnimationPlayer = /** @class */ (function () { function TransitionAnimationPlayer(namespaceId, triggerName, element) { this.namespaceId = namespaceId; this.triggerName = triggerName; this.element = element; this._player = new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](); this._containsRealPlayer = false; this._queuedCallbacks = {}; this.destroyed = false; this.markedForDestroy = false; this.disabled = false; this.queued = true; this.totalTime = 0; } TransitionAnimationPlayer.prototype.setRealPlayer = function (player) { var _this = this; if (this._containsRealPlayer) return; this._player = player; Object.keys(this._queuedCallbacks).forEach(function (phase) { _this._queuedCallbacks[phase].forEach(function (callback) { return listenOnPlayer(player, phase, undefined, callback); }); }); this._queuedCallbacks = {}; this._containsRealPlayer = true; this.overrideTotalTime(player.totalTime); this.queued = false; }; TransitionAnimationPlayer.prototype.getRealPlayer = function () { return this._player; }; TransitionAnimationPlayer.prototype.overrideTotalTime = function (totalTime) { this.totalTime = totalTime; }; TransitionAnimationPlayer.prototype.syncPlayerEvents = function (player) { var _this = this; var p = this._player; if (p.triggerCallback) { player.onStart(function () { return p.triggerCallback('start'); }); } player.onDone(function () { return _this.finish(); }); player.onDestroy(function () { return _this.destroy(); }); }; TransitionAnimationPlayer.prototype._queueEvent = function (name, callback) { getOrSetAsInMap(this._queuedCallbacks, name, []).push(callback); }; TransitionAnimationPlayer.prototype.onDone = function (fn) { if (this.queued) { this._queueEvent('done', fn); } this._player.onDone(fn); }; TransitionAnimationPlayer.prototype.onStart = function (fn) { if (this.queued) { this._queueEvent('start', fn); } this._player.onStart(fn); }; TransitionAnimationPlayer.prototype.onDestroy = function (fn) { if (this.queued) { this._queueEvent('destroy', fn); } this._player.onDestroy(fn); }; TransitionAnimationPlayer.prototype.init = function () { this._player.init(); }; TransitionAnimationPlayer.prototype.hasStarted = function () { return this.queued ? false : this._player.hasStarted(); }; TransitionAnimationPlayer.prototype.play = function () { !this.queued && this._player.play(); }; TransitionAnimationPlayer.prototype.pause = function () { !this.queued && this._player.pause(); }; TransitionAnimationPlayer.prototype.restart = function () { !this.queued && this._player.restart(); }; TransitionAnimationPlayer.prototype.finish = function () { this._player.finish(); }; TransitionAnimationPlayer.prototype.destroy = function () { this.destroyed = true; this._player.destroy(); }; TransitionAnimationPlayer.prototype.reset = function () { !this.queued && this._player.reset(); }; TransitionAnimationPlayer.prototype.setPosition = function (p) { if (!this.queued) { this._player.setPosition(p); } }; TransitionAnimationPlayer.prototype.getPosition = function () { return this.queued ? 0 : this._player.getPosition(); }; /** @internal */ TransitionAnimationPlayer.prototype.triggerCallback = function (phaseName) { var p = this._player; if (p.triggerCallback) { p.triggerCallback(phaseName); } }; return TransitionAnimationPlayer; }()); function deleteOrUnsetInMap(map, key, value) { var currentValues; if (map instanceof Map) { currentValues = map.get(key); if (currentValues) { if (currentValues.length) { var index = currentValues.indexOf(value); currentValues.splice(index, 1); } if (currentValues.length == 0) { map.delete(key); } } } else { currentValues = map[key]; if (currentValues) { if (currentValues.length) { var index = currentValues.indexOf(value); currentValues.splice(index, 1); } if (currentValues.length == 0) { delete map[key]; } } } return currentValues; } function normalizeTriggerValue(value) { // we use `!= null` here because it's the most simple // way to test against a "falsy" value without mixing // in empty strings or a zero value. DO NOT OPTIMIZE. return value != null ? value : null; } function isElementNode(node) { return node && node['nodeType'] === 1; } function isTriggerEventValid(eventName) { return eventName == 'start' || eventName == 'done'; } function cloakElement(element, value) { var oldValue = element.style.display; element.style.display = value != null ? value : 'none'; return oldValue; } function cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, defaultStyle) { var cloakVals = []; elements.forEach(function (element) { return cloakVals.push(cloakElement(element)); }); var failedElements = []; elementPropsMap.forEach(function (props, element) { var styles = {}; props.forEach(function (prop) { var value = styles[prop] = driver.computeStyle(element, prop, defaultStyle); // there is no easy way to detect this because a sub element could be removed // by a parent animation element being detached. if (!value || value.length == 0) { element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE; failedElements.push(element); } }); valuesMap.set(element, styles); }); // we use a index variable here since Set.forEach(a, i) does not return // an index value for the closure (but instead just the value) var i = 0; elements.forEach(function (element) { return cloakElement(element, cloakVals[i++]); }); return failedElements; } /* Since the Angular renderer code will return a collection of inserted nodes in all areas of a DOM tree, it's up to this algorithm to figure out which nodes are roots for each animation @trigger. By placing each inserted node into a Set and traversing upwards, it is possible to find the @trigger elements and well any direct *star insertion nodes, if a @trigger root is found then the enter element is placed into the Map[@trigger] spot. */ function buildRootMap(roots, nodes) { var rootMap = new Map(); roots.forEach(function (root) { return rootMap.set(root, []); }); if (nodes.length == 0) return rootMap; var NULL_NODE = 1; var nodeSet = new Set(nodes); var localRootMap = new Map(); function getRoot(node) { if (!node) return NULL_NODE; var root = localRootMap.get(node); if (root) return root; var parent = node.parentNode; if (rootMap.has(parent)) { // ngIf inside @trigger root = parent; } else if (nodeSet.has(parent)) { // ngIf inside ngIf root = NULL_NODE; } else { // recurse upwards root = getRoot(parent); } localRootMap.set(node, root); return root; } nodes.forEach(function (node) { var root = getRoot(node); if (root !== NULL_NODE) { rootMap.get(root).push(node); } }); return rootMap; } var CLASSES_CACHE_KEY = '$$classes'; function addClass(element, className) { if (element.classList) { element.classList.add(className); } else { var classes = element[CLASSES_CACHE_KEY]; if (!classes) { classes = element[CLASSES_CACHE_KEY] = {}; } classes[className] = true; } } function removeClass(element, className) { if (element.classList) { element.classList.remove(className); } else { var classes = element[CLASSES_CACHE_KEY]; if (classes) { delete classes[className]; } } } function removeNodesAfterAnimationDone(engine, element, players) { optimizeGroupPlayer(players).onDone(function () { return engine.processLeaveNode(element); }); } function flattenGroupPlayers(players) { var finalPlayers = []; _flattenGroupPlayersRecur(players, finalPlayers); return finalPlayers; } function _flattenGroupPlayersRecur(players, finalPlayers) { for (var i = 0; i < players.length; i++) { var player = players[i]; if (player instanceof _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵAnimationGroupPlayer"]) { _flattenGroupPlayersRecur(player.players, finalPlayers); } else { finalPlayers.push(player); } } } function objEquals(a, b) { var k1 = Object.keys(a); var k2 = Object.keys(b); if (k1.length != k2.length) return false; for (var i = 0; i < k1.length; i++) { var prop = k1[i]; if (!b.hasOwnProperty(prop) || a[prop] !== b[prop]) return false; } return true; } function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) { var postEntry = allPostStyleElements.get(element); if (!postEntry) return false; var preEntry = allPreStyleElements.get(element); if (preEntry) { postEntry.forEach(function (data) { return preEntry.add(data); }); } else { allPreStyleElements.set(element, postEntry); } allPostStyleElements.delete(element); return true; } var AnimationEngine = /** @class */ (function () { function AnimationEngine(bodyNode, _driver, normalizer) { var _this = this; this.bodyNode = bodyNode; this._driver = _driver; this._triggerCache = {}; // this method is designed to be overridden by the code that uses this engine this.onRemovalComplete = function (element, context) { }; this._transitionEngine = new TransitionAnimationEngine(bodyNode, _driver, normalizer); this._timelineEngine = new TimelineAnimationEngine(bodyNode, _driver, normalizer); this._transitionEngine.onRemovalComplete = function (element, context) { return _this.onRemovalComplete(element, context); }; } AnimationEngine.prototype.registerTrigger = function (componentId, namespaceId, hostElement, name, metadata) { var cacheKey = componentId + '-' + name; var trigger = this._triggerCache[cacheKey]; if (!trigger) { var errors = []; var ast = buildAnimationAst(this._driver, metadata, errors); if (errors.length) { throw new Error("The animation trigger \"" + name + "\" has failed to build due to the following errors:\n - " + errors.join("\n - ")); } trigger = buildTrigger(name, ast); this._triggerCache[cacheKey] = trigger; } this._transitionEngine.registerTrigger(namespaceId, name, trigger); }; AnimationEngine.prototype.register = function (namespaceId, hostElement) { this._transitionEngine.register(namespaceId, hostElement); }; AnimationEngine.prototype.destroy = function (namespaceId, context) { this._transitionEngine.destroy(namespaceId, context); }; AnimationEngine.prototype.onInsert = function (namespaceId, element, parent, insertBefore) { this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore); }; AnimationEngine.prototype.onRemove = function (namespaceId, element, context) { this._transitionEngine.removeNode(namespaceId, element, context); }; AnimationEngine.prototype.disableAnimations = function (element, disable) { this._transitionEngine.markElementAsDisabled(element, disable); }; AnimationEngine.prototype.process = function (namespaceId, element, property, value) { if (property.charAt(0) == '@') { var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(parseTimelineCommand(property), 2), id = _a[0], action = _a[1]; var args = value; this._timelineEngine.command(id, element, action, args); } else { this._transitionEngine.trigger(namespaceId, element, property, value); } }; AnimationEngine.prototype.listen = function (namespaceId, element, eventName, eventPhase, callback) { // @@listen if (eventName.charAt(0) == '@') { var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(parseTimelineCommand(eventName), 2), id = _a[0], action = _a[1]; return this._timelineEngine.listen(id, element, action, callback); } return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback); }; AnimationEngine.prototype.flush = function (microtaskId) { if (microtaskId === void 0) { microtaskId = -1; } this._transitionEngine.flush(microtaskId); }; Object.defineProperty(AnimationEngine.prototype, "players", { get: function () { return this._transitionEngine.players .concat(this._timelineEngine.players); }, enumerable: true, configurable: true }); AnimationEngine.prototype.whenRenderingDone = function () { return this._transitionEngine.whenRenderingDone(); }; return AnimationEngine; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; var ANIMATION_PROP = 'animation'; var ANIMATIONEND_EVENT = 'animationend'; var ONE_SECOND$1 = 1000; var ElementAnimationStyleHandler = /** @class */ (function () { function ElementAnimationStyleHandler(_element, _name, _duration, _delay, _easing, _fillMode, _onDoneFn) { var _this = this; this._element = _element; this._name = _name; this._duration = _duration; this._delay = _delay; this._easing = _easing; this._fillMode = _fillMode; this._onDoneFn = _onDoneFn; this._finished = false; this._destroyed = false; this._startTime = 0; this._position = 0; this._eventFn = function (e) { return _this._handleCallback(e); }; } ElementAnimationStyleHandler.prototype.apply = function () { applyKeyframeAnimation(this._element, this._duration + "ms " + this._easing + " " + this._delay + "ms 1 normal " + this._fillMode + " " + this._name); addRemoveAnimationEvent(this._element, this._eventFn, false); this._startTime = Date.now(); }; ElementAnimationStyleHandler.prototype.pause = function () { playPauseAnimation(this._element, this._name, 'paused'); }; ElementAnimationStyleHandler.prototype.resume = function () { playPauseAnimation(this._element, this._name, 'running'); }; ElementAnimationStyleHandler.prototype.setPosition = function (position) { var index = findIndexForAnimation(this._element, this._name); this._position = position * this._duration; setAnimationStyle(this._element, 'Delay', "-" + this._position + "ms", index); }; ElementAnimationStyleHandler.prototype.getPosition = function () { return this._position; }; ElementAnimationStyleHandler.prototype._handleCallback = function (event) { var timestamp = event._ngTestManualTimestamp || Date.now(); var elapsedTime = parseFloat(event.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)) * ONE_SECOND$1; if (event.animationName == this._name && Math.max(timestamp - this._startTime, 0) >= this._delay && elapsedTime >= this._duration) { this.finish(); } }; ElementAnimationStyleHandler.prototype.finish = function () { if (this._finished) return; this._finished = true; this._onDoneFn(); addRemoveAnimationEvent(this._element, this._eventFn, true); }; ElementAnimationStyleHandler.prototype.destroy = function () { if (this._destroyed) return; this._destroyed = true; this.finish(); removeKeyframeAnimation(this._element, this._name); }; return ElementAnimationStyleHandler; }()); function playPauseAnimation(element, name, status) { var index = findIndexForAnimation(element, name); setAnimationStyle(element, 'PlayState', status, index); } function applyKeyframeAnimation(element, value) { var anim = getAnimationStyle(element, '').trim(); var index = 0; if (anim.length) { index = countChars(anim, ',') + 1; value = anim + ", " + value; } setAnimationStyle(element, '', value); return index; } function removeKeyframeAnimation(element, name) { var anim = getAnimationStyle(element, ''); var tokens = anim.split(','); var index = findMatchingTokenIndex(tokens, name); if (index >= 0) { tokens.splice(index, 1); var newValue = tokens.join(','); setAnimationStyle(element, '', newValue); } } function findIndexForAnimation(element, value) { var anim = getAnimationStyle(element, ''); if (anim.indexOf(',') > 0) { var tokens = anim.split(','); return findMatchingTokenIndex(tokens, value); } return findMatchingTokenIndex([anim], value); } function findMatchingTokenIndex(tokens, searchToken) { for (var i = 0; i < tokens.length; i++) { if (tokens[i].indexOf(searchToken) >= 0) { return i; } } return -1; } function addRemoveAnimationEvent(element, fn, doRemove) { doRemove ? element.removeEventListener(ANIMATIONEND_EVENT, fn) : element.addEventListener(ANIMATIONEND_EVENT, fn); } function setAnimationStyle(element, name, value, index) { var prop = ANIMATION_PROP + name; if (index != null) { var oldValue = element.style[prop]; if (oldValue.length) { var tokens = oldValue.split(','); tokens[index] = value; value = tokens.join(','); } } element.style[prop] = value; } function getAnimationStyle(element, name) { return element.style[ANIMATION_PROP + name]; } function countChars(value, char) { var count = 0; for (var i = 0; i < value.length; i++) { var c = value.charAt(i); if (c === char) count++; } return count; } var DEFAULT_FILL_MODE = 'forwards'; var DEFAULT_EASING = 'linear'; var CssKeyframesPlayer = /** @class */ (function () { function CssKeyframesPlayer(element, keyframes, animationName, _duration, _delay, easing, _finalStyles) { this.element = element; this.keyframes = keyframes; this.animationName = animationName; this._duration = _duration; this._delay = _delay; this._finalStyles = _finalStyles; this._onDoneFns = []; this._onStartFns = []; this._onDestroyFns = []; this._started = false; this.currentSnapshot = {}; this._state = 0; this.easing = easing || DEFAULT_EASING; this.totalTime = _duration + _delay; this._buildStyler(); } CssKeyframesPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; CssKeyframesPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; CssKeyframesPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; CssKeyframesPlayer.prototype.destroy = function () { this.init(); if (this._state >= 4 /* DESTROYED */) return; this._state = 4 /* DESTROYED */; this._styler.destroy(); this._flushStartFns(); this._flushDoneFns(); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; }; CssKeyframesPlayer.prototype._flushDoneFns = function () { this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; }; CssKeyframesPlayer.prototype._flushStartFns = function () { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; }; CssKeyframesPlayer.prototype.finish = function () { this.init(); if (this._state >= 3 /* FINISHED */) return; this._state = 3 /* FINISHED */; this._styler.finish(); this._flushStartFns(); this._flushDoneFns(); }; CssKeyframesPlayer.prototype.setPosition = function (value) { this._styler.setPosition(value); }; CssKeyframesPlayer.prototype.getPosition = function () { return this._styler.getPosition(); }; CssKeyframesPlayer.prototype.hasStarted = function () { return this._state >= 2 /* STARTED */; }; CssKeyframesPlayer.prototype.init = function () { if (this._state >= 1 /* INITIALIZED */) return; this._state = 1 /* INITIALIZED */; var elm = this.element; this._styler.apply(); if (this._delay) { this._styler.pause(); } }; CssKeyframesPlayer.prototype.play = function () { this.init(); if (!this.hasStarted()) { this._flushStartFns(); this._state = 2 /* STARTED */; } this._styler.resume(); }; CssKeyframesPlayer.prototype.pause = function () { this.init(); this._styler.pause(); }; CssKeyframesPlayer.prototype.restart = function () { this.reset(); this.play(); }; CssKeyframesPlayer.prototype.reset = function () { this._styler.destroy(); this._buildStyler(); this._styler.apply(); }; CssKeyframesPlayer.prototype._buildStyler = function () { var _this = this; this._styler = new ElementAnimationStyleHandler(this.element, this.animationName, this._duration, this._delay, this.easing, DEFAULT_FILL_MODE, function () { return _this.finish(); }); }; /** @internal */ CssKeyframesPlayer.prototype.triggerCallback = function (phaseName) { var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; CssKeyframesPlayer.prototype.beforeDestroy = function () { var _this = this; this.init(); var styles = {}; if (this.hasStarted()) { var finished_1 = this._state >= 3 /* FINISHED */; Object.keys(this._finalStyles).forEach(function (prop) { if (prop != 'offset') { styles[prop] = finished_1 ? _this._finalStyles[prop] : computeStyle(_this.element, prop); } }); } this.currentSnapshot = styles; }; return CssKeyframesPlayer; }()); var DirectStylePlayer = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DirectStylePlayer, _super); function DirectStylePlayer(element, styles) { var _this = _super.call(this) || this; _this.element = element; _this._startingStyles = {}; _this.__initialized = false; _this._styles = hypenatePropsObject(styles); return _this; } DirectStylePlayer.prototype.init = function () { var _this = this; if (this.__initialized || !this._startingStyles) return; this.__initialized = true; Object.keys(this._styles).forEach(function (prop) { _this._startingStyles[prop] = _this.element.style[prop]; }); _super.prototype.init.call(this); }; DirectStylePlayer.prototype.play = function () { var _this = this; if (!this._startingStyles) return; this.init(); Object.keys(this._styles) .forEach(function (prop) { return _this.element.style.setProperty(prop, _this._styles[prop]); }); _super.prototype.play.call(this); }; DirectStylePlayer.prototype.destroy = function () { var _this = this; if (!this._startingStyles) return; Object.keys(this._startingStyles).forEach(function (prop) { var value = _this._startingStyles[prop]; if (value) { _this.element.style.setProperty(prop, value); } else { _this.element.style.removeProperty(prop); } }); this._startingStyles = null; _super.prototype.destroy.call(this); }; return DirectStylePlayer; }(_angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"])); var KEYFRAMES_NAME_PREFIX = 'gen_css_kf_'; var TAB_SPACE = ' '; var CssKeyframesDriver = /** @class */ (function () { function CssKeyframesDriver() { this._count = 0; this._head = document.querySelector('head'); this._warningIssued = false; } CssKeyframesDriver.prototype.validateStyleProperty = function (prop) { return validateStyleProperty(prop); }; CssKeyframesDriver.prototype.matchesElement = function (element, selector) { return matchesElement(element, selector); }; CssKeyframesDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; CssKeyframesDriver.prototype.query = function (element, selector, multi) { return invokeQuery(element, selector, multi); }; CssKeyframesDriver.prototype.computeStyle = function (element, prop, defaultValue) { return window.getComputedStyle(element)[prop]; }; CssKeyframesDriver.prototype.buildKeyframeElement = function (element, name, keyframes) { keyframes = keyframes.map(function (kf) { return hypenatePropsObject(kf); }); var keyframeStr = "@keyframes " + name + " {\n"; var tab = ''; keyframes.forEach(function (kf) { tab = TAB_SPACE; var offset = parseFloat(kf.offset); keyframeStr += "" + tab + offset * 100 + "% {\n"; tab += TAB_SPACE; Object.keys(kf).forEach(function (prop) { var value = kf[prop]; switch (prop) { case 'offset': return; case 'easing': if (value) { keyframeStr += tab + "animation-timing-function: " + value + ";\n"; } return; default: keyframeStr += "" + tab + prop + ": " + value + ";\n"; return; } }); keyframeStr += tab + "}\n"; }); keyframeStr += "}\n"; var kfElm = document.createElement('style'); kfElm.innerHTML = keyframeStr; return kfElm; }; CssKeyframesDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers, scrubberAccessRequested) { if (previousPlayers === void 0) { previousPlayers = []; } if (scrubberAccessRequested) { this._notifyFaultyScrubber(); } var previousCssKeyframePlayers = previousPlayers.filter(function (player) { return player instanceof CssKeyframesPlayer; }); var previousStyles = {}; if (allowPreviousPlayerStylesMerge(duration, delay)) { previousCssKeyframePlayers.forEach(function (player) { var styles = player.currentSnapshot; Object.keys(styles).forEach(function (prop) { return previousStyles[prop] = styles[prop]; }); }); } keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles); var finalStyles = flattenKeyframesIntoStyles(keyframes); // if there is no animation then there is no point in applying // styles and waiting for an event to get fired. This causes lag. // It's better to just directly apply the styles to the element // via the direct styling animation player. if (duration == 0) { return new DirectStylePlayer(element, finalStyles); } var animationName = "" + KEYFRAMES_NAME_PREFIX + this._count++; var kfElm = this.buildKeyframeElement(element, animationName, keyframes); document.querySelector('head').appendChild(kfElm); var player = new CssKeyframesPlayer(element, keyframes, animationName, duration, delay, easing, finalStyles); player.onDestroy(function () { return removeElement(kfElm); }); return player; }; CssKeyframesDriver.prototype._notifyFaultyScrubber = function () { if (!this._warningIssued) { console.warn('@angular/animations: please load the web-animations.js polyfill to allow programmatic access...\n', ' visit http://bit.ly/IWukam to learn more about using the web-animation-js polyfill.'); this._warningIssued = true; } }; return CssKeyframesDriver; }()); function flattenKeyframesIntoStyles(keyframes) { var flatKeyframes = {}; if (keyframes) { var kfs = Array.isArray(keyframes) ? keyframes : [keyframes]; kfs.forEach(function (kf) { Object.keys(kf).forEach(function (prop) { if (prop == 'offset' || prop == 'easing') return; flatKeyframes[prop] = kf[prop]; }); }); } return flatKeyframes; } function removeElement(node) { node.parentNode.removeChild(node); } var WebAnimationsPlayer = /** @class */ (function () { function WebAnimationsPlayer(element, keyframes, options) { this.element = element; this.keyframes = keyframes; this.options = options; this._onDoneFns = []; this._onStartFns = []; this._onDestroyFns = []; this._initialized = false; this._finished = false; this._started = false; this._destroyed = false; this.time = 0; this.parentPlayer = null; this.currentSnapshot = {}; this._duration = options['duration']; this._delay = options['delay'] || 0; this.time = this._duration + this._delay; } WebAnimationsPlayer.prototype._onFinish = function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; WebAnimationsPlayer.prototype.init = function () { this._buildPlayer(); this._preparePlayerBeforeStart(); }; WebAnimationsPlayer.prototype._buildPlayer = function () { var _this = this; if (this._initialized) return; this._initialized = true; var keyframes = this.keyframes; this.domPlayer = this._triggerWebAnimation(this.element, keyframes, this.options); this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : {}; this.domPlayer.addEventListener('finish', function () { return _this._onFinish(); }); }; WebAnimationsPlayer.prototype._preparePlayerBeforeStart = function () { // this is required so that the player doesn't start to animate right away if (this._delay) { this._resetDomPlayerState(); } else { this.domPlayer.pause(); } }; /** @internal */ WebAnimationsPlayer.prototype._triggerWebAnimation = function (element, keyframes, options) { // jscompiler doesn't seem to know animate is a native property because it's not fully // supported yet across common browsers (we polyfill it for Edge/Safari) [CL #143630929] return element['animate'](keyframes, options); }; WebAnimationsPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; WebAnimationsPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; WebAnimationsPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; WebAnimationsPlayer.prototype.play = function () { this._buildPlayer(); if (!this.hasStarted()) { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; this._started = true; } this.domPlayer.play(); }; WebAnimationsPlayer.prototype.pause = function () { this.init(); this.domPlayer.pause(); }; WebAnimationsPlayer.prototype.finish = function () { this.init(); this._onFinish(); this.domPlayer.finish(); }; WebAnimationsPlayer.prototype.reset = function () { this._resetDomPlayerState(); this._destroyed = false; this._finished = false; this._started = false; }; WebAnimationsPlayer.prototype._resetDomPlayerState = function () { if (this.domPlayer) { this.domPlayer.cancel(); } }; WebAnimationsPlayer.prototype.restart = function () { this.reset(); this.play(); }; WebAnimationsPlayer.prototype.hasStarted = function () { return this._started; }; WebAnimationsPlayer.prototype.destroy = function () { if (!this._destroyed) { this._destroyed = true; this._resetDomPlayerState(); this._onFinish(); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; WebAnimationsPlayer.prototype.setPosition = function (p) { this.domPlayer.currentTime = p * this.time; }; WebAnimationsPlayer.prototype.getPosition = function () { return this.domPlayer.currentTime / this.time; }; Object.defineProperty(WebAnimationsPlayer.prototype, "totalTime", { get: function () { return this._delay + this._duration; }, enumerable: true, configurable: true }); WebAnimationsPlayer.prototype.beforeDestroy = function () { var _this = this; var styles = {}; if (this.hasStarted()) { Object.keys(this._finalKeyframe).forEach(function (prop) { if (prop != 'offset') { styles[prop] = _this._finished ? _this._finalKeyframe[prop] : computeStyle(_this.element, prop); } }); } this.currentSnapshot = styles; }; /** @internal */ WebAnimationsPlayer.prototype.triggerCallback = function (phaseName) { var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return WebAnimationsPlayer; }()); var WebAnimationsDriver = /** @class */ (function () { function WebAnimationsDriver() { this._isNativeImpl = /\{\s*\[native\s+code\]\s*\}/.test(getElementAnimateFn().toString()); this._cssKeyframesDriver = new CssKeyframesDriver(); } WebAnimationsDriver.prototype.validateStyleProperty = function (prop) { return validateStyleProperty(prop); }; WebAnimationsDriver.prototype.matchesElement = function (element, selector) { return matchesElement(element, selector); }; WebAnimationsDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; WebAnimationsDriver.prototype.query = function (element, selector, multi) { return invokeQuery(element, selector, multi); }; WebAnimationsDriver.prototype.computeStyle = function (element, prop, defaultValue) { return window.getComputedStyle(element)[prop]; }; WebAnimationsDriver.prototype.overrideWebAnimationsSupport = function (supported) { this._isNativeImpl = supported; }; WebAnimationsDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers, scrubberAccessRequested) { if (previousPlayers === void 0) { previousPlayers = []; } var useKeyframes = !scrubberAccessRequested && !this._isNativeImpl; if (useKeyframes) { return this._cssKeyframesDriver.animate(element, keyframes, duration, delay, easing, previousPlayers); } var fill = delay == 0 ? 'both' : 'forwards'; var playerOptions = { duration: duration, delay: delay, fill: fill }; // we check for this to avoid having a null|undefined value be present // for the easing (which results in an error for certain browsers #9752) if (easing) { playerOptions['easing'] = easing; } var previousStyles = {}; var previousWebAnimationPlayers = previousPlayers.filter(function (player) { return player instanceof WebAnimationsPlayer; }); if (allowPreviousPlayerStylesMerge(duration, delay)) { previousWebAnimationPlayers.forEach(function (player) { var styles = player.currentSnapshot; Object.keys(styles).forEach(function (prop) { return previousStyles[prop] = styles[prop]; }); }); } keyframes = keyframes.map(function (styles) { return copyStyles(styles, false); }); keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles); return new WebAnimationsPlayer(element, keyframes, playerOptions); }; return WebAnimationsDriver; }()); function supportsWebAnimations() { return typeof getElementAnimateFn() === 'function'; } function getElementAnimateFn() { return (isBrowser() && Element.prototype['animate']) || {}; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=browser.js.map /***/ }), /***/ "./node_modules/@angular/cdk/esm5/a11y.es5.js": /*!****************************************************!*\ !*** ./node_modules/@angular/cdk/esm5/a11y.es5.js ***! \****************************************************/ /*! exports provided: ARIA_DESCRIBER_PROVIDER_FACTORY, MESSAGES_CONTAINER_ID, CDK_DESCRIBEDBY_ID_PREFIX, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, AriaDescriber, ARIA_DESCRIBER_PROVIDER, ActiveDescendantKeyManager, FocusKeyManager, ListKeyManager, FocusTrap, FocusTrapFactory, CdkTrapFocus, InteractivityChecker, LIVE_ANNOUNCER_PROVIDER_FACTORY, LiveAnnouncer, CdkAriaLive, LIVE_ANNOUNCER_PROVIDER, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, LIVE_ANNOUNCER_ELEMENT_TOKEN, FOCUS_MONITOR_PROVIDER_FACTORY, TOUCH_BUFFER_MS, FocusMonitor, CdkMonitorFocus, FOCUS_MONITOR_PROVIDER, isFakeMousedownFromScreenReader, A11yModule */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARIA_DESCRIBER_PROVIDER_FACTORY", function() { return ARIA_DESCRIBER_PROVIDER_FACTORY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGES_CONTAINER_ID", function() { return MESSAGES_CONTAINER_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CDK_DESCRIBEDBY_ID_PREFIX", function() { return CDK_DESCRIBEDBY_ID_PREFIX; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CDK_DESCRIBEDBY_HOST_ATTRIBUTE", function() { return CDK_DESCRIBEDBY_HOST_ATTRIBUTE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AriaDescriber", function() { return AriaDescriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARIA_DESCRIBER_PROVIDER", function() { return ARIA_DESCRIBER_PROVIDER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActiveDescendantKeyManager", function() { return ActiveDescendantKeyManager; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FocusKeyManager", function() { return FocusKeyManager; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ListKeyManager", function() { return ListKeyManager; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FocusTrap", function() { return FocusTrap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FocusTrapFactory", function() { return FocusTrapFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTrapFocus", function() { return CdkTrapFocus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InteractivityChecker", function() { return InteractivityChecker; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LIVE_ANNOUNCER_PROVIDER_FACTORY", function() { return LIVE_ANNOUNCER_PROVIDER_FACTORY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiveAnnouncer", function() { return LiveAnnouncer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkAriaLive", function() { return CdkAriaLive; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LIVE_ANNOUNCER_PROVIDER", function() { return LIVE_ANNOUNCER_PROVIDER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY", function() { return LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LIVE_ANNOUNCER_ELEMENT_TOKEN", function() { return LIVE_ANNOUNCER_ELEMENT_TOKEN; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FOCUS_MONITOR_PROVIDER_FACTORY", function() { return FOCUS_MONITOR_PROVIDER_FACTORY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TOUCH_BUFFER_MS", function() { return TOUCH_BUFFER_MS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FocusMonitor", function() { return FocusMonitor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkMonitorFocus", function() { return CdkMonitorFocus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FOCUS_MONITOR_PROVIDER", function() { return FOCUS_MONITOR_PROVIDER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFakeMousedownFromScreenReader", function() { return isFakeMousedownFromScreenReader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A11yModule", function() { return A11yModule; }); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); /* harmony import */ var _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/cdk/keycodes */ "./node_modules/@angular/cdk/esm5/keycodes.es5.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _angular_cdk_platform__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular/cdk/platform */ "./node_modules/@angular/cdk/esm5/platform.es5.js"); /* harmony import */ var _angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular/cdk/coercion */ "./node_modules/@angular/cdk/esm5/coercion.es5.js"); /* harmony import */ var _angular_cdk_observers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular/cdk/observers */ "./node_modules/@angular/cdk/esm5/observers.es5.js"); /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * IDs are deliminated by an empty space, as per the spec. * @type {?} */ var ID_DELIMINATOR = ' '; /** * Adds the given ID to the specified ARIA attribute on an element. * Used for attributes such as aria-labelledby, aria-owns, etc. * @param {?} el * @param {?} attr * @param {?} id * @return {?} */ function addAriaReferencedId(el, attr, id) { /** @type {?} */ var ids = getAriaReferenceIds(el, attr); if (ids.some(function (existingId) { return existingId.trim() == id.trim(); })) { return; } ids.push(id.trim()); el.setAttribute(attr, ids.join(ID_DELIMINATOR)); } /** * Removes the given ID from the specified ARIA attribute on an element. * Used for attributes such as aria-labelledby, aria-owns, etc. * @param {?} el * @param {?} attr * @param {?} id * @return {?} */ function removeAriaReferencedId(el, attr, id) { /** @type {?} */ var ids = getAriaReferenceIds(el, attr); /** @type {?} */ var filteredIds = ids.filter(function (val) { return val != id.trim(); }); el.setAttribute(attr, filteredIds.join(ID_DELIMINATOR)); } /** * Gets the list of IDs referenced by the given ARIA attribute on an element. * Used for attributes such as aria-labelledby, aria-owns, etc. * @param {?} el * @param {?} attr * @return {?} */ function getAriaReferenceIds(el, attr) { // Get string array of all individual ids (whitespace deliminated) in the attribute value return (el.getAttribute(attr) || '').match(/\S+/g) || []; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * ID used for the body container where all messages are appended. * @type {?} */ var MESSAGES_CONTAINER_ID = 'cdk-describedby-message-container'; /** * ID prefix used for each created message element. * @type {?} */ var CDK_DESCRIBEDBY_ID_PREFIX = 'cdk-describedby-message'; /** * Attribute given to each host element that is described by a message element. * @type {?} */ var CDK_DESCRIBEDBY_HOST_ATTRIBUTE = 'cdk-describedby-host'; /** * Global incremental identifier for each registered message element. * @type {?} */ var nextId = 0; /** * Global map of all registered message elements that have been placed into the document. * @type {?} */ var messageRegistry = new Map(); /** * Container for all registered messages. * @type {?} */ var messagesContainer = null; /** * Utility that creates visually hidden elements with a message content. Useful for elements that * want to use aria-describedby to further describe themselves without adding additional visual * content. * \@docs-private */ var AriaDescriber = /** @class */ (function () { function AriaDescriber(_document) { this._document = _document; } /** * Adds to the host element an aria-describedby reference to a hidden element that contains * the message. If the same message has already been registered, then it will reuse the created * message element. */ /** * Adds to the host element an aria-describedby reference to a hidden element that contains * the message. If the same message has already been registered, then it will reuse the created * message element. * @param {?} hostElement * @param {?} message * @return {?} */ AriaDescriber.prototype.describe = /** * Adds to the host element an aria-describedby reference to a hidden element that contains * the message. If the same message has already been registered, then it will reuse the created * message element. * @param {?} hostElement * @param {?} message * @return {?} */ function (hostElement, message) { if (!this._canBeDescribed(hostElement, message)) { return; } if (!messageRegistry.has(message)) { this._createMessageElement(message); } if (!this._isElementDescribedByMessage(hostElement, message)) { this._addMessageReference(hostElement, message); } }; /** Removes the host element's aria-describedby reference to the message element. */ /** * Removes the host element's aria-describedby reference to the message element. * @param {?} hostElement * @param {?} message * @return {?} */ AriaDescriber.prototype.removeDescription = /** * Removes the host element's aria-describedby reference to the message element. * @param {?} hostElement * @param {?} message * @return {?} */ function (hostElement, message) { if (!this._canBeDescribed(hostElement, message)) { return; } if (this._isElementDescribedByMessage(hostElement, message)) { this._removeMessageReference(hostElement, message); } /** @type {?} */ var registeredMessage = messageRegistry.get(message); if (registeredMessage && registeredMessage.referenceCount === 0) { this._deleteMessageElement(message); } if (messagesContainer && messagesContainer.childNodes.length === 0) { this._deleteMessagesContainer(); } }; /** Unregisters all created message elements and removes the message container. */ /** * Unregisters all created message elements and removes the message container. * @return {?} */ AriaDescriber.prototype.ngOnDestroy = /** * Unregisters all created message elements and removes the message container. * @return {?} */ function () { /** @type {?} */ var describedElements = this._document.querySelectorAll("[" + CDK_DESCRIBEDBY_HOST_ATTRIBUTE + "]"); for (var i = 0; i < describedElements.length; i++) { this._removeCdkDescribedByReferenceIds(describedElements[i]); describedElements[i].removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE); } if (messagesContainer) { this._deleteMessagesContainer(); } messageRegistry.clear(); }; /** * Creates a new element in the visually hidden message container element with the message * as its content and adds it to the message registry. */ /** * Creates a new element in the visually hidden message container element with the message * as its content and adds it to the message registry. * @private * @param {?} message * @return {?} */ AriaDescriber.prototype._createMessageElement = /** * Creates a new element in the visually hidden message container element with the message * as its content and adds it to the message registry. * @private * @param {?} message * @return {?} */ function (message) { /** @type {?} */ var messageElement = this._document.createElement('div'); messageElement.setAttribute('id', CDK_DESCRIBEDBY_ID_PREFIX + "-" + nextId++); messageElement.appendChild((/** @type {?} */ (this._document.createTextNode(message)))); this._createMessagesContainer(); (/** @type {?} */ (messagesContainer)).appendChild(messageElement); messageRegistry.set(message, { messageElement: messageElement, referenceCount: 0 }); }; /** Deletes the message element from the global messages container. */ /** * Deletes the message element from the global messages container. * @private * @param {?} message * @return {?} */ AriaDescriber.prototype._deleteMessageElement = /** * Deletes the message element from the global messages container. * @private * @param {?} message * @return {?} */ function (message) { /** @type {?} */ var registeredMessage = messageRegistry.get(message); /** @type {?} */ var messageElement = registeredMessage && registeredMessage.messageElement; if (messagesContainer && messageElement) { messagesContainer.removeChild(messageElement); } messageRegistry.delete(message); }; /** Creates the global container for all aria-describedby messages. */ /** * Creates the global container for all aria-describedby messages. * @private * @return {?} */ AriaDescriber.prototype._createMessagesContainer = /** * Creates the global container for all aria-describedby messages. * @private * @return {?} */ function () { if (!messagesContainer) { /** @type {?} */ var preExistingContainer = this._document.getElementById(MESSAGES_CONTAINER_ID); // When going from the server to the client, we may end up in a situation where there's // already a container on the page, but we don't have a reference to it. Clear the // old container so we don't get duplicates. Doing this, instead of emptying the previous // container, should be slightly faster. if (preExistingContainer) { (/** @type {?} */ (preExistingContainer.parentNode)).removeChild(preExistingContainer); } messagesContainer = this._document.createElement('div'); messagesContainer.id = MESSAGES_CONTAINER_ID; messagesContainer.setAttribute('aria-hidden', 'true'); messagesContainer.style.display = 'none'; this._document.body.appendChild(messagesContainer); } }; /** Deletes the global messages container. */ /** * Deletes the global messages container. * @private * @return {?} */ AriaDescriber.prototype._deleteMessagesContainer = /** * Deletes the global messages container. * @private * @return {?} */ function () { if (messagesContainer && messagesContainer.parentNode) { messagesContainer.parentNode.removeChild(messagesContainer); messagesContainer = null; } }; /** Removes all cdk-describedby messages that are hosted through the element. */ /** * Removes all cdk-describedby messages that are hosted through the element. * @private * @param {?} element * @return {?} */ AriaDescriber.prototype._removeCdkDescribedByReferenceIds = /** * Removes all cdk-describedby messages that are hosted through the element. * @private * @param {?} element * @return {?} */ function (element) { // Remove all aria-describedby reference IDs that are prefixed by CDK_DESCRIBEDBY_ID_PREFIX /** @type {?} */ var originalReferenceIds = getAriaReferenceIds(element, 'aria-describedby') .filter(function (id) { return id.indexOf(CDK_DESCRIBEDBY_ID_PREFIX) != 0; }); element.setAttribute('aria-describedby', originalReferenceIds.join(' ')); }; /** * Adds a message reference to the element using aria-describedby and increments the registered * message's reference count. */ /** * Adds a message reference to the element using aria-describedby and increments the registered * message's reference count. * @private * @param {?} element * @param {?} message * @return {?} */ AriaDescriber.prototype._addMessageReference = /** * Adds a message reference to the element using aria-describedby and increments the registered * message's reference count. * @private * @param {?} element * @param {?} message * @return {?} */ function (element, message) { /** @type {?} */ var registeredMessage = (/** @type {?} */ (messageRegistry.get(message))); // Add the aria-describedby reference and set the // describedby_host attribute to mark the element. addAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id); element.setAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE, ''); registeredMessage.referenceCount++; }; /** * Removes a message reference from the element using aria-describedby * and decrements the registered message's reference count. */ /** * Removes a message reference from the element using aria-describedby * and decrements the registered message's reference count. * @private * @param {?} element * @param {?} message * @return {?} */ AriaDescriber.prototype._removeMessageReference = /** * Removes a message reference from the element using aria-describedby * and decrements the registered message's reference count. * @private * @param {?} element * @param {?} message * @return {?} */ function (element, message) { /** @type {?} */ var registeredMessage = (/** @type {?} */ (messageRegistry.get(message))); registeredMessage.referenceCount--; removeAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id); element.removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE); }; /** Returns true if the element has been described by the provided message ID. */ /** * Returns true if the element has been described by the provided message ID. * @private * @param {?} element * @param {?} message * @return {?} */ AriaDescriber.prototype._isElementDescribedByMessage = /** * Returns true if the element has been described by the provided message ID. * @private * @param {?} element * @param {?} message * @return {?} */ function (element, message) { /** @type {?} */ var referenceIds = getAriaReferenceIds(element, 'aria-describedby'); /** @type {?} */ var registeredMessage = messageRegistry.get(message); /** @type {?} */ var messageId = registeredMessage && registeredMessage.messageElement.id; return !!messageId && referenceIds.indexOf(messageId) != -1; }; /** Determines whether a message can be described on a particular element. */ /** * Determines whether a message can be described on a particular element. * @private * @param {?} element * @param {?} message * @return {?} */ AriaDescriber.prototype._canBeDescribed = /** * Determines whether a message can be described on a particular element. * @private * @param {?} element * @param {?} message * @return {?} */ function (element, message) { return element.nodeType === this._document.ELEMENT_NODE && message != null && !!("" + message).trim(); }; AriaDescriber.decorators = [ { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"], args: [{ providedIn: 'root' },] }, ]; /** @nocollapse */ AriaDescriber.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"],] }] } ]; }; /** @nocollapse */ AriaDescriber.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["defineInjectable"])({ factory: function AriaDescriber_Factory() { return new AriaDescriber(Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["inject"])(_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"])); }, token: AriaDescriber, providedIn: "root" }); return AriaDescriber; }()); /** * \@docs-private \@deprecated \@breaking-change 8.0.0 * @param {?} parentDispatcher * @param {?} _document * @return {?} */ function ARIA_DESCRIBER_PROVIDER_FACTORY(parentDispatcher, _document) { return parentDispatcher || new AriaDescriber(_document); } /** * \@docs-private \@deprecated \@breaking-change 8.0.0 * @type {?} */ var ARIA_DESCRIBER_PROVIDER = { // If there is already an AriaDescriber available, use that. Otherwise, provide a new one. provide: AriaDescriber, deps: [ [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"](), AriaDescriber], (/** @type {?} */ (_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"])) ], useFactory: ARIA_DESCRIBER_PROVIDER_FACTORY }; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * This class manages keyboard events for selectable lists. If you pass it a query list * of items, it will set the active item correctly when arrow events occur. * @template T */ var /** * This class manages keyboard events for selectable lists. If you pass it a query list * of items, it will set the active item correctly when arrow events occur. * @template T */ ListKeyManager = /** @class */ (function () { function ListKeyManager(_items) { var _this = this; this._items = _items; this._activeItemIndex = -1; this._activeItem = null; this._wrap = false; this._letterKeyStream = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); this._typeaheadSubscription = rxjs__WEBPACK_IMPORTED_MODULE_2__["Subscription"].EMPTY; this._vertical = true; this._allowedModifierKeys = []; /** * Predicate function that can be used to check whether an item should be skipped * by the key manager. By default, disabled items are skipped. */ this._skipPredicateFn = function (item) { return item.disabled; }; // Buffer for the letters that the user has pressed when the typeahead option is turned on. this._pressedLetters = []; /** * Stream that emits any time the TAB key is pressed, so components can react * when focus is shifted off of the list. */ this.tabOut = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); /** * Stream that emits whenever the active item of the list manager changes. */ this.change = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); // We allow for the items to be an array because, in some cases, the consumer may // not have access to a QueryList of the items they want to manage (e.g. when the // items aren't being collected via `ViewChildren` or `ContentChildren`). if (_items instanceof _angular_core__WEBPACK_IMPORTED_MODULE_1__["QueryList"]) { _items.changes.subscribe(function (newItems) { if (_this._activeItem) { /** @type {?} */ var itemArray = newItems.toArray(); /** @type {?} */ var newIndex = itemArray.indexOf(_this._activeItem); if (newIndex > -1 && newIndex !== _this._activeItemIndex) { _this._activeItemIndex = newIndex; } } }); } } /** * Sets the predicate function that determines which items should be skipped by the * list key manager. * @param predicate Function that determines whether the given item should be skipped. */ /** * Sets the predicate function that determines which items should be skipped by the * list key manager. * @template THIS * @this {THIS} * @param {?} predicate Function that determines whether the given item should be skipped. * @return {THIS} */ ListKeyManager.prototype.skipPredicate = /** * Sets the predicate function that determines which items should be skipped by the * list key manager. * @template THIS * @this {THIS} * @param {?} predicate Function that determines whether the given item should be skipped. * @return {THIS} */ function (predicate) { (/** @type {?} */ (this))._skipPredicateFn = predicate; return (/** @type {?} */ (this)); }; /** * Configures wrapping mode, which determines whether the active item will wrap to * the other end of list when there are no more items in the given direction. * @param shouldWrap Whether the list should wrap when reaching the end. */ /** * Configures wrapping mode, which determines whether the active item will wrap to * the other end of list when there are no more items in the given direction. * @template THIS * @this {THIS} * @param {?=} shouldWrap Whether the list should wrap when reaching the end. * @return {THIS} */ ListKeyManager.prototype.withWrap = /** * Configures wrapping mode, which determines whether the active item will wrap to * the other end of list when there are no more items in the given direction. * @template THIS * @this {THIS} * @param {?=} shouldWrap Whether the list should wrap when reaching the end. * @return {THIS} */ function (shouldWrap) { if (shouldWrap === void 0) { shouldWrap = true; } (/** @type {?} */ (this))._wrap = shouldWrap; return (/** @type {?} */ (this)); }; /** * Configures whether the key manager should be able to move the selection vertically. * @param enabled Whether vertical selection should be enabled. */ /** * Configures whether the key manager should be able to move the selection vertically. * @template THIS * @this {THIS} * @param {?=} enabled Whether vertical selection should be enabled. * @return {THIS} */ ListKeyManager.prototype.withVerticalOrientation = /** * Configures whether the key manager should be able to move the selection vertically. * @template THIS * @this {THIS} * @param {?=} enabled Whether vertical selection should be enabled. * @return {THIS} */ function (enabled) { if (enabled === void 0) { enabled = true; } (/** @type {?} */ (this))._vertical = enabled; return (/** @type {?} */ (this)); }; /** * Configures the key manager to move the selection horizontally. * Passing in `null` will disable horizontal movement. * @param direction Direction in which the selection can be moved. */ /** * Configures the key manager to move the selection horizontally. * Passing in `null` will disable horizontal movement. * @template THIS * @this {THIS} * @param {?} direction Direction in which the selection can be moved. * @return {THIS} */ ListKeyManager.prototype.withHorizontalOrientation = /** * Configures the key manager to move the selection horizontally. * Passing in `null` will disable horizontal movement. * @template THIS * @this {THIS} * @param {?} direction Direction in which the selection can be moved. * @return {THIS} */ function (direction) { (/** @type {?} */ (this))._horizontal = direction; return (/** @type {?} */ (this)); }; /** * Modifier keys which are allowed to be held down and whose default actions will be prevented * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys. */ /** * Modifier keys which are allowed to be held down and whose default actions will be prevented * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys. * @template THIS * @this {THIS} * @param {?} keys * @return {THIS} */ ListKeyManager.prototype.withAllowedModifierKeys = /** * Modifier keys which are allowed to be held down and whose default actions will be prevented * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys. * @template THIS * @this {THIS} * @param {?} keys * @return {THIS} */ function (keys) { (/** @type {?} */ (this))._allowedModifierKeys = keys; return (/** @type {?} */ (this)); }; /** * Turns on typeahead mode which allows users to set the active item by typing. * @param debounceInterval Time to wait after the last keystroke before setting the active item. */ /** * Turns on typeahead mode which allows users to set the active item by typing. * @template THIS * @this {THIS} * @param {?=} debounceInterval Time to wait after the last keystroke before setting the active item. * @return {THIS} */ ListKeyManager.prototype.withTypeAhead = /** * Turns on typeahead mode which allows users to set the active item by typing. * @template THIS * @this {THIS} * @param {?=} debounceInterval Time to wait after the last keystroke before setting the active item. * @return {THIS} */ function (debounceInterval) { var _this = this; if (debounceInterval === void 0) { debounceInterval = 200; } if ((/** @type {?} */ (this))._items.length && (/** @type {?} */ (this))._items.some(function (item) { return typeof item.getLabel !== 'function'; })) { throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.'); } (/** @type {?} */ (this))._typeaheadSubscription.unsubscribe(); // Debounce the presses of non-navigational keys, collect the ones that correspond to letters // and convert those letters back into a string. Afterwards find the first item that starts // with that string and select it. (/** @type {?} */ (this))._typeaheadSubscription = (/** @type {?} */ (this))._letterKeyStream.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["tap"])(function (keyCode) { return (/** @type {?} */ (_this))._pressedLetters.push(keyCode); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["debounceTime"])(debounceInterval), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["filter"])(function () { return (/** @type {?} */ (_this))._pressedLetters.length > 0; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["map"])(function () { return (/** @type {?} */ (_this))._pressedLetters.join(''); })).subscribe(function (inputString) { /** @type {?} */ var items = (/** @type {?} */ (_this))._getItemsArray(); // Start at 1 because we want to start searching at the item immediately // following the current active item. for (var i = 1; i < items.length + 1; i++) { /** @type {?} */ var index = ((/** @type {?} */ (_this))._activeItemIndex + i) % items.length; /** @type {?} */ var item = items[index]; if (!(/** @type {?} */ (_this))._skipPredicateFn(item) && (/** @type {?} */ (item.getLabel))().toUpperCase().trim().indexOf(inputString) === 0) { (/** @type {?} */ (_this)).setActiveItem(index); break; } } (/** @type {?} */ (_this))._pressedLetters = []; }); return (/** @type {?} */ (this)); }; /** * @param {?} item * @return {?} */ ListKeyManager.prototype.setActiveItem = /** * @param {?} item * @return {?} */ function (item) { /** @type {?} */ var previousIndex = this._activeItemIndex; this.updateActiveItem(item); if (this._activeItemIndex !== previousIndex) { this.change.next(this._activeItemIndex); } }; /** * Sets the active item depending on the key event passed in. * @param event Keyboard event to be used for determining which element should be active. */ /** * Sets the active item depending on the key event passed in. * @param {?} event Keyboard event to be used for determining which element should be active. * @return {?} */ ListKeyManager.prototype.onKeydown = /** * Sets the active item depending on the key event passed in. * @param {?} event Keyboard event to be used for determining which element should be active. * @return {?} */ function (event) { var _this = this; /** @type {?} */ var keyCode = event.keyCode; /** @type {?} */ var modifiers = ['altKey', 'ctrlKey', 'metaKey', 'shiftKey']; /** @type {?} */ var isModifierAllowed = modifiers.every(function (modifier) { return !event[modifier] || _this._allowedModifierKeys.indexOf(modifier) > -1; }); switch (keyCode) { case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["TAB"]: this.tabOut.next(); return; case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["DOWN_ARROW"]: if (this._vertical && isModifierAllowed) { this.setNextItemActive(); break; } else { return; } case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["UP_ARROW"]: if (this._vertical && isModifierAllowed) { this.setPreviousItemActive(); break; } else { return; } case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["RIGHT_ARROW"]: if (this._horizontal && isModifierAllowed) { this._horizontal === 'rtl' ? this.setPreviousItemActive() : this.setNextItemActive(); break; } else { return; } case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["LEFT_ARROW"]: if (this._horizontal && isModifierAllowed) { this._horizontal === 'rtl' ? this.setNextItemActive() : this.setPreviousItemActive(); break; } else { return; } default: if (isModifierAllowed || Object(_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["hasModifierKey"])(event, 'shiftKey')) { // Attempt to use the `event.key` which also maps it to the user's keyboard language, // otherwise fall back to resolving alphanumeric characters via the keyCode. if (event.key && event.key.length === 1) { this._letterKeyStream.next(event.key.toLocaleUpperCase()); } else if ((keyCode >= _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["A"] && keyCode <= _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["Z"]) || (keyCode >= _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["ZERO"] && keyCode <= _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["NINE"])) { this._letterKeyStream.next(String.fromCharCode(keyCode)); } } // Note that we return here, in order to avoid preventing // the default action of non-navigational keys. return; } this._pressedLetters = []; event.preventDefault(); }; Object.defineProperty(ListKeyManager.prototype, "activeItemIndex", { /** Index of the currently active item. */ get: /** * Index of the currently active item. * @return {?} */ function () { return this._activeItemIndex; }, enumerable: true, configurable: true }); Object.defineProperty(ListKeyManager.prototype, "activeItem", { /** The active item. */ get: /** * The active item. * @return {?} */ function () { return this._activeItem; }, enumerable: true, configurable: true }); /** Sets the active item to the first enabled item in the list. */ /** * Sets the active item to the first enabled item in the list. * @return {?} */ ListKeyManager.prototype.setFirstItemActive = /** * Sets the active item to the first enabled item in the list. * @return {?} */ function () { this._setActiveItemByIndex(0, 1); }; /** Sets the active item to the last enabled item in the list. */ /** * Sets the active item to the last enabled item in the list. * @return {?} */ ListKeyManager.prototype.setLastItemActive = /** * Sets the active item to the last enabled item in the list. * @return {?} */ function () { this._setActiveItemByIndex(this._items.length - 1, -1); }; /** Sets the active item to the next enabled item in the list. */ /** * Sets the active item to the next enabled item in the list. * @return {?} */ ListKeyManager.prototype.setNextItemActive = /** * Sets the active item to the next enabled item in the list. * @return {?} */ function () { this._activeItemIndex < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(1); }; /** Sets the active item to a previous enabled item in the list. */ /** * Sets the active item to a previous enabled item in the list. * @return {?} */ ListKeyManager.prototype.setPreviousItemActive = /** * Sets the active item to a previous enabled item in the list. * @return {?} */ function () { this._activeItemIndex < 0 && this._wrap ? this.setLastItemActive() : this._setActiveItemByDelta(-1); }; /** * @param {?} item * @return {?} */ ListKeyManager.prototype.updateActiveItem = /** * @param {?} item * @return {?} */ function (item) { /** @type {?} */ var itemArray = this._getItemsArray(); /** @type {?} */ var index = typeof item === 'number' ? item : itemArray.indexOf(item); /** @type {?} */ var activeItem = itemArray[index]; // Explicitly check for `null` and `undefined` because other falsy values are valid. this._activeItem = activeItem == null ? null : activeItem; this._activeItemIndex = index; }; /** * Allows setting of the activeItemIndex without any other effects. * @param index The new activeItemIndex. * @deprecated Use `updateActiveItem` instead. * @breaking-change 8.0.0 */ /** * Allows setting of the activeItemIndex without any other effects. * @deprecated Use `updateActiveItem` instead. * \@breaking-change 8.0.0 * @param {?} index The new activeItemIndex. * @return {?} */ ListKeyManager.prototype.updateActiveItemIndex = /** * Allows setting of the activeItemIndex without any other effects. * @deprecated Use `updateActiveItem` instead. * \@breaking-change 8.0.0 * @param {?} index The new activeItemIndex. * @return {?} */ function (index) { this.updateActiveItem(index); }; /** * This method sets the active item, given a list of items and the delta between the * currently active item and the new active item. It will calculate differently * depending on whether wrap mode is turned on. */ /** * This method sets the active item, given a list of items and the delta between the * currently active item and the new active item. It will calculate differently * depending on whether wrap mode is turned on. * @private * @param {?} delta * @return {?} */ ListKeyManager.prototype._setActiveItemByDelta = /** * This method sets the active item, given a list of items and the delta between the * currently active item and the new active item. It will calculate differently * depending on whether wrap mode is turned on. * @private * @param {?} delta * @return {?} */ function (delta) { this._wrap ? this._setActiveInWrapMode(delta) : this._setActiveInDefaultMode(delta); }; /** * Sets the active item properly given "wrap" mode. In other words, it will continue to move * down the list until it finds an item that is not disabled, and it will wrap if it * encounters either end of the list. */ /** * Sets the active item properly given "wrap" mode. In other words, it will continue to move * down the list until it finds an item that is not disabled, and it will wrap if it * encounters either end of the list. * @private * @param {?} delta * @return {?} */ ListKeyManager.prototype._setActiveInWrapMode = /** * Sets the active item properly given "wrap" mode. In other words, it will continue to move * down the list until it finds an item that is not disabled, and it will wrap if it * encounters either end of the list. * @private * @param {?} delta * @return {?} */ function (delta) { /** @type {?} */ var items = this._getItemsArray(); for (var i = 1; i <= items.length; i++) { /** @type {?} */ var index = (this._activeItemIndex + (delta * i) + items.length) % items.length; /** @type {?} */ var item = items[index]; if (!this._skipPredicateFn(item)) { this.setActiveItem(index); return; } } }; /** * Sets the active item properly given the default mode. In other words, it will * continue to move down the list until it finds an item that is not disabled. If * it encounters either end of the list, it will stop and not wrap. */ /** * Sets the active item properly given the default mode. In other words, it will * continue to move down the list until it finds an item that is not disabled. If * it encounters either end of the list, it will stop and not wrap. * @private * @param {?} delta * @return {?} */ ListKeyManager.prototype._setActiveInDefaultMode = /** * Sets the active item properly given the default mode. In other words, it will * continue to move down the list until it finds an item that is not disabled. If * it encounters either end of the list, it will stop and not wrap. * @private * @param {?} delta * @return {?} */ function (delta) { this._setActiveItemByIndex(this._activeItemIndex + delta, delta); }; /** * Sets the active item to the first enabled item starting at the index specified. If the * item is disabled, it will move in the fallbackDelta direction until it either * finds an enabled item or encounters the end of the list. */ /** * Sets the active item to the first enabled item starting at the index specified. If the * item is disabled, it will move in the fallbackDelta direction until it either * finds an enabled item or encounters the end of the list. * @private * @param {?} index * @param {?} fallbackDelta * @return {?} */ ListKeyManager.prototype._setActiveItemByIndex = /** * Sets the active item to the first enabled item starting at the index specified. If the * item is disabled, it will move in the fallbackDelta direction until it either * finds an enabled item or encounters the end of the list. * @private * @param {?} index * @param {?} fallbackDelta * @return {?} */ function (index, fallbackDelta) { /** @type {?} */ var items = this._getItemsArray(); if (!items[index]) { return; } while (this._skipPredicateFn(items[index])) { index += fallbackDelta; if (!items[index]) { return; } } this.setActiveItem(index); }; /** Returns the items as an array. */ /** * Returns the items as an array. * @private * @return {?} */ ListKeyManager.prototype._getItemsArray = /** * Returns the items as an array. * @private * @return {?} */ function () { return this._items instanceof _angular_core__WEBPACK_IMPORTED_MODULE_1__["QueryList"] ? this._items.toArray() : this._items; }; return ListKeyManager; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template T */ var /** * @template T */ ActiveDescendantKeyManager = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__extends"])(ActiveDescendantKeyManager, _super); function ActiveDescendantKeyManager() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} index * @return {?} */ ActiveDescendantKeyManager.prototype.setActiveItem = /** * @param {?} index * @return {?} */ function (index) { if (this.activeItem) { this.activeItem.setInactiveStyles(); } _super.prototype.setActiveItem.call(this, index); if (this.activeItem) { this.activeItem.setActiveStyles(); } }; return ActiveDescendantKeyManager; }(ListKeyManager)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template T */ var /** * @template T */ FocusKeyManager = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__extends"])(FocusKeyManager, _super); function FocusKeyManager() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._origin = 'program'; return _this; } /** * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls. * @param origin Focus origin to be used when focusing items. */ /** * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls. * @template THIS * @this {THIS} * @param {?} origin Focus origin to be used when focusing items. * @return {THIS} */ FocusKeyManager.prototype.setFocusOrigin = /** * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls. * @template THIS * @this {THIS} * @param {?} origin Focus origin to be used when focusing items. * @return {THIS} */ function (origin) { (/** @type {?} */ (this))._origin = origin; return (/** @type {?} */ (this)); }; /** * @param {?} item * @return {?} */ FocusKeyManager.prototype.setActiveItem = /** * @param {?} item * @return {?} */ function (item) { _super.prototype.setActiveItem.call(this, item); if (this.activeItem) { this.activeItem.focus(this._origin); } }; return FocusKeyManager; }(ListKeyManager)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // The InteractivityChecker leans heavily on the ally.js accessibility utilities. // Methods like `isTabbable` are only covering specific edge-cases for the browsers which are // supported. /** * Utility for checking the interactivity of an element, such as whether is is focusable or * tabbable. */ var InteractivityChecker = /** @class */ (function () { function InteractivityChecker(_platform) { this._platform = _platform; } /** * Gets whether an element is disabled. * * @param element Element to be checked. * @returns Whether the element is disabled. */ /** * Gets whether an element is disabled. * * @param {?} element Element to be checked. * @return {?} Whether the element is disabled. */ InteractivityChecker.prototype.isDisabled = /** * Gets whether an element is disabled. * * @param {?} element Element to be checked. * @return {?} Whether the element is disabled. */ function (element) { // This does not capture some cases, such as a non-form control with a disabled attribute or // a form control inside of a disabled form, but should capture the most common cases. return element.hasAttribute('disabled'); }; /** * Gets whether an element is visible for the purposes of interactivity. * * This will capture states like `display: none` and `visibility: hidden`, but not things like * being clipped by an `overflow: hidden` parent or being outside the viewport. * * @returns Whether the element is visible. */ /** * Gets whether an element is visible for the purposes of interactivity. * * This will capture states like `display: none` and `visibility: hidden`, but not things like * being clipped by an `overflow: hidden` parent or being outside the viewport. * * @param {?} element * @return {?} Whether the element is visible. */ InteractivityChecker.prototype.isVisible = /** * Gets whether an element is visible for the purposes of interactivity. * * This will capture states like `display: none` and `visibility: hidden`, but not things like * being clipped by an `overflow: hidden` parent or being outside the viewport. * * @param {?} element * @return {?} Whether the element is visible. */ function (element) { return hasGeometry(element) && getComputedStyle(element).visibility === 'visible'; }; /** * Gets whether an element can be reached via Tab key. * Assumes that the element has already been checked with isFocusable. * * @param element Element to be checked. * @returns Whether the element is tabbable. */ /** * Gets whether an element can be reached via Tab key. * Assumes that the element has already been checked with isFocusable. * * @param {?} element Element to be checked. * @return {?} Whether the element is tabbable. */ InteractivityChecker.prototype.isTabbable = /** * Gets whether an element can be reached via Tab key. * Assumes that the element has already been checked with isFocusable. * * @param {?} element Element to be checked. * @return {?} Whether the element is tabbable. */ function (element) { // Nothing is tabbable on the server 😎 if (!this._platform.isBrowser) { return false; } /** @type {?} */ var frameElement = getFrameElement(getWindow(element)); if (frameElement) { /** @type {?} */ var frameType = frameElement && frameElement.nodeName.toLowerCase(); // Frame elements inherit their tabindex onto all child elements. if (getTabIndexValue(frameElement) === -1) { return false; } // Webkit and Blink consider anything inside of an element as non-tabbable. if ((this._platform.BLINK || this._platform.WEBKIT) && frameType === 'object') { return false; } // Webkit and Blink disable tabbing to an element inside of an invisible frame. if ((this._platform.BLINK || this._platform.WEBKIT) && !this.isVisible(frameElement)) { return false; } } /** @type {?} */ var nodeName = element.nodeName.toLowerCase(); /** @type {?} */ var tabIndexValue = getTabIndexValue(element); if (element.hasAttribute('contenteditable')) { return tabIndexValue !== -1; } if (nodeName === 'iframe') { // The frames may be tabbable depending on content, but it's not possibly to reliably // investigate the content of the frames. return false; } if (nodeName === 'audio') { if (!element.hasAttribute('controls')) { // By default an