UNPKG

3.41 kBSCSSView Raw
1//
2// Copyright 2020 Google Inc.
3//
4// Permission is hereby granted, free of charge, to any person obtaining a copy
5// of this software and associated documentation files (the "Software"), to deal
6// in the Software without restriction, including without limitation the rights
7// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8// copies of the Software, and to permit persons to whom the Software is
9// furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20// THE SOFTWARE.
21//
22
23@use '@material/feature-targeting/feature-targeting';
24@use '@material/menu-surface/mixins' as menu-surface-mixins;
25@use '@material/rtl/rtl';
26@use './select-icon-theme';
27@use './select-theme';
28
29@mixin core-styles($query: feature-targeting.all()) {
30 $feat-structure: feature-targeting.create-target($query, structure);
31
32 .mdc-select--filled {
33 @include select-theme.filled-height(select-theme.$height, $query: $query);
34 @include select-theme.filled-shape-radius(
35 select-theme.$shape-radius,
36 $query: $query
37 );
38
39 @include select-theme.container-fill-color(
40 (
41 default: select-theme.$fill-color,
42 disabled: select-theme.$disabled-fill-color,
43 ),
44 $query: $query
45 );
46
47 @include select-theme.bottom-line-color(
48 (
49 default: select-theme.$bottom-line-idle-color,
50 focus: primary,
51 hover: select-theme.$bottom-line-hover-color,
52 disabled: select-theme.$disabled-bottom-line-color,
53 ),
54 $query: $query
55 );
56
57 @include select-theme.truncate-floating-label-max-width(
58 $leading-icon-size: 0,
59 $dropdown-icon-size: select-icon-theme.$icon-size,
60 $query: $query
61 );
62
63 @include menu-surface-mixins.flatten-top-when-opened-below($query: $query);
64
65 &.mdc-select--focused.mdc-line-ripple::after {
66 @include feature-targeting.targets($feat-structure) {
67 transform: scale(1, 2);
68 opacity: 1;
69 }
70 }
71
72 .mdc-floating-label {
73 @include feature-targeting.targets($feat-structure) {
74 @include rtl.reflexive-position(
75 left,
76 select-theme.$outline-label-offset
77 );
78 }
79 }
80
81 &.mdc-select--with-leading-icon {
82 @include select-theme.leading-icon-floating-label-position(
83 select-icon-theme.$icon-size,
84 $query: $query
85 );
86
87 @include select-theme.truncate-floating-label-max-width(
88 $leading-icon-size: select-icon-theme.$icon-size,
89 $dropdown-icon-size: select-icon-theme.$icon-size,
90 $query: $query
91 );
92 }
93 }
94
95 .mdc-select--invalid {
96 @include select-theme.bottom-line-color(
97 (
98 default: select-theme.$error-color,
99 hover: select-theme.$error-color,
100 focus: select-theme.$error-color,
101 ),
102 $query: $query
103 );
104 }
105}