-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(form-field): Added theme styles to form field
PiperOrigin-RevId: 464479156
- Loading branch information
1 parent
424596e
commit 17075f4
Showing
4 changed files
with
74 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Copyright 2022 Google LLC | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
// stylelint-disable selector-class-pattern -- | ||
// Selector '.md3-*' should only be used in this project. | ||
|
||
@use 'sass:map'; | ||
|
||
@use '@material/web/sass/theme'; | ||
@use '@material/web/tokens'; | ||
|
||
$custom-property-prefix: 'formfield'; | ||
|
||
$light-theme: ( | ||
label-text-color: | ||
map.get(tokens.md-sys-color-values-light-dynamic(), on-surface), | ||
disabled-label-text-color: | ||
map.get(tokens.md-sys-color-values-light-dynamic(), on-surface-variant), | ||
); | ||
|
||
@mixin theme($theme) { | ||
$theme: theme.validate-theme($light-theme, $theme); | ||
@include theme.emit-theme-vars( | ||
theme.create-theme-vars($theme, $custom-property-prefix) | ||
); | ||
} | ||
|
||
@mixin theme-styles($theme) { | ||
$theme: theme.validate-theme($light-theme, $theme); | ||
$theme: theme.create-theme-vars($theme, $prefix: $custom-property-prefix); | ||
|
||
.md3-formfield__label { | ||
color: map.get($theme, label-text-color); | ||
} | ||
|
||
&.md3-formfield--disabled .md3-formfield__label { | ||
color: map.get($theme, disabled-label-text-color); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters