arrfab / centos / centos.org

Forked from centos/centos.org 3 years ago
Clone

Blame content/assets/css/bootstrap/_button-groups.scss

e8ec7a
//
e8ec7a
// Button groups
e8ec7a
// --------------------------------------------------
e8ec7a
e8ec7a
// Button carets
e8ec7a
//
e8ec7a
// Match the button text color to the arrow/caret for indicating dropdown-ness.
e8ec7a
e8ec7a
.caret {
e8ec7a
  .btn-default & {
e8ec7a
    border-top-color: $btn-default-color;
e8ec7a
  }
e8ec7a
  .btn-primary &,
e8ec7a
  .btn-success &,
e8ec7a
  .btn-warning &,
e8ec7a
  .btn-danger &,
e8ec7a
  .btn-info & {
e8ec7a
    border-top-color: #fff;
e8ec7a
  }
e8ec7a
}
e8ec7a
.dropup {
e8ec7a
  & .btn-default .caret {
e8ec7a
    border-bottom-color: $btn-default-color;
e8ec7a
  }
e8ec7a
  .btn-primary,
e8ec7a
  .btn-success,
e8ec7a
  .btn-warning,
e8ec7a
  .btn-danger,
e8ec7a
  .btn-info {
e8ec7a
   .caret {
e8ec7a
      border-bottom-color: #fff;
e8ec7a
    }
e8ec7a
  }
e8ec7a
}
e8ec7a
e8ec7a
// Make the div behave like a button
e8ec7a
.btn-group,
e8ec7a
.btn-group-vertical {
e8ec7a
  position: relative;
e8ec7a
  display: inline-block;
e8ec7a
  vertical-align: middle; // match .btn alignment given font-size hack above
e8ec7a
  > .btn {
e8ec7a
    position: relative;
e8ec7a
    float: left;
e8ec7a
    // Bring the "active" button to the front
e8ec7a
    &:hover,
e8ec7a
    &:focus,
e8ec7a
    &:active,
e8ec7a
    &.active {
e8ec7a
      z-index: 2;
e8ec7a
    }
e8ec7a
    &:focus {
e8ec7a
      // Remove focus outline when dropdown JS adds it after closing the menu
e8ec7a
      outline: none;
e8ec7a
    }
e8ec7a
  }
e8ec7a
}
e8ec7a
e8ec7a
// Prevent double borders when buttons are next to each other
e8ec7a
.btn-group {
e8ec7a
  .btn + .btn,
e8ec7a
  .btn + .btn-group,
e8ec7a
  .btn-group + .btn,
e8ec7a
  .btn-group + .btn-group {
e8ec7a
    margin-left: -1px;
e8ec7a
  }
e8ec7a
}
e8ec7a
e8ec7a
// Optional: Group multiple button groups together for a toolbar
e8ec7a
.btn-toolbar {
e8ec7a
  @include clearfix();
e8ec7a
e8ec7a
  .btn-group {
e8ec7a
    float: left;
e8ec7a
  }
e8ec7a
  // Space out series of button groups
e8ec7a
  > .btn,
e8ec7a
  > .btn-group {
e8ec7a
    + .btn,
e8ec7a
    + .btn-group {
e8ec7a
      margin-left: 5px;
e8ec7a
    }
e8ec7a
  }
e8ec7a
}
e8ec7a
e8ec7a
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
e8ec7a
  border-radius: 0;
e8ec7a
}
e8ec7a
e8ec7a
// 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
e8ec7a
.btn-group > .btn:first-child {
e8ec7a
  margin-left: 0;
e8ec7a
  &:not(:last-child):not(.dropdown-toggle) {
e8ec7a
    @include border-right-radius(0);
e8ec7a
  }
e8ec7a
}
e8ec7a
// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
e8ec7a
.btn-group > .btn:last-child:not(:first-child),
e8ec7a
.btn-group > .dropdown-toggle:not(:first-child) {
e8ec7a
  @include border-left-radius(0);
e8ec7a
}
e8ec7a
e8ec7a
// Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
e8ec7a
.btn-group > .btn-group {
e8ec7a
  float: left;
e8ec7a
}
e8ec7a
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
e8ec7a
  border-radius: 0;
