-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy path_patterns_contextual-menu.scss
113 lines (95 loc) · 2.62 KB
/
_patterns_contextual-menu.scss
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
@import 'settings';
@mixin vf-p-contextual-menu {
%p-contextual-menu {
display: inline-block;
margin: 0;
position: relative;
}
.p-contextual-menu {
@extend %p-contextual-menu;
}
// Dropdown element for contextual menu
.p-contextual-menu__dropdown {
@extend %vf-has-box-shadow;
background: $colors--theme--background-default;
display: none;
margin: 0;
max-width: 21rem;
min-width: 10rem;
padding: 0;
position: absolute;
right: 0;
width: fit-content;
z-index: 9; // to appear below main navigation dropdowns (that use z-index: 10)
// When set to false will show the contextual menu
&[aria-hidden='false'] {
display: block;
}
}
// Alignment extension to align the menu to the left
.p-contextual-menu--left {
@extend %p-contextual-menu;
.p-contextual-menu__dropdown {
left: 0;
}
}
// Alignment extension to align the menu to the center of the parent
.p-contextual-menu--center {
@extend %p-contextual-menu;
.p-contextual-menu__dropdown {
left: 50%;
// stylelint-disable property-no-vendor-prefix
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
// stylelint-enable property-no-vendor-prefix
}
}
.p-contextual-menu__group {
display: block;
+ .p-contextual-menu__group {
border-top-color: $colors--theme--border-default;
border-top-style: solid;
border-top-width: $input-border-thickness;
margin: -$input-border-thickness 0 0 0;
}
}
.p-contextual-menu__link {
@include vf-focus-themed;
border: 0;
clear: both;
display: block;
margin: 0;
overflow: hidden;
padding: $spv--x-small $sph--large;
text-align: left;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
&,
&:active,
&:hover,
&:visited {
background-color: transparent;
color: $colors--theme--text-default;
}
&:hover {
background-color: $colors--theme--background-hover;
text-decoration: none;
}
&:active {
background-color: $colors--theme--background-active;
cursor: default;
}
}
.p-contextual-menu__toggle {
// All buttons have a margin right, unless they are a last child.
// In cases where contextual menu toggle is a button, we do not want it to
// have a margin, but since it is never the last child in this pattern,
// so we need to remove the margin.
// https://github.com/canonical/vanilla-framework/pull/3584
margin-right: 0;
&[aria-expanded='true'] .p-contextual-menu__indicator {
transform: rotate(180deg);
}
}
}