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