gitlab-org--gitlab-foss/app/assets/stylesheets/framework/dropdowns.scss
Filipa Lacerda e4f8aa719b Merge branch 'master' into issue-discussions-refactor
* master: (162 commits)
  Since mysql is not a priority anymore, test it less
  Add container registry and spam logs icons
  Fix different Markdown styles
  Backport to CE for:
  Make new dropdown dividers full width
  Bump GITLAB_SHELL_VERSION and GITALY_VERSION to support unhiding refs
  Install yarn via apt in update guides
  Use long curl options
  Remove monkey-patched Array.prototype.first() and last() methods
  Openshift Getting Started
  35659 Rename Pipelines tab to CI / CD in new navigation
  Don't bother going through an entire Banzai pipeline for empty text
  Add active state for pipelines settings on old nav
  Bump rspec to 3.6.0
  Resolve "Specific Async Script Loading by using a Page Variable"
  Revert "Merge branch 'rs-warm-capybara-only-in-ci' into 'master'"
  another rubocop style fix
  Use mixin for new dropdown style
  Migrate Repository#last_commit_for_path to Gitaly
  Migrate blame loading to Gitaly
  ...
2017-08-04 19:38:37 +01:00

783 lines
12 KiB
SCSS

.dropdown {
position: relative;
.btn-link {
&:hover {
cursor: pointer;
}
}
}
@mixin chevron-active {
.fa-chevron-down {
color: $gray-darkest;
}
}
@mixin set-visible {
transform: translateY(0);
visibility: visible;
opacity: 1;
transition-duration: 100ms, 150ms, 25ms;
transition-delay: 35ms, 50ms, 25ms;
}
@mixin set-invisible {
transform: translateY(-10px);
visibility: hidden;
opacity: 0;
transition-property: opacity, transform, visibility;
transition-duration: 70ms, 250ms, 250ms;
transition-timing-function: linear, $dropdown-animation-timing;
transition-delay: 25ms, 50ms, 0ms;
}
.open {
.dropdown-menu,
.dropdown-menu-nav {
@include set-visible;
display: block;
@media (max-width: $screen-xs-max) {
width: 100%;
}
}
.dropdown-toggle,
.dropdown-menu-toggle {
@include chevron-active;
border-color: $gray-darkest;
}
[data-toggle="dropdown"] {
outline: 0;
}
}
.dropdown-toggle {
padding: 6px 8px 6px 10px;
background-color: $white-light;
color: $gl-text-color;
font-size: 14px;
text-align: left;
border: 1px solid $border-color;
border-radius: $border-radius-base;
white-space: nowrap;
&[disabled] {
opacity: .65;
cursor: not-allowed;
}
&.no-outline {
outline: 0;
}
&.large {
width: 200px;
}
&.wide {
width: 100%;
+ .dropdown-select {
width: 100%;
}
}
// Allows dynamic-width text in the dropdown toggle.
// Resizes to allow long text without overflowing the container.
&.dynamic {
width: auto;
min-width: 160px;
max-width: 100%;
padding-right: 25px;
}
.fa {
color: $gray-darkest;
}
.fa-chevron-down {
font-size: $dropdown-chevron-size;
position: relative;
top: -2px;
margin-left: 5px;
}
&:hover {
@include chevron-active;
border-color: $gray-darkest;
}
&:focus:active {
@include chevron-active;
border-color: $dropdown-toggle-active-border-color;
outline: 0;
}
}
.dropdown-menu-toggle {
@extend .dropdown-toggle;
padding-right: 25px;
position: relative;
width: 163px;
text-overflow: ellipsis;
overflow: hidden;
.fa {
position: absolute;
&.fa-spinner {
font-size: 16px;
margin-top: -3px;
}
}
.fa-chevron-down,
.fa-spinner {
position: absolute;
top: 11px;
right: 8px;
}
}
@mixin dropdown-link {
display: block;
position: relative;
padding: 5px 8px;
color: $gl-text-color;
line-height: initial;
border-radius: 2px;
white-space: nowrap;
overflow: hidden;
&:hover,
&:focus,
&.is-focused {
background-color: $dropdown-link-hover-bg;
text-decoration: none;
.badge {
background-color: darken($dropdown-link-hover-bg, 5%);
}
}
&.dropdown-menu-empty-link {
&.is-focused {
background-color: $dropdown-empty-row-bg;
}
}
&.dropdown-menu-user-link {
line-height: 16px;
}
.icon-play {
fill: $gl-text-color-secondary;
margin-right: 6px;
height: 12px;
width: 11px;
}
}
.dropdown-menu,
.dropdown-menu-nav {
@include set-invisible;
display: block;
position: absolute;
width: auto;
top: 100%;
left: 0;
z-index: 9;
min-width: 240px;
max-width: 500px;
margin-top: 2px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
padding: 8px 0;
background-color: $white-light;
border: 1px solid $dropdown-border-color;
border-radius: $border-radius-base;
box-shadow: 0 2px 4px $dropdown-shadow-color;
&.dropdown-open-left {
right: 0;
left: auto;
}
&.is-loading {
.dropdown-content {
display: none;
}
.dropdown-loading {
display: block;
}
}
.shortcut-mappings {
display: none;
}
&.shortcuts .shortcut-mappings {
display: inline-block;
margin-right: 5px;
}
ul {
margin: 0;
padding: 0;
}
li {
text-align: left;
list-style: none;
padding: 0 10px;
}
.divider {
height: 1px;
margin: 6px 10px;
padding: 0;
background-color: $dropdown-divider-color;
}
.separator {
width: 100%;
height: 1px;
margin-top: 8px;
margin-bottom: 8px;
background-color: $dropdown-divider-color;
}
a {
@include dropdown-link;
}
.dropdown-header {
color: $gl-text-color-secondary;
font-size: 13px;
line-height: 22px;
padding: 0 16px;
}
&.capitalize-header .dropdown-header {
text-transform: capitalize;
}
.dropdown-bold-header {
font-weight: 600;
line-height: 22px;
padding: 0 16px;
}
.separator + .dropdown-header,
.separator + .dropdown-bold-header {
padding-top: 2px;
}
.unclickable {
cursor: not-allowed;
padding: 5px 8px;
color: $gl-text-color-secondary;
}
.badge + span:not(.badge) {
// Expects up to 3 digits on the badge
margin-right: 40px;
}
}
.droplab-dropdown {
.dropdown-toggle > i {
pointer-events: none;
}
.dropdown-menu li {
padding: $gl-btn-padding;
cursor: pointer;
> a,
> button {
display: flex;
margin: 0;
padding: 0;
border-radius: 0;
text-overflow: inherit;
background-color: inherit;
color: inherit;
border: inherit;
text-align: left;
&:hover,
&:focus {
background-color: inherit;
color: inherit;
}
&.btn .fa:not(:last-child) {
margin-left: 5px;
}
}
&:hover,
&:focus {
background-color: $dropdown-hover-color;
color: $white-light;
}
&.droplab-item-selected i {
visibility: visible;
}
&.divider {
margin: 0 8px;
padding: 0;
border-top: $gray-darkest;
}
.icon {
visibility: hidden;
}
.description {
display: inline-block;
white-space: normal;
margin-left: 5px;
p {
margin-bottom: 0;
}
}
}
.icon {
display: inline-block;
vertical-align: top;
padding-top: 2px;
}
}
.droplab-dropdown .dropdown-menu,
.droplab-dropdown .dropdown-menu-nav {
display: none;
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.comment-type-dropdown.open .dropdown-menu {
display: block;
}
.filtered-search-box-input-container {
.dropdown-menu,
.dropdown-menu-nav {
max-width: 280px;
}
}
.dropdown-menu-drop-up {
top: auto;
bottom: 100%;
}
.dropdown-menu-large {
width: 340px;
}
.dropdown-menu-no-wrap {
a {
white-space: normal;
}
}
.dropdown-menu-full-width {
width: 100%;
}
.dropdown-menu-paging {
.dropdown-page-two,
.dropdown-menu-back {
display: none;
}
&.is-page-two {
.dropdown-page-one {
display: none;
}
.dropdown-page-two,
.dropdown-menu-back {
display: block;
}
.dropdown-content {
padding: 0 10px;
}
}
}
.dropdown-menu-user {
.avatar {
float: left;
width: 2 * $gl-padding;
height: 2 * $gl-padding;
margin: 0 10px 0 0;
}
}
.dropdown-menu-user-link {
padding-top: 10px;
padding-bottom: 7px;
}
.dropdown-menu-user-full-name {
display: block;
font-weight: 500;
line-height: 16px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.dropdown-menu-user-username {
display: block;
line-height: 16px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.dropdown-select {
width: $dropdown-width;
@media (max-width: $screen-sm-min) {
width: 100%;
}
}
.dropdown-menu-align-right {
left: auto;
right: 0;
margin-top: -5px;
}
.dropdown-menu-selectable {
a {
padding-left: 26px;
position: relative;
&.is-indeterminate,
&.is-active {
font-weight: 600;
color: $gl-text-color;
&::before {
position: absolute;
left: 6px;
top: 50%;
transform: translateY(-50%);
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
&.is-indeterminate::before {
content: "\f068";
}
&.is-active::before {
content: "\f00c";
position: absolute;
top: 50%;
transform: translateY(-50%);
}
}
}
.dropdown-title {
position: relative;
padding: 2px 25px 10px;
margin: 0 10px 10px;
font-weight: 600;
line-height: 1;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
border-bottom: 1px solid $dropdown-divider-color;
overflow: hidden;
}
.dropdown-title-button {
position: absolute;
top: 0;
padding: 0;
color: $dropdown-title-btn-color;
font-size: 14px;
border: 0;
background: none;
outline: 0;
&:hover {
color: darken($dropdown-title-btn-color, 15%);
}
}
.dropdown-menu-close {
right: 5px;
width: 20px;
height: 20px;
top: -1px;
}
.dropdown-menu-back {
left: 7px;
top: 2px;
}
.dropdown-input {
position: relative;
margin-bottom: 10px;
padding: 0 10px;
.fa {
position: absolute;
top: 10px;
right: 20px;
color: $dropdown-input-fa-color;
font-size: 12px;
pointer-events: none;
}
.dropdown-input-clear {
display: none;
cursor: pointer;
pointer-events: all;
right: 22px;
top: 9px;
font-size: 14px;
}
&.has-value {
.dropdown-input-clear {
display: block;
}
.dropdown-input-search {
display: none;
}
}
}
.dropdown-input-field,
.default-dropdown-input {
display: block;
width: 100%;
min-height: 30px;
padding: 0 7px;
color: $dropdown-input-color;
line-height: 30px;
border: 1px solid $dropdown-divider-color;
border-radius: 2px;
outline: 0;
&:focus {
color: $dropdown-link-color;
border-color: $dropdown-input-focus-border;
box-shadow: 0 0 4px $dropdown-input-focus-shadow;
~ .fa {
color: $dropdown-link-color;
}
}
&:hover {
~ .fa {
color: $dropdown-link-color;
}
}
}
.dropdown-content {
max-height: 215px;
overflow-y: auto;
}
.dropdown-info-note {
color: $gl-text-color-secondary;
text-align: center;
}
.dropdown-footer {
padding-top: 10px;
margin-top: 10px;
font-size: 13px;
border-top: 1px solid $dropdown-divider-color;
}
.dropdown-due-date-footer {
padding-top: 0;
margin-left: 10px;
margin-right: 10px;
border-top: 0;
}
.dropdown-footer-list {
font-size: 14px;
a {
cursor: pointer;
padding-left: 10px;
}
}
.dropdown-loading {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: none;
z-index: 9;
background-color: $dropdown-loading-bg;
font-size: 28px;
.fa {
position: absolute;
top: 50%;
left: 50%;
margin-top: -14px;
margin-left: -14px;
}
}
.dropdown-label-box {
position: relative;
top: 3px;
margin-right: 5px;
display: inline-block;
width: 15px;
height: 15px;
border-radius: $border-radius-base;
}
.dropdown-menu-due-date {
.dropdown-content {
max-height: 230px;
}
.pika-single {
position: relative !important;
top: 0 !important;
border: 0;
box-shadow: none;
}
.pika-lendar {
margin-top: -5px;
margin-bottom: 0;
}
}
.dropdown-menu-inner-title {
display: block;
color: $gl-text-color;
font-weight: 600;
}
.dropdown-menu-inner-content {
display: block;
color: $gl-text-color-secondary;
}
.dropdown-toggle-text {
&.is-default {
color: $gl-text-color-secondary;
}
}
.droplab-item-ignore {
pointer-events: none;
}
.pika-single.animate-picker.is-bound,
.pika-single.animate-picker.is-bound.is-hidden {
/*
* Having `!important` is not recommended but
* since `pikaday` sets positioning inline
* there's no way it can be gracefully overridden
* using config options.
*/
position: absolute !important;
display: block;
}
.pika-single.animate-picker.is-bound {
@include set-visible;
}
.pika-single.animate-picker.is-bound.is-hidden {
@include set-invisible;
overflow: hidden;
}
// TODO: change global style and remove mixin
@mixin new-style-dropdown {
.dropdown-menu,
.dropdown-menu-nav {
.divider {
margin: 6px 0;
}
li {
padding: 0 1px;
&.dropdown-header {
padding: 8px 16px;
}
a {
border-radius: 0;
padding: 8px 16px;
&.is-focused,
&:hover,
&:active,
&:focus {
background-color: $gray-darker;
}
&.is-active {
font-weight: inherit;
&::before {
top: 16px;
}
}
}
}
&.dropdown-menu-selectable {
li {
a {
padding: 8px 40px;
&.is-active::before {
left: 16px;
}
}
}
}
}
.dropdown-menu-align-right {
margin-top: 2px;
}
}