mdb-ui-kit/scss/_dropdown.scss

128 lines
3.3 KiB
SCSS
Raw Normal View History

// Menus https://www.google.com/design/spec/components/menus.html#menus-specs
// Dropdown buttons (mobile and desktop) https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons
//%menu-bottom-left {
// top: 100%;
// left: 0;
// transform-origin: 0 0;
//}
//
//%menu-bottom-right {
// right: 0;
// left: auto;
// transform-origin: 100% 0;
//}
.dropdown-menu {
display: block; // utilize transition transform instead of flipping display
padding: .5rem 0;
border: 0;
opacity: 0;
transition: transform $mdb-menu-expand-duration $mdb-animation-curve-default, opacity $mdb-menu-fade-duration $mdb-animation-curve-default;
transform: scale(0);
transform-origin: 0 0;
will-change: transform;
.open > & {
//z-index: 999;
opacity: 1;
transform: scale(1);
}
// Default the alignment on the button to bottom right
//@extend %menu-bottom-right;
// FIXME: bootstrap alignment issue - https://github.com/twbs/bootstrap/issues/18852
// FIXME: once the bug is fixed, want to default origin of menu open to the right of standard buttons
//&.dropdown-menu-left {
// @extend %menu-bottom-left;
//}
//
//&.dropdown-menu-right {
// @extend %menu-bottom-right;
//}
//
//&.dropdown-menu-top-left {
// top: auto;
// bottom: 0; // needs to be overridden with the toggle-button height, see bmd-btn-icon above
// transform-origin: 0 100%;
//}
//
//&.dropdown-menu-top-right {
// top: auto;
// right: 0;
// bottom: 0; // needs to be overridden with the toggle-button height, see bmd-btn-icon above
// left: auto;
// transform-origin: 100% 100%;
//}
// https://www.google.com/design/spec/components/menus.html#menus-specs
.dropdown-item {
display: flex;
flex-flow: row wrap;
min-width: $mdb-menu-item-min-width;
max-width: $mdb-menu-item-max-width;
min-height: $mdb-menu-item-min-height;
align-items: center;
padding-top: $mdb-menu-item-padding-top;
padding-right: $mdb-menu-item-padding-right;
padding-bottom: $mdb-menu-item-padding-bottom;
padding-left: $mdb-menu-item-padding-left;
// FIXME: multi-line menu word wrapping doesn't work - see the maximum width example in menus.md
overflow: hidden;
line-height: $mdb-menu-line-height;
text-overflow: ellipsis;
word-wrap: break-word;
// Simple menus always maintain a 16dp margin (phone) or 24dp margin (tablet) to the left and right edges of the screen.
@include media-breakpoint-up(md) {
padding-right: $mdb-menu-item-padding-right-md;
padding-left: $mdb-menu-item-padding-left-md;
}
}
}
.dropdown {
.dropdown-toggle {
&.bmd-btn-icon,
&.bmd-btn-fab {
// remove the dropdown icon
&::after {
display: none;
}
~ .dropdown-menu {
&.dropdown-menu-top-left,
&.dropdown-menu-top-right {
bottom: $mdb-btn-icon-size; // push up the bottom of the menu the height of the button
}
}
}
&.bmd-btn-fab-sm {
~ .dropdown-menu {
&.dropdown-menu-top-left,
&.dropdown-menu-top-right {
bottom: $mdb-btn-fab-size-sm; // push up the bottom of the menu the height of the button
}
}
}
&.bmd-btn-icon {
~ .dropdown-menu {
// collapse some spacing
margin: 0;
}
}
}
}