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