hjg
2023-11-18 bb48edb3d9faaaeab0088151c86fc24137acdb08
提交 | 用户 | 时间
58d006 1 //buttons
A 2 .btn {
3  display: inline-block;
4
5  color: #FFF !important;
6  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);// !important;
7
8  background-image: none !important;
9  border: 5px solid #FFF;
10  border-radius: 0;
11  box-shadow: none !important;
12
13  .transition(~"background-color 0.15s, border-color 0.15s, opacity 0.15s");
14
15  cursor: pointer;
16
17  vertical-align: middle;
18  margin: 0;
19
20  position: relative;
21  
22  /**
23  &:hover, &:focus, &.focus, .open > &.dropdown-toggle {
24     color: #FFF;
25     box-shadow: none;
26  }
27  */
28 }
29 .btn.active , .open > .btn.active.dropdown-toggle {
30  box-shadow: none;
31  //color: @btn-active-color;
32 }
33
34
35 .btn-lg, .btn-group-lg > .btn {
36     border-width: 5px;
37     line-height: 1.4;
38     padding: 5px 16px 6px;
39 }
40 .btn-xlg, .btn-group-xlg > .btn {
41     border-width: 5px;
42     line-height: 1.35;
43     padding: 7px 16px;
44     font-size: @font-size-large;
45 }
46 .btn-sm, .btn-group-sm > .btn {
47     border-width: 4px;
48     font-size: @font-size-btn-sm;
49     padding: 4px 9px;
50     line-height: 1.38;//1.39;
51 }
52 .btn-xs, .btn-group-xs > .btn {
53     padding-top: 3px;
54     padding-bottom: 3px;
55     border-width: 3px;
56 }
57 .btn-mini, .btn-group-mini > .btn {
58     padding: 1px 5px;
59     border-width: 3px;
60     font-size: @font-size-btn-xs;
61     line-height: 1.5;
62 }
63
64 .btn-minier, .btn-group-minier > .btn {
65     padding: 0 4px;
66     line-height: 18px;
67     border-width: 2px;
68     font-size: @font-size-btn-minier;
69 }
70
71 button.btn:active {
72     top: 1px;
73     //left: 1px;
74     //using both left & top, will cause chrome not to catch click events at seldom times
75 }
76
77
78 .input-group-lg > .form-control, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .btn {
79     border-radius: 0;
80 }
81
82
83
84 .enable_default_buttons() when(@enable-default-buttons = true) {
85
86 //button color
87 .btn-color(@color1, @color2) {
88   & , &:focus {
89     background-color: @color1 !important;
90     border-color: @color1;
91   }
92
93   &:hover , &:active, &:focus:active, &:focus:hover, &:active:hover, &.active:hover,
94   .open > &.dropdown-toggle, .open > &.dropdown-toggle:active, .open > &.dropdown-toggle:hover, .open > &.dropdown-toggle:focus, .open > &.dropdown-toggle.active {
95     background-color: @color2 !important;
96     border-color: @color1;
97   }
98   &.no-border:hover , &.no-border:active {
99     border-color: @color2;
100   }
101   &.no-hover:hover , &.no-hover:active {
102     background-color: @color1 !important;
103   }
104   &.active {
105     background-color: mix(@color1,@color2) !important;
106     border-color: darken(mix(@color1,@color2),7%);
107   }
108   &.no-border.active {
109     background-color: darken(mix(@color1,@color2),3%) !important;
110     border-color: darken(mix(@color1,@color2),3%);
111   }
112   &.disabled, &[disabled], fieldset[disabled] & {
113     &,
114     &:hover,
115     &:focus,
116     &:active,
117     &.active {
118         background-color: @color1 !important;
119         border-color:@color1;
120     }
121   }
122 }
123
124 .btn-color(@color-name) {
125  @color1-name : ~`"btn-@{color-name}"`;
126  @color2-name : ~`"btn-@{color-name}-hover"`;
127
128  .btn-color(@@color1-name, @@color2-name);
129 }
130
131
132 .btn , .btn-default {
133     .btn-color(~"default");
134 }
135 .btn-primary {
136     .btn-color(~"primary");
137 }
138 .btn-info {
139     .btn-color(~"info");
140 }
141 .btn-info2 {
142     .btn-color(~"info2");
143 }
144 .btn-success {
145     .btn-color(~"success");
146 }
147 .btn-warning {
148     .btn-color(~"warning");
149 }
150 .btn-danger {
151     .btn-color(~"danger");
152 }
153 .btn-inverse {
154     .btn-color(~"inverse");
155 }
156 .btn-pink {
157     .btn-color(~"pink");
158 }
159 .btn-purple {
160     .btn-color(~"purple");
161 }
162 .btn-grey {
163  .btn-color(~"grey");
164 }
165
166 .btn-yellow {
167  .btn-color(~"yellow");
168  color: @btn-yellow-color !important;
169  text-shadow:0 -1px 0 rgba(255, 255, 255, 0.4) !important;
170  
171   &:hover, &:focus, &.focus, .open > &.dropdown-toggle, &.active , .open > &.active.dropdown-toggle {
172     color:@btn-yellow-color;
173   }
174
175 }
176
177 .btn-light {
178  .btn-color(~"light");
179  color: @btn-light-color !important;
180  text-shadow:0 -1px 0 rgba(250, 250, 250, 0.25) !important;
181  
182   &:hover, &:focus, &.focus, .open > &.dropdown-toggle, &.active , .open > &.active.dropdown-toggle {
183     color:@btn-light-color;
184   }
185  
186  &.btn-xs:after, &.btn-mini:after {
187     left: -2px;
188     right: -2px;
189     top: -2px;
190     bottom: -2px;
191  }
192  &.btn-sm:after {
193     left: -4px;
194     right: -4px;
195     top: -4px;
196     bottom: -4px;
197  }
198  .btn-lg:after {
199     left: -6px;
200     right: -6px;
201     top: -6px;
202     bottom: -6px;
203  }
204 }
205
206 }
207 .enable_default_buttons();
208
209
210
211 .enable_white_buttons() when(@enable-white-buttons = true) {
212 .btn.btn-white {
213     //border-width: 1px;
214     text-shadow: none !important;
215     background-color: #FFF !important;
216
217     &.no-hover:hover , &.no-hover:active {
218         background-color: #FFF !important;
219     }
220
221     &:focus , &.active {
222         box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.1) !important;
223         
224         &.btn-bold {
225             box-shadow: inset 1px 1px 3px 0 rgba(0,0,0,0.15) !important;
226         }
227     }
228     &.active:after {
229         display: none;
230     }
231 }
232 .btn-white(@txt-color, @border-color, @bg-hover-color) {
233  border-color: @border-color;
234  color: @txt-color !important;
235
236  &:hover, &:focus , &.active, &:active, .open > &.dropdown-toggle, .open > &.active.dropdown-toggle {
237     background-color: @bg-hover-color !important;
238     border-color: @border-color;
239     color: saturate(darken(@txt-color , 5%) , 5%) !important;
240     
241     &.no-border {
242         border-color: @border-color;
243     }
244  }
245  /**
246  //&:hover, &:focus, &.focus, .open > &.dropdown-toggle {
247     //color: saturate(darken(@txt-color , 5%) , 5%) !important;
248  //}
249  //&.no-border:hover , &.no-border:active {
250     //border-color: @border-color;
251  //}
252  */
253
254  &.disabled, &[disabled], fieldset[disabled] & {
255     &,
256     &:hover,
257     &:focus,
258     &:active,
259     &.active {
260         //background-color: #FFF !important;
261         border-color: @border-color;
262     }
263   }
264 }
265
266 .btn.btn-white {
267   .btn-white(#444, #CCC , #EBEBEB);
268 }
269 .btn-white.btn-default {
270   .btn-white(darken(@btn-default-hover, 4%), @btn-default , lighten(@btn-default, 23%));
271 }
272 .btn-white.btn-primary {
273   .btn-white(desaturate(@btn-primary , 30%), desaturate(lighten(@btn-primary , 15%), 15%) , desaturate(lighten(@btn-primary , 42%), 6%));
274 }
275 .btn-white.btn-success {
276   .btn-white(desaturate(darken(@btn-success , 4%) , 8%), desaturate(lighten(@btn-success , 10%), 2%) , desaturate(lighten(@btn-success , 33%), 1%));
277 }
278 .btn-white.btn-danger {
279   .btn-white(desaturate(lighten(@btn-danger, 5%) , 30%), desaturate(lighten(@btn-danger , 18%), 18%) , desaturate(lighten(@btn-danger , 42%), 7%));
280 }
281 .btn-white.btn-warning {
282   .btn-white(desaturate(darken(@btn-warning , 6%), 36%), desaturate(lighten(@btn-warning , 3%), 30%) , desaturate(lighten(@btn-warning , 30%), 10%));
283 }
284 .btn-white.btn-info {
285   .btn-white(desaturate(darken(@btn-info, 6%) , 25%), desaturate(lighten(@btn-info , 5%), 15%) , desaturate(lighten(@btn-info , 30%), 6%));
286 }
287 .btn-white.btn-inverse {
288   .btn-white(@btn-inverse, lighten(@btn-inverse , 25%) , lighten(@btn-inverse , 56%));
289 }
290 .btn-white.btn-pink {
291   .btn-white(desaturate(@btn-pink , 35%), desaturate(lighten(@btn-pink , 15%), 25%) , desaturate(lighten(@btn-pink , 40%), 5%));
292 }
293 .btn-white.btn-purple {
294   .btn-white(darken(desaturate(@btn-purple , 10%) , 10%), desaturate(lighten(@btn-purple , 10%), 15%) , desaturate(lighten(@btn-purple , 31%), 5%));
295 }
296 .btn-white.btn-yellow {
297   .btn-white(darken(desaturate(@btn-yellow , 20%) , 30%), desaturate(darken(@btn-yellow, 5%), 25%) , desaturate(lighten(@btn-yellow , 18%), 10%));
298 }
299 .btn-white.btn-grey {
300   .btn-white(darken(@btn-grey , 8%), lighten(@btn-grey , 15%) , lighten(@btn-grey , 30%));
301 }
302
303 .btn-white.btn-transparent {
304   background-color: rgba(0,0,0,0.4) !important;
305   &:hover {
306     background-color: rgba(0,0,0,0.5) !important;
307   }
308   &:focus, &:active {
309     background-color: rgba(0,0,0,0.6) !important;
310   }
311 }
312
313 .btn-white.no-border {
314   border-color: transparent !important;
315 }
316
317 }
318 .enable_white_buttons();
319
320
321
322
323
324
325
326
327
328
329
330
331 .btn.disabled, .btn[disabled] {
332  &.active, &:focus, &:active {
333     outline:none;
334  }
335  &:active {
336     top:0; left:0;
337  }
338 }
339
340 //active buttons
341 .btn.active {
342  &:after {
343     display: inline-block;
344     content: "";
345     position: absolute;
346     border-bottom: 1px solid @btn-active-color;
347     left: -4px;
348     right: -4px;
349     bottom: -4px;
350  }
351  &.btn-sm:after {
352     left: -3px;
353     right: -3px;
354     bottom: -3px;
355     //border-bottom-width:1px;
356  }
357  &.btn-lg:after {
358     left: -5px;
359     right: -5px;
360     bottom: -5px;
361     //border-bottom-width:1px;
362  }
363  &.btn-xs:after , &.btn-mini:after, &.btn-minier:after {
364     left: -1px;
365     right: -1px;
366     bottom: -2px;
367     //border-bottom-width:1px;
368  }
369  &.btn-minier:after {
370     bottom: -1px;
371  }
372  
373   &.btn-yellow:after {
374     border-bottom-color: @btn-yellow-active-border;
375  }
376  &.btn-light {    
377     color: #515151;
378     &:after {
379         border-bottom-color: #B5B5B5;
380     }
381  }
382 }
383
384
385
386
387 //icons inside buttons
388 .btn {
389     > .@{icon} {
390         margin-right: 4px;
391         //min-width: 12px;
392         //display: inline;
393
394         &.icon-on-right {
395             margin-right: 0;
396             margin-left: 4px;
397         }
398     }
399     > .icon-only.@{icon} {
400         margin: 0 !important;//to override .rtl
401         text-align: center;
402         padding: 0;
403         //min-width: 24px;
404         //vertical-align: middle;
405     }
406 }
407
408 .btn-lg > .@{icon} {
409     margin-right: 6px;
410     
411     &.icon-on-right {
412         margin-right: 0;
413         margin-left: 6px;
414     }
415 }
416 .btn-sm > .@{icon} {
417     margin-right: 3px;
418
419     &.icon-on-right {
420         margin-right: 0;
421         margin-left: 3px;
422     }
423 }
424 .btn-xs > .@{icon} , .btn-mini > .@{icon} , .btn-minier > .@{icon} {
425     margin-right: 2px;
426
427     &.icon-on-right {
428         margin-right: 0;
429         margin-left: 2px;
430     }
431 }
432
433
434
435 .btn.btn-link {
436   border-width: 0 !important;
437   background: transparent none !important;
438   color: @btn-link-color !important;
439   text-shadow: none !important;
440   padding: 4px 12px !important;
441   line-height: 20px !important;
442
443  &:hover {
444     background: transparent none !important;
445     text-shadow: none !important;
446  }
447  &.active, &:active, &:focus {
448     & , .open > & {
449         background: transparent none !important;
450         text-decoration: underline;
451         color: lighten(@btn-link-color , 6%) !important;
452     }
453     &:after {
454         display: none;
455     }
456  }
457  &.disabled , &[disabled]{
458     background: transparent none !important;
459     .opacity(0.65);
460     text-decoration: none !important;
461  }
462 }
463
464 .btn.btn-no-border {
465  border-width: 0 !important;
466 }
467
468
469
470
471 //button groups
472 .btn-group {
473   &:first-child {
474     margin-left: 0;
475   }
476         
477   > .btn {
478       & , + .btn {
479          margin: 0 1px 0 0;
480       }
481       &:first-child {
482         margin: 0 1px 0 0;
483       }
484
485       
486       //caret inside buttons
487       > .caret {
488          margin-top: 15px;
489          margin-left: 1px;
490          border-width: 5px;
491          border-top-color: #FFF;
492       }
493
494      &.btn-sm > .caret {
495         margin-top: 10px;
496         border-width: 4px;
497      }
498      &.btn-lg > .caret {
499         margin-top: 18px;
500         border-width: 6px;
501      }
502      &.btn-xs > .caret , &.btn-mini > .caret {
503         margin-top: 9px;
504         border-width: 4px;
505      }
506      &.btn-minier > .caret {
507         margin-top: 7px;
508         border-width: 3px;
509      }
510      
511      //dropdown toggle
512      + .btn.dropdown-toggle {
513         padding-right: 3px;
514         padding-left: 3px;
515     }
516     + .btn-lg.dropdown-toggle {
517         padding-right: 4px;
518         padding-left: 4px;
519     }
520
521   }
522   .dropdown-toggle {
523     border-radius: 0;
524   }
525
526
527
528   .btn-group-active-state(@left, @right, @bottom, @width) {/* the border under an active button in button groups */
529         &.active:after {
530             left: unit(@left, px); right:unit(@right, px); bottom:unit(@bottom, px);
531             border-bottom-width: unit(@width, px);
532         }
533   }
534    > .btn  , + .btn{
535         margin: 0 1px 0 0;
536         border-width: 3px;// !important;
537         .btn-group-active-state(-2, -2, -2, 1);
538    }
539
540    > .btn-lg  , + .btn-lg{
541         border-width: 4px;// !important;
542         .btn-group-active-state(-3, -3, -3, 1);
543    }
544    > .btn-sm  , + .btn-sm{
545         border-width: 2px;// !important;
546         .btn-group-active-state(-1, -1, -1, 1);
547    }
548    > .btn-xs  , + .btn-xs , > .btn-mini  , + .btn-mini {
549         border-width: 1px;// !important;
550         .btn-group-active-state(0, 0, 0, 1);
551    }
552    > .btn-minier  , + .btn-minier{
553         border-width: 1px;// !important;
554         .btn-group-active-state(0, 0, 0, 1);
555    }
556    
557 }
558 .btn-group-vertical > .btn:last-child:not(:first-child) , .btn-group-vertical > .btn:first-child:not(:last-child) {
559     border-radius: 0;
560 }
561
562
563
564 .btn-group-vertical > .btn , .btn-group-vertical > .btn + .btn {
565     margin: 1px 0 0;
566 }
567 .btn-group-vertical > .btn:first-child {
568     margin-top: 0;
569 }
570 .btn-group.btn-overlap > .btn {
571     margin-right: -1px;
572 }
573 .btn-group.btn-corner > .btn {
574     &:first-child {
575         border-bottom-left-radius: 8px;
576         border-top-left-radius: 8px;
577     }
578     &:last-child {
579         border-bottom-right-radius: 8px;
580         border-top-right-radius: 8px;
581     }
582     &.btn-sm:first-child {
583         border-bottom-left-radius: 6px;
584         border-top-left-radius: 6px;
585     }
586     &.btn-sm:last-child {
587         border-bottom-right-radius: 6px;
588         border-top-right-radius: 6px;
589     }
590     &.btn-xs:first-child , &.btn-mini:first-child {
591         border-bottom-left-radius: 4px;
592         border-top-left-radius: 4px;
593     }
594     &.btn-xs:last-child, &.btn-mini:last-child {
595         border-bottom-right-radius: 4px;
596         border-top-right-radius: 4px;
597     }
598 }
599
600
601
602 .btn.btn-white {
603   border-width: 1px;
604 }
605 .btn.btn-bold {
606   border-bottom-width: 2px;
607 }
608 .btn.btn-round {
609   border-bottom-width: 2px;
610   border-radius: 4px !important;
611 }
612
613
614
615 //application buttons
616 .enable_application_buttons() when(@enable-application-buttons = true) {
617 .btn.btn-app {
618  display: inline-block;
619  width: 100px;
620
621  font-size: @font-size-btn-app;
622  font-weight: normal;
623  color: #FFF;
624  
625  text-align: center;
626  text-shadow: 0 -1px -1px rgba(0,0,0,0.2) !important;
627  
628  border: none;
629  border-radius: 12px;
630  
631  padding: 12px 0 8px;
632  margin: 2px;
633  
634  line-height: 1.7;
635
636  position: relative;
637 }
638
639
640 //button color
641 .btn-app-color(@color1, @color2, @percent) {
642   & , &.no-hover:hover , &.disabled:hover {
643     background: average(@color1, @color2) !important;
644     #gradient > .vertical(@color1 , @color2) !important;
645   }
646   &:hover {
647     background: average(darken(@color1,@percent), darken(@color2,@percent)) !important;
648     #gradient > .vertical(darken(@color1,@percent) , darken(@color2,@percent)) !important;
649   }
650 }
651
652 .btn-app-color(@color-name, @percent:10%) {
653  @color1-name : ~`"btn-app-@{color-name}-1"`;
654  @color2-name : ~`"btn-app-@{color-name}-2"`;
655  
656  .btn-app-color(@@color1-name, @@color2-name , @percent);
657 }
658
659 .btn-app, .btn-app.btn-default {
660     .btn-app-color(~"default" , 8%);
661 }
662 .btn-app.btn-primary {
663     .btn-app-color(~"primary");
664 }
665 .btn-app.btn-info {
666     .btn-app-color(~"info");
667 }
668 .btn-app.btn-success {
669     .btn-app-color(~"success");
670 }
671 .btn-app.btn-danger {
672     .btn-app-color(~"danger");
673 }
674 .btn-app.btn-warning {
675     .btn-app-color(~"warning");
676 }
677 .btn-app.btn-purple {
678     .btn-app-color(~"purple");
679 }
680 .btn-app.btn-pink {
681     .btn-app-color(~"pink");
682 }
683 .btn-app.btn-inverse {
684     .btn-app-color(~"inverse");
685 }
686 .btn-app.btn-grey {
687     .btn-app-color(~"grey" , 5%);
688 }
689
690 .btn.btn-app.btn-light {
691  .btn-app-color(~"light" , 5%);
692
693  color: @btn-app-light-color !important;
694  text-shadow: 0 1px 1px #EEE !important;
695 }
696
697 .btn.btn-app.btn-yellow {
698  .btn-app-color(~"yellow" , 5%);
699  
700  color:@btn-app-yellow-color !important;
701  text-shadow:0 -1px 0 rgba(255, 255, 255, 0.4) !important;
702 }
703
704
705 .btn.btn-app {
706     > .@{icon} {
707         opacity: 0.88;
708     }
709     &:hover > .@{icon} {
710         opacity: 1;
711     }
712
713     &.btn-sm {
714         width: 80px;
715         font-size: @font-size-btn-app-sm;
716         border-radius: 10px;
717         
718         line-height: 1.5;
719     }
720     &.btn-xs {
721         width: 64px;
722         font-size: @font-size-btn-app-xs;
723         border-radius: 8px;
724         padding-bottom: 7px;
725         padding-top: 8px;
726         
727         line-height: 1.45;
728     }
729     
730     
731
732    > .@{icon} {
733         display: block;
734         font-size: @font-size-btn-app-icon;
735      
736         margin: 0 0 4px;
737         line-height: 36px;
738         min-width: 0;
739      
740         padding: 0;
741    }
742    &.btn-sm > .@{icon} {
743         display: block;
744         font-size: @font-size-btn-app-sm-icon;
745         line-height: 30px;
746         margin: 0 0 3px;
747     }
748    &.btn-xs > .@{icon} {
749         display: block;
750         font-size: @font-size-btn-app-xs-icon;
751         line-height: 24px;
752         margin: 0;
753     }
754     
755     &.no-radius {
756         border-radius: 0;
757     }
758     &.radius-4 {
759         border-radius: 4px;
760     }
761     
762     //badge & label inside buttons
763     > .badge , > .label {
764         position: absolute !important;
765         top: -2px;
766         right: -2px;
767         padding: 1px 3px;
768         text-align: center;
769         font-size: @font-size-label-inside-btn-app - 1;
770         
771         color: #FFF;
772
773         &.badge-left , &.label-left{
774             right: auto;
775             left: -2px;
776         }
777     }
778     
779     > .badge-yellow, > .label-yellow {
780         color: @label-yellow-text;
781     }
782     > .badge-light, > .label-light {
783         color: @label-light-text;
784     }
785
786     
787     > .label {
788         padding:1px 6px 3px;
789         font-size: @font-size-label-inside-btn-app;
790     }
791     &.radius-4 , &.no-radius {
792         > .badge {
793             border-radius: 3px;
794             &.no-radius {// > .badge.no-radius
795                 border-radius: 0;
796             }
797         }
798     }
799     
800     
801     
802     //active state
803     &.active {
804         color:@btn-app-active;
805         &:after {
806             display: none;
807         }
808         &.btn-yellow {
809             color:@btn-app-yellow-color;
810             border-color:@btn-app-yellow-border;
811         }
812         &.btn-light {
813             color:@btn-app-light-active;
814         }
815     }
816 }
817
818
819
820
821 //////////
822 //
823 //ie8 fix needed (ace-ie.css)
824 .btn-group > .btn-app:first-child:not(:last-child):not(.dropdown-toggle) {
825     margin-right: 24px;
826 }
827 .btn-group > .btn-app + .btn-app.dropdown-toggle {
828     position: absolute;
829     width: auto;
830     height: 100%;
831     padding-left: 6px;
832     padding-right: 6px;
833     
834     margin-left: -23px;
835     
836     .border-left-radius(0);
837     
838     right: 0;
839 }
840
841
842 .btn.btn-app {
843  &.btn-light, &.btn-yellow {
844     .box-shadow(~"0 0 0 1px rgba(0, 0, 0, 0.08) inset") !important;
845  }
846 }
847
848
849 }
850 .enable_application_buttons();