Blame view

src/styles/components/switch.less 2.29 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
17
18
  
      &-inner {
          color: #fff;
3c01d81a   梁灏   fixed Modal bug,w...
19
          font-size: @font-size-small;
07aa688e   梁灏   add Switch UI
20
          position: absolute;
ac2f8493   梁灏   update Switch style
21
          left: 23px;
95436eeb   梁灏   add InputNumber UI
22
  
e2645048   jingsam   :fire: remove tra...
23
          i {
95436eeb   梁灏   add InputNumber UI
24
25
26
27
              width: 12px;
              height: 12px;
              text-align: center;
          }
07aa688e   梁灏   add Switch UI
28
29
30
31
      }
  
      &:after {
          content: '';
ac2f8493   梁灏   update Switch style
32
33
34
          width: 18px;
          height: 18px;
          border-radius: 18px;
07aa688e   梁灏   add Switch UI
35
36
          background-color: #fff;
          position: absolute;
2af5843d   梁灏   Switch add large ...
37
38
          left: 1px;
          top: 1px;
07aa688e   梁灏   add Switch UI
39
          cursor: pointer;
e2645048   jingsam   :fire: remove tra...
40
          transition: left @transition-time @ease-in-out, width @transition-time @ease-in-out;
07aa688e   梁灏   add Switch UI
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
      }
  
      &:active:after {
          width: 26px;
      }
  
      &:focus {
          box-shadow: 0 0 0 2px fade(@primary-color, 20%);
          outline: 0;
      }
  
      &:focus:hover {
          box-shadow: none;
      }
  
      &-small {
ac2f8493   梁灏   update Switch style
57
58
59
          width: 28px;
          height: 16px;
          line-height: 14px;
07aa688e   梁灏   add Switch UI
60
          &:after {
ac2f8493   梁灏   update Switch style
61
62
              width: 12px;
              height: 12px;
07aa688e   梁灏   add Switch UI
63
64
          }
          &:active:after {
2af5843d   梁灏   Switch add large ...
65
              width: 14px;
07aa688e   梁灏   add Switch UI
66
67
68
69
          }
      }
  
      &-small&-checked:after {
ac2f8493   梁灏   update Switch style
70
          left: 13px;
07aa688e   梁灏   add Switch UI
71
72
73
      }
  
      &-small:active&-checked:after {
ac2f8493   梁灏   update Switch style
74
          left: 11px;
2af5843d   梁灏   Switch add large ...
75
76
77
      }
  
      &-large{
ac2f8493   梁灏   update Switch style
78
          width: 56px;
2af5843d   梁灏   Switch add large ...
79
80
81
82
83
84
          &:active:after {
              width: 26px;
          }
      }
  
      &-large:active:after {
ac2f8493   梁灏   update Switch style
85
          width: 30px;
2af5843d   梁灏   Switch add large ...
86
87
88
      }
  
      &-large&-checked:after {
ac2f8493   梁灏   update Switch style
89
          left: 35px;
2af5843d   梁灏   Switch add large ...
90
91
92
      }
  
      &-large:active&-checked:after {
ac2f8493   梁灏   update Switch style
93
          left: 23px;
07aa688e   梁灏   add Switch UI
94
95
96
97
98
99
100
      }
  
      &-checked {
          border-color: @primary-color;
          background-color: @primary-color;
  
          .@{switch-prefix-cls}-inner {
ac2f8493   梁灏   update Switch style
101
              left: 7px;
07aa688e   梁灏   add Switch UI
102
103
104
          }
  
          &:after {
ac2f8493   梁灏   update Switch style
105
              left: 23px;
07aa688e   梁灏   add Switch UI
106
107
108
          }
  
          &:active:after {
ac2f8493   梁灏   update Switch style
109
              left: 15px;
07aa688e   梁灏   add Switch UI
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
          }
      }
  
      &-disabled {
          cursor: @cursor-disabled;
          background: #f3f3f3;
          border-color: #f3f3f3;
  
          &:after {
              background: #ccc;
              cursor: not-allowed;
          }
  
          .@{switch-prefix-cls}-inner {
              color: #ccc;
          }
      }
e2645048   jingsam   :fire: remove tra...
127
  }