-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(select): Move colors for default select to mixins (#1934)
BREAKING CHANGE: Move colors for default select element to mixins. Refer to the documentation for guidance. refs: #1150 Move colors for the select into a new mixins file.
- Loading branch information
1 parent
568fc32
commit d6c68ce
Showing
5 changed files
with
172 additions
and
59 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
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,119 @@ | ||
// | ||
// Copyright 2018 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
// Public | ||
|
||
@mixin mdc-select-ink-color($color) { | ||
&:not(.mdc-select--disabled) { | ||
@include mdc-select-ink-color_($color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-container-fill-color($color) { | ||
&:not(.mdc-select--disabled) { | ||
@include mdc-select-container-fill-color_($color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-label-color($color) { | ||
&:not(.mdc-select--disabled) { | ||
@include mdc-select-label-color_($color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-focused-label-color($color, $opacity: .87) { | ||
&:not(.mdc-select--disabled) { | ||
@include mdc-select-focused-label-color_($color, $opacity); | ||
} | ||
} | ||
|
||
@mixin mdc-select-bottom-line-color($color) { | ||
&:not(.mdc-select--disabled) { | ||
@include mdc-select-bottom-line-color_($color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-focused-bottom-line-color($color) { | ||
&:not(.mdc-select--disabled) { | ||
@include mdc-select-focused-bottom-line-color_($color); | ||
} | ||
} | ||
|
||
// Private | ||
|
||
@mixin mdc-select-focused-bottom-line_ { | ||
// JS-enhanced and CSS-only Selects require different selectors for focused bottom-line due to different DOM structure | ||
.mdc-select__surface:focus .mdc-select__bottom-line, | ||
.mdc-select__surface:focus ~ .mdc-select__bottom-line { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin mdc-select-ink-color_($color) { | ||
.mdc-select__surface, | ||
.mdc-select__selected-text { | ||
@include mdc-theme-prop(color, $color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-container-fill-color_($color) { | ||
.mdc-select__surface { | ||
@include mdc-theme-prop(background-color, $color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-label-color_($color) { | ||
.mdc-select__label { | ||
@include mdc-theme-prop(color, $color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-focused-label-color_($color, $opacity: .87) { | ||
.mdc-select__surface:focus .mdc-select__label { | ||
@include mdc-theme-prop(color, $color); | ||
} | ||
|
||
// Separate parameter is used for opacity, because opacity is only applied when the | ||
// label is floating, but the label is the same color when the select is focused | ||
// but an option has not been selected. | ||
.mdc-select__surface:focus .mdc-select__label--float-above { | ||
opacity: $opacity; | ||
} | ||
} | ||
|
||
@mixin mdc-select-bottom-line-color_($color) { | ||
.mdc-select__bottom-line { | ||
@include mdc-theme-prop(background-color, $color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-focused-bottom-line-color_($color) { | ||
@include mdc-select-focused-bottom-line_ { | ||
@include mdc-theme-prop(background-color, $color); | ||
} | ||
|
||
&.mdc-select--open .mdc-select__bottom-line { | ||
@include mdc-theme-prop(background-color, $color); | ||
} | ||
|
||
.mdc-select__bottom-line::after { | ||
@include mdc-theme-prop(background-color, $color); | ||
} | ||
} | ||
|
||
@mixin mdc-select-dd-arrow-svg-bg_($fill-hex-number: 000000, $opacity: .54) { | ||
background-image: url(data:image/svg+xml,%3Csvg%20width%3D%2210px%22%20height%3D%225px%22%20viewBox%3D%227%2010%2010%205%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3Cpolygon%20id%3D%22Shape%22%20stroke%3D%22none%22%20fill%3D%22%23#{$fill-hex-number}%22%20fill-rule%3D%22evenodd%22%20opacity%3D%22#{$opacity}%22%20points%3D%227%2010%2012%2015%2017%2010%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E); | ||
} |
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