/
_mixins.scss
101 lines (86 loc) · 2.25 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
////
/// @group form-label
////
@import '~@react-md/icon/dist/mixins';
@import '~@react-md/typography/dist/mixins';
@import '~@react-md/transition/dist/mixins';
@import '~@react-md/utils/dist/mixins';
@import '../variables';
@import '../functions';
/// Creates the base styles for a `<label>` element as well as all the different
/// states a label can be in.
@mixin rmd-label {
@include rmd-typography(body-1);
@include rmd-transition(standard);
display: inline-flex;
font-size: $rmd-label-font-size;
transition: color $rmd-transition-standard-time;
&--active {
@include rmd-form-theme(color, active-color);
}
&--error {
@include rmd-form-theme(color, error-color);
}
&--disabled {
@include rmd-form-theme(color, disabled-color);
}
}
/// @access private
@mixin rmd-floating-label {
$transitions: background-color, color, font-size, transform;
@include rmd-form-theme-update-var(
active-color,
rmd-form-theme-var(text-active-color)
);
@include rmd-utils-rtl {
left: auto;
right: 0;
transform: translate(
rmd-utils-negate-var(rmd-form-theme-var(text-padding-left)),
rmd-form-theme-var(floating-top)
);
}
left: 0;
position: absolute;
top: 0;
transform: translate(
rmd-form-theme-var(text-padding-left),
rmd-form-theme-var(floating-top)
);
transition-property: $transitions;
will-change: $transitions;
&--dense {
@include rmd-form-theme-update-var(
floating-top,
rmd-form-theme-var(floating-dense-top)
);
}
&--active {
@include rmd-form-theme(background-color, label-active-background-color);
@include rmd-form-theme(padding, label-active-padding);
@include rmd-utils-rtl {
transform: translate(
rmd-utils-negate-var(rmd-form-theme-var(label-left-offset)),
rmd-form-theme-var(label-top-offset)
);
}
font-size: $rmd-label-floating-font-size;
transform: translate(
rmd-form-theme-var(label-left-offset),
rmd-form-theme-var(label-top-offset)
);
z-index: 1;
}
&--inactive {
@include rmd-theme(color, text-secondary-on-background);
}
}
/// @access private
@mixin react-md-label {
.rmd-label {
@include rmd-label;
}
.rmd-floating-label {
@include rmd-floating-label;
}
}