Blame view

src/styles/components/radio.less 8.52 KB
4925f85f   梁灏   add Radio UI
1
2
3
4
5
  @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";
  
79964596   Xotic750   Use native w3c
6
7
8
9
10
  .@{radio-prefix-cls}-focus {
      box-shadow: 0 0 0 2px fade(@primary-color, 20%);
      z-index: 1;
  }
  
4925f85f   梁灏   add Radio UI
11
12
  .@{radio-group-prefix-cls} {
      display: inline-block;
3c01d81a   梁灏   fixed Modal bug,w...
13
      font-size: @font-size-small;
98fbc549   Sergio Crisostomo   use vertical-alig...
14
      vertical-align: middle;
79964596   Xotic750   Use native w3c
15
      //outline: none;
5722a6fb   梁灏   RadioGroup add ve...
16
17
18
19
20
21
22
      &-vertical{
          .@{radio-prefix-cls}-wrapper {
              display: block;
              height: 30px;
              line-height: 30px;
          }
      }
4925f85f   梁灏   add Radio UI
23
24
  }
  
e0f097e6   Graham Fairweather   Initial WIP
25
  // 普通状态 - Normal state
4925f85f   梁灏   add Radio UI
26
  .@{radio-prefix-cls}-wrapper {
3c01d81a   梁灏   fixed Modal bug,w...
27
      font-size: @font-size-small;
4925f85f   梁灏   add Radio UI
28
29
30
31
32
      vertical-align: middle;
      display: inline-block;
      position: relative;
      white-space: nowrap;
      margin-right: 8px;
5722a6fb   梁灏   RadioGroup add ve...
33
34
35
36
      cursor: pointer;
      &-disabled{
          cursor: @cursor-disabled;
      }
79964596   Xotic750   Use native w3c
37
      //outline: none;
4925f85f   梁灏   add Radio UI
38
39
40
  }
  
  .@{radio-prefix-cls} {
3c01d81a   梁灏   fixed Modal bug,w...
41
42
      display: inline-block;
      margin-right: 4px;
4925f85f   梁灏   add Radio UI
43
      white-space: nowrap;
79964596   Xotic750   Use native w3c
44
      //outline: none;
4925f85f   梁灏   add Radio UI
45
46
47
48
49
50
51
52
53
54
55
      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...
56
57
          width: 14px;
          height: 14px;
4925f85f   梁灏   add Radio UI
58
59
60
61
62
63
          position: relative;
          top: 0;
          left: 0;
          background-color: #fff;
          border: 1px solid @border-color-base;
          border-radius: 50%;
e2645048   jingsam   :fire: remove tra...
64
          transition: all @transition-time @ease-in-out;
4925f85f   梁灏   add Radio UI
65
66
67
  
          &:after {
              position: absolute;
7d7221ec   梁灏   optimize Radio si...
68
69
              width: 8px;
              height: 8px;
4925f85f   梁灏   add Radio UI
70
71
72
73
74
75
76
77
78
              left: 2px;
              top: 2px;
              border-radius: @border-radius-base;
              display: table;
              border-top: 0;
              border-left: 0;
              content: ' ';
              background-color: @primary-color;
              opacity: 0;
e2645048   jingsam   :fire: remove tra...
79
80
              transition: all @transition-time @ease-in-out;
              transform: scale(0);
4925f85f   梁灏   add Radio UI
81
82
          }
      }
4d545420   梁灏   Radio add size prop
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
      &-large{
          font-size: @font-size-base;
          & .@{radio-inner-prefix-cls}{
              width: 16px;
              height: 16px;
              &:after{
                  width: 10px;
                  height: 10px;
              }
          }
          &.@{radio-prefix-cls}-wrapper, & .@{radio-prefix-cls}-wrapper{
              font-size: @font-size-base;
          }
      }
      &-small{
          & .@{radio-inner-prefix-cls}{
              width: 12px;
              height: 12px;
              &:after{
                  width: 6px;
                  height: 6px;
              }
          }
      }
4925f85f   梁灏   add Radio UI
107
108
109
110
111
112
113
114
  
      &-input {
          position: absolute;
          top: 0;
          bottom: 0;
          left: 0;
          right: 0;
          z-index: 1;
4925f85f   梁灏   add Radio UI
115
          opacity: 0;
7d7221ec   梁灏   optimize Radio si...
116
          cursor: pointer;
4925f85f   梁灏   add Radio UI
117
118
119
      }
  }
  
