Blame view

src/styles/components/radio.less 6.11 KB
4925f85f   梁灏   add Radio UI
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
  @radio-prefix-cls: ~"@{css-prefix}radio";
  @radio-group-prefix-cls: ~"@{radio-prefix-cls}-group";
  @radio-inner-prefix-cls: ~"@{radio-prefix-cls}-inner";
  @radio-group-button-prefix-cls: ~"@{radio-group-prefix-cls}-button";
  
  .@{radio-group-prefix-cls} {
      display: inline-block;
      font-size: @font-size-base;
  }
  
  // 普通状态
  .@{radio-prefix-cls}-wrapper {
      font-size: @font-size-base;
      vertical-align: middle;
      display: inline-block;
      position: relative;
      white-space: nowrap;
      margin-right: 8px;
  }
  
  .@{radio-prefix-cls} {
      white-space: nowrap;
      outline: none;
      display: inline-block;
      position: relative;
      line-height: 1;
      vertical-align: middle;
      cursor: pointer;
      &:hover {
          .@{radio-inner-prefix-cls} {
              border-color: #bcbcbc;
          }
      }
      &-inner {
          display: inline-block;
7d7221ec   梁灏   optimize Radio si...
36
37
          width: 14px;
          height: 14px;
4925f85f   梁灏   add Radio UI
38
39
40
41
42
43
          position: relative;
          top: 0;
          left: 0;
          background-color: #fff;
          border: 1px solid @border-color-base;
          border-radius: 50%;
6c5fbd8b   梁灏   add Checkbox UI
44
          .transition(all @transition-time @ease-in-out);
4925f85f   梁灏   add Radio UI
45
46
47
  
          &:after {
              position: absolute;
7d7221ec   梁灏   optimize Radio si...
48
49
              width: 8px;
              height: 8px;
4925f85f   梁灏   add Radio UI
50
51
52
53
54
55
56
57
58
              left: 2px;
              top: 2px;
              border-radius: @border-radius-base;
              display: table;
              border-top: 0;
              border-left: 0;
              content: ' ';
              background-color: @primary-color;
              opacity: 0;
6c5fbd8b   梁灏   add Checkbox UI
59
              .transition(all @transition-time @ease-in-out);
4925f85f   梁灏   add Radio UI
60
61
62
63
64
65
66
67
68
69
70
              .transform(scale(0));
          }
      }
  
      &-input {
          position: absolute;
          top: 0;
          bottom: 0;
          left: 0;
          right: 0;
          z-index: 1;
4925f85f   梁灏   add Radio UI
71
          opacity: 0;
7d7221ec   梁灏   optimize Radio si...
72
          cursor: pointer;
4925f85f   梁灏   add Radio UI
73
74
75
76
77
78
      }
  }
  
  // 选中状态
  .@{radio-prefix-cls}-checked {
      .@{radio-inner-prefix-cls} {
7d7221ec   梁灏   optimize Radio si...
79
          border-color: @primary-color;
4925f85f   梁灏   add Radio UI
80
81
82
          &:after {
              opacity: 1;
              .transform(scale(1));
6c5fbd8b   梁灏   add Checkbox UI
83
              .transition(all @transition-time @ease-in-out);
4925f85f   梁灏   add Radio UI
84
85
          }
      }
7d7221ec   梁灏   optimize Radio si...
86
87
88
89
90
      &:hover {
          .@{radio-inner-prefix-cls} {
              border-color: @primary-color;
          }
      }
4925f85f   梁灏   add Radio UI
91
92
93
  }
  
  .@{radio-prefix-cls}-disabled {
7d7221ec   梁灏   optimize Radio si...
94
95
96
97
98
      cursor: @cursor-disabled;
      .@{radio-prefix-cls}-input {
          cursor: @cursor-disabled;
      }
  
4925f85f   梁灏   add Radio UI
99
100
101
102
103
104
105
106
107
108
109
110
111
      &:hover {
          .@{radio-inner-prefix-cls} {
              border-color: @border-color-base;
          }
      }
      .@{radio-inner-prefix-cls} {
          border-color: @border-color-base;
          background-color: #f3f3f3;
          &:after {
              background-color: #cccccc;
          }
      }
  
4925f85f   梁灏   add Radio UI
112
113
      .@{radio-prefix-cls}-disabled + span {
          color: #ccc;
4925f85f   梁灏   add Radio UI
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
      }
  }
  
  span.@{radio-prefix-cls} + * {
      margin-left: 2px;
      margin-right: 2px;
  }
  
  // 按钮样式
  .@{radio-group-button-prefix-cls} {
      font-size: 0;
      -webkit-text-size-adjust:none;
  
      .@{radio-prefix-cls}-wrapper {
          font-size: 14px;
          margin: 0;
          height: 28px;
          line-height: 26px;
          color: @btn-default-color;
          display: inline-block;
6c5fbd8b   梁灏   add Checkbox UI
134
          .transition(all @transition-time ease-in-out);
4925f85f   梁灏   add Radio UI
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
          cursor: pointer;
          border: 1px solid @border-color-base;
          border-left: 0;
          background: #fff;
          padding: 0 16px;
  
          > span {
              margin-left: 0;
          }
  
          &:before {
              content: '';
              position: absolute;
              width: 1px;
              height: 100%;
              left: -1px;
              background: @border-color-base;
              visibility: hidden;
6c5fbd8b   梁灏   add Checkbox UI
153
              .transition(all @transition-time ease-in-out);
4925f85f   梁灏   add Radio UI
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
          }
  
          &:first-child {
              border-radius: @btn-border-radius 0 0 @btn-border-radius;
              border-left: 1px solid @border-color-base;
              &:before {
                  display: none;
              }
          }
  
          &:last-child {
              border-radius: 0 @btn-border-radius @btn-border-radius 0;
          }
  
          &:first-child:last-child {
              border-radius: @btn-border-radius;
          }
  
          &:hover {
              position: relative;
              color: @primary-color;
          }
  
          .@{radio-prefix-cls}-inner,
          input {
              opacity: 0;
              width: 0;
              height: 0;
          }
  
          &-checked {
              background: #fff;
              border-color: @primary-color;
              color: @primary-color;
              box-shadow: -1px 0 0 0 @primary-color;
  
              &:first-child {
                  border-color: @primary-color;
                  box-shadow: none!important;
              }
  
              &:hover {
                  border-color: tint(@primary-color, 20%);
                  box-shadow: -1px 0 0 0 tint(@primary-color, 20%);
                  color: tint(@primary-color, 20%);
              }
  
              &:active {
                  border-color: shade(@primary-color, 5%);
                  box-shadow: -1px 0 0 0 shade(@primary-color, 5%);
                  color: shade(@primary-color, 5%);
              }
          }
  
          &-disabled {
              border-color: @border-color-base;
              background-color: @background-color-base;
7d7221ec   梁灏   optimize Radio si...
211
              cursor: @cursor-disabled;
4925f85f   梁灏   add Radio UI
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
              color: #ccc;
  
              &:first-child,
              &:hover {
                  border-color: @border-color-base;
                  background-color: @background-color-base;
                  color: #ccc;
              }
              &:first-child {
                  border-left-color: @border-color-base;
              }
          }
  
          &-disabled.@{radio-prefix-cls}-wrapper-checked {
              color: #fff;
              background-color: #e6e6e6;
              border-color: @border-color-base;
              box-shadow: none!important;
          }
      }
  }
  
  .@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-large .@{radio-prefix-cls}-wrapper{
      height: 32px;
      line-height: 30px;
  }
  
  .@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-small .@{radio-prefix-cls}-wrapper{
      height: 22px;
      line-height: 20px;
      padding: 0 12px;
      font-size: 12px;
      &:first-child {
7098f972   梁灏   fixed RadioGroup ...
245
          border-radius: @btn-border-radius-small 0 0 @btn-border-radius-small;
4925f85f   梁灏   add Radio UI
246
247
      }
      &:last-child {
7098f972   梁灏   fixed RadioGroup ...
248
          border-radius: 0 @btn-border-radius-small @btn-border-radius-small 0;
4925f85f   梁灏   add Radio UI
249
250
      }
  }