radio.mjs 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. import { _IdGenerator, FocusMonitor } from '@angular/cdk/a11y';
  2. import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
  3. import * as i0 from '@angular/core';
  4. import { forwardRef, InjectionToken, inject, ChangeDetectorRef, EventEmitter, booleanAttribute, Directive, Output, ContentChildren, Input, ElementRef, NgZone, Renderer2, Injector, ANIMATION_MODULE_TYPE, HostAttributeToken, numberAttribute, afterNextRender, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, NgModule } from '@angular/core';
  5. import { NG_VALUE_ACCESSOR } from '@angular/forms';
  6. import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
  7. import { _ as _StructuralStylesLoader } from './structural-styles-BQUT6wsL.mjs';
  8. import { M as MatRipple } from './ripple-BT3tzh6F.mjs';
  9. import { _ as _MatInternalFormField } from './internal-form-field-grv62mCZ.mjs';
  10. import { M as MatCommonModule } from './common-module-WayjW0Pb.mjs';
  11. import { M as MatRippleModule } from './index-SYVYjXwK.mjs';
  12. import '@angular/cdk/platform';
  13. import '@angular/cdk/coercion';
  14. import '@angular/cdk/bidi';
  15. /** Change event object emitted by radio button and radio group. */
  16. class MatRadioChange {
  17. source;
  18. value;
  19. constructor(
  20. /** The radio button that emits the change event. */
  21. source,
  22. /** The value of the radio button. */
  23. value) {
  24. this.source = source;
  25. this.value = value;
  26. }
  27. }
  28. /**
  29. * Provider Expression that allows mat-radio-group to register as a ControlValueAccessor. This
  30. * allows it to support [(ngModel)] and ngControl.
  31. * @docs-private
  32. */
  33. const MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = {
  34. provide: NG_VALUE_ACCESSOR,
  35. useExisting: forwardRef(() => MatRadioGroup),
  36. multi: true,
  37. };
  38. /**
  39. * Injection token that can be used to inject instances of `MatRadioGroup`. It serves as
  40. * alternative token to the actual `MatRadioGroup` class which could cause unnecessary
  41. * retention of the class and its component metadata.
  42. */
  43. const MAT_RADIO_GROUP = new InjectionToken('MatRadioGroup');
  44. const MAT_RADIO_DEFAULT_OPTIONS = new InjectionToken('mat-radio-default-options', {
  45. providedIn: 'root',
  46. factory: MAT_RADIO_DEFAULT_OPTIONS_FACTORY,
  47. });
  48. /**
  49. * @docs-private
  50. * @deprecated No longer used, will be removed.
  51. * @breaking-change 21.0.0
  52. */
  53. function MAT_RADIO_DEFAULT_OPTIONS_FACTORY() {
  54. return {
  55. color: 'accent',
  56. disabledInteractive: false,
  57. };
  58. }
  59. /**
  60. * A group of radio buttons. May contain one or more `<mat-radio-button>` elements.
  61. */
  62. class MatRadioGroup {
  63. _changeDetector = inject(ChangeDetectorRef);
  64. /** Selected value for the radio group. */
  65. _value = null;
  66. /** The HTML name attribute applied to radio buttons in this group. */
  67. _name = inject(_IdGenerator).getId('mat-radio-group-');
  68. /** The currently selected radio button. Should match value. */
  69. _selected = null;
  70. /** Whether the `value` has been set to its initial value. */
  71. _isInitialized = false;
  72. /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
  73. _labelPosition = 'after';
  74. /** Whether the radio group is disabled. */
  75. _disabled = false;
  76. /** Whether the radio group is required. */
  77. _required = false;
  78. /** Subscription to changes in amount of radio buttons. */
  79. _buttonChanges;
  80. /** The method to be called in order to update ngModel */
  81. _controlValueAccessorChangeFn = () => { };
  82. /**
  83. * onTouch function registered via registerOnTouch (ControlValueAccessor).
  84. * @docs-private
  85. */
  86. onTouched = () => { };
  87. /**
  88. * Event emitted when the group value changes.
  89. * Change events are only emitted when the value changes due to user interaction with
  90. * a radio button (the same behavior as `<input type-"radio">`).
  91. */
  92. change = new EventEmitter();
  93. /** Child radio buttons. */
  94. _radios;
  95. /**
  96. * Theme color of the radio buttons in the group. This API is supported in M2
  97. * themes only, it has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/radio/styling.
  98. *
  99. * For information on applying color variants in M3, see
  100. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  101. */
  102. color;
  103. /** Name of the radio button group. All radio buttons inside this group will use this name. */
  104. get name() {
  105. return this._name;
  106. }
  107. set name(value) {
  108. this._name = value;
  109. this._updateRadioButtonNames();
  110. }
  111. /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
  112. get labelPosition() {
  113. return this._labelPosition;
  114. }
  115. set labelPosition(v) {
  116. this._labelPosition = v === 'before' ? 'before' : 'after';
  117. this._markRadiosForCheck();
  118. }
  119. /**
  120. * Value for the radio-group. Should equal the value of the selected radio button if there is
  121. * a corresponding radio button with a matching value. If there is not such a corresponding
  122. * radio button, this value persists to be applied in case a new radio button is added with a
  123. * matching value.
  124. */
  125. get value() {
  126. return this._value;
  127. }
  128. set value(newValue) {
  129. if (this._value !== newValue) {
  130. // Set this before proceeding to ensure no circular loop occurs with selection.
  131. this._value = newValue;
  132. this._updateSelectedRadioFromValue();
  133. this._checkSelectedRadioButton();
  134. }
  135. }
  136. _checkSelectedRadioButton() {
  137. if (this._selected && !this._selected.checked) {
  138. this._selected.checked = true;
  139. }
  140. }
  141. /**
  142. * The currently selected radio button. If set to a new radio button, the radio group value
  143. * will be updated to match the new selected button.
  144. */
  145. get selected() {
  146. return this._selected;
  147. }
  148. set selected(selected) {
  149. this._selected = selected;
  150. this.value = selected ? selected.value : null;
  151. this._checkSelectedRadioButton();
  152. }
  153. /** Whether the radio group is disabled */
  154. get disabled() {
  155. return this._disabled;
  156. }
  157. set disabled(value) {
  158. this._disabled = value;
  159. this._markRadiosForCheck();
  160. }
  161. /** Whether the radio group is required */
  162. get required() {
  163. return this._required;
  164. }
  165. set required(value) {
  166. this._required = value;
  167. this._markRadiosForCheck();
  168. }
  169. /** Whether buttons in the group should be interactive while they're disabled. */
  170. get disabledInteractive() {
  171. return this._disabledInteractive;
  172. }
  173. set disabledInteractive(value) {
  174. this._disabledInteractive = value;
  175. this._markRadiosForCheck();
  176. }
  177. _disabledInteractive = false;
  178. constructor() { }
  179. /**
  180. * Initialize properties once content children are available.
  181. * This allows us to propagate relevant attributes to associated buttons.
  182. */
  183. ngAfterContentInit() {
  184. // Mark this component as initialized in AfterContentInit because the initial value can
  185. // possibly be set by NgModel on MatRadioGroup, and it is possible that the OnInit of the
  186. // NgModel occurs *after* the OnInit of the MatRadioGroup.
  187. this._isInitialized = true;
  188. // Clear the `selected` button when it's destroyed since the tabindex of the rest of the
  189. // buttons depends on it. Note that we don't clear the `value`, because the radio button
  190. // may be swapped out with a similar one and there are some internal apps that depend on
  191. // that behavior.
  192. this._buttonChanges = this._radios.changes.subscribe(() => {
  193. if (this.selected && !this._radios.find(radio => radio === this.selected)) {
  194. this._selected = null;
  195. }
  196. });
  197. }
  198. ngOnDestroy() {
  199. this._buttonChanges?.unsubscribe();
  200. }
  201. /**
  202. * Mark this group as being "touched" (for ngModel). Meant to be called by the contained
  203. * radio buttons upon their blur.
  204. */
  205. _touch() {
  206. if (this.onTouched) {
  207. this.onTouched();
  208. }
  209. }
  210. _updateRadioButtonNames() {
  211. if (this._radios) {
  212. this._radios.forEach(radio => {
  213. radio.name = this.name;
  214. radio._markForCheck();
  215. });
  216. }
  217. }
  218. /** Updates the `selected` radio button from the internal _value state. */
  219. _updateSelectedRadioFromValue() {
  220. // If the value already matches the selected radio, do nothing.
  221. const isAlreadySelected = this._selected !== null && this._selected.value === this._value;
  222. if (this._radios && !isAlreadySelected) {
  223. this._selected = null;
  224. this._radios.forEach(radio => {
  225. radio.checked = this.value === radio.value;
  226. if (radio.checked) {
  227. this._selected = radio;
  228. }
  229. });
  230. }
  231. }
  232. /** Dispatch change event with current selection and group value. */
  233. _emitChangeEvent() {
  234. if (this._isInitialized) {
  235. this.change.emit(new MatRadioChange(this._selected, this._value));
  236. }
  237. }
  238. _markRadiosForCheck() {
  239. if (this._radios) {
  240. this._radios.forEach(radio => radio._markForCheck());
  241. }
  242. }
  243. /**
  244. * Sets the model value. Implemented as part of ControlValueAccessor.
  245. * @param value
  246. */
  247. writeValue(value) {
  248. this.value = value;
  249. this._changeDetector.markForCheck();
  250. }
  251. /**
  252. * Registers a callback to be triggered when the model value changes.
  253. * Implemented as part of ControlValueAccessor.
  254. * @param fn Callback to be registered.
  255. */
  256. registerOnChange(fn) {
  257. this._controlValueAccessorChangeFn = fn;
  258. }
  259. /**
  260. * Registers a callback to be triggered when the control is touched.
  261. * Implemented as part of ControlValueAccessor.
  262. * @param fn Callback to be registered.
  263. */
  264. registerOnTouched(fn) {
  265. this.onTouched = fn;
  266. }
  267. /**
  268. * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
  269. * @param isDisabled Whether the control should be disabled.
  270. */
  271. setDisabledState(isDisabled) {
  272. this.disabled = isDisabled;
  273. this._changeDetector.markForCheck();
  274. }
  275. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatRadioGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  276. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: MatRadioGroup, isStandalone: true, selector: "mat-radio-group", inputs: { color: "color", name: "name", labelPosition: "labelPosition", value: "value", selected: "selected", disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], disabledInteractive: ["disabledInteractive", "disabledInteractive", booleanAttribute] }, outputs: { change: "change" }, host: { attributes: { "role": "radiogroup" }, classAttribute: "mat-mdc-radio-group" }, providers: [
  277. MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR,
  278. { provide: MAT_RADIO_GROUP, useExisting: MatRadioGroup },
  279. ], queries: [{ propertyName: "_radios", predicate: i0.forwardRef(() => MatRadioButton), descendants: true }], exportAs: ["matRadioGroup"], ngImport: i0 });
  280. }
  281. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatRadioGroup, decorators: [{
  282. type: Directive,
  283. args: [{
  284. selector: 'mat-radio-group',
  285. exportAs: 'matRadioGroup',
  286. providers: [
  287. MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR,
  288. { provide: MAT_RADIO_GROUP, useExisting: MatRadioGroup },
  289. ],
  290. host: {
  291. 'role': 'radiogroup',
  292. 'class': 'mat-mdc-radio-group',
  293. },
  294. }]
  295. }], ctorParameters: () => [], propDecorators: { change: [{
  296. type: Output
  297. }], _radios: [{
  298. type: ContentChildren,
  299. args: [forwardRef(() => MatRadioButton), { descendants: true }]
  300. }], color: [{
  301. type: Input
  302. }], name: [{
  303. type: Input
  304. }], labelPosition: [{
  305. type: Input
  306. }], value: [{
  307. type: Input
  308. }], selected: [{
  309. type: Input
  310. }], disabled: [{
  311. type: Input,
  312. args: [{ transform: booleanAttribute }]
  313. }], required: [{
  314. type: Input,
  315. args: [{ transform: booleanAttribute }]
  316. }], disabledInteractive: [{
  317. type: Input,
  318. args: [{ transform: booleanAttribute }]
  319. }] } });
  320. class MatRadioButton {
  321. _elementRef = inject(ElementRef);
  322. _changeDetector = inject(ChangeDetectorRef);
  323. _focusMonitor = inject(FocusMonitor);
  324. _radioDispatcher = inject(UniqueSelectionDispatcher);
  325. _defaultOptions = inject(MAT_RADIO_DEFAULT_OPTIONS, {
  326. optional: true,
  327. });
  328. _ngZone = inject(NgZone);
  329. _renderer = inject(Renderer2);
  330. _uniqueId = inject(_IdGenerator).getId('mat-radio-');
  331. _cleanupClick;
  332. /** The unique ID for the radio button. */
  333. id = this._uniqueId;
  334. /** Analog to HTML 'name' attribute used to group radios for unique selection. */
  335. name;
  336. /** Used to set the 'aria-label' attribute on the underlying input element. */
  337. ariaLabel;
  338. /** The 'aria-labelledby' attribute takes precedence as the element's text alternative. */
  339. ariaLabelledby;
  340. /** The 'aria-describedby' attribute is read after the element's label and field type. */
  341. ariaDescribedby;
  342. /** Whether ripples are disabled inside the radio button */
  343. disableRipple = false;
  344. /** Tabindex of the radio button. */
  345. tabIndex = 0;
  346. /** Whether this radio button is checked. */
  347. get checked() {
  348. return this._checked;
  349. }
  350. set checked(value) {
  351. if (this._checked !== value) {
  352. this._checked = value;
  353. if (value && this.radioGroup && this.radioGroup.value !== this.value) {
  354. this.radioGroup.selected = this;
  355. }
  356. else if (!value && this.radioGroup && this.radioGroup.value === this.value) {
  357. // When unchecking the selected radio button, update the selected radio
  358. // property on the group.
  359. this.radioGroup.selected = null;
  360. }
  361. if (value) {
  362. // Notify all radio buttons with the same name to un-check.
  363. this._radioDispatcher.notify(this.id, this.name);
  364. }
  365. this._changeDetector.markForCheck();
  366. }
  367. }
  368. /** The value of this radio button. */
  369. get value() {
  370. return this._value;
  371. }
  372. set value(value) {
  373. if (this._value !== value) {
  374. this._value = value;
  375. if (this.radioGroup !== null) {
  376. if (!this.checked) {
  377. // Update checked when the value changed to match the radio group's value
  378. this.checked = this.radioGroup.value === value;
  379. }
  380. if (this.checked) {
  381. this.radioGroup.selected = this;
  382. }
  383. }
  384. }
  385. }
  386. /** Whether the label should appear after or before the radio button. Defaults to 'after' */
  387. get labelPosition() {
  388. return this._labelPosition || (this.radioGroup && this.radioGroup.labelPosition) || 'after';
  389. }
  390. set labelPosition(value) {
  391. this._labelPosition = value;
  392. }
  393. _labelPosition;
  394. /** Whether the radio button is disabled. */
  395. get disabled() {
  396. return this._disabled || (this.radioGroup !== null && this.radioGroup.disabled);
  397. }
  398. set disabled(value) {
  399. this._setDisabled(value);
  400. }
  401. /** Whether the radio button is required. */
  402. get required() {
  403. return this._required || (this.radioGroup && this.radioGroup.required);
  404. }
  405. set required(value) {
  406. if (value !== this._required) {
  407. this._changeDetector.markForCheck();
  408. }
  409. this._required = value;
  410. }
  411. /**
  412. * Theme color of the radio button. This API is supported in M2 themes only, it
  413. * has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/radio/styling.
  414. *
  415. * For information on applying color variants in M3, see
  416. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  417. */
  418. get color() {
  419. // As per M2 design specifications the selection control radio should use the accent color
  420. // palette by default. https://m2.material.io/components/radio-buttons#specs
  421. return (this._color ||
  422. (this.radioGroup && this.radioGroup.color) ||
  423. (this._defaultOptions && this._defaultOptions.color) ||
  424. 'accent');
  425. }
  426. set color(newValue) {
  427. this._color = newValue;
  428. }
  429. _color;
  430. /** Whether the radio button should remain interactive when it is disabled. */
  431. get disabledInteractive() {
  432. return (this._disabledInteractive || (this.radioGroup !== null && this.radioGroup.disabledInteractive));
  433. }
  434. set disabledInteractive(value) {
  435. this._disabledInteractive = value;
  436. }
  437. _disabledInteractive;
  438. /**
  439. * Event emitted when the checked state of this radio button changes.
  440. * Change events are only emitted when the value changes due to user interaction with
  441. * the radio button (the same behavior as `<input type-"radio">`).
  442. */
  443. change = new EventEmitter();
  444. /** The parent radio group. May or may not be present. */
  445. radioGroup;
  446. /** ID of the native input element inside `<mat-radio-button>` */
  447. get inputId() {
  448. return `${this.id || this._uniqueId}-input`;
  449. }
  450. /** Whether this radio is checked. */
  451. _checked = false;
  452. /** Whether this radio is disabled. */
  453. _disabled;
  454. /** Whether this radio is required. */
  455. _required;
  456. /** Value assigned to this radio. */
  457. _value = null;
  458. /** Unregister function for _radioDispatcher */
  459. _removeUniqueSelectionListener = () => { };
  460. /** Previous value of the input's tabindex. */
  461. _previousTabIndex;
  462. /** The native `<input type=radio>` element */
  463. _inputElement;
  464. /** Trigger elements for the ripple events. */
  465. _rippleTrigger;
  466. /** Whether animations are disabled. */
  467. _noopAnimations;
  468. _injector = inject(Injector);
  469. constructor() {
  470. inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
  471. const radioGroup = inject(MAT_RADIO_GROUP, { optional: true });
  472. const animationMode = inject(ANIMATION_MODULE_TYPE, { optional: true });
  473. const tabIndex = inject(new HostAttributeToken('tabindex'), { optional: true });
  474. // Assertions. Ideally these should be stripped out by the compiler.
  475. // TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
  476. this.radioGroup = radioGroup;
  477. this._noopAnimations = animationMode === 'NoopAnimations';
  478. this._disabledInteractive = this._defaultOptions?.disabledInteractive ?? false;
  479. if (tabIndex) {
  480. this.tabIndex = numberAttribute(tabIndex, 0);
  481. }
  482. }
  483. /** Focuses the radio button. */
  484. focus(options, origin) {
  485. if (origin) {
  486. this._focusMonitor.focusVia(this._inputElement, origin, options);
  487. }
  488. else {
  489. this._inputElement.nativeElement.focus(options);
  490. }
  491. }
  492. /**
  493. * Marks the radio button as needing checking for change detection.
  494. * This method is exposed because the parent radio group will directly
  495. * update bound properties of the radio button.
  496. */
  497. _markForCheck() {
  498. // When group value changes, the button will not be notified. Use `markForCheck` to explicit
  499. // update radio button's status
  500. this._changeDetector.markForCheck();
  501. }
  502. ngOnInit() {
  503. if (this.radioGroup) {
  504. // If the radio is inside a radio group, determine if it should be checked
  505. this.checked = this.radioGroup.value === this._value;
  506. if (this.checked) {
  507. this.radioGroup.selected = this;
  508. }
  509. // Copy name from parent radio group
  510. this.name = this.radioGroup.name;
  511. }
  512. this._removeUniqueSelectionListener = this._radioDispatcher.listen((id, name) => {
  513. if (id !== this.id && name === this.name) {
  514. this.checked = false;
  515. }
  516. });
  517. }
  518. ngDoCheck() {
  519. this._updateTabIndex();
  520. }
  521. ngAfterViewInit() {
  522. this._updateTabIndex();
  523. this._focusMonitor.monitor(this._elementRef, true).subscribe(focusOrigin => {
  524. if (!focusOrigin && this.radioGroup) {
  525. this.radioGroup._touch();
  526. }
  527. });
  528. // We bind this outside of the zone, because:
  529. // 1. Its logic is completely DOM-related so we can avoid some change detections.
  530. // 2. There appear to be some internal tests that break when this triggers a change detection.
  531. this._ngZone.runOutsideAngular(() => {
  532. this._cleanupClick = this._renderer.listen(this._inputElement.nativeElement, 'click', this._onInputClick);
  533. });
  534. }
  535. ngOnDestroy() {
  536. this._cleanupClick?.();
  537. this._focusMonitor.stopMonitoring(this._elementRef);
  538. this._removeUniqueSelectionListener();
  539. }
  540. /** Dispatch change event with current value. */
  541. _emitChangeEvent() {
  542. this.change.emit(new MatRadioChange(this, this._value));
  543. }
  544. _isRippleDisabled() {
  545. return this.disableRipple || this.disabled;
  546. }
  547. /** Triggered when the radio button receives an interaction from the user. */
  548. _onInputInteraction(event) {
  549. // We always have to stop propagation on the change event.
  550. // Otherwise the change event, from the input element, will bubble up and
  551. // emit its event object to the `change` output.
  552. event.stopPropagation();
  553. if (!this.checked && !this.disabled) {
  554. const groupValueChanged = this.radioGroup && this.value !== this.radioGroup.value;
  555. this.checked = true;
  556. this._emitChangeEvent();
  557. if (this.radioGroup) {
  558. this.radioGroup._controlValueAccessorChangeFn(this.value);
  559. if (groupValueChanged) {
  560. this.radioGroup._emitChangeEvent();
  561. }
  562. }
  563. }
  564. }
  565. /** Triggered when the user clicks on the touch target. */
  566. _onTouchTargetClick(event) {
  567. this._onInputInteraction(event);
  568. if (!this.disabled || this.disabledInteractive) {
  569. // Normally the input should be focused already, but if the click
  570. // comes from the touch target, then we might have to focus it ourselves.
  571. this._inputElement?.nativeElement.focus();
  572. }
  573. }
  574. /** Sets the disabled state and marks for check if a change occurred. */
  575. _setDisabled(value) {
  576. if (this._disabled !== value) {
  577. this._disabled = value;
  578. this._changeDetector.markForCheck();
  579. }
  580. }
  581. /** Called when the input is clicked. */
  582. _onInputClick = (event) => {
  583. // If the input is disabled while interactive, we need to prevent the
  584. // selection from happening in this event handler. Note that even though
  585. // this happens on `click` events, the logic applies when the user is
  586. // navigating with the keyboard as well. An alternative way of doing
  587. // this is by resetting the `checked` state in the `change` callback but
  588. // it isn't optimal, because it can allow a pre-checked disabled button
  589. // to be un-checked. This approach seems to cover everything.
  590. if (this.disabled && this.disabledInteractive) {
  591. event.preventDefault();
  592. }
  593. };
  594. /** Gets the tabindex for the underlying input element. */
  595. _updateTabIndex() {
  596. const group = this.radioGroup;
  597. let value;
  598. // Implement a roving tabindex if the button is inside a group. For most cases this isn't
  599. // necessary, because the browser handles the tab order for inputs inside a group automatically,
  600. // but we need an explicitly higher tabindex for the selected button in order for things like
  601. // the focus trap to pick it up correctly.
  602. if (!group || !group.selected || this.disabled) {
  603. value = this.tabIndex;
  604. }
  605. else {
  606. value = group.selected === this ? this.tabIndex : -1;
  607. }
  608. if (value !== this._previousTabIndex) {
  609. // We have to set the tabindex directly on the DOM node, because it depends on
  610. // the selected state which is prone to "changed after checked errors".
  611. const input = this._inputElement?.nativeElement;
  612. if (input) {
  613. input.setAttribute('tabindex', value + '');
  614. this._previousTabIndex = value;
  615. // Wait for any pending tabindex changes to be applied
  616. afterNextRender(() => {
  617. queueMicrotask(() => {
  618. // The radio group uses a "selection follows focus" pattern for tab management, so if this
  619. // radio button is currently focused and another radio button in the group becomes
  620. // selected, we should move focus to the newly selected radio button to maintain
  621. // consistency between the focused and selected states.
  622. if (group &&
  623. group.selected &&
  624. group.selected !== this &&
  625. document.activeElement === input) {
  626. group.selected?._inputElement.nativeElement.focus();
  627. // If this radio button still has focus, the selected one must be disabled. In this
  628. // case the radio group as a whole should lose focus.
  629. if (document.activeElement === input) {
  630. this._inputElement.nativeElement.blur();
  631. }
  632. }
  633. });
  634. }, { injector: this._injector });
  635. }
  636. }
  637. }
  638. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatRadioButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
  639. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.6", type: MatRadioButton, isStandalone: true, selector: "mat-radio-button", inputs: { id: "id", name: "name", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaDescribedby: ["aria-describedby", "ariaDescribedby"], disableRipple: ["disableRipple", "disableRipple", booleanAttribute], tabIndex: ["tabIndex", "tabIndex", (value) => (value == null ? 0 : numberAttribute(value))], checked: ["checked", "checked", booleanAttribute], value: "value", labelPosition: "labelPosition", disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], color: "color", disabledInteractive: ["disabledInteractive", "disabledInteractive", booleanAttribute] }, outputs: { change: "change" }, host: { listeners: { "focus": "_inputElement.nativeElement.focus()" }, properties: { "attr.id": "id", "class.mat-primary": "color === \"primary\"", "class.mat-accent": "color === \"accent\"", "class.mat-warn": "color === \"warn\"", "class.mat-mdc-radio-checked": "checked", "class.mat-mdc-radio-disabled": "disabled", "class.mat-mdc-radio-disabled-interactive": "disabledInteractive", "class._mat-animation-noopable": "_noopAnimations", "attr.tabindex": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.aria-describedby": "null" }, classAttribute: "mat-mdc-radio-button" }, viewQueries: [{ propertyName: "_inputElement", first: true, predicate: ["input"], descendants: true }, { propertyName: "_rippleTrigger", first: true, predicate: ["formField"], descendants: true, read: ElementRef, static: true }], exportAs: ["matRadioButton"], ngImport: i0, template: "<div mat-internal-form-field [labelPosition]=\"labelPosition\" #formField>\n <div class=\"mdc-radio\" [class.mdc-radio--disabled]=\"disabled\">\n <!-- Render this element first so the input is on top. -->\n <div class=\"mat-mdc-radio-touch-target\" (click)=\"_onTouchTargetClick($event)\"></div>\n <!--\n Note that we set `aria-invalid=\"false\"` on the input, because otherwise some screen readers\n will read out \"required, invalid data\" for each radio button that hasn't been checked.\n An alternate approach is to use `aria-required` instead of `required`, however we have an\n internal check which enforces that elements marked as `aria-required` also have the `required`\n attribute which ends up re-introducing the issue for us.\n -->\n <input #input class=\"mdc-radio__native-control\" type=\"radio\"\n [id]=\"inputId\"\n [checked]=\"checked\"\n [disabled]=\"disabled && !disabledInteractive\"\n [attr.name]=\"name\"\n [attr.value]=\"value\"\n [required]=\"required\"\n aria-invalid=\"false\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-disabled]=\"disabled && disabledInteractive ? 'true' : null\"\n (change)=\"_onInputInteraction($event)\">\n <div class=\"mdc-radio__background\">\n <div class=\"mdc-radio__outer-circle\"></div>\n <div class=\"mdc-radio__inner-circle\"></div>\n </div>\n <div mat-ripple class=\"mat-radio-ripple mat-focus-indicator\"\n [matRippleTrigger]=\"_rippleTrigger.nativeElement\"\n [matRippleDisabled]=\"_isRippleDisabled()\"\n [matRippleCentered]=\"true\">\n <div class=\"mat-ripple-element mat-radio-persistent-ripple\"></div>\n </div>\n </div>\n <label class=\"mdc-label\" [for]=\"inputId\">\n <ng-content></ng-content>\n </label>\n</div>\n", styles: [".mat-mdc-radio-button{-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-radio-button .mdc-radio{display:inline-block;position:relative;flex:0 0 auto;box-sizing:content-box;width:20px;height:20px;cursor:pointer;will-change:opacity,transform,border-color,color;padding:calc((var(--mdc-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-radio-button .mdc-radio:hover>.mdc-radio__native-control:not([disabled]):not(:focus)~.mdc-radio__background::before{opacity:.04;transform:scale(1)}.mat-mdc-radio-button .mdc-radio:hover>.mdc-radio__native-control:not([disabled])~.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-hover-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mdc-radio:hover>.mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio:hover>.mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-hover-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio:active>.mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-pressed-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mdc-radio:active>.mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio:active>.mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-pressed-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__background{display:inline-block;position:relative;box-sizing:border-box;width:20px;height:20px}.mat-mdc-radio-button .mdc-radio__background::before{position:absolute;transform:scale(0, 0);border-radius:50%;opacity:0;pointer-events:none;content:\"\";transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);width:var(--mdc-radio-state-layer-size, 40px);height:var(--mdc-radio-state-layer-size, 40px);top:calc(-1*(var(--mdc-radio-state-layer-size, 40px) - 20px)/2);left:calc(-1*(var(--mdc-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-radio-button .mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:50%;transition:border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-radio-button .mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);border-width:10px;border-style:solid;border-radius:50%;transition:transform 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-radio-button .mdc-radio__native-control{position:absolute;margin:0;padding:0;opacity:0;top:0;right:0;left:0;cursor:inherit;z-index:1;width:var(--mdc-radio-state-layer-size, 40px);height:var(--mdc-radio-state-layer-size, 40px)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background{transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__outer-circle{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__inner-circle{transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:focus+.mdc-radio__background::before{transform:scale(1);opacity:.12;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background{cursor:default}.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-radio-button .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-selected-focus-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle{transform:scale(0.5);transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled{pointer-events:auto}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled:hover .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled:hover .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__background::before,.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__outer-circle,.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__inner-circle{transition:none !important}.mat-mdc-radio-button .mdc-radio__background::before{background-color:var(--mat-radio-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button.mat-mdc-radio-checked .mat-ripple-element,.mat-mdc-radio-button.mat-mdc-radio-checked .mdc-radio__background::before{background-color:var(--mat-radio-checked-ripple-color, var(--mat-sys-primary))}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mat-ripple-element,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__background::before{background-color:var(--mat-radio-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mat-internal-form-field{color:var(--mat-radio-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-radio-label-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-radio-label-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-radio-label-text-size, var(--mat-sys-body-medium-size));letter-spacing:var(--mat-radio-label-text-tracking, var(--mat-sys-body-medium-tracking));font-weight:var(--mat-radio-label-text-weight, var(--mat-sys-body-medium-weight))}.mat-mdc-radio-button .mdc-radio--disabled+label{color:var(--mat-radio-disabled-label-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-radio-button .mat-radio-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:50%}.mat-mdc-radio-button .mat-radio-ripple>.mat-ripple-element{opacity:.14}.mat-mdc-radio-button .mat-radio-ripple::before{border-radius:50%}.mat-mdc-radio-button .mdc-radio>.mdc-radio__native-control:focus:enabled:not(:checked)~.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-focus-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button.cdk-focused .mat-focus-indicator::before{content:\"\"}.mat-mdc-radio-disabled{cursor:default;pointer-events:none}.mat-mdc-radio-disabled.mat-mdc-radio-disabled-interactive{pointer-events:auto}.mat-mdc-radio-touch-target{position:absolute;top:50%;left:50%;height:48px;width:48px;transform:translate(-50%, -50%);display:var(--mat-radio-touch-target-display, block)}[dir=rtl] .mat-mdc-radio-touch-target{left:auto;right:50%;transform:translate(50%, -50%)}\n"], dependencies: [{ kind: "directive", type: MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "component", type: _MatInternalFormField, selector: "div[mat-internal-form-field]", inputs: ["labelPosition"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  640. }
  641. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatRadioButton, decorators: [{
  642. type: Component,
  643. args: [{ selector: 'mat-radio-button', host: {
  644. 'class': 'mat-mdc-radio-button',
  645. '[attr.id]': 'id',
  646. '[class.mat-primary]': 'color === "primary"',
  647. '[class.mat-accent]': 'color === "accent"',
  648. '[class.mat-warn]': 'color === "warn"',
  649. '[class.mat-mdc-radio-checked]': 'checked',
  650. '[class.mat-mdc-radio-disabled]': 'disabled',
  651. '[class.mat-mdc-radio-disabled-interactive]': 'disabledInteractive',
  652. '[class._mat-animation-noopable]': '_noopAnimations',
  653. // Needs to be removed since it causes some a11y issues (see #21266).
  654. '[attr.tabindex]': 'null',
  655. '[attr.aria-label]': 'null',
  656. '[attr.aria-labelledby]': 'null',
  657. '[attr.aria-describedby]': 'null',
  658. // Note: under normal conditions focus shouldn't land on this element, however it may be
  659. // programmatically set, for example inside of a focus trap, in this case we want to forward
  660. // the focus to the native element.
  661. '(focus)': '_inputElement.nativeElement.focus()',
  662. }, exportAs: 'matRadioButton', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatRipple, _MatInternalFormField], template: "<div mat-internal-form-field [labelPosition]=\"labelPosition\" #formField>\n <div class=\"mdc-radio\" [class.mdc-radio--disabled]=\"disabled\">\n <!-- Render this element first so the input is on top. -->\n <div class=\"mat-mdc-radio-touch-target\" (click)=\"_onTouchTargetClick($event)\"></div>\n <!--\n Note that we set `aria-invalid=\"false\"` on the input, because otherwise some screen readers\n will read out \"required, invalid data\" for each radio button that hasn't been checked.\n An alternate approach is to use `aria-required` instead of `required`, however we have an\n internal check which enforces that elements marked as `aria-required` also have the `required`\n attribute which ends up re-introducing the issue for us.\n -->\n <input #input class=\"mdc-radio__native-control\" type=\"radio\"\n [id]=\"inputId\"\n [checked]=\"checked\"\n [disabled]=\"disabled && !disabledInteractive\"\n [attr.name]=\"name\"\n [attr.value]=\"value\"\n [required]=\"required\"\n aria-invalid=\"false\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-disabled]=\"disabled && disabledInteractive ? 'true' : null\"\n (change)=\"_onInputInteraction($event)\">\n <div class=\"mdc-radio__background\">\n <div class=\"mdc-radio__outer-circle\"></div>\n <div class=\"mdc-radio__inner-circle\"></div>\n </div>\n <div mat-ripple class=\"mat-radio-ripple mat-focus-indicator\"\n [matRippleTrigger]=\"_rippleTrigger.nativeElement\"\n [matRippleDisabled]=\"_isRippleDisabled()\"\n [matRippleCentered]=\"true\">\n <div class=\"mat-ripple-element mat-radio-persistent-ripple\"></div>\n </div>\n </div>\n <label class=\"mdc-label\" [for]=\"inputId\">\n <ng-content></ng-content>\n </label>\n</div>\n", styles: [".mat-mdc-radio-button{-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-radio-button .mdc-radio{display:inline-block;position:relative;flex:0 0 auto;box-sizing:content-box;width:20px;height:20px;cursor:pointer;will-change:opacity,transform,border-color,color;padding:calc((var(--mdc-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-radio-button .mdc-radio:hover>.mdc-radio__native-control:not([disabled]):not(:focus)~.mdc-radio__background::before{opacity:.04;transform:scale(1)}.mat-mdc-radio-button .mdc-radio:hover>.mdc-radio__native-control:not([disabled])~.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-hover-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mdc-radio:hover>.mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio:hover>.mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-hover-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio:active>.mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-pressed-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mdc-radio:active>.mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio:active>.mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-pressed-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__background{display:inline-block;position:relative;box-sizing:border-box;width:20px;height:20px}.mat-mdc-radio-button .mdc-radio__background::before{position:absolute;transform:scale(0, 0);border-radius:50%;opacity:0;pointer-events:none;content:\"\";transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);width:var(--mdc-radio-state-layer-size, 40px);height:var(--mdc-radio-state-layer-size, 40px);top:calc(-1*(var(--mdc-radio-state-layer-size, 40px) - 20px)/2);left:calc(-1*(var(--mdc-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-radio-button .mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:50%;transition:border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-radio-button .mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);border-width:10px;border-style:solid;border-radius:50%;transition:transform 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-radio-button .mdc-radio__native-control{position:absolute;margin:0;padding:0;opacity:0;top:0;right:0;left:0;cursor:inherit;z-index:1;width:var(--mdc-radio-state-layer-size, 40px);height:var(--mdc-radio-state-layer-size, 40px)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background{transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__outer-circle{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__inner-circle{transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:focus+.mdc-radio__background::before{transform:scale(1);opacity:.12;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background{cursor:default}.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-radio-button .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-selected-focus-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle{transform:scale(0.5);transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled{pointer-events:auto}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled:hover .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled:hover .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__background::before,.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__outer-circle,.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__inner-circle{transition:none !important}.mat-mdc-radio-button .mdc-radio__background::before{background-color:var(--mat-radio-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button.mat-mdc-radio-checked .mat-ripple-element,.mat-mdc-radio-button.mat-mdc-radio-checked .mdc-radio__background::before{background-color:var(--mat-radio-checked-ripple-color, var(--mat-sys-primary))}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mat-ripple-element,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__background::before{background-color:var(--mat-radio-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mat-internal-form-field{color:var(--mat-radio-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-radio-label-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-radio-label-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-radio-label-text-size, var(--mat-sys-body-medium-size));letter-spacing:var(--mat-radio-label-text-tracking, var(--mat-sys-body-medium-tracking));font-weight:var(--mat-radio-label-text-weight, var(--mat-sys-body-medium-weight))}.mat-mdc-radio-button .mdc-radio--disabled+label{color:var(--mat-radio-disabled-label-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-radio-button .mat-radio-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:50%}.mat-mdc-radio-button .mat-radio-ripple>.mat-ripple-element{opacity:.14}.mat-mdc-radio-button .mat-radio-ripple::before{border-radius:50%}.mat-mdc-radio-button .mdc-radio>.mdc-radio__native-control:focus:enabled:not(:checked)~.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-focus-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button.cdk-focused .mat-focus-indicator::before{content:\"\"}.mat-mdc-radio-disabled{cursor:default;pointer-events:none}.mat-mdc-radio-disabled.mat-mdc-radio-disabled-interactive{pointer-events:auto}.mat-mdc-radio-touch-target{position:absolute;top:50%;left:50%;height:48px;width:48px;transform:translate(-50%, -50%);display:var(--mat-radio-touch-target-display, block)}[dir=rtl] .mat-mdc-radio-touch-target{left:auto;right:50%;transform:translate(50%, -50%)}\n"] }]
  663. }], ctorParameters: () => [], propDecorators: { id: [{
  664. type: Input
  665. }], name: [{
  666. type: Input
  667. }], ariaLabel: [{
  668. type: Input,
  669. args: ['aria-label']
  670. }], ariaLabelledby: [{
  671. type: Input,
  672. args: ['aria-labelledby']
  673. }], ariaDescribedby: [{
  674. type: Input,
  675. args: ['aria-describedby']
  676. }], disableRipple: [{
  677. type: Input,
  678. args: [{ transform: booleanAttribute }]
  679. }], tabIndex: [{
  680. type: Input,
  681. args: [{
  682. transform: (value) => (value == null ? 0 : numberAttribute(value)),
  683. }]
  684. }], checked: [{
  685. type: Input,
  686. args: [{ transform: booleanAttribute }]
  687. }], value: [{
  688. type: Input
  689. }], labelPosition: [{
  690. type: Input
  691. }], disabled: [{
  692. type: Input,
  693. args: [{ transform: booleanAttribute }]
  694. }], required: [{
  695. type: Input,
  696. args: [{ transform: booleanAttribute }]
  697. }], color: [{
  698. type: Input
  699. }], disabledInteractive: [{
  700. type: Input,
  701. args: [{ transform: booleanAttribute }]
  702. }], change: [{
  703. type: Output
  704. }], _inputElement: [{
  705. type: ViewChild,
  706. args: ['input']
  707. }], _rippleTrigger: [{
  708. type: ViewChild,
  709. args: ['formField', { read: ElementRef, static: true }]
  710. }] } });
  711. class MatRadioModule {
  712. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  713. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: MatRadioModule, imports: [MatCommonModule, MatRippleModule, MatRadioGroup, MatRadioButton], exports: [MatCommonModule, MatRadioGroup, MatRadioButton] });
  714. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatRadioModule, imports: [MatCommonModule, MatRippleModule, MatRadioButton, MatCommonModule] });
  715. }
  716. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatRadioModule, decorators: [{
  717. type: NgModule,
  718. args: [{
  719. imports: [MatCommonModule, MatRippleModule, MatRadioGroup, MatRadioButton],
  720. exports: [MatCommonModule, MatRadioGroup, MatRadioButton],
  721. }]
  722. }] });
  723. export { MAT_RADIO_DEFAULT_OPTIONS, MAT_RADIO_DEFAULT_OPTIONS_FACTORY, MAT_RADIO_GROUP, MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR, MatRadioButton, MatRadioChange, MatRadioGroup, MatRadioModule };
  724. //# sourceMappingURL=radio.mjs.map