e0f097e6   Graham Fairweather   Initial WIP
120
  // 选中状态 - Selected state
4925f85f   梁灏   add Radio UI
121
122
  .@{radio-prefix-cls}-checked {
      .@{radio-inner-prefix-cls} {
7d7221ec   梁灏   optimize Radio si...
123
          border-color: @primary-color;
4925f85f   梁灏   add Radio UI
124
125
          &:after {
              opacity: 1;
e2645048   jingsam   :fire: remove tra...
126
127
              transform: scale(1);
              transition: all @transition-time @ease-in-out;
4925f85f   梁灏   add Radio UI
128
129
          }
      }
7d7221ec   梁灏   optimize Radio si...
130
131
132
133
134
      &:hover {
          .@{radio-inner-prefix-cls} {
              border-color: @primary-color;
          }
      }
4925f85f   梁灏   add Radio UI
135
136
137
  }
  
  .@{radio-prefix-cls}-disabled {
7d7221ec   梁灏   optimize Radio si...
138
139
140
141
142
      cursor: @cursor-disabled;
      .@{radio-prefix-cls}-input {
          cursor: @cursor-disabled;
      }
  
4925f85f   梁灏   add Radio UI
143
144
145
146
147
148
149
150
151
152
153
154
155
      &: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
156
157
      .@{radio-prefix-cls}-disabled + span {
          color: #ccc;
4925f85f   梁灏   add Radio UI
158
159
160
161
162
163
164
165
      }
  }
  
  span.@{radio-prefix-cls} + * {
      margin-left: 2px;
      margin-right: 2px;
  }
  
e0f097e6   Graham Fairweather   Initial WIP
166
  // 按钮样式 - Button style
