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