e8ec7a
}
e8ec7a
.btn-group > .btn-group:first-child {
e8ec7a
  > .btn:last-child,
e8ec7a
  > .dropdown-toggle {
e8ec7a
    @include border-right-radius(0);
e8ec7a
  }
e8ec7a
}
e8ec7a
.btn-group > .btn-group:last-child > .btn:first-child {
e8ec7a
  @include border-left-radius(0);
e8ec7a
}
e8ec7a
e8ec7a
// On active and open, don't show outline
e8ec7a
.btn-group .dropdown-toggle:active,
e8ec7a
.btn-group.open .dropdown-toggle {
e8ec7a
  outline: 0;
e8ec7a
}
e8ec7a
e8ec7a
e8ec7a
// Sizing
e8ec7a
//
e8ec7a
// Remix the default button sizing classes into new ones for easier manipulation.
e8ec7a
e8ec7a
.btn-group-xs > .btn { @extend .btn-xs; }
e8ec7a
.btn-group-sm > .btn { @extend .btn-sm; }
e8ec7a
.btn-group-lg > .btn { @extend .btn-lg; }
e8ec7a
e8ec7a
e8ec7a
// Split button dropdowns
e8ec7a
// ----------------------
e8ec7a
e8ec7a
// Give the line between buttons some depth
e8ec7a
.btn-group > .btn + .dropdown-toggle {
e8ec7a
  padding-left: 8px;
e8ec7a
  padding-right: 8px;
e8ec7a
}
e8ec7a
.btn-group > .btn-lg + .dropdown-toggle {
e8ec7a
  padding-left: 12px;
e8ec7a
  padding-right: 12px;
e8ec7a
}
e8ec7a
e8ec7a
// The clickable button for toggling the menu
e8ec7a
// Remove the gradient and set the same inset shadow as the :active state
e8ec7a
.btn-group.open .dropdown-toggle {
e8ec7a
  @include box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
e8ec7a
}
e8ec7a
e8ec7a
e8ec7a
// Reposition the caret
e8ec7a
.btn .caret {
e8ec7a
  margin-left: 0;
e8ec7a
}
e8ec7a
// Carets in other button sizes
e8ec7a
.btn-lg .caret {
e8ec7a
  border-width: $caret-width-large $caret-width-large 0;
e8ec7a
  border-bottom-width: 0;
e8ec7a
}
e8ec7a
// Upside down carets for .dropup
e8ec7a
.dropup .btn-lg .caret {
e8ec7a
  border-width: 0 $caret-width-large $caret-width-large;
e8ec7a
}
e8ec7a
e8ec7a
e8ec7a
// Vertical button groups
e8ec7a
// ----------------------
e8ec7a
e8ec7a
.btn-group-vertical {
e8ec7a
  > .btn,
e8ec7a
  > .btn-group {
e8ec7a
    display: block;
e8ec7a
    float: none;
e8ec7a
    width: 100%;
e8ec7a
    max-width: 100%;
e8ec7a
  }
e8ec7a
e8ec7a
  // Clear floats so dropdown menus can be properly placed
e8ec7a
  > .btn-group {
e8ec7a
    @include clearfix();
e8ec7a
    > .btn {
e8ec7a
      float: none;
e8ec7a
    }
e8ec7a
  }
e8ec7a
e8ec7a
  > .btn + .btn,
e8ec7a
  > .btn + .btn-group,
e8ec7a
  > .btn-group + .btn,
e8ec7a
  > .btn-group + .btn-group {
e8ec7a
    margin-top: -1px;
e8ec7a
    margin-left: 0;
e8ec7a
  }
e8ec7a
}
e8ec7a
e8ec7a
.btn-group-vertical > .btn {
e8ec7a
  &:not(:first-child):not(:last-child) {
e8ec7a
    border-radius: 0;
e8ec7a
  }
e8ec7a
  &:first-child:not(:last-child) {
e8ec7a
    border-top-right-radius: $border-radius-base;
e8ec7a
    @include border-bottom-radius(0);
e8ec7a
  }
e8ec7a
  &:last-child:not(:first-child) {
e8ec7a
    border-bottom-left-radius: $border-radius-base;
e8ec7a
    @include border-top-radius(0);
e8ec7a
  }
e8ec7a
}
e8ec7a
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
e8ec7a
  border-radius: 0;
e8ec7a
}
e8ec7a
.btn-group-vertical > .btn-group:first-child {
e8ec7a
  > .btn:last-child,
e8ec7a
  > .dropdown-toggle {
e8ec7a
    @include border-bottom-radius(0);
e8ec7a
  }
e8ec7a
}
e8ec7a
.btn-group-vertical > .btn-group:last-child > .btn:first-child {
e8ec7a
  @include border-top-radius(0);
e8ec7a
}
e8ec7a
e8ec7a
e8ec7a
e8ec7a
// Justified button groups
e8ec7a
// ----------------------
e8ec7a
e8ec7a
.btn-group-justified {
e8ec7a
  display: table;
e8ec7a
  width: 100%;
e8ec7a
  table-layout: fixed;
e8ec7a
  border-collapse: separate;
e8ec7a
  .btn {
e8ec7a
    float: none;
e8ec7a
    display: table-cell;
e8ec7a
    width: 1%;
e8ec7a
  }
e8ec7a
}
e8ec7a
e8ec7a
e8ec7a
// Checkbox and radio options
e8ec7a
[data-toggle="buttons"] > .btn > input[type="radio"],
e8ec7a
[data-toggle="buttons"] > .btn > input[type="checkbox"] {
e8ec7a
  display: none;
e8ec7a
}