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 "../forms/common";
|
6 | @import "./common";
|
7 |
|
8 | /*
|
9 | Button groups
|
10 |
|
11 | Markup:
|
12 | <div class="#{$ns}-button-group {{.modifier}}">
|
13 | <button type="button" class="#{$ns}-button #{$ns}-intent-success">Save</button>
|
14 | <button type="button" class="#{$ns}-button #{$ns}-intent-success #{$ns}-icon-caret-down"></button>
|
15 | </div>
|
16 | <div class="#{$ns}-button-group {{.modifier}}">
|
17 | <a class="#{$ns}-button #{$ns}-icon-database" tabindex="0" role="button">Queries</a>
|
18 | <a class="#{$ns}-button #{$ns}-icon-function" tabindex="0" role="button">Functions</a>
|
19 | <a class="#{$ns}-button" tabindex="0" role="button">
|
20 | Options <span class="#{$ns}-icon-standard #{$ns}-icon-caret-down #{$ns}-align-right"></span>
|
21 | </a>
|
22 | </div>
|
23 | <div class="#{$ns}-button-group {{.modifier}}">
|
24 | <a class="#{$ns}-button #{$ns}-icon-chart" tabindex="0" role="button"></a>
|
25 | <a class="#{$ns}-button #{$ns}-icon-control" tabindex="0" role="button"></a>
|
26 | <a class="#{$ns}-button #{$ns}-icon-graph" tabindex="0" role="button"></a>
|
27 | <a class="#{$ns}-button #{$ns}-icon-camera" tabindex="0" role="button"></a>
|
28 | <a class="#{$ns}-button #{$ns}-icon-map" tabindex="0" role="button"></a>
|
29 | <a class="#{$ns}-button #{$ns}-icon-code" tabindex="0" role="button"></a>
|
30 | <a class="#{$ns}-button #{$ns}-icon-th" tabindex="0" role="button"></a>
|
31 | <a class="#{$ns}-button #{$ns}-icon-time" tabindex="0" role="button"></a>
|
32 | <a class="#{$ns}-button #{$ns}-icon-compressed" tabindex="0" role="button"></a>
|
33 | </div>
|
34 |
|
35 | .#{$ns}-fill - Buttons expand equally to fill container
|
36 | .#{$ns}-large - Use large buttons
|
37 | .#{$ns}-minimal - Use minimal buttons
|
38 | .#{$ns}-vertical - Vertical layout
|
39 |
|
40 | Styleguide button-group
|
41 | */
|
42 |
|
43 | .#{$ns}-button-group {
|
44 | display: inline-flex;
|
45 |
|
46 | .#{$ns}-button {
|
47 | // ensure button can never be smaller than its default size
|
48 | flex: 0 0 auto;
|
49 | position: relative;
|
50 | z-index: index($control-group-stack, "button-default");
|
51 |
|
52 | // the ordering of these z-index CSS rules is particular because of CSS
|
53 | // selector specificity. specifically, disabled styles should have
|
54 | // precedence over hover and active styles to prevent mouse interactions on
|
55 | // disabled buttons from reordering elements in the stack.
|
56 |
|
57 | &:focus {
|
58 | z-index: index($control-group-stack, "button-focus");
|
59 | }
|
60 |
|
61 | &:hover {
|
62 | z-index: index($control-group-stack, "button-hover");
|
63 | }
|
64 |
|
65 | &:active,
|
66 | &.#{$ns}-active {
|
67 | z-index: index($control-group-stack, "button-active");
|
68 | }
|
69 |
|
70 | &:disabled,
|
71 | &.#{$ns}-disabled {
|
72 | z-index: index($control-group-stack, "button-disabled");
|
73 | }
|
74 |
|
75 | &[class*="#{$ns}-intent-"] {
|
76 | z-index: index($control-group-stack, "intent-button-default");
|
77 |
|
78 | &:focus {
|
79 | z-index: index($control-group-stack, "intent-button-focus");
|
80 | }
|
81 |
|
82 | &:hover {
|
83 | z-index: index($control-group-stack, "intent-button-hover");
|
84 | }
|
85 |
|
86 | &:active,
|
87 | &.#{$ns}-active {
|
88 | z-index: index($control-group-stack, "intent-button-active");
|
89 | }
|
90 |
|
91 | &:disabled,
|
92 | &.#{$ns}-disabled {
|
93 | z-index: index($control-group-stack, "intent-button-disabled");
|
94 | }
|
95 | }
|
96 | }
|
97 |
|
98 | // support wrapping buttons in a tooltip, which adds a wrapper element
|
99 | &:not(.#{$ns}-minimal) {
|
100 | > .#{$ns}-popover-wrapper:not(:first-child) .#{$ns}-button,
|
101 | > .#{$ns}-button:not(:first-child) {
|
102 | border-bottom-left-radius: 0;
|
103 | border-top-left-radius: 0;
|
104 | }
|
105 |
|
106 | > .#{$ns}-popover-wrapper:not(:last-child) .#{$ns}-button,
|
107 | > .#{$ns}-button:not(:last-child) {
|
108 | border-bottom-right-radius: 0;
|
109 | border-top-right-radius: 0;
|
110 | margin-right: -$button-border-width;
|
111 | }
|
112 | }
|
113 |
|
114 | &.#{$ns}-minimal {
|
115 | .#{$ns}-button {
|
116 | @include pt-button-minimal();
|
117 | }
|
118 | }
|
119 |
|
120 | .#{$ns}-popover-wrapper,
|
121 | .#{$ns}-popover-target {
|
122 | display: flex;
|
123 | flex: 1 1 auto;
|
124 | }
|
125 |
|
126 | /*
|
127 | Responsive
|
128 |
|
129 | Markup:
|
130 | <div class="#{$ns}-button-group #{$ns}-large #{$ns}-fill">
|
131 | <a class="#{$ns}-button #{$ns}-intent-primary #{$ns}-fixed" tabindex="0" role="button">Start</a>
|
132 | <a class="#{$ns}-button #{$ns}-intent-primary" tabindex="0" role="button">Left</a>
|
133 | <a class="#{$ns}-button #{$ns}-intent-primary #{$ns}-active" tabindex="0" role="button">Middle</a>
|
134 | <a class="#{$ns}-button #{$ns}-intent-primary" tabindex="0" role="button">Right</a>
|
135 | <a class="#{$ns}-button #{$ns}-intent-primary #{$ns}-fixed" tabindex="0" role="button">End</a>
|
136 | </div>
|
137 | <br />
|
138 | <div class="#{$ns}-button-group #{$ns}-fill">
|
139 | <button class="#{$ns}-button #{$ns}-icon-arrow-left"></button>
|
140 | <button class="#{$ns}-button #{$ns}-fill">Middle</button>
|
141 | <button class="#{$ns}-button #{$ns}-icon-arrow-right"></button>
|
142 | </div>
|
143 |
|
144 | Styleguide button-group}-fill
|
145 | */
|
146 |
|
147 | &.#{$ns}-fill {
|
148 | display: flex;
|
149 | width: 100%;
|
150 | }
|
151 |
|
152 | .#{$ns}-button.#{$ns}-fill,
|
153 | &.#{$ns}-fill .#{$ns}-button:not(.#{$ns}-fixed) {
|
154 | flex: 1 1 auto;
|
155 | }
|
156 |
|
157 | /*
|
158 | Vertical button groups
|
159 |
|
160 | Markup:
|
161 | <div class="#{$ns}-button-group #{$ns}-vertical">
|
162 | <a class="#{$ns}-button #{$ns}-icon-search-template" role="button" tabindex="0"></a>
|
163 | <a class="#{$ns}-button #{$ns}-icon-zoom-in" role="button" tabindex="0"></a>
|
164 | <a class="#{$ns}-button #{$ns}-icon-zoom-out" role="button" tabindex="0"></a>
|
165 | <a class="#{$ns}-button #{$ns}-icon-zoom-to-fit" role="button" tabindex="0"></a>
|
166 | </div>
|
167 | <div class="#{$ns}-button-group #{$ns}-vertical">
|
168 | <button type="button" class="#{$ns}-button #{$ns}-active">Home</button>
|
169 | <button type="button" class="#{$ns}-button">Pages</button>
|
170 | <button type="button" class="#{$ns}-button">Blog</button>
|
171 | <button type="button" class="#{$ns}-button">Calendar</button>
|
172 | </div>
|
173 | <div class="#{$ns}-button-group #{$ns}-vertical #{$ns}-align-left #{$ns}-large">
|
174 | <button type="button" class="#{$ns}-button #{$ns}-intent-primary #{$ns}-icon-document">Text</button>
|
175 | <button type="button" class="#{$ns}-button #{$ns}-intent-primary #{$ns}-icon-media #{$ns}-active">Media</button>
|
176 | <button type="button" class="#{$ns}-button #{$ns}-intent-primary #{$ns}-icon-link">Sources</button>
|
177 | </div>
|
178 |
|
179 | Styleguide button-group-vertical
|
180 | */
|
181 |
|
182 | &.#{$ns}-vertical {
|
183 | align-items: stretch;
|
184 | flex-direction: column;
|
185 | vertical-align: top;
|
186 |
|
187 | &.#{$ns}-fill {
|
188 | height: 100%;
|
189 | width: unset;
|
190 | }
|
191 |
|
192 | .#{$ns}-button {
|
193 | // we never want that margin-right when vertical
|
194 | margin-right: 0 ; /* stylelint-disable-line declaration-no-important */
|
195 | // needed to ensure buttons take up the full width when wrapped in a Popover:
|
196 | width: 100%;
|
197 | }
|
198 |
|
199 | &:not(.#{$ns}-minimal) {
|
200 | > .#{$ns}-popover-wrapper:first-child .#{$ns}-button,
|
201 | > .#{$ns}-button:first-child {
|
202 | border-radius: $pt-border-radius $pt-border-radius 0 0;
|
203 | }
|
204 |
|
205 | > .#{$ns}-popover-wrapper:last-child .#{$ns}-button,
|
206 | > .#{$ns}-button:last-child {
|
207 | border-radius: 0 0 $pt-border-radius $pt-border-radius;
|
208 | }
|
209 |
|
210 | > .#{$ns}-popover-wrapper:not(:last-child) .#{$ns}-button,
|
211 | > .#{$ns}-button:not(:last-child) {
|
212 | margin-bottom: -$button-border-width;
|
213 | }
|
214 | }
|
215 | }
|
216 |
|
217 | &.#{$ns}-align-left .#{$ns}-button {
|
218 | text-align: left;
|
219 | }
|
220 |
|
221 | .#{$ns}-dark & {
|
222 | // support wrapping buttons in a Blueprint.Tooltip, which adds a wrapper element
|
223 | // in dark theme, we adjust the spacing between buttons for best visual results
|
224 | &:not(.#{$ns}-minimal) {
|
225 | // deeply nested selector necessary to target the appropriate popover
|
226 | // wrapper, yet ensure we only style buttons within the target.
|
227 | > .#{$ns}-popover-wrapper:not(:last-child) .#{$ns}-button,
|
228 | > .#{$ns}-button:not(:last-child) {
|
229 | margin-right: $button-border-width;
|
230 | }
|
231 | }
|
232 |
|
233 | &.#{$ns}-vertical {
|
234 | > .#{$ns}-popover-wrapper:not(:last-child) .#{$ns}-button,
|
235 | > .#{$ns}-button:not(:last-child) {
|
236 | margin-bottom: $button-border-width;
|
237 | }
|
238 | }
|
239 | }
|
240 | }
|