/** * @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 { Directive, inject } from '@angular/core'; import { MatInput as BaseMatInput } from '@angular/material/input'; import { MatLegacyFormFieldControl, MAT_LEGACY_FORM_FIELD, } from '@angular/material/legacy-form-field'; import * as i0 from "@angular/core"; /** * Directive that allows a native input to work inside a `MatFormField`. * @deprecated Use `MatInput` from `@angular/material/input` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyInput extends BaseMatInput { constructor() { super(...arguments); this._legacyFormField = inject(MAT_LEGACY_FORM_FIELD, { optional: true }); } _getPlaceholder() { // If we're hiding the native placeholder, it should also be cleared from the DOM, otherwise // screen readers will read it out twice: once from the label and once from the attribute. // TODO: can be removed once we get rid of the `legacy` style for the form field, because it's // the only one that supports promoting the placeholder to a label. const formField = this._legacyFormField; return formField && formField.appearance === 'legacy' && !formField._hasLabel?.() ? null : this.placeholder; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatLegacyInput, deps: null, target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: MatLegacyInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],\n input[matNativeControl], textarea[matNativeControl]", host: { properties: { "class.mat-input-server": "_isServer", "class.mat-mdc-input-element": "false", "class.mat-mdc-form-field-textarea-control": "false", "class.mat-mdc-form-field-input-control": "false", "class.mdc-text-field__input": "false", "class.mat-mdc-native-select-inline": "false", "attr.data-placeholder": "placeholder", "class.mat-native-select-inline": "_isInlineSelect()" }, classAttribute: "mat-input-element mat-form-field-autofill-control" }, providers: [{ provide: MatLegacyFormFieldControl, useExisting: MatLegacyInput }], exportAs: ["matInput"], usesInheritance: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatLegacyInput, decorators: [{ type: Directive, args: [{ selector: `input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]`, exportAs: 'matInput', host: { /** * @breaking-change 8.0.0 remove .mat-form-field-autofill-control in favor of AutofillMonitor. */ 'class': 'mat-input-element mat-form-field-autofill-control', '[class.mat-input-server]': '_isServer', // These classes are inherited from the base input class and need to be cleared. '[class.mat-mdc-input-element]': 'false', '[class.mat-mdc-form-field-textarea-control]': 'false', '[class.mat-mdc-form-field-input-control]': 'false', '[class.mdc-text-field__input]': 'false', '[class.mat-mdc-native-select-inline]': 'false', // At the time of writing, we have a lot of customer tests that look up the input based on its // placeholder. Since we sometimes omit the placeholder attribute from the DOM to prevent screen // readers from reading it twice, we have to keep it somewhere in the DOM for the lookup. '[attr.data-placeholder]': 'placeholder', '[class.mat-native-select-inline]': '_isInlineSelect()', }, providers: [{ provide: MatLegacyFormFieldControl, useExisting: MatLegacyInput }], }] }] }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvbGVnYWN5LWlucHV0L2lucHV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxTQUFTLEVBQUUsTUFBTSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ2hELE9BQU8sRUFBQyxRQUFRLElBQUksWUFBWSxFQUFDLE1BQU0seUJBQXlCLENBQUM7QUFDakUsT0FBTyxFQUNMLHlCQUF5QixFQUV6QixxQkFBcUIsR0FDdEIsTUFBTSxxQ0FBcUMsQ0FBQzs7QUFFN0M7Ozs7R0FJRztBQXlCSCxNQUFNLE9BQU8sY0FBZSxTQUFRLFlBQVk7SUF4QmhEOztRQXlCVSxxQkFBZ0IsR0FB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