Skip to content

Commit e17ffa6

Browse files
devversionandrewseguin
authored andcommitted
refactor(material-experimental/mdc-form-field): use mdc-line-ripple for inactive bottom-line
Previously, MDC only set the bottom-line for text-fields on the input and textarea elements. This didn't work for us since we support custom form field controls. We added a custom bottom-line for this. MDC recently made a change to move the bottom-line inactive styles to the actual `mdc-bottom-line` (which we already use for active styles). This means that we can get rid of our custom styles. Reference commit: material-components/material-components-web@b6c7f62.
1 parent 5852fcb commit e17ffa6

File tree

6 files changed

+4
-43
lines changed

6 files changed

+4
-43
lines changed

src/material-experimental/mdc-form-field/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ sass_library(
8181
sass_library(
8282
name = "form_field_partials",
8383
srcs = [
84-
"_form-field-bottom-line.scss",
8584
"_form-field-focus-overlay.scss",
8685
"_form-field-sizing.scss",
8786
"_form-field-subscript.scss",

src/material-experimental/mdc-form-field/_form-field-bottom-line.scss

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/material-experimental/mdc-form-field/_mdc-form-field.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
@import '@material/textfield/mixins.import';
55
@import '../mdc-helpers/mdc-helpers';
66
@import 'form-field-subscript';
7-
@import 'form-field-bottom-line';
87
@import 'form-field-focus-overlay';
98
@import 'mdc-text-field-theme-variable-refresh';
109

@@ -40,7 +39,6 @@
4039
@include mdc-notched-outline-core-styles($query: $mat-base-styles-query);
4140
@include mdc-line-ripple-core-styles($query: $mat-theme-styles-query);
4241
@include _mat-form-field-subscript-theme();
43-
@include _mat-form-field-bottom-line-theme();
4442
@include _mat-form-field-focus-overlay-theme();
4543

4644
.mat-mdc-form-field.mat-accent {

src/material-experimental/mdc-form-field/_mdc-text-field-theme-variable-refresh.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
@mixin _mdc-text-field-refresh-theme-variables() {
1111
$_mdc-text-field-disabled-border-border: $mdc-text-field-disabled-border-border;
1212
$mdc-text-field-disabled-border: rgba(theme-variables.prop-value(on-surface), 0.06) !global;
13+
$_mdc-text-field-bottom-line-hover: $mdc-text-field-bottom-line-hover;
14+
$mdc-text-field-bottom-line-hover: rgba(theme-variables.prop-value(on-surface), 0.87) !global;
1315
$_mdc-text-field-bottom-line-idle: $mdc-text-field-bottom-line-idle;
1416
$mdc-text-field-bottom-line-idle: rgba(theme-variables.prop-value(on-surface), 0.42) !global;
1517
$_mdc-text-field-label: $mdc-text-field-label;
@@ -46,6 +48,7 @@
4648

4749
// Reset all variables to ensure that this mixin does not cause unexpected side effects.
4850
$mdc-text-field-disabled-border-border: $_mdc-text-field-disabled-border-border !global;
51+
$mdc-text-field-bottom-line-hover: $_mdc-text-field-bottom-line-hover !global;
4952
$mdc-text-field-bottom-line-idle: $_mdc-text-field-bottom-line-idle !global;
5053
$mdc-text-field-label: $_mdc-text-field-label !global;
5154
$mdc-text-field-ink-color: $_mdc-text-field-ink-color !global;

src/material-experimental/mdc-form-field/form-field.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
</div>
5454

5555
<div matFormFieldLineRipple *ngIf="!_hasOutline()"></div>
56-
<div class="mat-mdc-form-field-bottom-line" *ngIf="!_hasOutline()"></div>
5756
</div>
5857

5958
<div class="mat-mdc-form-field-subscript-wrapper"

src/material-experimental/mdc-form-field/form-field.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
@import 'form-field-sizing';
44
@import 'form-field-subscript';
5-
@import 'form-field-bottom-line';
65
@import 'form-field-focus-overlay';
76
@import 'mdc-text-field-textarea-overrides';
87
@import 'mdc-text-field-structure-overrides';
@@ -17,9 +16,8 @@
1716
@include _mat-mdc-text-field-textarea-overrides();
1817
@include _mat-mdc-text-field-structure-overrides();
1918

20-
// Include the subscript, bottom-line and focus-overlay styles.
19+
// Include the subscript and focus-overlay styles.
2120
@include _mat-form-field-subscript();
22-
@include _mat-form-field-bottom-line();
2321
@include _mat-form-field-focus-overlay();
2422

2523
// Host element of the form-field. It contains the mdc-text-field wrapper

0 commit comments

Comments
 (0)