Skip to content

Commit

Permalink
refactor(textfield): expose light theme map
Browse files Browse the repository at this point in the history
Exports the `light-theme` map so it can be used for validations.

PiperOrigin-RevId: 553546367
  • Loading branch information
material-web-copybara authored and copybara-github committed Aug 3, 2023
1 parent 83355c3 commit 3bf4a12
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/mdc-textfield/_filled-text-field-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

$_custom-property-prefix: 'filled-text-field';

$_light-theme: (
$light-theme: (
active-indicator-color: null,
active-indicator-height: null,
caret-color: null,
Expand Down Expand Up @@ -131,7 +131,7 @@ $_light-theme: (
);

@mixin theme($theme) {
$theme: validate.theme($_light-theme, $theme);
$theme: validate.theme($light-theme, $theme);

@include keys.declare-custom-properties(
$theme,
Expand All @@ -140,7 +140,7 @@ $_light-theme: (
}

@mixin theme-styles($theme, $resolvers: resolvers.$material) {
$theme: validate.theme-styles($_light-theme, $theme, false);
$theme: validate.theme-styles($light-theme, $theme, false);

$theme: keys.create-theme-properties(
$theme,
Expand Down
16 changes: 11 additions & 5 deletions packages/mdc-textfield/_outlined-text-field-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

$custom-property-prefix: 'outlined-text-field';

$_light-theme: (
$light-theme: (
caret-color: null,
container-height: null,
container-shape: null,
Expand Down Expand Up @@ -125,7 +125,7 @@ $_light-theme: (
);

@mixin theme($theme) {
$theme: validate.theme($_light-theme, $theme);
$theme: validate.theme($light-theme, $theme);

@include keys.declare-custom-properties(
$theme,
Expand All @@ -134,7 +134,7 @@ $_light-theme: (
}

@mixin theme-styles($theme, $resolvers: resolvers.$material) {
$theme: validate.theme-styles($_light-theme, $theme, false);
$theme: validate.theme-styles($light-theme, $theme, false);

$theme: keys.create-theme-properties(
$theme,
Expand All @@ -157,15 +157,21 @@ $_light-theme: (
'text-field-outlined-#{custom-properties.get-fallback($container-height)}',
'text-field-outlined-#{$container-height}'
);
@include mixins.outlined-height($container-height-value, $keyframe-suffix);
@include mixins.outlined-height(
$container-height-value,
$keyframe-suffix
);

&.mdc-text-field--with-leading-icon {
$with-leading-icon-keyframe-suffix: if(
custom-properties.is-custom-prop($container-height),
'text-field-outlined-with-leading-icon-#{custom-properties.get-fallback($container-height)}',
'text-field-outlined-with-leading-icon-#{$container-height}'
);
@include mixins.outlined-with-leading-icon-height($container-height-value, $with-leading-icon-keyframe-suffix);
@include mixins.outlined-with-leading-icon-height(
$container-height-value,
$with-leading-icon-keyframe-suffix
);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mdc-textfield/_text-field-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

@use './text-field';

$_light-theme: (
$light-theme: (
active-indicator-color: null,
active-indicator-height: null,
caret-color: null,
Expand Down Expand Up @@ -144,7 +144,7 @@ $_light-theme: (
);

@mixin theme-styles($theme, $resolvers: resolvers.$material) {
@include theme.validate-theme-styles($_light-theme, $theme);
@include theme.validate-theme-styles($light-theme, $theme);

// TODO(b/261633818): Remove support for extraneous `*-caret-color` tokens.
@include _caret-color(
Expand Down

0 comments on commit 3bf4a12

Please sign in to comment.