@angular/material
Version:
Angular Material
929 lines (916 loc) • 37.1 kB
JavaScript
/**
* @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/cdk/a11y'), require('@angular/cdk/collections'), require('@angular/common'), require('@angular/core'), require('@angular/material/core'), require('@angular/cdk/coercion'), require('@angular/forms')) :
typeof define === 'function' && define.amd ? define(['exports', '@angular/cdk/a11y', '@angular/cdk/collections', '@angular/common', '@angular/core', '@angular/material/core', '@angular/cdk/coercion', '@angular/forms'], factory) :
(factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.radio = global.ng.material.radio || {}),global.ng.cdk.a11y,global.ng.cdk.collections,global.ng.common,global.ng.core,global.ng.material.core,global.ng.cdk.coercion,global.ng.forms));
}(this, (function (exports,_angular_cdk_a11y,_angular_cdk_collections,_angular_common,_angular_core,_angular_material_core,_angular_cdk_coercion,_angular_forms) { '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 = 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]; };
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} checked by tsc
*/
// Increasing integer for generating unique ids for radio components.
var nextUniqueId = 0;
/**
* Provider Expression that allows mat-radio-group to register as a ControlValueAccessor. This
* allows it to support [(ngModel)] and ngControl.
* \@docs-private
*/
var MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = {
provide: _angular_forms.NG_VALUE_ACCESSOR,
useExisting: _angular_core.forwardRef(function () { return MatRadioGroup; }),
multi: true
};
/**
* Change event object emitted by MatRadio and MatRadioGroup.
*/
var MatRadioChange = /** @class */ (function () {
function MatRadioChange(source, value) {
this.source = source;
this.value = value;
}
return MatRadioChange;
}());
/**
* \@docs-private
*/
var MatRadioGroupBase = /** @class */ (function () {
function MatRadioGroupBase() {
}
return MatRadioGroupBase;
}());
var _MatRadioGroupMixinBase = _angular_material_core.mixinDisabled(MatRadioGroupBase);
/**
* A group of radio buttons. May contain one or more `<mat-radio-button>` elements.
*/
var MatRadioGroup = /** @class */ (function (_super) {
__extends(MatRadioGroup, _super);
function MatRadioGroup(_changeDetector) {
var _this = _super.call(this) || this;
_this._changeDetector = _changeDetector;
/**
* Selected value for group. Should equal the value of the selected radio button if there *is*
* a corresponding radio button with a matching value. If there is *not* such a corresponding
* radio button, this value persists to be applied in case a new radio button is added with a
* matching value.
*/
_this._value = null;
/**
* The HTML name attribute applied to radio buttons in this group.
*/
_this._name = "mat-radio-group-" + nextUniqueId++;
/**
* The currently selected radio button. Should match value.
*/
_this._selected = null;
/**
* Whether the `value` has been set to its initial value.
*/
_this._isInitialized = false;
/**
* Whether the labels should appear after or before the radio-buttons. Defaults to 'after'
*/
_this._labelPosition = 'after';
/**
* Whether the radio group is disabled.
*/
_this._disabled = false;
/**
* Whether the radio group is required.
*/
_this._required = false;
/**
* The method to be called in order to update ngModel
*/
_this._controlValueAccessorChangeFn = function () { };
/**
* onTouch function registered via registerOnTouch (ControlValueAccessor).
* \@docs-private
*/
_this.onTouched = function () { };
/**
* Event emitted when the group value changes.
* Change events are only emitted when the value changes due to user interaction with
* a radio button (the same behavior as `<input type-"radio">`).
*/
_this.change = new _angular_core.EventEmitter();
return _this;
}
Object.defineProperty(MatRadioGroup.prototype, "name", {
get: /**
* Name of the radio button group. All radio buttons inside this group will use this name.
* @return {?}
*/
function () { return this._name; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._name = value;
this._updateRadioButtonNames();
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioGroup.prototype, "align", {
get: /**
* Alignment of the radio-buttons relative to their labels. Can be 'before' or 'after'.
* @deprecated
* \@deletion-target 6.0.0
* @return {?}
*/
function () {
// align refers to the checkbox relative to the label, while labelPosition refers to the
// label relative to the checkbox. As such, they are inverted.
return this.labelPosition == 'after' ? 'start' : 'end';
},
set: /**
* @param {?} v
* @return {?}
*/
function (v) {
this.labelPosition = (v == 'start') ? 'after' : 'before';
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioGroup.prototype, "labelPosition", {
get: /**
* Whether the labels should appear after or before the radio-buttons. Defaults to 'after'
* @return {?}
*/
function () {
return this._labelPosition;
},
set: /**
* @param {?} v
* @return {?}
*/
function (v) {
this._labelPosition = (v == 'before') ? 'before' : 'after';
this._markRadiosForCheck();
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioGroup.prototype, "value", {
get: /**
* Value of the radio button.
* @return {?}
*/
function () { return this._value; },
set: /**
* @param {?} newValue
* @return {?}
*/
function (newValue) {
if (this._value != newValue) {
// Set this before proceeding to ensure no circular loop occurs with selection.
this._value = newValue;
this._updateSelectedRadioFromValue();
this._checkSelectedRadioButton();
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
MatRadioGroup.prototype._checkSelectedRadioButton = /**
* @return {?}
*/
function () {
if (this._selected && !this._selected.checked) {
this._selected.checked = true;
}
};
Object.defineProperty(MatRadioGroup.prototype, "selected", {
get: /**
* Whether the radio button is selected.
* @return {?}
*/
function () { return this._selected; },
set: /**
* @param {?} selected
* @return {?}
*/
function (selected) {
this._selected = selected;
this.value = selected ? selected.value : null;
this._checkSelectedRadioButton();
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioGroup.prototype, "disabled", {
get: /**
* Whether the radio group is disabled
* @return {?}
*/
function () { return this._disabled; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._disabled = _angular_cdk_coercion.coerceBooleanProperty(value);
this._markRadiosForCheck();
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioGroup.prototype, "required", {
get: /**
* Whether the radio group is required
* @return {?}
*/
function () { return this._required; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._required = _angular_cdk_coercion.coerceBooleanProperty(value);
this._markRadiosForCheck();
},
enumerable: true,
configurable: true
});
/**
* Initialize properties once content children are available.
* This allows us to propagate relevant attributes to associated buttons.
*/
/**
* Initialize properties once content children are available.
* This allows us to propagate relevant attributes to associated buttons.
* @return {?}
*/
MatRadioGroup.prototype.ngAfterContentInit = /**
* Initialize properties once content children are available.
* This allows us to propagate relevant attributes to associated buttons.
* @return {?}
*/
function () {
// Mark this component as initialized in AfterContentInit because the initial value can
// possibly be set by NgModel on MatRadioGroup, and it is possible that the OnInit of the
// NgModel occurs *after* the OnInit of the MatRadioGroup.
this._isInitialized = true;
};
/**
* Mark this group as being "touched" (for ngModel). Meant to be called by the contained
* radio buttons upon their blur.
*/
/**
* Mark this group as being "touched" (for ngModel). Meant to be called by the contained
* radio buttons upon their blur.
* @return {?}
*/
MatRadioGroup.prototype._touch = /**
* Mark this group as being "touched" (for ngModel). Meant to be called by the contained
* radio buttons upon their blur.
* @return {?}
*/
function () {
if (this.onTouched) {
this.onTouched();
}
};
/**
* @return {?}
*/
MatRadioGroup.prototype._updateRadioButtonNames = /**
* @return {?}
*/
function () {
var _this = this;
if (this._radios) {
this._radios.forEach(function (radio) {
radio.name = _this.name;
});
}
};
/**
* Updates the `selected` radio button from the internal _value state.
* @return {?}
*/
MatRadioGroup.prototype._updateSelectedRadioFromValue = /**
* Updates the `selected` radio button from the internal _value state.
* @return {?}
*/
function () {
var _this = this;
// If the value already matches the selected radio, do nothing.
var /** @type {?} */ isAlreadySelected = this._selected != null && this._selected.value == this._value;
if (this._radios != null && !isAlreadySelected) {
this._selected = null;
this._radios.forEach(function (radio) {
radio.checked = _this.value == radio.value;
if (radio.checked) {
_this._selected = radio;
}
});
}
};
/** Dispatch change event with current selection and group value. */
/**
* Dispatch change event with current selection and group value.
* @return {?}
*/
MatRadioGroup.prototype._emitChangeEvent = /**
* Dispatch change event with current selection and group value.
* @return {?}
*/
function () {
if (this._isInitialized) {
this.change.emit(new MatRadioChange(/** @type {?} */ ((this._selected)), this._value));
}
};
/**
* @return {?}
*/
MatRadioGroup.prototype._markRadiosForCheck = /**
* @return {?}
*/
function () {
if (this._radios) {
this._radios.forEach(function (radio) { return radio._markForCheck(); });
}
};
/**
* Sets the model value. Implemented as part of ControlValueAccessor.
* @param value
*/
/**
* Sets the model value. Implemented as part of ControlValueAccessor.
* @param {?} value
* @return {?}
*/
MatRadioGroup.prototype.writeValue = /**
* Sets the model value. Implemented as part of ControlValueAccessor.
* @param {?} value
* @return {?}
*/
function (value) {
this.value = value;
this._changeDetector.markForCheck();
};
/**
* Registers a callback to be triggered when the model value changes.
* Implemented as part of ControlValueAccessor.
* @param fn Callback to be registered.
*/
/**
* Registers a callback to be triggered when the model value changes.
* Implemented as part of ControlValueAccessor.
* @param {?} fn Callback to be registered.
* @return {?}
*/
MatRadioGroup.prototype.registerOnChange = /**
* Registers a callback to be triggered when the model value changes.
* Implemented as part of ControlValueAccessor.
* @param {?} fn Callback to be registered.
* @return {?}
*/
function (fn) {
this._controlValueAccessorChangeFn = fn;
};
/**
* Registers a callback to be triggered when the control is touched.
* Implemented as part of ControlValueAccessor.
* @param fn Callback to be registered.
*/
/**
* Registers a callback to be triggered when the control is touched.
* Implemented as part of ControlValueAccessor.
* @param {?} fn Callback to be registered.
* @return {?}
*/
MatRadioGroup.prototype.registerOnTouched = /**
* Registers a callback to be triggered when the control is touched.
* Implemented as part of ControlValueAccessor.
* @param {?} fn Callback to be registered.
* @return {?}
*/
function (fn) {
this.onTouched = fn;
};
/**
* Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
* @param isDisabled Whether the control should be disabled.
*/
/**
* Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
* @param {?} isDisabled Whether the control should be disabled.
* @return {?}
*/
MatRadioGroup.prototype.setDisabledState = /**
* Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
* @param {?} isDisabled Whether the control should be disabled.
* @return {?}
*/
function (isDisabled) {
this.disabled = isDisabled;
this._changeDetector.markForCheck();
};
MatRadioGroup.decorators = [
{ type: _angular_core.Directive, args: [{
selector: 'mat-radio-group',
exportAs: 'matRadioGroup',
providers: [MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR],
host: {
'role': 'radiogroup',
'class': 'mat-radio-group',
},
inputs: ['disabled'],
},] },
];
/** @nocollapse */
MatRadioGroup.ctorParameters = function () { return [
{ type: _angular_core.ChangeDetectorRef, },
]; };
MatRadioGroup.propDecorators = {
"change": [{ type: _angular_core.Output },],
"_radios": [{ type: _angular_core.ContentChildren, args: [_angular_core.forwardRef(function () { return MatRadioButton; }), { descendants: true },] },],
"name": [{ type: _angular_core.Input },],
"align": [{ type: _angular_core.Input },],
"labelPosition": [{ type: _angular_core.Input },],
"value": [{ type: _angular_core.Input },],
"selected": [{ type: _angular_core.Input },],
"disabled": [{ type: _angular_core.Input },],
"required": [{ type: _angular_core.Input },],
};
return MatRadioGroup;
}(_MatRadioGroupMixinBase));
/**
* \@docs-private
*/
var MatRadioButtonBase = /** @class */ (function () {
function MatRadioButtonBase(_elementRef) {
this._elementRef = _elementRef;
}
return MatRadioButtonBase;
}());
// As per Material design specifications the selection control radio should use the accent color
// palette by default. https://material.io/guidelines/components/selection-controls.html
var _MatRadioButtonMixinBase = _angular_material_core.mixinColor(_angular_material_core.mixinDisableRipple(_angular_material_core.mixinTabIndex(MatRadioButtonBase)), 'accent');
/**
* A Material design radio-button. Typically placed inside of `<mat-radio-group>` elements.
*/
var MatRadioButton = /** @class */ (function (_super) {
__extends(MatRadioButton, _super);
function MatRadioButton(radioGroup, elementRef, _changeDetector, _focusMonitor, _radioDispatcher) {
var _this = _super.call(this, elementRef) || this;
_this._changeDetector = _changeDetector;
_this._focusMonitor = _focusMonitor;
_this._radioDispatcher = _radioDispatcher;
_this._uniqueId = "mat-radio-" + ++nextUniqueId;
/**
* The unique ID for the radio button.
*/
_this.id = _this._uniqueId;
/**
* Event emitted when the checked state of this radio button changes.
* Change events are only emitted when the value changes due to user interaction with
* the radio button (the same behavior as `<input type-"radio">`).
*/
_this.change = new _angular_core.EventEmitter();
/**
* Whether this radio is checked.
*/
_this._checked = false;
/**
* Value assigned to this radio.
*/
_this._value = null;
/**
* Unregister function for _radioDispatcher
*/
_this._removeUniqueSelectionListener = function () { };
// Assertions. Ideally these should be stripped out by the compiler.
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
// Assertions. Ideally these should be stripped out by the compiler.
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
_this.radioGroup = radioGroup;
_this._removeUniqueSelectionListener =
_radioDispatcher.listen(function (id, name) {
if (id != _this.id && name == _this.name) {
_this.checked = false;
}
});
return _this;
}
Object.defineProperty(MatRadioButton.prototype, "checked", {
get: /**
* Whether this radio button is checked.
* @return {?}
*/
function () { return this._checked; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
var /** @type {?} */ newCheckedState = _angular_cdk_coercion.coerceBooleanProperty(value);
if (this._checked != newCheckedState) {
this._checked = newCheckedState;
if (newCheckedState && this.radioGroup && this.radioGroup.value != this.value) {
this.radioGroup.selected = this;
}
else if (!newCheckedState && this.radioGroup && this.radioGroup.value == this.value) {
// When unchecking the selected radio button, update the selected radio
// property on the group.
this.radioGroup.selected = null;
}
if (newCheckedState) {
// Notify all radio buttons with the same name to un-check.
this._radioDispatcher.notify(this.id, this.name);
}
this._changeDetector.markForCheck();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioButton.prototype, "value", {
get: /**
* The value of this radio button.
* @return {?}
*/
function () { return this._value; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (this._value != value) {
this._value = value;
if (this.radioGroup != null) {
if (!this.checked) {
// Update checked when the value changed to match the radio group's value
this.checked = this.radioGroup.value == value;
}
if (this.checked) {
this.radioGroup.selected = this;
}
}
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioButton.prototype, "align", {
get: /**
* Whether or not the radio-button should appear before or after the label.
* @deprecated
* \@deletion-target 6.0.0
* @return {?}
*/
function () {
// align refers to the checkbox relative to the label, while labelPosition refers to the
// label relative to the checkbox. As such, they are inverted.
return this.labelPosition == 'after' ? 'start' : 'end';
},
set: /**
* @param {?} v
* @return {?}
*/
function (v) {
this.labelPosition = (v == 'start') ? 'after' : 'before';
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioButton.prototype, "labelPosition", {
get: /**
* Whether the label should appear after or before the radio button. Defaults to 'after'
* @return {?}
*/
function () {
return this._labelPosition || (this.radioGroup && this.radioGroup.labelPosition) || 'after';
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._labelPosition = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioButton.prototype, "disabled", {
get: /**
* Whether the radio button is disabled.
* @return {?}
*/
function () {
return this._disabled || (this.radioGroup != null && this.radioGroup.disabled);
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._disabled = _angular_cdk_coercion.coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioButton.prototype, "required", {
get: /**
* Whether the radio button is required.
* @return {?}
*/
function () {
return this._required || (this.radioGroup && this.radioGroup.required);
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._required = _angular_cdk_coercion.coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MatRadioButton.prototype, "inputId", {
/** ID of the native input element inside `<mat-radio-button>` */
get: /**
* ID of the native input element inside `<mat-radio-button>`
* @return {?}
*/
function () { return (this.id || this._uniqueId) + "-input"; },
enumerable: true,
configurable: true
});
/** Focuses the radio button. */
/**
* Focuses the radio button.
* @return {?}
*/
MatRadioButton.prototype.focus = /**
* Focuses the radio button.
* @return {?}
*/
function () {
this._focusMonitor.focusVia(this._inputElement.nativeElement, 'keyboard');
};
/**
* Marks the radio button as needing checking for change detection.
* This method is exposed because the parent radio group will directly
* update bound properties of the radio button.
*/
/**
* Marks the radio button as needing checking for change detection.
* This method is exposed because the parent radio group will directly
* update bound properties of the radio button.
* @return {?}
*/
MatRadioButton.prototype._markForCheck = /**
* Marks the radio button as needing checking for change detection.
* This method is exposed because the parent radio group will directly
* update bound properties of the radio button.
* @return {?}
*/
function () {
// When group value changes, the button will not be notified. Use `markForCheck` to explicit
// update radio button's status
this._changeDetector.markForCheck();
};
/**
* @return {?}
*/
MatRadioButton.prototype.ngOnInit = /**
* @return {?}
*/
function () {
if (this.radioGroup) {
// If the radio is inside a radio group, determine if it should be checked
this.checked = this.radioGroup.value === this._value;
// Copy name from parent radio group
this.name = this.radioGroup.name;
}
};
/**
* @return {?}
*/
MatRadioButton.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
var _this = this;
this._focusMonitor
.monitor(this._inputElement.nativeElement)
.subscribe(function (focusOrigin) { return _this._onInputFocusChange(focusOrigin); });
};
/**
* @return {?}
*/
MatRadioButton.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this._focusMonitor.stopMonitoring(this._inputElement.nativeElement);
this._removeUniqueSelectionListener();
};
/**
* Dispatch change event with current value.
* @return {?}
*/
MatRadioButton.prototype._emitChangeEvent = /**
* Dispatch change event with current value.
* @return {?}
*/
function () {
this.change.emit(new MatRadioChange(this, this._value));
};
/**
* @return {?}
*/
MatRadioButton.prototype._isRippleDisabled = /**
* @return {?}
*/
function () {
return this.disableRipple || this.disabled;
};
/**
* @param {?} event
* @return {?}
*/
MatRadioButton.prototype._onInputClick = /**
* @param {?} event
* @return {?}
*/
function (event) {
// 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 `radio-button` 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();
};
/**
* Triggered when the radio button received a click or the input recognized any change.
* Clicking on a label element, will trigger a change event on the associated input.
*/
/**
* Triggered when the radio button received a click or the input recognized any change.
* Clicking on a label element, will trigger a change event on the associated input.
* @param {?} event
* @return {?}
*/
MatRadioButton.prototype._onInputChange = /**
* Triggered when the radio button received a click or the input recognized any change.
* Clicking on a label element, will trigger a change event on the associated input.
* @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();
var /** @type {?} */ groupValueChanged = this.radioGroup && this.value != this.radioGroup.value;
this.checked = true;
this._emitChangeEvent();
if (this.radioGroup) {
this.radioGroup._controlValueAccessorChangeFn(this.value);
this.radioGroup._touch();
if (groupValueChanged) {
this.radioGroup._emitChangeEvent();
}
}
};
/**
* Function is called whenever the focus changes for the input element.
* @param {?} focusOrigin
* @return {?}
*/
MatRadioButton.prototype._onInputFocusChange = /**
* Function is called whenever the focus changes for the input element.
* @param {?} focusOrigin
* @return {?}
*/
function (focusOrigin) {
if (!this._focusRipple && focusOrigin === 'keyboard') {
this._focusRipple = this._ripple.launch(0, 0, { persistent: true });
}
else if (!focusOrigin) {
if (this.radioGroup) {
this.radioGroup._touch();
}
if (this._focusRipple) {
this._focusRipple.fadeOut();
this._focusRipple = null;
}
}
};
MatRadioButton.decorators = [
{ type: _angular_core.Component, args: [{selector: 'mat-radio-button',
template: "<label [attr.for]=\"inputId\" class=\"mat-radio-label\" #label><div class=\"mat-radio-container\"><div class=\"mat-radio-outer-circle\"></div><div class=\"mat-radio-inner-circle\"></div><div mat-ripple class=\"mat-radio-ripple\" [matRippleTrigger]=\"label\" [matRippleDisabled]=\"_isRippleDisabled()\" [matRippleCentered]=\"true\" [matRippleRadius]=\"23\" [matRippleAnimation]=\"{enterDuration: 150}\"></div></div><input #input class=\"mat-radio-input cdk-visually-hidden\" type=\"radio\" [id]=\"inputId\" [checked]=\"checked\" [disabled]=\"disabled\" [tabIndex]=\"tabIndex\" [attr.name]=\"name\" [required]=\"required\" [attr.aria-label]=\"ariaLabel\" [attr.aria-labelledby]=\"ariaLabelledby\" [attr.aria-describedby]=\"ariaDescribedby\" (change)=\"_onInputChange($event)\" (click)=\"_onInputClick($event)\"><div class=\"mat-radio-label-content\" [class.mat-radio-label-before]=\"labelPosition == 'before'\"><span style=\"display:none\"> </span><ng-content></ng-content></div></label>",
styles: [".mat-radio-button{display:inline-block}.mat-radio-label{cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;vertical-align:middle}.mat-radio-container{box-sizing:border-box;display:inline-block;position:relative;width:20px;height:20px;flex-shrink:0}.mat-radio-outer-circle{box-sizing:border-box;height:20px;left:0;position:absolute;top:0;transition:border-color ease 280ms;width:20px;border-width:2px;border-style:solid;border-radius:50%}.mat-radio-inner-circle{border-radius:50%;box-sizing:border-box;height:20px;left:0;position:absolute;top:0;transition:transform ease 280ms,background-color ease 280ms;width:20px;transform:scale(.001)}.mat-radio-checked .mat-radio-inner-circle{transform:scale(.5)}.mat-radio-label-content{display:inline-block;order:0;line-height:inherit;padding-left:8px;padding-right:0}[dir=rtl] .mat-radio-label-content{padding-right:8px;padding-left:0}.mat-radio-label-content.mat-radio-label-before{order:-1;padding-left:0;padding-right:8px}[dir=rtl] .mat-radio-label-content.mat-radio-label-before{padding-right:0;padding-left:8px}.mat-radio-disabled,.mat-radio-disabled .mat-radio-label{cursor:default}.mat-radio-ripple{position:absolute;left:calc(50% - 25px);top:calc(50% - 25px);height:50px;width:50px;z-index:1;pointer-events:none}"],
inputs: ['color', 'disableRipple', 'tabIndex'],
encapsulation: _angular_core.ViewEncapsulation.None,
preserveWhitespaces: false,
exportAs: 'matRadioButton',
host: {
'class': 'mat-radio-button',
'[class.mat-radio-checked]': 'checked',
'[class.mat-radio-disabled]': 'disabled',
'[attr.id]': 'id',
// Note: under normal conditions focus shouldn't land on this element, however it may be
// programmatically set, for example inside of a focus trap, in this case we want to forward
// the focus to the native element.
'(focus)': '_inputElement.nativeElement.focus()',
},
changeDetection: _angular_core.ChangeDetectionStrategy.OnPush,
},] },
];
/** @nocollapse */
MatRadioButton.ctorParameters = function () { return [
{ type: MatRadioGroup, decorators: [{ type: _angular_core.Optional },] },
{ type: _angular_core.ElementRef, },
{ type: _angular_core.ChangeDetectorRef, },
{ type: _angular_cdk_a11y.FocusMonitor, },
{ type: _angular_cdk_collections.UniqueSelectionDispatcher, },
]; };
MatRadioButton.propDecorators = {
"id": [{ type: _angular_core.Input },],
"name": [{ type: _angular_core.Input },],
"ariaLabel": [{ type: _angular_core.Input, args: ['aria-label',] },],
"ariaLabelledby": [{ type: _angular_core.Input, args: ['aria-labelledby',] },],
"ariaDescribedby": [{ type: _angular_core.Input, args: ['aria-describedby',] },],
"checked": [{ type: _angular_core.Input },],
"value": [{ type: _angular_core.Input },],
"align": [{ type: _angular_core.Input },],
"labelPosition": [{ type: _angular_core.Input },],
"disabled": [{ type: _angular_core.Input },],
"required": [{ type: _angular_core.Input },],
"change": [{ type: _angular_core.Output },],
"_ripple": [{ type: _angular_core.ViewChild, args: [_angular_material_core.MatRipple,] },],
"_inputElement": [{ type: _angular_core.ViewChild, args: ['input',] },],
};
return MatRadioButton;
}(_MatRadioButtonMixinBase));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MatRadioModule = /** @class */ (function () {
function MatRadioModule() {
}
MatRadioModule.decorators = [
{ type: _angular_core.NgModule, args: [{
imports: [_angular_common.CommonModule, _angular_material_core.MatRippleModule, _angular_material_core.MatCommonModule, _angular_cdk_a11y.A11yModule],
exports: [MatRadioGroup, MatRadioButton, _angular_material_core.MatCommonModule],
providers: [_angular_cdk_collections.UNIQUE_SELECTION_DISPATCHER_PROVIDER],
declarations: [MatRadioGroup, MatRadioButton],
},] },
];
/** @nocollapse */
MatRadioModule.ctorParameters = function () { return []; };
return MatRadioModule;
}());
exports.MatRadioModule = MatRadioModule;
exports.MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR;
exports.MatRadioChange = MatRadioChange;
exports.MatRadioGroupBase = MatRadioGroupBase;
exports._MatRadioGroupMixinBase = _MatRadioGroupMixinBase;
exports.MatRadioGroup = MatRadioGroup;
exports.MatRadioButtonBase = MatRadioButtonBase;
exports._MatRadioButtonMixinBase = _MatRadioButtonMixinBase;
exports.MatRadioButton = MatRadioButton;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=material-radio.umd.js.map