1 |
|
2 |
|
3 | .vxe-switch {
|
4 | display: inline-block;
|
5 | color: $vxe-font-color;
|
6 | vertical-align: middle;
|
7 | padding: 0.4em;
|
8 | user-select: none;
|
9 | text-align: center;
|
10 | &.is--animat {
|
11 | .vxe-switch--button {
|
12 | transition: border-color .3s, background-color .3s;
|
13 | }
|
14 | .vxe-switch--icon {
|
15 | transition: all 0.3s;
|
16 | }
|
17 | }
|
18 | &.is--on {
|
19 | .vxe-switch--button {
|
20 | padding-right: 1.7em;
|
21 | background-color: $vxe-switch-open-background-color;
|
22 | }
|
23 | .vxe-switch--icon {
|
24 | left: 100%;
|
25 | transform: translateX(-1.4em);
|
26 | }
|
27 | }
|
28 | &.is--off {
|
29 | .vxe-switch--button {
|
30 | padding-left: 1.7em;
|
31 | background-color: $vxe-switch-close-background-color;
|
32 | }
|
33 | .vxe-switch--icon {
|
34 | left: 0.2em;
|
35 | transform: translateX(0);
|
36 | }
|
37 | }
|
38 | &.is--on .vxe-switch--label-off,
|
39 | &.is--off .vxe-switch--label-on {
|
40 | height: 0;
|
41 | visibility: hidden;
|
42 | overflow: hidden;
|
43 | }
|
44 | &.is--on,
|
45 | &.is--off {
|
46 | .vxe-switch--label {
|
47 | opacity: 1;
|
48 | }
|
49 | }
|
50 | &:not(.is--disabled) {
|
51 | .vxe-switch--button {
|
52 | cursor: pointer;
|
53 | &:focus {
|
54 | box-shadow: 0 0 0.4em 0 $vxe-primary-color;
|
55 | }
|
56 | }
|
57 | }
|
58 | &.is--disabled {
|
59 | .vxe-switch--button {
|
60 | cursor: no-drop;
|
61 | }
|
62 | &.is--on {
|
63 | .vxe-switch--button {
|
64 | background-color: lighten($vxe-primary-color, 20%);
|
65 | }
|
66 | }
|
67 | &.is--off {
|
68 | .vxe-switch--button {
|
69 | background-color: $vxe-switch-disabled-background-color;
|
70 | }
|
71 | }
|
72 | }
|
73 | .vxe-switch--button {
|
74 | display: block;
|
75 | position: relative;
|
76 | height: 1.6em;
|
77 | line-height: 1;
|
78 | min-width: 3.2em;
|
79 | padding: 0 0.6em;
|
80 | border-radius: 1em;
|
81 | border: 0;
|
82 | outline: 0;
|
83 | }
|
84 | .vxe-switch--label {
|
85 | opacity: 0;
|
86 | display: block;
|
87 | color: $vxe-switch-font-color;
|
88 | font-size: 0.8em;
|
89 | }
|
90 | .vxe-switch--icon {
|
91 | position: absolute;
|
92 | top: 0.2em;
|
93 | left: 0;
|
94 | width: 1.2em;
|
95 | height: 1.2em;
|
96 | border-radius: 50%;
|
97 | background-color: $vxe-switch-icon-background-color;
|
98 | }
|
99 | .vxe-switch--label-icon {
|
100 | margin-right: 0.25em;
|
101 | }
|
102 | }
|
103 |
|
104 | .vxe-switch {
|
105 | font-size: $vxe-font-size;
|
106 | &.size--medium {
|
107 | font-size: $vxe-font-size-medium;
|
108 | }
|
109 | &.size--small {
|
110 | font-size: $vxe-font-size-small;
|
111 | }
|
112 | &.size--mini {
|
113 | font-size: $vxe-font-size-mini;
|
114 | }
|
115 | }
|