From aa2356d3fc3a37b1bdabc7cbeca957e1f59ffb7e Mon Sep 17 00:00:00 2001 From: mmalerba Date: Mon, 12 Mar 2018 15:37:42 -0700 Subject: [PATCH] refactor(form-field): remove deprecated CSS classes (#10296) BREAKING CHANGES: - The following deprecated CSS classes have been removed: - mat-input-container instead use mat-form-field - mat-input-invalid instead use mat-form-field-invalid - mat-input-wrapper instead use mat-form-field-wrapper - mat-input-flex instead use mat-form-field-flex - mat-input-prefix instead use mat-form-field-prefix - mat-input-infix instead use mat-form-field-infix - mat-input-placeholder-wrapper instead use mat-form-field-label-wrapper - mat-input-placeholder instead use mat-form-field-label - mat-input-suffix instead use mat-form-field-suffix - mat-input-underline instead use mat-form-field-underline - mat-input-ripple instead use mat-form-field-ripple - mat-input-subscript-wrapper instead use mat-form-field-subscript-wrapper - mat-input-hint-wrapper instead use mat-form-field-hint-wrapper - mat-input-hint-spacer instead use mat-form-field-hint-spacer - mat-form-field-placeholder-wrapper instead use mat-form-field-label-wrapper - mat-form-field-placeholder instead use mat-form-field-label --- src/lib/autocomplete/autocomplete.spec.ts | 2 +- src/lib/form-field/form-field.html | 35 ++++++++--------------- src/lib/form-field/form-field.scss | 6 ++-- src/lib/form-field/form-field.ts | 3 +- 4 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/lib/autocomplete/autocomplete.spec.ts b/src/lib/autocomplete/autocomplete.spec.ts index 704e2bea745..9734e1fdca2 100644 --- a/src/lib/autocomplete/autocomplete.spec.ts +++ b/src/lib/autocomplete/autocomplete.spec.ts @@ -1298,7 +1298,7 @@ describe('MatAutocomplete', () => { fixture.detectChanges(); input = fixture.debugElement.query(By.css('input')).nativeElement; - inputReference = fixture.debugElement.query(By.css('.mat-input-flex')).nativeElement; + inputReference = fixture.debugElement.query(By.css('.mat-form-field-flex')).nativeElement; }); it('should use below positioning by default', fakeAsync(() => { diff --git a/src/lib/form-field/form-field.html b/src/lib/form-field/form-field.html index 3f2429919c6..4f6adc89a6a 100644 --- a/src/lib/form-field/form-field.html +++ b/src/lib/form-field/form-field.html @@ -1,28 +1,17 @@ -
-
+
-
+
-
+
- - + - - -
-
+
-
-
@@ -75,18 +64,18 @@
-
-
{{hintLabel}}
-
+
diff --git a/src/lib/form-field/form-field.scss b/src/lib/form-field/form-field.scss index 9e242fb46dc..7375167e45f 100644 --- a/src/lib/form-field/form-field.scss +++ b/src/lib/form-field/form-field.scss @@ -123,9 +123,9 @@ $mat-form-field-default-infix-width: 180px !default; // Server-side rendered matInput with focus or a placeholder attribute but placeholder not shown // (used as a pure CSS stand-in for mat-form-field-should-float). -.mat-input-server:focus + .mat-form-field-placeholder-wrapper .mat-form-field-placeholder, -.mat-input-server[placeholder]:not(:placeholder-shown) + .mat-form-field-placeholder-wrapper - .mat-form-field-placeholder { +.mat-input-server:focus + .mat-form-field-label-wrapper .mat-form-field-label, +.mat-input-server[placeholder]:not(:placeholder-shown) + .mat-form-field-label-wrapper + .mat-form-field-label { display: none; .mat-form-field-can-float & { diff --git a/src/lib/form-field/form-field.ts b/src/lib/form-field/form-field.ts index ddc6727f9fc..0aed2a7ae16 100644 --- a/src/lib/form-field/form-field.ts +++ b/src/lib/form-field/form-field.ts @@ -97,12 +97,11 @@ export const MAT_FORM_FIELD_DEFAULT_OPTIONS = ], animations: [matFormFieldAnimations.transitionMessages], host: { - 'class': 'mat-input-container mat-form-field', + 'class': 'mat-form-field', '[class.mat-form-field-appearance-standard]': 'appearance == "standard"', '[class.mat-form-field-appearance-fill]': 'appearance == "fill"', '[class.mat-form-field-appearance-outline]': 'appearance == "outline"', '[class.mat-form-field-appearance-legacy]': 'appearance == "legacy"', - '[class.mat-input-invalid]': '_control.errorState', '[class.mat-form-field-invalid]': '_control.errorState', '[class.mat-form-field-can-float]': '_canLabelFloat', '[class.mat-form-field-should-float]': '_shouldLabelFloat()',