4925f85f   梁灏   add Radio UI
167
168
169
170
  .@{radio-group-button-prefix-cls} {
      font-size: 0;
      -webkit-text-size-adjust:none;
  
3c01d81a   梁灏   fixed Modal bug,w...
171
172
173
174
175
      .@{radio-prefix-cls}{
          width: 0;
          margin-right: 0;
      }
  
4925f85f   梁灏   add Radio UI
176
      .@{radio-prefix-cls}-wrapper {
3c01d81a   梁灏   fixed Modal bug,w...
177
178
179
          display: inline-block;
          height: @btn-circle-size;
          line-height: @btn-circle-size - 2px;
4925f85f   梁灏   add Radio UI
180
          margin: 0;
a646fc36   梁灏   optimize box-shadow
181
          padding: 0 16px - 1px;
3c01d81a   梁灏   fixed Modal bug,w...
182
          font-size: @font-size-small;
4925f85f   梁灏   add Radio UI
183
          color: @btn-default-color;
e2645048   jingsam   :fire: remove tra...
184
          transition: all @transition-time ease-in-out;
4925f85f   梁灏   add Radio UI
185
186
          cursor: pointer;
          border: 1px solid @border-color-base;
a646fc36   梁灏   optimize box-shadow
187
          border-left: 0;
4925f85f   梁灏   add Radio UI
188
          background: #fff;
a646fc36   梁灏   optimize box-shadow
189
          position: relative;
4925f85f   梁灏   add Radio UI
190
191
192
193
194
  
          > span {
              margin-left: 0;
          }
  
a646fc36   梁灏   optimize box-shadow
195
          &:before, &:after {
4925f85f   梁灏   add Radio UI
196
              content: '';
a646fc36   梁灏   optimize box-shadow
197
              display: block;
4925f85f   梁灏   add Radio UI
198
199
200
201
              position: absolute;
              width: 1px;
              height: 100%;
              left: -1px;
a646fc36   梁灏   optimize box-shadow
202
              top: 0;
4925f85f   梁灏   add Radio UI
203
              background: @border-color-base;
a646fc36   梁灏   optimize box-shadow
204
              //visibility: hidden;
e2645048   jingsam   :fire: remove tra...
205
              transition: all @transition-time ease-in-out;
4925f85f   梁灏   add Radio UI
206
207
          }
  
a646fc36   梁灏   optimize box-shadow
208
209
210
211
212
213
214
215
          &:after{
              height: @btn-circle-size + 4px;
              left: -1px;
              top: -3px;
              background: fade(@primary-color, 20%);
              opacity: 0;
          }
  
4925f85f   梁灏   add Radio UI
216
217
218
          &:first-child {
              border-radius: @btn-border-radius 0 0 @btn-border-radius;
              border-left: 1px solid @border-color-base;
a646fc36   梁灏   optimize box-shadow
219
              &:before, &:after {
4925f85f   梁灏   add Radio UI
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
                  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;
e0f097e6   Graham Fairweather   Initial WIP
235
236
237
238
239
              & .@{radio-prefix-cls} {
                  background-color: black;
              }
          }
  
4925f85f   梁灏   add Radio UI
240
241
242
243
244
245
246
247
248
249
250
          .@{radio-prefix-cls}-inner,
          input {
              opacity: 0;
              width: 0;
              height: 0;
          }
  
          &-checked {
              background: #fff;
              border-color: @primary-color;
              color: @primary-color;
a646fc36   梁灏   optimize box-shadow
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
              box-shadow: -1px 0 0 0 @primary-color;
              z-index: 1;
  
              &:before{
                  background: @primary-color;
                  opacity: 0.1;
              }
  
              &.@{radio-prefix-cls}-focus{
                  box-shadow: -1px 0 0 0 @primary-color, 0 0 0 2px fade(@primary-color, 20%);
                  transition: all @transition-time ease-in-out;
                  &:after{
                      left: -3px;
                      top: -3px;
                      opacity: 1;
                      background: fade(@primary-color, 20%);
                  }
                  &:first-child{
                      box-shadow: 0 0 0 2px fade(@primary-color, 20%);
                  }
              }
4925f85f   梁灏   add Radio UI
272
273
274
  
              &:first-child {
                  border-color: @primary-color;
a646fc36   梁灏   optimize box-shadow
275
                  box-shadow: none;
4925f85f   梁灏   add Radio UI
276
277
278
279
              }
  
              &:hover {
                  border-color: tint(@primary-color, 20%);
f4e25069   Graham Fairweather   Use z-index to sh...
280
                  //box-shadow: -1px 0 0 0 tint(@primary-color, 20%);
4925f85f   梁灏   add Radio UI
281
282
283
                  color: tint(@primary-color, 20%);
              }
  
4925f85f   梁灏   add Radio UI
284
285
              &:active {
                  border-color: shade(@primary-color, 5%);
f4e25069   Graham Fairweather   Use z-index to sh...
286
                  //box-shadow: -1px 0 0 0 shade(@primary-color, 5%);
4925f85f   梁灏   add Radio UI
287
288
289
290
291
292
293
                  color: shade(@primary-color, 5%);
              }
          }
  
          &-disabled {
              border-color: @border-color-base;
              background-color: @background-color-base;
7d7221ec   梁灏   optimize Radio si...
294
              cursor: @cursor-disabled;
4925f85f   梁灏   add Radio UI
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
              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{
3c01d81a   梁灏   fixed Modal bug,w...
318
319
320
      height: @btn-circle-size-large;
      line-height: @btn-circle-size-large - 2px;
      font-size: @font-size-base;
a646fc36   梁灏   optimize box-shadow
321
322
323
      &:after{
          height: @btn-circle-size-large + 4px;
      }
4925f85f   梁灏   add Radio UI
324
325
326
  }
  
  .@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-small .@{radio-prefix-cls}-wrapper{
3c01d81a   梁灏   fixed Modal bug,w...
327
328
      height: @btn-circle-size-small;
      line-height: @btn-circle-size-small - 2px;
4925f85f   梁灏   add Radio UI
329
      padding: 0 12px;
3c01d81a   梁灏   fixed Modal bug,w...
330
      font-size: @font-size-small;
a646fc36   梁灏   optimize box-shadow
331
332
333
334
335
  
      &:after{
          height: @btn-circle-size-small + 4px;
      }
  
4925f85f   梁灏   add Radio UI
336
      &:first-child {
7098f972   梁灏   fixed RadioGroup ...
337
          border-radius: @btn-border-radius-small 0 0 @btn-border-radius-small;
4925f85f   梁灏   add Radio UI
338
339
      }
      &:last-child {
7098f972   梁灏   fixed RadioGroup ...
340
          border-radius: 0 @btn-border-radius-small @btn-border-radius-small 0;
4925f85f   梁灏   add Radio UI
341
      }
e2645048   jingsam   :fire: remove tra...
342
  }
e0f097e6   Graham Fairweather   Initial WIP