blob: e5dd23eb8704c746b4527e4466e5ed8031280237 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
// 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
@mixin menu-bottom-left {
top: 100%;
left: 0;
transform-origin: 0 0;
}
@mixin menu-bottom-right {
right: 0;
left: auto;
transform-origin: 100% 0;
}
.dropdown-menu {
display: block; // utilize transition transform instead of flipping display
padding: .25rem 0;
border: 0;
opacity: 0;
transition: transform $bmd-menu-expand-duration $bmd-animation-curve-default, opacity $bmd-menu-fade-duration $bmd-animation-curve-default;
transform: scale(0);
transform-origin: 0 0;
will-change: transform;
@include media-breakpoint-up(md) {
padding: .5rem 0;
}
.open > & {
//z-index: 999;
opacity: 1;
transform: scale(1);
}
// Default the alignment of the dropdown to originate on the bottom right of the button
@include menu-bottom-right();
// FIXME: bootstrap alignment issue - https://github.com/twbs/bootstrap/issues/18852
&.dropdown-menu-left {
@include menu-bottom-left();
}
&.dropdown-menu-right {
@include 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 {
// used to properly size the ripple container
position: relative;
display: flex;
flex-flow: row wrap;
align-items: center;
min-width: $bmd-menu-item-min-width;
max-width: $bmd-menu-item-max-width;
min-height: $bmd-menu-item-min-height;
padding: $bmd-menu-item-padding-top $bmd-menu-item-padding-right $bmd-menu-item-padding-bottom $bmd-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: $bmd-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: $bmd-menu-item-padding-right-md;
padding-left: $bmd-menu-item-padding-left-md;
}
}
}
// this could be in a .btn-group or .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: $bmd-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: $bmd-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;
}
}
}
|