Merge "HTML escape parameter 'text' of hook 'SkinEditSectionLinks'"
[lhc/web/wiklou.git] / resources / src / mediawiki.ui / components / buttons.less
1 @import 'mediawiki.mixins';
2 @import 'mediawiki.ui/mixins.buttons';
3 @import 'mediawiki.ui/variables';
4
5 /* stylelint-disable selector-class-pattern */
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 and destructive 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 background-color: @colorGray15;
30 color: @colorButtonText;
31 // Container layout
32 display: inline-block;
33 .box-sizing( border-box );
34 min-width: 4em;
35 max-width: 28.75em; // equivalent to 460px, @see T95367
36 margin: 0;
37 padding: 0.57142857em 0.9375em; // equivalent to `8px 12px`
38 border: @border-width-base @border-style-base @border-color-base;
39 border-radius: @borderRadius;
40 // Inherit the font rather than apply user agent stylesheet (T72072)
41 font-family: inherit;
42 font-size: 1em;
43 font-weight: bold;
44 line-height: 1;
45 text-align: center;
46 // Disable weird iOS styling
47 -webkit-appearance: none;
48 // IE 6 & 7 hack
49 // https://stackoverflow.com/a/5838575/365238
50 *display: inline; /* stylelint-disable-line declaration-block-no-duplicate-properties */
51 zoom: 1;
52 // Ensure that buttons and inputs are nicely aligned when they have differing heights
53 vertical-align: middle;
54 // Interaction styling
55 cursor: pointer;
56
57 // Make sure that `color` isn't inheriting from user-agent styles
58 &:visited {
59 color: @colorButtonText;
60 }
61
62 &:hover {
63 background-color: @background-color-base;
64 color: @colorGray4;
65 border-color: @colorGray10;
66 }
67
68 &:focus {
69 background-color: @background-color-base;
70 // Make sure that `color` isn't inheriting from user-agent styles
71 color: @colorButtonText;
72 border-color: @colorProgressive;
73 box-shadow: inset 0 0 0 1px @colorProgressive, inset 0 0 0 2px @background-color-base;
74 outline-width: 0;
75
76 // Remove the inner border and padding in Firefox.
77 &::-moz-focus-inner {
78 border-color: transparent;
79 padding: 0;
80 }
81 }
82
83 &:active,
84 &.is-on {
85 background-color: @colorGray12;
86 color: @colorGray1;
87 border-color: @colorGray7;
88 box-shadow: none;
89 }
90
91 &:disabled {
92 background-color: @colorGray12;
93 color: @colorBaseInverted;
94 border-color: @colorGray12;
95 cursor: default;
96
97 // Make sure disabled buttons don't have hover and active states
98 &:hover,
99 &:active {
100 background-color: @colorGray12;
101 color: @colorBaseInverted;
102 box-shadow: none;
103 border-color: @colorGray12;
104 }
105 }
106
107 // `:not()` is used exclusively for `transition`s as both are not supported by IE < 9
108 &:not( :disabled ) {
109 .transition( ~'background-color 100ms, color 100ms, border-color 100ms, box-shadow 100ms' );
110 }
111
112 // Styling for specific button types
113 // -----------------------------------------
114
115 // Quiet buttons
116 //
117 // Use quiet buttons when they are less important and alongside other progressive or destructive buttons. It should be used for an action that exits the user from the current view/workflow.
118 // Its use is not recommended on mobile/tablet due to lack of hover state.
119 //
120 // Markup:
121 // <div>
122 // <button class="mw-ui-button mw-ui-quiet">.mw-ui-button</button>
123 // </div>
124 // <div>
125 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet">.mw-ui-destructive</button>
126 // </div>
127 // <div>
128 // <button class="mw-ui-button mw-ui-destructive mw-ui-quiet" disabled>.mw-ui-destructive</button>
129 // </div>
130 // <div>
131 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet">.mw-ui-progressive</button>
132 // </div>
133 // <div>
134 // <button class="mw-ui-button mw-ui-progressive mw-ui-quiet" disabled>.mw-ui-progressive</button>
135 // </div>
136 //
137 // Styleguide 2.1.1.
138 &.mw-ui-quiet,
139 &.mw-ui-quiet.mw-ui-progressive,
140 &.mw-ui-quiet.mw-ui-destructive {
141 background-color: transparent;
142 // Quiet buttons all start gray, and reveal
143 // progressive/destructive color on hover and active.
144 color: @colorButtonText;
145 border-color: transparent;
146
147 &:hover {
148 background-color: transparent;
149 color: @colorButtonTextHighlight;
150 border-color: transparent;
151 box-shadow: none;
152 }
153
154 &:active {
155 background-color: transparent;
156 color: @colorButtonTextActive;
157 border-color: transparent;
158 }
159
160 &:focus {
161 background-color: transparent;
162 color: @colorButtonText;
163 border-color: transparent;
164 box-shadow: none;
165 }
166
167 &:disabled,
168 &:disabled:hover,
169 &:disabled:active {
170 background-color: transparent;
171 color: @colorDisabledText;
172 border-color: transparent;
173 }
174 }
175
176 // Progressive buttons
177 //
178 // Use progressive buttons for actions which lead to a next step in the process.
179 //
180 // Markup:
181 // <div>
182 // <button class="mw-ui-button mw-ui-progressive">.mw-ui-progressive</button>
183 // </div>
184 // <div>
185 // <button class="mw-ui-button mw-ui-progressive" disabled>.mw-ui-progressive</button>
186 // </div>
187 //
188 // Styleguide 2.1.2.
189 &.mw-ui-progressive {
190 .button-colors-primary( @colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive );
191
192 &.mw-ui-quiet {
193 color: @colorProgressive;
194
195 &:hover {
196 background-color: transparent;
197 color: @colorProgressiveHighlight;
198 }
199
200 &:active {
201 color: @colorProgressiveActive;
202 }
203
204 &:focus {
205 background-color: transparent;
206 color: @colorProgressive;
207 }
208 }
209 }
210
211 // Destructive buttons
212 //
213 // Use destructive buttons for actions that remove or limit, such as deleting a page or blocking a user.
214 // This should not be used for cancel buttons.
215 //
216 // Markup:
217 // <div>
218 // <button class="mw-ui-button mw-ui-destructive">.mw-ui-destructive</button>
219 // </div>
220 // <div>
221 // <button class="mw-ui-button mw-ui-destructive" disabled>.mw-ui-destructive</button>
222 // </div>
223 //
224 // Styleguide 2.1.3.
225 &.mw-ui-destructive {
226 .button-colors-primary( @colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive );
227
228 &.mw-ui-quiet {
229 color: @colorDestructive;
230
231 &:hover {
232 background-color: transparent;
233 color: @colorDestructiveHighlight;
234 }
235
236 &:active {
237 color: @colorDestructiveActive;
238 }
239
240 &:focus {
241 background-color: transparent;
242 color: @colorDestructive;
243 }
244 }
245 }
246
247 // Big buttons
248 //
249 // Not all buttons are equal. You can emphasise certain actions over others
250 // using the mw-ui-big class.
251 //
252 // Markup:
253 // <div>
254 // <button class="mw-ui-button mw-ui-big">.mw-ui-button</button>
255 // </div>
256 // <div>
257 // <button class="mw-ui-button mw-ui-progressive mw-ui-big">.mw-ui-progressive</button>
258 // </div>
259 // <div>
260 // <button class="mw-ui-button mw-ui-destructive mw-ui-big">.mw-ui-destructive</button>
261 // </div>
262 //
263 // Styleguide 2.1.4.
264 &.mw-ui-big {
265 font-size: 1.3em;
266 }
267
268 // Block buttons
269 //
270 // Some buttons might need to be stacked.
271 //
272 // Markup:
273 // <div>
274 // <button class="mw-ui-button mw-ui-block">.mw-ui-button</button>
275 // </div>
276 // <div>
277 // <button class="mw-ui-button mw-ui-progressive mw-ui-block">.mw-ui-progressive</button>
278 // </div>
279 // <div>
280 // <button class="mw-ui-button mw-ui-destructive mw-ui-block">.mw-ui-destructive</button>
281 // </div>
282 //
283 // Styleguide 2.1.5.
284 &.mw-ui-block {
285 display: block;
286 width: 100%;
287 margin-left: auto;
288 margin-right: auto;
289 }
290 }
291
292 input.mw-ui-button,
293 button.mw-ui-button {
294 // Buttons in Firefox have extra height
295 &::-moz-focus-inner {
296 margin-top: -1px;
297 margin-bottom: -1px;
298 }
299 }
300
301 a.mw-ui-button {
302 text-decoration: none;
303
304 // This overrides an underline declaration on a:hover and a:focus in
305 // commonElements.css, which the class alone isn't specific enough to do.
306 &:hover,
307 &:focus {
308 text-decoration: none;
309 }
310 }
311
312 // Button groups
313 //
314 // Group of buttons. Make sure you clear the floating after using a mw-ui-button-group.
315 //
316 // Markup:
317 // <div class="mw-ui-button-group">
318 // <div class="mw-ui-button is-on">A</div>
319 // <div class="mw-ui-button">B</div>
320 // <div class="mw-ui-button">C</div>
321 // <div class="mw-ui-button">D</div>
322 // </div><div style="clear:both"></div>
323 //
324 // Styleguide 2.2.
325 .mw-ui-button-group {
326 & > * {
327 min-width: 48px;
328 border-radius: 0;
329 float: left;
330
331 &:first-child {
332 border-top-left-radius: @borderRadius;
333 border-bottom-left-radius: @borderRadius;
334 }
335
336 &:not( :first-child ) {
337 border-left: 0;
338 }
339
340 &:last-child {
341 border-top-right-radius: @borderRadius;
342 border-bottom-right-radius: @borderRadius;
343 }
344 }
345
346 & .is-on .button {
347 cursor: default;
348 }
349 }