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