-
Notifications
You must be signed in to change notification settings - Fork 969
/
theme.css
129 lines (111 loc) · 2.91 KB
/
theme.css
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
@import '../colors.css';
@import '../variables.css';
@import './config.css';
.field {
display: block;
height: var(--switch-total-height);
margin-bottom: var(--switch-field-margin-bottom);
position: relative;
white-space: nowrap;
}
.text {
color: var(--switch-text-color);
display: inline-block;
font-size: var(--switch-font-size);
line-height: var(--switch-total-height);
padding-left: var(--unit);
vertical-align: top;
white-space: nowrap;
}
.thumb {
border-radius: 50%;
cursor: pointer;
height: var(--switch-thumb-size);
position: absolute;
top: calc((var(--switch-track-height) - var(--switch-thumb-size)) / 2);
transition-duration: 0.28s;
transition-property: left;
transition-timing-function: var(--animation-curve-default);
width: var(--switch-thumb-size);
& .ripple {
background-color: var(--switch-color);
opacity: 0.3;
transition-duration: var(--switch-ripple-duration);
}
}
.on,
.off {
border-radius: var(--switch-track-height);
cursor: pointer;
display: inline-block;
height: var(--switch-track-height);
margin-top: calc((var(--switch-total-height) - var(--switch-track-height)) / 2);
position: relative;
vertical-align: top;
width: var(--switch-track-length);
}
.on {
background: var(--switch-track-on-color);
& .thumb {
background: var(--switch-thumb-on-color);
box-shadow: var(--shadow-3p);
left: calc(var(--switch-track-length) - var(--switch-thumb-size));
}
}
.off {
background: var(--switch-track-off-color);
& .thumb {
background: var(--switch-thumb-off-color);
box-shadow: var(--shadow-2p);
left: 0;
}
& .ripple {
background: var(--switch-off-ripple-color);
}
}
.input {
height: 0;
opacity: 0;
overflow: hidden;
width: 0;
&:focus:not(:active) {
& + .switch-on > .thumb::before,
& + .switch-off > .thumb::before {
background-color: transparent;
border-radius: 50%;
box-sizing: border-box;
content: '';
display: inline-block;
height: var(--switch-focus-init-size);
left: 50%;
position: absolute;
top: 50%;
transform: translate(calc(-1 * var(--switch-focus-init-size) / 2), calc(-1 * var(--switch-focus-init-size) / 2));
width: var(--switch-focus-init-size);
}
& + .switch-on > .thumb::before {
background-color: var(--switch-on-focus-color);
box-shadow: 0 0 0 var(--switch-focus-diff) var(--switch-on-focus-color);
}
& + .switch-off > .thumb::before {
background-color: var(--switch-off-focus-color);
box-shadow: 0 0 0 var(--switch-focus-diff) var(--switch-off-focus-color);
}
}
}
.disabled {
composes: field;
& .text {
color: var(--switch-disabled-text-color);
}
& .on,
& .off {
background: var(--switch-disabled-track-color);
cursor: auto;
}
& .thumb {
background-color: var(--switch-disabled-thumb-color);
border-color: transparent;
cursor: auto;
}
}