-
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.
Showing
8 changed files
with
209 additions
and
25 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// | ||
// 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/iconbutton/standard-icon-button'; | ||
|
||
@mixin theme-styles($theme) { | ||
@include _leading-icon-color( | ||
( | ||
default: map.get($theme, leading-icon-color), | ||
hover: map.get($theme, hover-leading-icon-color), | ||
focus: map.get($theme, focus-leading-icon-color), | ||
disabled: map.get($theme, disabled-leading-icon-color), | ||
) | ||
); | ||
@include _trailing-icon-color( | ||
( | ||
default: map.get($theme, trailing-icon-color), | ||
hover: map.get($theme, hover-trailing-icon-color), | ||
focus: map.get($theme, focus-trailing-icon-color), | ||
disabled: map.get($theme, disabled-trailing-icon-color), | ||
) | ||
); | ||
|
||
&.md3-text-field--error:not(.md3-text-field--disabled) { | ||
@include _leading-icon-color( | ||
( | ||
default: map.get($theme, error-leading-icon-color), | ||
hover: map.get($theme, error-hover-leading-icon-color), | ||
focus: map.get($theme, error-focus-leading-icon-color), | ||
) | ||
); | ||
@include _trailing-icon-color( | ||
( | ||
default: map.get($theme, error-trailing-icon-color), | ||
hover: map.get($theme, error-hover-trailing-icon-color), | ||
focus: map.get($theme, error-focus-trailing-icon-color), | ||
) | ||
); | ||
} | ||
|
||
&.md3-text-field--disabled { | ||
.md3-text-field__icon--leading { | ||
opacity: map.get($theme, disabled-leading-icon-opacity); | ||
} | ||
|
||
.md3-text-field__icon--trailing { | ||
opacity: map.get($theme, disabled-trailing-icon-opacity); | ||
} | ||
} | ||
} | ||
|
||
@mixin _leading-icon-color($colors) { | ||
@include _set-leading-icon-color(map.get($colors, default)); | ||
|
||
&:hover { | ||
@include _set-leading-icon-color(map.get($colors, hover)); | ||
} | ||
|
||
&:focus-within { | ||
@include _set-leading-icon-color(map.get($colors, focus)); | ||
} | ||
|
||
&.md3-text-field--disabled { | ||
@include _set-leading-icon-color(map.get($colors, disabled)); | ||
} | ||
} | ||
|
||
@mixin _set-leading-icon-color($color) { | ||
.md3-text-field__icon--leading { | ||
color: $color; | ||
} | ||
} | ||
|
||
@mixin _trailing-icon-color($colors) { | ||
@include _set-trailing-icon-color(map.get($colors, default)); | ||
|
||
&:hover { | ||
@include _set-trailing-icon-color(map.get($colors, hover)); | ||
} | ||
|
||
&:focus-within { | ||
@include _set-trailing-icon-color(map.get($colors, focus)); | ||
} | ||
|
||
&.md3-text-field--disabled { | ||
@include _set-trailing-icon-color(map.get($colors, disabled)); | ||
} | ||
} | ||
|
||
@mixin _set-trailing-icon-color($color) { | ||
.md3-text-field__icon--trailing { | ||
color: $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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Copyright 2022 Google LLC | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
// stylelint-disable selector-class-pattern -- | ||
// Selector '.md3-*' should only be used in this project. | ||
|
||
@mixin static-styles() { | ||
.md3-text-field__icon { | ||
display: flex; | ||
|
||
::slotted(*) { | ||
// Remove excess whitespace below inline elementsxs | ||
display: flex; | ||
} | ||
} | ||
} |
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
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