From aa680c2682a49ac33b05660977e310ab3729ee1f Mon Sep 17 00:00:00 2001
From: Miles Malerba
Date: Thu, 18 Feb 2021 18:01:22 -0800
Subject: [PATCH 1/4] feat(material-experimental/mdc-form-field): separate out
text and icon prefixes/suffixes
---
src/dev-app/mdc-input/mdc-input-demo.html | 56 +++++++++++++------
.../mdc-form-field/_form-field-theme.scss | 4 +-
.../mdc-form-field/directives/prefix.ts | 3 +-
.../mdc-form-field/directives/suffix.ts | 3 +-
.../mdc-form-field/form-field.html | 14 +++--
.../mdc-form-field/form-field.scss | 5 ++
.../mdc-form-field/form-field.ts | 13 +++--
.../testing/form-field-harness.ts | 4 +-
8 files changed, 70 insertions(+), 32 deletions(-)
diff --git a/src/dev-app/mdc-input/mdc-input-demo.html b/src/dev-app/mdc-input/mdc-input-demo.html
index 313f13761adf..a091105202f6 100644
--- a/src/dev-app/mdc-input/mdc-input-demo.html
+++ b/src/dev-app/mdc-input/mdc-input-demo.html
@@ -124,32 +124,50 @@ Text
Amount
- $
- .00
+ $
+ .00
Text (always outline)
Amount
- $
- .00
+ $
+ .00
Icons
Amount
- calendar_today
- mode_edit
+ calendar_today
+ mode_edit
Icon buttons
Amount
-
-
+
+
+
+
+ Text & Icons
+
+ Amount
+
+ $
+ .00
+
+
@@ -371,20 +389,22 @@
Textarea
Prefixed
- Example:
+ Example:
Suffixed
- .00 €
+ .00 €
Both:
Email address
- email
- @gmail.com
+
+ email
+
+ @gmail.com
@@ -679,8 +699,8 @@ <textarea> with bindable autosize
Amount
- $
- .00
+ $
+ .00
@@ -692,9 +712,9 @@ <textarea> with bindable autosize
Amount
- $
- !
- .00
+ $
+ !
+ .00
@@ -724,7 +744,7 @@ Custom control
Phone number
- phone
+ phone
Include area code
diff --git a/src/material-experimental/mdc-form-field/_form-field-theme.scss b/src/material-experimental/mdc-form-field/_form-field-theme.scss
index b6af728250ba..28ed69fb3887 100644
--- a/src/material-experimental/mdc-form-field/_form-field-theme.scss
+++ b/src/material-experimental/mdc-form-field/_form-field-theme.scss
@@ -75,8 +75,8 @@
// the correct level.
.mat-mdc-input-element,
.mat-mdc-form-field label,
- .mat-mdc-form-field-prefix,
- .mat-mdc-form-field-suffix {
+ .mat-mdc-form-field-text-prefix,
+ .mat-mdc-form-field-text-suffix {
@include mdc-typography(body1, $query: mdc-helpers.$mat-typography-styles-query);
}
}
diff --git a/src/material-experimental/mdc-form-field/directives/prefix.ts b/src/material-experimental/mdc-form-field/directives/prefix.ts
index bc8af2c2a3a1..33cec4845f19 100644
--- a/src/material-experimental/mdc-form-field/directives/prefix.ts
+++ b/src/material-experimental/mdc-form-field/directives/prefix.ts
@@ -17,7 +17,8 @@ export const MAT_PREFIX = new InjectionToken('MatPrefix');
/** Prefix to be placed in front of the form field. */
@Directive({
- selector: '[matPrefix]',
+ /** @breaking-change 13.0.0 remove [matPrefix] */
+ selector: '[matPrefix], [matIconPrefix], [matTextPrefix]',
providers: [{provide: MAT_PREFIX, useExisting: MatPrefix}],
})
export class MatPrefix {}
diff --git a/src/material-experimental/mdc-form-field/directives/suffix.ts b/src/material-experimental/mdc-form-field/directives/suffix.ts
index edc35cbf1838..200e73dbcc67 100644
--- a/src/material-experimental/mdc-form-field/directives/suffix.ts
+++ b/src/material-experimental/mdc-form-field/directives/suffix.ts
@@ -17,7 +17,8 @@ export const MAT_SUFFIX = new InjectionToken('MatSuffix');
/** Suffix to be placed at the end of the form field. */
@Directive({
- selector: '[matSuffix]',
+ /** @breaking-change 13.0.0 remove [matSuffix] */
+ selector: '[matSuffix], [matIconSuffix], [matTextSuffix]',
providers: [{provide: MAT_SUFFIX, useExisting: MatSuffix}],
})
export class MatSuffix {}
diff --git a/src/material-experimental/mdc-form-field/form-field.html b/src/material-experimental/mdc-form-field/form-field.html
index bb2d512011b9..030f5f19450e 100644
--- a/src/material-experimental/mdc-form-field/form-field.html
+++ b/src/material-experimental/mdc-form-field/form-field.html
@@ -44,8 +44,11 @@
-