You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

246 lines
5.6 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
  1. // stylelint-disable selector-no-qualifying-type
  2. //
  3. // Button groups
  4. // --------------------------------------------------
  5. // Make the div behave like a button
  6. .btn-group,
  7. .btn-group-vertical {
  8. position: relative;
  9. display: inline-block;
  10. vertical-align: middle; // match .btn alignment given font-size hack above
  11. > .btn {
  12. position: relative;
  13. float: left;
  14. // Bring the "active" button to the front
  15. &:hover,
  16. &:focus,
  17. &:active,
  18. &.active {
  19. z-index: 2;
  20. }
  21. }
  22. }
  23. // Prevent double borders when buttons are next to each other
  24. .btn-group {
  25. .btn + .btn,
  26. .btn + .btn-group,
  27. .btn-group + .btn,
  28. .btn-group + .btn-group {
  29. margin-left: -1px;
  30. }
  31. }
  32. // Optional: Group multiple button groups together for a toolbar
  33. .btn-toolbar {
  34. margin-left: -5px; // Offset the first child's margin
  35. &:extend(.clearfix all);
  36. .btn,
  37. .btn-group,
  38. .input-group {
  39. float: left;
  40. }
  41. > .btn,
  42. > .btn-group,
  43. > .input-group {
  44. margin-left: 5px;
  45. }
  46. }
  47. .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
  48. border-radius: 0;
  49. }
  50. // Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
  51. .btn-group > .btn:first-child {
  52. margin-left: 0;
  53. &:not(:last-child):not(.dropdown-toggle) {
  54. .border-right-radius(0);
  55. }
  56. }
  57. // Need .dropdown-toggle since :last-child doesn't apply, given that a .dropdown-menu is used immediately after it
  58. .btn-group > .btn:last-child:not(:first-child),
  59. .btn-group > .dropdown-toggle:not(:first-child) {
  60. .border-left-radius(0);
  61. }
  62. // Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
  63. .btn-group > .btn-group {
  64. float: left;
  65. }
  66. .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
  67. border-radius: 0;
  68. }
  69. .btn-group > .btn-group:first-child:not(:last-child) {
  70. > .btn:last-child,
  71. > .dropdown-toggle {
  72. .border-right-radius(0);
  73. }
  74. }
  75. .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
  76. .border-left-radius(0);
  77. }
  78. // On active and open, don't show outline
  79. .btn-group .dropdown-toggle:active,
  80. .btn-group.open .dropdown-toggle {
  81. outline: 0;
  82. }
  83. // Sizing
  84. //
  85. // Remix the default button sizing classes into new ones for easier manipulation.
  86. .btn-group-xs > .btn { &:extend(.btn-xs); }
  87. .btn-group-sm > .btn { &:extend(.btn-sm); }
  88. .btn-group-lg > .btn { &:extend(.btn-lg); }
  89. // Split button dropdowns
  90. // ----------------------
  91. // Give the line between buttons some depth
  92. .btn-group > .btn + .dropdown-toggle {
  93. padding-right: 8px;
  94. padding-left: 8px;
  95. }
  96. .btn-group > .btn-lg + .dropdown-toggle {
  97. padding-right: 12px;
  98. padding-left: 12px;
  99. }
  100. // The clickable button for toggling the menu
  101. // Remove the gradient and set the same inset shadow as the :active state
  102. .btn-group.open .dropdown-toggle {
  103. .box-shadow(inset 0 3px 5px rgba(0, 0, 0, .125));
  104. // Show no shadow for `.btn-link` since it has no other button styles.
  105. &.btn-link {
  106. .box-shadow(none);
  107. }
  108. }
  109. // Reposition the caret
  110. .btn .caret {
  111. margin-left: 0;
  112. }
  113. // Carets in other button sizes
  114. .btn-lg .caret {
  115. border-width: @caret-width-large @caret-width-large 0;
  116. border-bottom-width: 0;
  117. }
  118. // Upside down carets for .dropup
  119. .dropup .btn-lg .caret {
  120. border-width: 0 @caret-width-large @caret-width-large;
  121. }
  122. // Vertical button groups
  123. // ----------------------
  124. .btn-group-vertical {
  125. > .btn,
  126. > .btn-group,
  127. > .btn-group > .btn {
  128. display: block;
  129. float: none;
  130. width: 100%;
  131. max-width: 100%;
  132. }
  133. // Clear floats so dropdown menus can be properly placed
  134. > .btn-group {
  135. &:extend(.clearfix all);
  136. > .btn {
  137. float: none;
  138. }
  139. }
  140. > .btn + .btn,
  141. > .btn + .btn-group,
  142. > .btn-group + .btn,
  143. > .btn-group + .btn-group {
  144. margin-top: -1px;
  145. margin-left: 0;
  146. }
  147. }
  148. .btn-group-vertical > .btn {
  149. &:not(:first-child):not(:last-child) {
  150. border-radius: 0;
  151. }
  152. &:first-child:not(:last-child) {
  153. .border-top-radius(@btn-border-radius-base);
  154. .border-bottom-radius(0);
  155. }
  156. &:last-child:not(:first-child) {
  157. .border-top-radius(0);
  158. .border-bottom-radius(@btn-border-radius-base);
  159. }
  160. }
  161. .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
  162. border-radius: 0;
  163. }
  164. .btn-group-vertical > .btn-group:first-child:not(:last-child) {
  165. > .btn:last-child,
  166. > .dropdown-toggle {
  167. .border-bottom-radius(0);
  168. }
  169. }
  170. .btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
  171. .border-top-radius(0);
  172. }
  173. // Justified button groups
  174. // ----------------------
  175. .btn-group-justified {
  176. display: table;
  177. width: 100%;
  178. table-layout: fixed;
  179. border-collapse: separate;
  180. > .btn,
  181. > .btn-group {
  182. display: table-cell;
  183. float: none;
  184. width: 1%;
  185. }
  186. > .btn-group .btn {
  187. width: 100%;
  188. }
  189. > .btn-group .dropdown-menu {
  190. left: auto;
  191. }
  192. }
  193. // Checkbox and radio options
  194. //
  195. // In order to support the browser's form validation feedback, powered by the
  196. // `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
  197. // `display: none;` or `visibility: hidden;` as that also hides the popover.
  198. // Simply visually hiding the inputs via `opacity` would leave them clickable in
  199. // certain cases which is prevented by using `clip` and `pointer-events`.
  200. // This way, we ensure a DOM element is visible to position the popover from.
  201. //
  202. // See https://github.com/twbs/bootstrap/pull/12794 and
  203. // https://github.com/twbs/bootstrap/pull/14559 for more information.
  204. [data-toggle="buttons"] {
  205. > .btn,
  206. > .btn-group > .btn {
  207. input[type="radio"],
  208. input[type="checkbox"] {
  209. position: absolute;
  210. clip: rect(0, 0, 0, 0);
  211. pointer-events: none;
  212. }
  213. }
  214. }