bootstrap-switch.less 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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}-disabled,
  50. &.@{bootstrap-switch-base}-readonly,
  51. &.@{bootstrap-switch-base}-indeterminate {
  52. .opacity(50);
  53. cursor: default !important;
  54. .@{bootstrap-switch-base}-handle-on,
  55. .@{bootstrap-switch-base}-handle-off,
  56. .@{bootstrap-switch-base}-label {
  57. cursor: default !important;
  58. }
  59. }
  60. &.@{bootstrap-switch-base}-animate {
  61. .@{bootstrap-switch-base}-container {
  62. .transition(margin-left .5s);
  63. }
  64. }
  65. &.@{bootstrap-switch-base}-inverse {
  66. .@{bootstrap-switch-base}-handle-on {
  67. .border-left-radius(0);
  68. .border-right-radius(4px);
  69. }
  70. .@{bootstrap-switch-base}-handle-off {
  71. .border-right-radius(0);
  72. .border-left-radius(4px);
  73. }
  74. }
  75. &.@{bootstrap-switch-base}-focused {
  76. border-color: rgba(82, 168, 236, .8);
  77. outline: 0;
  78. outline: thin dotted \9;
  79. .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6)");
  80. }
  81. &.@{bootstrap-switch-base}-on,
  82. &.@{bootstrap-switch-base}-inverse.@{bootstrap-switch-base}-off {
  83. .@{bootstrap-switch-base}-container {
  84. margin-left: 0%;
  85. }
  86. .@{bootstrap-switch-base}-label {
  87. .border-right-radius(4px);
  88. }
  89. }
  90. &.@{bootstrap-switch-base}-off,
  91. &.@{bootstrap-switch-base}-inverse.@{bootstrap-switch-base}-on {
  92. .@{bootstrap-switch-base}-container {
  93. margin-left: -50%;
  94. }
  95. .@{bootstrap-switch-base}-label {
  96. .border-left-radius(4px);
  97. }
  98. }
  99. &.@{bootstrap-switch-base}-indeterminate {
  100. .@{bootstrap-switch-base}-container {
  101. margin-left: -25%;
  102. }
  103. }
  104. .@{bootstrap-switch-base}-container {
  105. display: inline-block;
  106. width: 150%;
  107. top: 0;
  108. .border-radius(4px);
  109. .translate3d(0, 0, 0);
  110. }
  111. .@{bootstrap-switch-base}-handle-on,
  112. .@{bootstrap-switch-base}-handle-off,
  113. .@{bootstrap-switch-base}-label {
  114. .box-sizing(border-box);
  115. cursor: pointer;
  116. display: inline-block !important;
  117. height: 100%;
  118. padding-bottom: 4px;
  119. padding-top: 4px;
  120. font-size: 14px;
  121. line-height: 20px;
  122. }
  123. .@{bootstrap-switch-base}-handle-on,
  124. .@{bootstrap-switch-base}-handle-off {
  125. text-align: center;
  126. z-index: 1;
  127. width: 33.333333333%;
  128. &.@{bootstrap-switch-base}-primary {
  129. .buttonBackground(@btnPrimaryBackgroundHighlight, @btnPrimaryBackground);
  130. }
  131. &.@{bootstrap-switch-base}-info {
  132. .buttonBackground(@btnInfoBackgroundHighlight, @btnInfoBackground);
  133. }
  134. &.@{bootstrap-switch-base}-success {
  135. .buttonBackground(@btnSuccessBackgroundHighlight, @btnSuccessBackground);
  136. }
  137. &.@{bootstrap-switch-base}-warning {
  138. .buttonBackground(@btnWarningBackgroundHighlight, @btnWarningBackground);
  139. }
  140. &.@{bootstrap-switch-base}-danger {
  141. .buttonBackground(@btnDangerBackgroundHighlight, @btnDangerBackground);
  142. }
  143. &.@{bootstrap-switch-base}-default {
  144. .buttonBackground(@btnBackgroundHighlight, @btnBackground, @grayDark, 0 1px 1px rgba(255,255,255,.75));
  145. }
  146. }
  147. .@{bootstrap-switch-base}-label {
  148. text-align: center;
  149. margin-top: -1px;
  150. margin-bottom: -1px;
  151. z-index: 100;
  152. width: 33.333333333%;
  153. border-left: 1px solid @btnBorder;
  154. border-right: 1px solid @btnBorder;
  155. .buttonBackground(@btnBackground, @btnBackgroundHighlight, @grayDark);
  156. }
  157. .@{bootstrap-switch-base}-handle-on {
  158. .border-left-radius(4px);
  159. }
  160. .@{bootstrap-switch-base}-handle-off {
  161. .border-right-radius(4px);
  162. }
  163. input[type='radio'],
  164. input[type='checkbox'] {
  165. position: absolute !important;
  166. top: 0;
  167. left: 0;
  168. .opacity(0);
  169. z-index: -1;
  170. &.form-control {
  171. height: auto;
  172. }
  173. }
  174. }