blob: c6a9069c0ef0d34fd6ebd14c33fbfe01750c27f2 [file] [log] [blame]
/**
* @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
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/forms'), require('@angular/material/core'), require('@angular/platform-browser/animations'), require('@angular/cdk/observers'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define('@angular/material/checkbox', ['exports', '@angular/core', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/forms', '@angular/material/core', '@angular/platform-browser/animations', '@angular/cdk/observers', '@angular/common'], factory) :
(factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.checkbox = {}),global.ng.core,global.ng.cdk.a11y,global.ng.cdk.coercion,global.ng.forms,global.ng.material.core,global.ng.platformBrowser.animations,global.ng.cdk.observers,global.ng.common));
}(this, (function (exports,core,a11y,coercion,forms,core$1,animations,observers,common) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Injection token that can be used to specify the checkbox click behavior.
* @type {?}
*/
var MAT_CHECKBOX_CLICK_ACTION = new core.InjectionToken('mat-checkbox-click-action');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// Increasing integer for generating unique ids for checkbox components.
/** @type {?} */
var nextUniqueId = 0;
/**
* Provider Expression that allows mat-checkbox to register as a ControlValueAccessor.
* This allows it to support [(ngModel)].
* \@docs-private
* @type {?}
*/
var MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
provide: forms.NG_VALUE_ACCESSOR,
useExisting: core.forwardRef((/**
* @return {?}
*/
function () { return MatCheckbox; })),
multi: true
};
/** @enum {number} */
var TransitionCheckState = {
/** The initial state of the component before any user interaction. */
Init: 0,
/** The state representing the component when it's becoming checked. */
Checked: 1,
/** The state representing the component when it's becoming unchecked. */
Unchecked: 2,
/** The state representing the component when it's becoming indeterminate. */
Indeterminate: 3,
};
TransitionCheckState[TransitionCheckState.Init] = 'Init';
TransitionCheckState[TransitionCheckState.Checked] = 'Checked';
TransitionCheckState[TransitionCheckState.Unchecked] = 'Unchecked';
TransitionCheckState[TransitionCheckState.Indeterminate] = 'Indeterminate';
/**
* Change event object emitted by MatCheckbox.
*/
var /**
* Change event object emitted by MatCheckbox.
*/
MatCheckboxChange = /** @class */ (function () {
function MatCheckboxChange() {
}
return MatCheckboxChange;
}());
// Boilerplate for applying mixins to MatCheckbox.
/**
* \@docs-private
*/
var
// Boilerplate for applying mixins to MatCheckbox.
/**
* \@docs-private
*/
MatCheckboxBase = /** @class */ (function () {
function MatCheckboxBase(_elementRef) {
this._elementRef = _elementRef;
}
return MatCheckboxBase;
}());
/** @type {?} */
var _MatCheckboxMixinBase = core$1.mixinTabIndex(core$1.mixinColor(core$1.mixinDisableRipple(core$1.mixinDisabled(MatCheckboxBase)), 'accent'));
/**
* A material design checkbox component. Supports all of the functionality of an HTML5 checkbox,
* and exposes a similar API. A MatCheckbox can be either checked, unchecked, indeterminate, or
* disabled. Note that all additional accessibility attributes are taken care of by the component,
* so there is no need to provide them yourself. However, if you want to omit a label and still
* have the checkbox be accessible, you may supply an [aria-label] input.
* See: https://material.io/design/components/selection-controls.html
*/
var MatCheckbox = /** @class */ (function (_super) {
__extends(MatCheckbox, _super);
function MatCheckbox(elementRef, _changeDetectorRef, _focusMonitor, _ngZone, tabIndex, _clickAction, _animationMode) {
var _this = _super.call(this, elementRef) || this;
_this._changeDetectorRef = _changeDetectorRef;
_this._focusMonitor = _focusMonitor;
_this._ngZone = _ngZone;
_this._clickAction = _clickAction;
_this._animationMode = _animationMode;
/**
* Attached to the aria-label attribute of the host element. In most cases, aria-labelledby will
* take precedence so this may be omitted.
*/
_this.ariaLabel = '';
/**
* Users can specify the `aria-labelledby` attribute which will be forwarded to the input element
*/
_this.ariaLabelledby = null;
_this._uniqueId = "mat-checkbox-" + ++nextUniqueId;
/**
* A unique id for the checkbox input. If none is supplied, it will be auto-generated.
*/
_this.id = _this._uniqueId;
/**
* Whether the label should appear after or before the checkbox. Defaults to 'after'
*/
_this.labelPosition = 'after';
/**
* Name value will be applied to the input element if present
*/
_this.name = null;
/**
* Event emitted when the checkbox's `checked` value changes.
*/
_this.change = new core.EventEmitter();
/**
* Event emitted when the checkbox's `indeterminate` value changes.
*/
_this.indeterminateChange = new core.EventEmitter();
/**
* Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor.
* \@docs-private
*/
_this._onTouched = (/**
* @return {?}
*/
function () { });
_this._currentAnimationClass = '';
_this._currentCheckState = TransitionCheckState.Init;
_this._controlValueAccessorChangeFn = (/**
* @return {?}
*/
function () { });
_this._checked = false;
_this._disabled = false;
_this._indeterminate = false;
_this.tabIndex = parseInt(tabIndex) || 0;
_this._focusMonitor.monitor(elementRef, true).subscribe((/**
* @param {?} focusOrigin
* @return {?}
*/
function (focusOrigin) {
if (!focusOrigin) {
// When a focused element becomes disabled, the browser *immediately* fires a blur event.
// Angular does not expect events to be raised during change detection, so any state change
// (such as a form control's 'ng-touched') will cause a changed-after-checked error.
// See https://github.com/angular/angular/issues/17793. To work around this, we defer
// telling the form control it has been touched until the next tick.
Promise.resolve().then((/**
* @return {?}
*/
function () {
_this._onTouched();
_changeDetectorRef.markForCheck();
}));
}
}));
return _this;
}
Object.defineProperty(MatCheckbox.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(MatCheckbox.prototype, "required", {
/** Whether the checkbox is required. */
get: /**
* Whether the checkbox is required.
* @return {?}
*/
function () { return this._required; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) { this._required = coercion.coerceBooleanProperty(value); },
enumerable: true,
configurable: true
});
// TODO: Delete next major revision.
// TODO: Delete next major revision.
/**
* @return {?}
*/
MatCheckbox.prototype.ngAfterViewChecked =
// TODO: Delete next major revision.
/**
* @return {?}
*/
function () { };
/**
* @return {?}
*/
MatCheckbox.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this._focusMonitor.stopMonitoring(this._elementRef);
};
Object.defineProperty(MatCheckbox.prototype, "checked", {
/**
* Whether the checkbox is checked.
*/
get: /**
* Whether the checkbox is checked.
* @return {?}
*/
function () { return this._checked; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (value != this.checked) {
this._checked = value;
this._changeDetectorRef.markForCheck();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatCheckbox.prototype, "disabled", {
/**
* Whether the checkbox is disabled. This fully overrides the implementation provided by
* mixinDisabled, but the mixin is still required because mixinTabIndex requires it.
*/
get: /**
* Whether the checkbox is disabled. This fully overrides the implementation provided by
* mixinDisabled, but the mixin is still required because mixinTabIndex requires it.
* @return {?}
*/
function () { return this._disabled; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
/** @type {?} */
var newValue = coercion.coerceBooleanProperty(value);
if (newValue !== this.disabled) {
this._disabled = newValue;
this._changeDetectorRef.markForCheck();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatCheckbox.prototype, "indeterminate", {
/**
* Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to
* represent a checkbox with three states, e.g. a checkbox that represents a nested list of
* checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately
* set to false.
*/
get: /**
* Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to
* represent a checkbox with three states, e.g. a checkbox that represents a nested list of
* checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately
* set to false.
* @return {?}
*/
function () { return this._indeterminate; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
/** @type {?} */
var changed = value != this._indeterminate;
this._indeterminate = value;
if (changed) {
if (this._indeterminate) {
this._transitionCheckState(TransitionCheckState.Indeterminate);
}
else {
this._transitionCheckState(this.checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
}
this.indeterminateChange.emit(this._indeterminate);
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
MatCheckbox.prototype._isRippleDisabled = /**
* @return {?}
*/
function () {
return this.disableRipple || this.disabled;
};
/** Method being called whenever the label text changes. */
/**
* Method being called whenever the label text changes.
* @return {?}
*/
MatCheckbox.prototype._onLabelTextChange = /**
* Method being called whenever the label text changes.
* @return {?}
*/
function () {
// Since the event of the `cdkObserveContent` directive runs outside of the zone, the checkbox
// component will be only marked for check, but no actual change detection runs automatically.
// Instead of going back into the zone in order to trigger a change detection which causes
// *all* components to be checked (if explicitly marked or not using OnPush), we only trigger
// an explicit change detection for the checkbox view and it's children.
this._changeDetectorRef.detectChanges();
};
// Implemented as part of ControlValueAccessor.
// Implemented as part of ControlValueAccessor.
/**
* @param {?} value
* @return {?}
*/
MatCheckbox.prototype.writeValue =
// Implemented as part of ControlValueAccessor.
/**
* @param {?} value
* @return {?}
*/
function (value) {
this.checked = !!value;
};
// Implemented as part of ControlValueAccessor.
// Implemented as part of ControlValueAccessor.
/**
* @param {?} fn
* @return {?}
*/
MatCheckbox.prototype.registerOnChange =
// Implemented as part of ControlValueAccessor.
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
this._controlValueAccessorChangeFn = fn;
};
// Implemented as part of ControlValueAccessor.
// Implemented as part of ControlValueAccessor.
/**
* @param {?} fn
* @return {?}
*/
MatCheckbox.prototype.registerOnTouched =
// Implemented as part of ControlValueAccessor.
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
this._onTouched = fn;
};
// Implemented as part of ControlValueAccessor.
// Implemented as part of ControlValueAccessor.
/**
* @param {?} isDisabled
* @return {?}
*/
MatCheckbox.prototype.setDisabledState =
// Implemented as part of ControlValueAccessor.
/**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this.disabled = isDisabled;
};
/**
* @return {?}
*/
MatCheckbox.prototype._getAriaChecked = /**
* @return {?}
*/
function () {
return this.checked ? 'true' : (this.indeterminate ? 'mixed' : 'false');
};
/**
* @private
* @param {?} newState
* @return {?}
*/
MatCheckbox.prototype._transitionCheckState = /**
* @private
* @param {?} newState
* @return {?}
*/
function (newState) {
/** @type {?} */
var oldState = this._currentCheckState;
/** @type {?} */
var element = this._elementRef.nativeElement;
if (oldState === newState) {
return;
}
if (this._currentAnimationClass.length > 0) {
element.classList.remove(this._currentAnimationClass);
}
this._currentAnimationClass = this._getAnimationClassForCheckStateTransition(oldState, newState);
this._currentCheckState = newState;
if (this._currentAnimationClass.length > 0) {
element.classList.add(this._currentAnimationClass);
// Remove the animation class to avoid animation when the checkbox is moved between containers
/** @type {?} */
var animationClass_1 = this._currentAnimationClass;
this._ngZone.runOutsideAngular((/**
* @return {?}
*/
function () {
setTimeout((/**
* @return {?}
*/
function () {
element.classList.remove(animationClass_1);
}), 1000);
}));
}
};
/**
* @private
* @return {?}
*/
MatCheckbox.prototype._emitChangeEvent = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var event = new MatCheckboxChange();
event.source = this;
event.checked = this.checked;
this._controlValueAccessorChangeFn(this.checked);
this.change.emit(event);
};
/** Toggles the `checked` state of the checkbox. */
/**
* Toggles the `checked` state of the checkbox.
* @return {?}
*/
MatCheckbox.prototype.toggle = /**
* Toggles the `checked` state of the checkbox.
* @return {?}
*/
function () {
this.checked = !this.checked;
};
/**
* Event handler for checkbox input element.
* Toggles checked state if element is not disabled.
* Do not toggle on (change) event since IE doesn't fire change event when
* indeterminate checkbox is clicked.
* @param event
*/
/**
* Event handler for checkbox input element.
* Toggles checked state if element is not disabled.
* Do not toggle on (change) event since IE doesn't fire change event when
* indeterminate checkbox is clicked.
* @param {?} event
* @return {?}
*/
MatCheckbox.prototype._onInputClick = /**
* Event handler for checkbox input element.
* Toggles checked state if element is not disabled.
* Do not toggle on (change) event since IE doesn't fire change event when
* indeterminate checkbox is clicked.
* @param {?} event
* @return {?}
*/
function (event) {
var _this = this;
// We have to stop propagation for click events on the visual hidden input element.
// By default, when a user clicks on a label element, a generated click event will be
// dispatched on the associated input element. Since we are using a label element as our
// root container, the click event on the `checkbox` will be executed twice.
// The real click event will bubble up, and the generated click event also tries to bubble up.
// This will lead to multiple click events.
// Preventing bubbling for the second event will solve that issue.
event.stopPropagation();
// If resetIndeterminate is false, and the current state is indeterminate, do nothing on click
if (!this.disabled && this._clickAction !== 'noop') {
// When user manually click on the checkbox, `indeterminate` is set to false.
if (this.indeterminate && this._clickAction !== 'check') {
Promise.resolve().then((/**
* @return {?}
*/
function () {
_this._indeterminate = false;
_this.indeterminateChange.emit(_this._indeterminate);
}));
}
this.toggle();
this._transitionCheckState(this._checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
// Emit our custom change event if the native input emitted one.
// It is important to only emit it, if the native input triggered one, because
// we don't want to trigger a change event, when the `checked` variable changes for example.
this._emitChangeEvent();
}
else if (!this.disabled && this._clickAction === 'noop') {
// Reset native input when clicked with noop. The native checkbox becomes checked after
// click, reset it to be align with `checked` value of `mat-checkbox`.
this._inputElement.nativeElement.checked = this.checked;
this._inputElement.nativeElement.indeterminate = this.indeterminate;
}
};
/** Focuses the checkbox. */
/**
* Focuses the checkbox.
* @return {?}
*/
MatCheckbox.prototype.focus = /**
* Focuses the checkbox.
* @return {?}
*/
function () {
this._focusMonitor.focusVia(this._inputElement, 'keyboard');
};
/**
* @param {?} event
* @return {?}
*/
MatCheckbox.prototype._onInteractionEvent = /**
* @param {?} event
* @return {?}
*/
function (event) {
// We always have to stop propagation on the change event.
// Otherwise the change event, from the input element, will bubble up and
// emit its event object to the `change` output.
event.stopPropagation();
};
/**
* @private
* @param {?} oldState
* @param {?} newState
* @return {?}
*/
MatCheckbox.prototype._getAnimationClassForCheckStateTransition = /**
* @private
* @param {?} oldState
* @param {?} newState
* @return {?}
*/
function (oldState, newState) {
// Don't transition if animations are disabled.
if (this._animationMode === 'NoopAnimations') {
return '';
}
/** @type {?} */
var animSuffix = '';
switch (oldState) {
case TransitionCheckState.Init:
// Handle edge case where user interacts with checkbox that does not have [(ngModel)] or
// [checked] bound to it.
if (newState === TransitionCheckState.Checked) {
animSuffix = 'unchecked-checked';
}
else if (newState == TransitionCheckState.Indeterminate) {
animSuffix = 'unchecked-indeterminate';
}
else {
return '';
}
break;
case TransitionCheckState.Unchecked:
animSuffix = newState === TransitionCheckState.Checked ?
'unchecked-checked' : 'unchecked-indeterminate';
break;
case TransitionCheckState.Checked:
animSuffix = newState === TransitionCheckState.Unchecked ?
'checked-unchecked' : 'checked-indeterminate';
break;
case TransitionCheckState.Indeterminate:
animSuffix = newState === TransitionCheckState.Checked ?
'indeterminate-checked' : 'indeterminate-unchecked';
break;
}
return "mat-checkbox-anim-" + animSuffix;
};
MatCheckbox.decorators = [
{ type: core.Component, args: [{selector: 'mat-checkbox',
template: "<label [attr.for]=\"inputId\" class=\"mat-checkbox-layout\" #label><div class=\"mat-checkbox-inner-container\" [class.mat-checkbox-inner-container-no-side-margin]=\"!checkboxLabel.textContent || !checkboxLabel.textContent.trim()\"><input #input class=\"mat-checkbox-input cdk-visually-hidden\" type=\"checkbox\" [id]=\"inputId\" [required]=\"required\" [checked]=\"checked\" [attr.value]=\"value\" [disabled]=\"disabled\" [attr.name]=\"name\" [tabIndex]=\"tabIndex\" [indeterminate]=\"indeterminate\" [attr.aria-label]=\"ariaLabel || null\" [attr.aria-labelledby]=\"ariaLabelledby\" [attr.aria-checked]=\"_getAriaChecked()\" (change)=\"_onInteractionEvent($event)\" (click)=\"_onInputClick($event)\"><div matRipple class=\"mat-checkbox-ripple\" [matRippleTrigger]=\"label\" [matRippleDisabled]=\"_isRippleDisabled()\" [matRippleRadius]=\"20\" [matRippleCentered]=\"true\" [matRippleAnimation]=\"{enterDuration: 150}\"><div class=\"mat-ripple-element mat-checkbox-persistent-ripple\"></div></div><div class=\"mat-checkbox-frame\"></div><div class=\"mat-checkbox-background\"><svg version=\"1.1\" focusable=\"false\" class=\"mat-checkbox-checkmark\" viewBox=\"0 0 24 24\" xml:space=\"preserve\"><path class=\"mat-checkbox-checkmark-path\" fill=\"none\" stroke=\"white\" d=\"M4.1,12.7 9,17.6 20.3,6.3\"/></svg><div class=\"mat-checkbox-mixedmark\"></div></div></div><span class=\"mat-checkbox-label\" #checkboxLabel (cdkObserveContent)=\"_onLabelTextChange()\"><span style=\"display:none\">&nbsp;</span><ng-content></ng-content></span></label>",
styles: ["@keyframes mat-checkbox-fade-in-background{0%{opacity:0}50%{opacity:1}}@keyframes mat-checkbox-fade-out-background{0%,50%{opacity:1}100%{opacity:0}}@keyframes mat-checkbox-unchecked-checked-checkmark-path{0%,50%{stroke-dashoffset:22.91026}50%{animation-timing-function:cubic-bezier(0,0,.2,.1)}100%{stroke-dashoffset:0}}@keyframes mat-checkbox-unchecked-indeterminate-mixedmark{0%,68.2%{transform:scaleX(0)}68.2%{animation-timing-function:cubic-bezier(0,0,0,1)}100%{transform:scaleX(1)}}@keyframes mat-checkbox-checked-unchecked-checkmark-path{from{animation-timing-function:cubic-bezier(.4,0,1,1);stroke-dashoffset:0}to{stroke-dashoffset:-22.91026}}@keyframes mat-checkbox-checked-indeterminate-checkmark{from{animation-timing-function:cubic-bezier(0,0,.2,.1);opacity:1;transform:rotate(0)}to{opacity:0;transform:rotate(45deg)}}@keyframes mat-checkbox-indeterminate-checked-checkmark{from{animation-timing-function:cubic-bezier(.14,0,0,1);opacity:0;transform:rotate(45deg)}to{opacity:1;transform:rotate(360deg)}}@keyframes mat-checkbox-checked-indeterminate-mixedmark{from{animation-timing-function:cubic-bezier(0,0,.2,.1);opacity:0;transform:rotate(-45deg)}to{opacity:1;transform:rotate(0)}}@keyframes mat-checkbox-indeterminate-checked-mixedmark{from{animation-timing-function:cubic-bezier(.14,0,0,1);opacity:1;transform:rotate(0)}to{opacity:0;transform:rotate(315deg)}}@keyframes mat-checkbox-indeterminate-unchecked-mixedmark{0%{animation-timing-function:linear;opacity:1;transform:scaleX(1)}100%,32.8%{opacity:0;transform:scaleX(0)}}.mat-checkbox-background,.mat-checkbox-frame{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:2px;box-sizing:border-box;pointer-events:none}.mat-checkbox{transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1);cursor:pointer;-webkit-tap-highlight-color:transparent}._mat-animation-noopable.mat-checkbox{transition:none;animation:none}.mat-checkbox .mat-ripple-element:not(.mat-checkbox-persistent-ripple){opacity:.16}.mat-checkbox-layout{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:inherit;align-items:baseline;vertical-align:middle;display:inline-flex;white-space:nowrap}.mat-checkbox-label{-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto}.mat-checkbox-inner-container{display:inline-block;height:16px;line-height:0;margin:auto;margin-right:8px;order:0;position:relative;vertical-align:middle;white-space:nowrap;width:16px;flex-shrink:0}[dir=rtl] .mat-checkbox-inner-container{margin-left:8px;margin-right:auto}.mat-checkbox-inner-container-no-side-margin{margin-left:0;margin-right:0}.mat-checkbox-frame{background-color:transparent;transition:border-color 90ms cubic-bezier(0,0,.2,.1);border-width:2px;border-style:solid}._mat-animation-noopable .mat-checkbox-frame{transition:none}@media (-ms-high-contrast:active){.mat-checkbox.cdk-keyboard-focused .mat-checkbox-frame{border-style:dotted}}.mat-checkbox-background{align-items:center;display:inline-flex;justify-content:center;transition:background-color 90ms cubic-bezier(0,0,.2,.1),opacity 90ms cubic-bezier(0,0,.2,.1)}._mat-animation-noopable .mat-checkbox-background{transition:none}.mat-checkbox-persistent-ripple{width:100%;height:100%;transform:none}.mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{opacity:.04}.mat-checkbox.cdk-keyboard-focused .mat-checkbox-persistent-ripple{opacity:.12}.mat-checkbox-persistent-ripple,.mat-checkbox.mat-checkbox-disabled .mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{opacity:0}@media (hover:none){.mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{display:none}}.mat-checkbox-checkmark{top:0;left:0;right:0;bottom:0;position:absolute;width:100%}.mat-checkbox-checkmark-path{stroke-dashoffset:22.91026;stroke-dasharray:22.91026;stroke-width:2.13333px}.mat-checkbox-mixedmark{width:calc(100% - 6px);height:2px;opacity:0;transform:scaleX(0) rotate(0);border-radius:2px}@media (-ms-high-contrast:active){.mat-checkbox-mixedmark{height:0;border-top:solid 2px;margin-top:2px}}.mat-checkbox-label-before .mat-checkbox-inner-container{order:1;margin-left:8px;margin-right:auto}[dir=rtl] .mat-checkbox-label-before .mat-checkbox-inner-container{margin-left:auto;margin-right:8px}.mat-checkbox-checked .mat-checkbox-checkmark{opacity:1}.mat-checkbox-checked .mat-checkbox-checkmark-path{stroke-dashoffset:0}.mat-checkbox-checked .mat-checkbox-mixedmark{transform:scaleX(1) rotate(-45deg)}.mat-checkbox-indeterminate .mat-checkbox-checkmark{opacity:0;transform:rotate(45deg)}.mat-checkbox-indeterminate .mat-checkbox-checkmark-path{stroke-dashoffset:0}.mat-checkbox-indeterminate .mat-checkbox-mixedmark{opacity:1;transform:scaleX(1) rotate(0)}.mat-checkbox-unchecked .mat-checkbox-background{background-color:transparent}.mat-checkbox-disabled{cursor:default}.mat-checkbox-anim-unchecked-checked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-in-background}.mat-checkbox-anim-unchecked-checked .mat-checkbox-checkmark-path{animation:180ms linear 0s mat-checkbox-unchecked-checked-checkmark-path}.mat-checkbox-anim-unchecked-indeterminate .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-in-background}.mat-checkbox-anim-unchecked-indeterminate .mat-checkbox-mixedmark{animation:90ms linear 0s mat-checkbox-unchecked-indeterminate-mixedmark}.mat-checkbox-anim-checked-unchecked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-out-background}.mat-checkbox-anim-checked-unchecked .mat-checkbox-checkmark-path{animation:90ms linear 0s mat-checkbox-checked-unchecked-checkmark-path}.mat-checkbox-anim-checked-indeterminate .mat-checkbox-checkmark{animation:90ms linear 0s mat-checkbox-checked-indeterminate-checkmark}.mat-checkbox-anim-checked-indeterminate .mat-checkbox-mixedmark{animation:90ms linear 0s mat-checkbox-checked-indeterminate-mixedmark}.mat-checkbox-anim-indeterminate-checked .mat-checkbox-checkmark{animation:.5s linear 0s mat-checkbox-indeterminate-checked-checkmark}.mat-checkbox-anim-indeterminate-checked .mat-checkbox-mixedmark{animation:.5s linear 0s mat-checkbox-indeterminate-checked-mixedmark}.mat-checkbox-anim-indeterminate-unchecked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-out-background}.mat-checkbox-anim-indeterminate-unchecked .mat-checkbox-mixedmark{animation:.3s linear 0s mat-checkbox-indeterminate-unchecked-mixedmark}.mat-checkbox-input{bottom:0;left:50%}.mat-checkbox .mat-checkbox-ripple{position:absolute;left:calc(50% - 20px);top:calc(50% - 20px);height:40px;width:40px;z-index:1;pointer-events:none}"],
exportAs: 'matCheckbox',
host: {
'class': 'mat-checkbox',
'[id]': 'id',
'[attr.tabindex]': 'null',
'[class.mat-checkbox-indeterminate]': 'indeterminate',
'[class.mat-checkbox-checked]': 'checked',
'[class.mat-checkbox-disabled]': 'disabled',
'[class.mat-checkbox-label-before]': 'labelPosition == "before"',
'[class._mat-animation-noopable]': "_animationMode === 'NoopAnimations'",
},
providers: [MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR],
inputs: ['disableRipple', 'color', 'tabIndex'],
encapsulation: core.ViewEncapsulation.None,
changeDetection: core.ChangeDetectionStrategy.OnPush
},] },
];
/** @nocollapse */
MatCheckbox.ctorParameters = function () { return [
{ type: core.ElementRef },
{ type: core.ChangeDetectorRef },
{ type: a11y.FocusMonitor },
{ type: core.NgZone },
{ type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_CHECKBOX_CLICK_ACTION,] }] },
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
]; };
MatCheckbox.propDecorators = {
ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
id: [{ type: core.Input }],
required: [{ type: core.Input }],
labelPosition: [{ type: core.Input }],
name: [{ type: core.Input }],
change: [{ type: core.Output }],
indeterminateChange: [{ type: core.Output }],
value: [{ type: core.Input }],
_inputElement: [{ type: core.ViewChild, args: ['input', { static: false },] }],
ripple: [{ type: core.ViewChild, args: [core$1.MatRipple, { static: false },] }],
checked: [{ type: core.Input }],
disabled: [{ type: core.Input }],
indeterminate: [{ type: core.Input }]
};
return MatCheckbox;
}(_MatCheckboxMixinBase));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var MAT_CHECKBOX_REQUIRED_VALIDATOR = {
provide: forms.NG_VALIDATORS,
useExisting: core.forwardRef((/**
* @return {?}
*/
function () { return MatCheckboxRequiredValidator; })),
multi: true
};
/**
* Validator for Material checkbox's required attribute in template-driven checkbox.
* Current CheckboxRequiredValidator only work with `input type=checkbox` and does not
* work with `mat-checkbox`.
*/
var MatCheckboxRequiredValidator = /** @class */ (function (_super) {
__extends(MatCheckboxRequiredValidator, _super);
function MatCheckboxRequiredValidator() {
return _super !== null && _super.apply(this, arguments) || this;
}
MatCheckboxRequiredValidator.decorators = [
{ type: core.Directive, args: [{
selector: "mat-checkbox[required][formControlName],\n mat-checkbox[required][formControl], mat-checkbox[required][ngModel]",
providers: [MAT_CHECKBOX_REQUIRED_VALIDATOR],
host: { '[attr.required]': 'required ? "" : null' }
},] },
];
return MatCheckboxRequiredValidator;
}(forms.CheckboxRequiredValidator));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* This module is used by both original and MDC-based checkbox implementations.
*/
var _MatCheckboxRequiredValidatorModule = /** @class */ (function () {
function _MatCheckboxRequiredValidatorModule() {
}
_MatCheckboxRequiredValidatorModule.decorators = [
{ type: core.NgModule, args: [{
exports: [MatCheckboxRequiredValidator],
declarations: [MatCheckboxRequiredValidator],
},] },
];
return _MatCheckboxRequiredValidatorModule;
}());
var MatCheckboxModule = /** @class */ (function () {
function MatCheckboxModule() {
}
MatCheckboxModule.decorators = [
{ type: core.NgModule, args: [{
imports: [
common.CommonModule, core$1.MatRippleModule, core$1.MatCommonModule, observers.ObserversModule,
_MatCheckboxRequiredValidatorModule
],
exports: [MatCheckbox, core$1.MatCommonModule, _MatCheckboxRequiredValidatorModule],
declarations: [MatCheckbox],
},] },
];
return MatCheckboxModule;
}());
exports.MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR = MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR;
exports.TransitionCheckState = TransitionCheckState;
exports.MatCheckboxChange = MatCheckboxChange;
exports.MatCheckbox = MatCheckbox;
exports.MAT_CHECKBOX_CLICK_ACTION = MAT_CHECKBOX_CLICK_ACTION;
exports._MatCheckboxRequiredValidatorModule = _MatCheckboxRequiredValidatorModule;
exports.MatCheckboxModule = MatCheckboxModule;
exports.MAT_CHECKBOX_REQUIRED_VALIDATOR = MAT_CHECKBOX_REQUIRED_VALIDATOR;
exports.MatCheckboxRequiredValidator = MatCheckboxRequiredValidator;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=material-checkbox.umd.js.map