UNPKG

4.79 kBSCSSView Raw
1// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
2// Licensed under the Apache License, Version 2.0.
3
4@import "../../common/variables";
5@import "~@blueprintjs/icons/src/icons";
6@import "../../common/mixins";
7
8@import "./common";
9@import "./submenu";
10
11/*
12Menus
13
14Markup:
15<ul class="#{$ns}-menu {{.modifier}} #{$ns}-elevation-1">
16 <li>
17 <a class="#{$ns}-menu-item #{$ns}-icon-people" tabindex="0">Share...</a>
18 </li>
19 <li>
20 <a class="#{$ns}-menu-item #{$ns}-icon-circle-arrow-right" tabindex="0">Move...</a>
21 </li>
22 <li>
23 <a class="#{$ns}-menu-item #{$ns}-icon-edit" tabindex="0">Rename</a>
24 </li>
25 <li class="#{$ns}-menu-divider"></li>
26 <li>
27 <a class="#{$ns}-menu-item #{$ns}-icon-trash #{$ns}-intent-danger" tabindex="0">Delete</a>
28 </li>
29</ul>
30
31.#{$ns}-large - Large size (only supported on <code>.#{$ns}-menu</code>)
32
33Styleguide menu
34*/
35
36.#{$ns}-menu {
37 background: $menu-background-color;
38 border-radius: $pt-border-radius;
39 color: $pt-text-color;
40 list-style: none;
41 margin: 0;
42 min-width: $menu-min-width;
43 padding: $half-grid-size;
44 text-align: left;
45}
46
47.#{$ns}-menu-divider {
48 @include menu-divider();
49}
50
51.#{$ns}-menu-item {
52 @include menu-item();
53 @include menu-item-intent();
54
55 &::before {
56 // support pt-icon-* classes directly on this element
57 @include pt-icon();
58 margin-right: $menu-item-padding;
59 }
60
61 &::before,
62 > .#{$ns}-icon {
63 color: $pt-icon-color;
64 margin-top: ($menu-item-line-height - $pt-icon-size-standard) / 2;
65 }
66
67 .#{$ns}-menu-item-label {
68 color: $pt-text-color-muted;
69 }
70
71 &:hover {
72 color: inherit;
73 }
74
75 &.#{$ns}-active,
76 &:active {
77 background-color: $menu-item-color-active;
78 }
79
80 // pt-disable always overrides over styles
81 /* stylelint-disable declaration-no-important */
82 &.#{$ns}-disabled {
83 background-color: inherit !important;
84 color: $pt-text-color-disabled !important;
85 cursor: not-allowed !important;
86 // override global a:focus styles
87 outline: none !important;
88
89 &::before,
90 > .#{$ns}-icon,
91 .#{$ns}-menu-item-label {
92 color: $pt-icon-color-disabled !important;
93 }
94 }
95 /* stylelint-enable declaration-no-important */
96
97 .#{$ns}-large & {
98 @include menu-item-large();
99
100 .#{$ns}-icon {
101 // SVG icons remain standard size when menu is large
102 margin-top: ($menu-item-line-height-large - $pt-icon-size-standard) / 2;
103 }
104
105 &::before {
106 @include pt-icon($pt-icon-size-large);
107 margin-right: $menu-item-padding-large;
108 margin-top: ($menu-item-line-height-large - $pt-icon-size-large) / 2;
109 }
110 }
111}
112
113button.#{$ns}-menu-item {
114 background: none;
115 border: none;
116 text-align: left;
117 width: 100%;
118}
119
120/*
121Menu headers
122
123Markup:
124<ul class="#{$ns}-menu #{$ns}-elevation-1">
125 <li class="#{$ns}-menu-header"><h6 class="#{$ns}-heading">Layouts</h6></li>
126 <li><button type="button" class="#{$ns}-menu-item #{$ns}-icon-layout-auto">Auto</button></li>
127 <li><button type="button" class="#{$ns}-menu-item #{$ns}-icon-layout-circle">Circle</button></li>
128 <li><button type="button" class="#{$ns}-menu-item #{$ns}-icon-layout-grid">Grid</button></li>
129 <li class="#{$ns}-menu-header"><h6 class="#{$ns}-heading">Views</h6></li>
130 <li><button type="button" class="#{$ns}-menu-item #{$ns}-icon-history">History</button></li>
131 <li><button type="button" class="#{$ns}-menu-item #{$ns}-icon-star">Favorites</button></li>
132 <li><button type="button" class="#{$ns}-menu-item #{$ns}-icon-envelope">Messages</button></li>
133</ul>
134
135Styleguide menu-header
136*/
137
138.#{$ns}-menu-header {
139 @include menu-header($heading-selector: "> h6");
140
141 .#{$ns}-large & {
142 @include menu-header-large($heading-selector: "> h6");
143 }
144}
145
146// dark theme
147.#{$ns}-dark {
148 .#{$ns}-menu {
149 background: $dark-menu-background-color;
150 color: $pt-dark-text-color;
151 }
152
153 .#{$ns}-menu-item {
154 @include menu-item-intent($pt-dark-intent-text-colors);
155
156 &::before,
157 > .#{$ns}-icon {
158 color: $pt-dark-icon-color;
159 }
160
161 .#{$ns}-menu-item-label {
162 color: $pt-dark-text-color-muted;
163 }
164
165 &.#{$ns}-active,
166 &:active {
167 background-color: $dark-menu-item-color-active;
168 }
169
170 // pt-disable always overrides over styles
171 /* stylelint-disable declaration-no-important */
172 &.#{$ns}-disabled {
173 color: $pt-dark-text-color-disabled !important;
174
175 &::before,
176 > .#{$ns}-icon,
177 .#{$ns}-menu-item-label {
178 color: $pt-dark-icon-color-disabled !important;
179 }
180 }
181 /* stylelint-enable declaration-no-important */
182 }
183
184 .#{$ns}-menu-divider,
185 .#{$ns}-menu-header {
186 border-color: $pt-dark-divider-white;
187 }
188
189 .#{$ns}-menu-header > h6 {
190 color: $pt-dark-heading-color;
191 }
192}
193
194// #402 support menu inside label
195.#{$ns}-label .#{$ns}-menu {
196 margin-top: $pt-grid-size / 2;
197}