Merge "jquery.accessKeyLabel: make modifier info public"
[lhc/web/wiklou.git] / resources / src / mediawiki.ui / components / buttons.less
1 @import "mediawiki.mixins";
2 @import "mediawiki.ui/variables";
3 @import "mediawiki.ui/mixins";
4
5 // Buttons
6 //
7 // All buttons start with mw-ui-button class, modified by other classes.
8 // It can be any element. Due to a lack of a CSS reset, the exact styling of
9 // the button depends on what type of element is used.
10 // There are two kinds of buttons, the default is a "Call to Action" with an obvious border
11 // and there is a quiet kind without a border.
12 //
13 // Styleguide 2.
14
15 // Neutral button styling
16 //
17 // These are the main actions on the page/workflow. The page should have only one of progressive, constructive and desctructive buttons, the rest being quiet.
18 //
19 // Markup:
20 // <div>
21 // <button class="mw-ui-button">.mw-ui-button</button>
22 // </div>
23 // <div>
24 // <button class="mw-ui-button" disabled>.mw-ui-button</button>
25 // </div>
26 //
27 // Styleguide 2.1.
28 .mw-ui-button {
29 // Inherit the font rather than apply user agent stylesheet (bug 70072)
30 font-family: inherit;
31 font-size: 1em;
32 // Container layout
33 display: inline-block;
34 padding: .5em 1em;
35 margin: 0;
36 .box-sizing( border-box );
37
38 // Disable weird iOS styling
39 -webkit-appearance: none;
40
41 // IE 6 & 7 hack
42 // https://stackoverflow.com/a/5838575/365238
43 *display: inline;
44 zoom: 1;
45
46 // Container styling
47 .button-colors( #fff, #ccc, #777 );
48 border-radius: @borderRadius;
49 min-width: 4em;
50
51 // Ensure that buttons and inputs are nicely aligned when they have differing heights
52 vertical-align: middle;
53
54 // Content styling
55 text-align: center;
56 font-weight: bold;
57
58 // Interaction styling
59 cursor: pointer;
60
61 &:disabled {
62 text-shadow: none;
63 cursor: default;
64 }
65
66 // Styling for specific button types
67 // -----------------------------------------
68
69 // Big buttons
70 //
71 // Not all buttons are equal. You can emphasise certain actions over others
72 // using the mw-ui-big class.
73 //
74 // Markup:
75 // <div>
76 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
77 // </div>
78 // <div>
79 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
80 // </div>
81 // <div>
82 // <button class="mw-ui-button mw-ui-constructive mw-ui-big">.mw-ui-constructive</button>
83 // </div>
84 // <div>
85 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
86 // </div>
87 //
88 // Styleguide 2.1.6.
89 &.mw-ui-big {
90 font-size: 1.3em;
91 }
92
93 // Block buttons
94 //
95 // Some buttons might need to be stacked.
96 //
97 // Markup:
98 // <div>
99 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
100 // </div>
101 // <div>
102 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
103 // </div>
104 // <div>
105 // <button class="mw-ui-button mw-ui-constructive mw-ui-block">.mw-ui-constructive</button>
106 // </div>
107 // <div>
108 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
109 // </div>
110 //
111 // Styleguide 2.1.5.
112 &.mw-ui-block {
113 display: block;
114 width: 100%;
115 }
116
117 // Progressive buttons
118 //
119 // Use progressive buttons for actions which lead to a next step in the process.
120 // .mw-ui-primary is deprecated, kept for compatibility.
121 //
122 // Markup:
123 // <div>
124 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
125 // </div>
126 // <div>
127 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
128 // </div>
129 //
130 // Styleguide 2.1.1.
131 &.mw-ui-progressive,
132 &.mw-ui-primary {
133 .button-colors( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
134
135 &.mw-ui-quiet {
136 .button-colors-quiet( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
137 }
138 }
139
140 // Constructive buttons
141 //
142 // Use constructive buttons for actions which result in a final action in the process that results
143 // in a change of state.
144 // e.g. save changes button
145 //
146 // Markup:
147 // <div>
148 // <button class="mw-ui-button mw-ui-constructive">.mw-ui-constructive</button>
149 // </div>
150 // <div>
151 // <button class="mw-ui-button mw-ui-constructive" disabled>.mw-ui-constructive</button>
152 // </div>
153 //
154 // Styleguide 2.1.2.
155 &.mw-ui-constructive {
156 .button-colors( @colorConstructive, @colorConstructiveHighlight, @colorConstructiveActive );
157
158 &.mw-ui-quiet {
159 .button-colors-quiet( @colorConstructive, @colorConstructiveHighlight, @colorConstructiveActive );
160 }
161 }
162
163 // Destructive buttons
164 //
165 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
166 // This should not be used for cancel buttons.
167 //
168 // Markup:
169 // <div>
170 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
171 // </div>
172 // <div>
173 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
174 // </div>
175 //
176 // Styleguide 2.1.3.
177 &.mw-ui-destructive {
178 .button-colors( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
179
180 &.mw-ui-quiet {
181 .button-colors-quiet( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
182 }
183 }
184
185 // Quiet buttons
186 //
187 // Use quiet buttons when they are less important and alongside other constructive, progressive or destructive buttons. It should be used for an action that exits the user from the current view/workflow.
188 // Its use is not recommended on mobile/tablet due to lack of hover state.
189 //
190 // Markup:
191 // <div>
192 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
193 // </div>
194 // <div>
195 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet">.mw-ui-constructive</button>
196 // </div>
197 // <div>
198 // <button class="mw-ui-button mw-ui-constructive mw-ui-quiet" disabled>.mw-ui-constructive</button>
199 // </div>
200 // <div>
201 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
202 // </div>
203 // <div>
204 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
205 // </div>
206 // <div>
207 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
208 // </div>
209 // <div>
210 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
211 // </div>
212 //
213 // Styleguide 2.1.4.
214 &.mw-ui-quiet {
215 background: transparent;
216 border: 0;
217 text-shadow: none;
218 .button-colors-quiet( @colorButtonText, @colorButtonTextHighlight, @colorButtonTextActive );
219
220 &:hover,
221 &:focus {
222 box-shadow: none;
223 }
224
225 &:active,
226 &:disabled {
227 background: transparent;
228 }
229 }
230 }
231
232 a.mw-ui-button {
233 text-decoration: none;
234
235 // This overrides an underline declaration on a:hover and a:focus in
236 // commonElements.css, which the class alone isn't specific enough to do.
237 &:hover,
238 &:focus {
239 text-decoration: none;
240 }
241
242 // a-tags behave different to inputs if the line-height attribute is inherited
243 // from another element (e.g. mw-body-content). They appear bigger as input
244 // tags. See Bug T116427. To fix that, apply the correct line-height (used
245 // for inputs) to a-tags, too.
246 line-height: normal;
247 }
248
249 // Button groups
250 //
251 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
252 //
253 // Markup:
254 // <div class="mw-ui-button-group">
255 // <div class="mw-ui-button">A</div>
256 // <div class="mw-ui-button">B</div>
257 // <div class="mw-ui-button">C</div>
258 // <div class="mw-ui-button">D</div>
259 // </div><div style="clear:both"></div>
260 //
261 // Styleguide 2.2.
262 .mw-ui-button-group > * {
263 min-width: 48px;
264 border-radius: 0;
265 float: left;
266
267 &:first-child {
268 border-top-left-radius: @borderRadius;
269 border-bottom-left-radius: @borderRadius;
270 }
271
272 &:not( :first-child ) {
273 border-left: 0;
274 }
275
276 &:last-child{
277 border-top-right-radius: @borderRadius;
278 border-bottom-right-radius: @borderRadius;
279 }
280 }