(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 ",
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
",
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 `