forked from material-components/material-components-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_mixins.scss
134 lines (115 loc) · 4.57 KB
/
_mixins.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//
// Copyright 2018 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@use "@material/rtl/mixins" as rtl-mixins;
@use "@material/theme/variables";
@use "@material/theme/mixins" as theme-mixins;
@use "@material/feature-targeting/functions" as feature-targeting-functions;
@use "@material/feature-targeting/mixins" as feature-targeting-mixins;
// Public mixins
@mixin icon-core-styles($query: feature-targeting-functions.all()) {
.mdc-text-field__icon {
@include icon_($query: $query);
}
}
///
/// Customizes the color for the leading icon in an enabled text-field.
/// @param {Color} $color - The desired icon color.
///
@mixin leading-icon-color($color, $query: feature-targeting-functions.all()) {
&:not(.mdc-text-field--disabled) {
@include leading-icon-color_($color, $query);
}
}
///
/// Customizes the color for the trailing icon in an enabled text-field.
/// @param {Color} $color - The desired icon color.
///
@mixin trailing-icon-color($color, $query: feature-targeting-functions.all()) {
&:not(.mdc-text-field--disabled) {
@include trailing-icon-color_($color, $query);
}
}
///
/// Customizes the color for the leading/trailing icons in a disabled text-field.
/// @param {Color} $color - The desired icon color.
///
@mixin disabled-icon-color($color, $query: feature-targeting-functions.all()) {
&.mdc-text-field--disabled {
@include leading-icon-color_($color, $query);
@include trailing-icon-color_($color, $query);
}
}
// Private mixins
@mixin leading-icon-horizontal-position_($position, $query: feature-targeting-functions.all()) {
$feat-structure: feature-targeting-functions.create-target($query, structure);
.mdc-text-field__icon--leading {
@include feature-targeting-mixins.targets($feat-structure) {
@include rtl-mixins.reflexive-position(left, $position);
}
}
}
@mixin trailing-icon-horizontal-position_($position, $query: feature-targeting-functions.all()) {
$feat-structure: feature-targeting-functions.create-target($query, structure);
.mdc-text-field__icon--trailing {
@include feature-targeting-mixins.targets($feat-structure) {
@include rtl-mixins.reflexive-position(right, $position);
}
}
}
@mixin icon-horizontal-position-two-icons_(
$position-left, $position-right, $query: feature-targeting-functions.all()) {
@include leading-icon-horizontal-position_($position-left, $query);
@include trailing-icon-horizontal-position_($position-right, $query);
}
@mixin icon_($query: feature-targeting-functions.all()) {
$feat-structure: feature-targeting-functions.create-target($query, structure);
$feat-color: feature-targeting-functions.create-target($query, color);
@include feature-targeting-mixins.targets($feat-structure) {
position: absolute;
top: 50%;
transform: translateY(-50%);
cursor: pointer;
}
&:not([tabindex]),
&[tabindex="-1"] {
@include feature-targeting-mixins.targets($feat-color) {
cursor: default;
pointer-events: none;
}
}
}
@mixin leading-icon-color_($color, $query: feature-targeting-functions.all()) {
$feat-color: feature-targeting-functions.create-target($query, color);
.mdc-text-field__icon--leading {
@include feature-targeting-mixins.targets($feat-color) {
@include theme-mixins.prop(color, $color);
}
}
}
@mixin trailing-icon-color_($color, $query: feature-targeting-functions.all()) {
$feat-color: feature-targeting-functions.create-target($query, color);
.mdc-text-field__icon--trailing {
@include feature-targeting-mixins.targets($feat-color) {
@include theme-mixins.prop(color, $color);
}
}
}