Blame view

src/styles/components/switch.less 3.53 KB
07aa688e   梁灏   add Switch UI
1
2
3
4
  @switch-prefix-cls: ~"@{css-prefix}switch";
  
  .@{switch-prefix-cls} {
      display: inline-block;
ac2f8493   梁灏   update Switch style
5
6
7
8
      width: 44px;
      height: 22px;
      line-height: 20px;
      border-radius: 22px;
07aa688e   梁灏   add Switch UI
9
10
11
12
13
      vertical-align: middle;
      border: 1px solid #ccc;
      background-color: #ccc;
      position: relative;
      cursor: pointer;
e2645048   jingsam   :fire: remove tra...
14
15
      user-select: none;
      transition: all @transition-time @ease-in-out;
07aa688e   梁灏   add Switch UI
16
  
eb7f31db   梁灏   Switch add loadin...
17
18
19
20
      &-loading{
          opacity: .4;
      }
  
07aa688e   梁灏   add Switch UI
21
22
      &-inner {
          color: #fff;
3c01d81a   梁灏   fixed Modal bug,w...
23
          font-size: @font-size-small;
07aa688e   梁灏   add Switch UI
24
          position: absolute;
ac2f8493   梁灏   update Switch style
25
          left: 23px;
95436eeb   梁灏   add InputNumber UI
26
  
e2645048   jingsam   :fire: remove tra...
27
          i {
95436eeb   梁灏   add InputNumber UI
28
29
30
              width: 12px;
              height: 12px;
              text-align: center;
d79eaf9b   梁灏   update Switch style
31
32
              position: relative;
              top: -1px;
95436eeb   梁灏   add InputNumber UI
33
          }
07aa688e   梁灏   add Switch UI
34
35
36
37
      }
  
      &:after {
          content: '';
ac2f8493   梁灏   update Switch style
38
39
40
          width: 18px;
          height: 18px;
          border-radius: 18px;
07aa688e   梁灏   add Switch UI
41
42
          background-color: #fff;
          position: absolute;
2af5843d   梁灏   Switch add large ...
43
44
          left: 1px;
          top: 1px;
07aa688e   梁灏   add Switch UI
45
          cursor: pointer;
e2645048   jingsam   :fire: remove tra...
46
          transition: left @transition-time @ease-in-out, width @transition-time @ease-in-out;
07aa688e   梁灏   add Switch UI
47
48
49
50
51
52
      }
  
      &:active:after {
          width: 26px;
      }
  
eb7f31db   梁灏   Switch add loadin...
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
      &:before{
          content: '';
          display: none;
          width: 14px;
          height: 14px;
          border-radius: 50%;
          background-color: transparent;
          position: absolute;
          left: 3px;
          top: 3px;
          z-index: 1;
          border: 1px solid @primary-color;
          border-color: transparent transparent transparent @primary-color;
          animation: switch-loading 1s linear;
          animation-iteration-count: infinite;
      }
      &-loading:before{
          display: block;
      }
  
07aa688e   梁灏   add Switch UI
73
74
75
76
77
78
79
80
81
82
      &:focus {
          box-shadow: 0 0 0 2px fade(@primary-color, 20%);
          outline: 0;
      }
  
      &:focus:hover {
          box-shadow: none;
      }
  
      &-small {
ac2f8493   梁灏   update Switch style
83
84
85
          width: 28px;
          height: 16px;
          line-height: 14px;
07aa688e   梁灏   add Switch UI
86
          &:after {
ac2f8493   梁灏   update Switch style
87
88
              width: 12px;
              height: 12px;
07aa688e   梁灏   add Switch UI
89
90
          }
          &:active:after {
2af5843d   梁灏   Switch add large ...
91
              width: 14px;
07aa688e   梁灏   add Switch UI
92
          }
eb7f31db   梁灏   Switch add loadin...
93
94
95
96
97
98
          &:before{
              width: 10px;
              height: 10px;
              left: 2px;
              top: 2px;
          }
07aa688e   梁灏   add Switch UI
99
100
101
      }
  
      &-small&-checked:after {
ac2f8493   梁灏   update Switch style
102
          left: 13px;
07aa688e   梁灏   add Switch UI
103
      }
eb7f31db   梁灏   Switch add loadin...
104
105
106
      &-small&-checked:before {
          left: 14px;
      }
07aa688e   梁灏   add Switch UI
107
108
  
      &-small:active&-checked:after {
ac2f8493   梁灏   update Switch style
109
          left: 11px;
2af5843d   梁灏   Switch add large ...
110
111
112
      }
  
      &-large{
ac2f8493   梁灏   update Switch style
113
          width: 56px;
2af5843d   梁灏   Switch add large ...
114
115
116
117
118
119
          &:active:after {
              width: 26px;
          }
      }
  
      &-large:active:after {
ac2f8493   梁灏   update Switch style
120
          width: 30px;
2af5843d   梁灏   Switch add large ...
121
122
123
      }
  
      &-large&-checked:after {
ac2f8493   梁灏   update Switch style
124
          left: 35px;
2af5843d   梁灏   Switch add large ...
125
      }
eb7f31db   梁灏   Switch add loadin...
126
127
128
      &-large&-checked:before {
          left: 37px;
      }
2af5843d   梁灏   Switch add large ...
129
130
  
      &-large:active&-checked:after {
ac2f8493   梁灏   update Switch style
131
          left: 23px;
07aa688e   梁灏   add Switch UI
132
133
134
135
136
137
138
      }
  
      &-checked {
          border-color: @primary-color;
          background-color: @primary-color;
  
          .@{switch-prefix-cls}-inner {
ac2f8493   梁灏   update Switch style
139
              left: 7px;
07aa688e   梁灏   add Switch UI
140
141
142
          }
  
          &:after {
ac2f8493   梁灏   update Switch style
143
              left: 23px;
07aa688e   梁灏   add Switch UI
144
          }
eb7f31db   梁灏   Switch add loadin...
145
146
147
          &:before{
              left: 25px;
          }
07aa688e   梁灏   add Switch UI
148
149
  
          &:active:after {
ac2f8493   梁灏   update Switch style
150
              left: 15px;
07aa688e   梁灏   add Switch UI
151
152
153
154
155
          }
      }
  
      &-disabled {
          cursor: @cursor-disabled;
1c35a44d   梁灏   update Switch style
156
          opacity: .4;
07aa688e   梁灏   add Switch UI
157
158
  
          &:after {
1c35a44d   梁灏   update Switch style
159
              background: #fff;
07aa688e   梁灏   add Switch UI
160
161
162
163
              cursor: not-allowed;
          }
  
          .@{switch-prefix-cls}-inner {
1c35a44d   梁灏   update Switch style
164
              color: #fff;
07aa688e   梁灏   add Switch UI
165
166
          }
      }
1a4a76e9   梁灏   update Page style
167
  
43d3eb1b   Aresn   Update switch.less
168
      &-disabled&-checked{
11d8490e   Haven   style (switch): ...
169
170
171
172
173
174
175
176
177
178
179
180
181
          border-color: @primary-color;
          background-color: @primary-color;
          opacity: .4;
          
          &:after {
              background: #fff;
          }
  
          .@{switch-prefix-cls}-inner {
              color: #fff;
          }
      }
  
e2645048   jingsam   :fire: remove tra...
182
  }
eb7f31db   梁灏   Switch add loadin...
183
184
185
186
187
188
189
190
  
  @keyframes switch-loading {
      0% {
          transform: rotate(0);
      }
      100% {
          transform: rotate(360deg);
      }
11d8490e   Haven   style (switch): ...
191
  }