/** * @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 */ import { Attribute, Directive, ElementRef, Input } from '@angular/core'; import { MAT_ERROR } from '@angular/material/form-field'; import * as i0 from "@angular/core"; let nextUniqueId = 0; /** * Single error message to be shown underneath the form field. * @deprecated Use `MatError` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyError { constructor(ariaLive, elementRef) { this.id = `mat-error-${nextUniqueId++}`; // If no aria-live value is set add 'polite' as a default. This is preferred over setting // role='alert' so that screen readers do not interrupt the current task to read this aloud. if (!ariaLive) { elementRef.nativeElement.setAttribute('aria-live', 'polite'); } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatLegacyError, deps: [{ token: 'aria-live', attribute: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: MatLegacyError, selector: "mat-error", inputs: { id: "id" }, host: { attributes: { "aria-atomic": "true" }, properties: { "attr.id": "id" }, classAttribute: "mat-error" }, providers: [{ provide: MAT_ERROR, useExisting: MatLegacyError }], ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatLegacyError, decorators: [{ type: Directive, args: [{ selector: 'mat-error', host: { 'class': 'mat-error', '[attr.id]': 'id', 'aria-atomic': 'true', }, providers: [{ provide: MAT_ERROR, useExisting: MatLegacyError }], }] }], ctorParameters: function () { return [{ type: undefined, decorators: [{ type: Attribute, args: ['aria-live'] }] }, { type: i0.ElementRef }]; }, propDecorators: { id: [{ type: Input }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIu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