UNPKG

3.69 kBCSSView Raw
1@charset "UTF-8";
2/*
3 * flex,兼容IE10
4*/
5.phoenix-switch__child {
6 display: -ms-flexbox;
7 display: -webkit-flex;
8 -ms-flex-pack: center;
9 -webkit-justify-content: center;
10 justify-content: center;
11 -ms-flex-align: center;
12 -webkit-align-items: center;
13 align-items: center;
14}
15
16.phoenix-switch {
17 position: relative;
18 display: inline-block;
19 box-sizing: border-box;
20 width: 38px;
21 height: 20px;
22 line-height: 20px;
23 padding: 0;
24 vertical-align: middle;
25 border-radius: 20px 20px;
26 border: 0;
27 background-color: #bfc3c7;
28 cursor: pointer;
29}
30
31.phoenix-switch__ani {
32 animation: fadeAniOff 2s cubic-bezier(0.08, 0.82, 0.17, 1), waveAniOff 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);
33}
34
35.phoenix-switch_small {
36 width: 30px;
37 height: 16px;
38 line-height: 16px;
39}
40
41.phoenix-switch_small .phoenix-switch__child {
42 left: 15px;
43 transform: scale(0.83333);
44}
45
46.phoenix-switch_small .phoenix-switch__bar {
47 width: 14px;
48 height: 14px;
49}
50
51.phoenix-switch_small .phoenix-switch__loading {
52 top: 2px;
53 left: 2px;
54 width: 10px;
55 height: 10px;
56 border-radius: 10px;
57}
58
59.phoenix-switch__child {
60 position: absolute;
61 left: 21px;
62 top: 0;
63 min-width: 12px;
64 max-width: 17px;
65 height: 100%;
66 white-space: nowrap;
67 font-size: 12px;
68 color: #fff;
69 overflow: hidden;
70}
71
72.phoenix-switch__ani {
73 position: absolute;
74 top: 0;
75 right: 0;
76 bottom: 0;
77 left: 0;
78 display: block;
79 border-radius: inherit;
80 box-shadow: 0 0 0 0 rgba(24, 144, 255, 0.8);
81 opacity: .2;
82 animation-fill-mode: forwards;
83 pointer-events: none;
84}
85
86.phoenix-switch__bar {
87 position: absolute;
88 width: 18px;
89 height: 18px;
90 left: 1px;
91 top: 1px;
92 border-radius: 50% 50%;
93 background-color: white;
94 cursor: pointer;
95 box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
96 transition: left 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
97}
98
99.phoenix-switch__loading {
100 position: absolute;
101 top: 3px;
102 left: 3px;
103 width: 12px;
104 height: 12px;
105 border-radius: 12px;
106 border: 0;
107 border-left: 1px solid rgba(191, 195, 199, 0.5);
108 box-sizing: border-box;
109 animation: loadingAni 1s linear infinite;
110}
111
112.phoenix-switch:focus {
113 box-shadow: 0 0 5px 2px rgba(29, 134, 240, 0.2);
114 outline: none;
115}
116
117.phoenix-switch_checked {
118 background-color: #1d86f0;
119}
120
121.phoenix-switch_checked .phoenix-switch__child {
122 left: 5px;
123}
124
125.phoenix-switch_checked .phoenix-switch__bar {
126 left: 19px;
127}
128
129.phoenix-switch_checked .phoenix-switch__ani {
130 animation: fadeAni 2s cubic-bezier(0.08, 0.82, 0.17, 1), waveAni 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);
131}
132
133.phoenix-switch_checked .phoenix-switch__loading {
134 border-color: rgba(29, 134, 240, 0.5);
135}
136
137.phoenix-switch_checked.phoenix-switch_small .phoenix-switch__child {
138 left: 3px;
139}
140
141.phoenix-switch_checked.phoenix-switch_small .phoenix-switch__bar {
142 left: 15px;
143}
144
145.phoenix-switch_disabled.phoenix-switch {
146 background: rgba(191, 195, 199, 0.5);
147}
148
149.phoenix-switch_disabled.phoenix-switch_checked {
150 background: rgba(29, 134, 240, 0.5);
151}
152
153.phoenix-switch_disabled {
154 cursor: not-allowed !important;
155}
156
157.phoenix-switch_disabled .phoenix-switch__bar {
158 cursor: not-allowed;
159}
160
161.phoenix-switch__label {
162 display: inline-block;
163 line-height: 20px;
164 font-size: 14px;
165 padding-left: 10px;
166 vertical-align: middle;
167 white-space: normal;
168 pointer-events: none;
169 user-select: text;
170}
171
172@keyframes waveAni {
173 100% {
174 box-shadow: 0 0 0 6px #1890ff;
175 }
176}
177
178@keyframes fadeAni {
179 100% {
180 opacity: 0;
181 }
182}
183
184@keyframes waveAniOff {
185 100% {
186 box-shadow: 0 0 0 6px #1890ff;
187 }
188}
189
190@keyframes fadeAniOff {
191 100% {
192 opacity: 0;
193 }
194}
195
196@keyframes loadingAni {
197 from {
198 transform: rotate(0);
199 }
200
201 to {
202 transform: rotate(360deg);
203 }
204}