Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
feat(select): Create additional state mixins
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 311465029
  • Loading branch information
allan-chen authored and copybara-github committed May 14, 2020
1 parent 2139200 commit 744d751
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/mdc-select/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,14 @@ Mixin | Description
`container-fill-color($color)` | Customizes the background color of the select.
`disabled-container-fill-color($color)` | Customizes the background color of the select when disabled.
`dropdown-icon-color($color)` | Customizes the dropdown icon color of the select.
`hover-dropdown-icon-color($color)` | Customizes the dropdown icon color of the select when hovered.
`focused-dropdown-icon-color($color)` | Customizes the dropdown icon color of the select when focused.
`disabled-dropdown-icon-color($color)` | Customizes the dropdown icon color of the select when disabled.
`label-color($color)` | Customizes the label color of the select in the unfocused state.
`hover-label-color($color)` | Customizes the label color of the select when hovered.
`focused-label-color($color)` | Customizes the label color of the select when focused.
`label-floating-color($color)` | Customizes the label color of the select when the label is floated, but the select is not necessarily focused.
`hover-label-floating-color($color)` | Customizes the label color of the select when hovered and label is floated.
`disabled-label-color($color)` | Customizes the label color of the select when disabled.
`bottom-line-color($color)` | Customizes the color of the default bottom line of the select.
`hover-bottom-line-color($color)` | Customizes the color of the bottom line when the select is hovered.
Expand Down
32 changes: 32 additions & 0 deletions packages/mdc-select/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@
}
}

@mixin hover-dropdown-icon-color($color, $query: feature-targeting-functions.all()) {
@include _if-enabled {
&:not(.mdc-select--focused):hover {
@include _dropdown-icon-color($color, $query: $query);
}
}
}

@mixin focused-dropdown-icon-color($color, $query: feature-targeting-functions.all()) {
@include _if-enabled {
&.mdc-select--focused {
Expand All @@ -286,6 +294,22 @@
}
}

@mixin label-floating-color($color, $query: feature-targeting-functions.all()) {
@include _if-enabled {
.mdc-floating-label--float-above {
@include floating-label-mixins.ink-color(theme-variables.prop-value($color), $query: $query);
}
}
}

@mixin hover-label-floating-color($color, $query: feature-targeting-functions.all()) {
@include _if-enabled {
&:not(.mdc-select--focused):hover .mdc-floating-label--float-above {
@include floating-label-mixins.ink-color(theme-variables.prop-value($color), $query: $query);
}
}
}

@mixin bottom-line-color($color, $query: feature-targeting-functions.all()) {
@include _if-enabled {
@include bottom-line-color_($color, $query: $query);
Expand Down Expand Up @@ -320,6 +344,14 @@
}
}

@mixin hover-label-color($color, $query: feature-targeting-functions.all()) {
@include _if-enabled {
&:not(.mdc-select--focused):hover .mdc-floating-label {
@include floating-label-mixins.ink-color(theme-variables.prop-value($color), $query: $query);
}
}
}

@mixin disabled-label-color($color, $query: feature-targeting-functions.all()) {
@include _if-disabled {
.mdc-floating-label {
Expand Down
1 change: 1 addition & 0 deletions packages/mdc-select/helper-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Mixin | Description
`helper-text-color($color)` | Customizes the color of the helper text following a select.
`disabled-helper-text-color($color)` | Customizes the color of the helper text following a select when disabled.
`helper-text-validation-color($color)` | Customizes the color of the helper text validation message when the select is invalid.
`hover-helper-text-validation-color($color)` | Customizes the color of the helper text validation message when the select is invalid and hovered.

## `MDCSelectHelperText` properties and methods

Expand Down
6 changes: 6 additions & 0 deletions packages/mdc-select/helper-text/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
}
}

@mixin hover-helper-text-validation-color($color, $query: feature-targeting-functions.all()) {
&:not(.mdc-select--disabled):not(.mdc-select--focused):hover {
@include helper-text-validation-color_($color, $query: $query);
}
}

// Private mixins

@mixin helper-text-color_($color, $query: feature-targeting-functions.all()) {
Expand Down

0 comments on commit 744d751

Please sign in to comment.