bootstrap-switch.less 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. @bootstrap-switch-base: bootstrap-switch;
  2. .@{bootstrap-switch-base} {
  3. display: inline-block;
  4. cursor: pointer;
  5. .border-radius(5px);
  6. border: 1px solid;
  7. border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  8. position: relative;
  9. text-align: left;
  10. overflow: hidden;
  11. line-height: 8px;
  12. .user-select(none);
  13. vertical-align: middle;
  14. min-width: 100px;
  15. .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s");
  16. &.@{bootstrap-switch-base}-mini {
  17. min-width: 71px;
  18. .@{bootstrap-switch-base}-handle-on,
  19. .@{bootstrap-switch-base}-handle-off,
  20. .@{bootstrap-switch-base}-label {
  21. padding-bottom: 4px;
  22. padding-top: 4px;
  23. font-size: 10px;
  24. line-height: 9px;
  25. }
  26. }
  27. &.@{bootstrap-switch-base}-small {
  28. min-width: 79px;
  29. .@{bootstrap-switch-base}-handle-on,
  30. .@{bootstrap-switch-base}-handle-off,
  31. .@{bootstrap-switch-base}-label {
  32. padding-bottom: 3px;
  33. padding-top: 3px;
  34. font-size: 12px;
  35. line-height: 18px;
  36. }
  37. }
  38. &.@{bootstrap-switch-base}-large {
  39. min-width: 120px;
  40. .@{bootstrap-switch-base}-handle-on,
  41. .@{bootstrap-switch-base}-handle-off,
  42. .@{bootstrap-switch-base}-label {
  43. padding-bottom: 9px;
  44. padding-top: 9px;
  45. font-size: 16px;
  46. line-height: normal;
  47. }
  48. }
  49. &.@{bootstrap-switch-base}-animate {
  50. .@{bootstrap-switch-base}-container {
  51. .transition(margin-left 0.5s);
  52. }
  53. }
  54. &.@{bootstrap-switch-base}-on {
  55. .@{bootstrap-switch-base}-container {
  56. margin-left: 0%;
  57. }
  58. .@{bootstrap-switch-base}-label {
  59. .border-right-radius(4px);
  60. }
  61. }
  62. &.@{bootstrap-switch-base}-off {
  63. .@{bootstrap-switch-base}-container {
  64. margin-left: -50%;
  65. }
  66. .@{bootstrap-switch-base}-label {
  67. .border-left-radius(4px);
  68. }
  69. }
  70. &.@{bootstrap-switch-base}-disabled,
  71. &.@{bootstrap-switch-base}-readonly {
  72. .opacity(50);
  73. cursor: default !important;
  74. .@{bootstrap-switch-base}-handle-on,
  75. .@{bootstrap-switch-base}-handle-off,
  76. .@{bootstrap-switch-base}-label {
  77. cursor: default !important;
  78. }
  79. }
  80. &.@{bootstrap-switch-base}-focused {
  81. border-color: rgba(82, 168, 236, .8);
  82. outline: 0;
  83. outline: thin dotted \9;
  84. .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6)");
  85. }
  86. .@{bootstrap-switch-base}-container {
  87. display: inline-block;
  88. width: 150%;
  89. top: 0;
  90. .border-radius(4px);
  91. .translate3d(0, 0, 0);
  92. }
  93. .@{bootstrap-switch-base}-handle-on,
  94. .@{bootstrap-switch-base}-handle-off,
  95. .@{bootstrap-switch-base}-label {
  96. .box-sizing(border-box);
  97. cursor: pointer;
  98. display: inline-block !important;
  99. height: 100%;
  100. padding-bottom: 4px;
  101. padding-top: 4px;
  102. font-size: 14px;
  103. line-height: 20px;
  104. }
  105. .@{bootstrap-switch-base}-handle-on,
  106. .@{bootstrap-switch-base}-handle-off {
  107. text-align: center;
  108. z-index: 1;
  109. width: 33.333333333%;
  110. &.@{bootstrap-switch-base}-primary {
  111. .buttonBackground(@btnPrimaryBackgroundHighlight, @btnPrimaryBackground);
  112. }
  113. &.@{bootstrap-switch-base}-info {
  114. .buttonBackground(@btnInfoBackgroundHighlight, @btnInfoBackground);
  115. }
  116. &.@{bootstrap-switch-base}-success {
  117. .buttonBackground(@btnSuccessBackgroundHighlight, @btnSuccessBackground);
  118. }
  119. &.@{bootstrap-switch-base}-warning {
  120. .buttonBackground(@btnWarningBackgroundHighlight, @btnWarningBackground);
  121. }
  122. &.@{bootstrap-switch-base}-danger {
  123. .buttonBackground(@btnDangerBackgroundHighlight, @btnDangerBackground);
  124. }
  125. &.@{bootstrap-switch-base}-default {
  126. .buttonBackground(@btnBackgroundHighlight, @btnBackground, @grayDark, 0 1px 1px rgba(255,255,255,.75));
  127. }
  128. }
  129. .@{bootstrap-switch-base}-handle-on {
  130. .border-left-radius(4px);
  131. }
  132. .@{bootstrap-switch-base}-handle-off {
  133. .border-right-radius(4px);
  134. }
  135. .@{bootstrap-switch-base}-label {
  136. text-align: center;
  137. margin-top: -1px;
  138. margin-bottom: -1px;
  139. z-index: 100;
  140. width: 33.333333333%;
  141. border-left: 1px solid @btnBorder;
  142. border-right: 1px solid @btnBorder;
  143. .buttonBackground(@btnBackground, @btnBackgroundHighlight, @grayDark);
  144. }
  145. input[type='radio'],
  146. input[type='checkbox'] {
  147. position: absolute !important;
  148. top: 0;
  149. left: 0;
  150. .opacity(0);
  151. z-index: -1;
  152. }
  153. }