mediawiki.ui: Move remaining mixin to buttons.less; remove mixins.less
[lhc/web/wiklou.git] / resources / src / mediawiki.ui / components / forms.less
1 // Form elements and layouts
2
3 @import 'mediawiki.mixins';
4 @import 'mediawiki.ui/variables';
5
6 // --------------------------------------------------------------------------
7 // Layouts
8 // --------------------------------------------------------------------------
9
10 // The FancyCaptcha image CAPTCHA used on WMF wikis drives the width of the
11 // 'VForm' design, the form can't be narrower than this.
12 @captchaContainerWidth: 290px;
13 @defaultFormWidth: @captchaContainerWidth;
14
15 // Forms
16 //
17 // Styleguide 5.
18
19 // VForm
20 //
21 // Style a compact vertical stacked form ("VForm") and the elements in divs
22 // within it. See button and inputs section on guidance of how and when to use them.
23 //
24 // Markup:
25 // <form class="mw-ui-vform">
26 // <div class="mw-ui-vform-field">This is a form example.</div>
27 // <div class="mw-ui-vform-field">
28 // <label>Username </label>
29 // <input class="mw-ui-input" value="input">
30 // </div>
31 // <div class="mw-ui-vform-field">
32 // <button class="mw-ui-button mw-ui-progressive">Button in vform</button>
33 // </div>
34 // </form>
35 //
36 // Styleguide 5.1.
37 .mw-ui-vform {
38 .box-sizing( border-box );
39
40 width: @defaultFormWidth;
41
42 // MW currently doesn't use the type attribute everywhere on inputs.
43 select,
44 .mw-ui-button {
45 display: block;
46 .box-sizing( border-box );
47 margin: 0;
48 width: 100%;
49 }
50
51 // Give dropdown lists the same spacing as input fields for consistency.
52 // Values taken from .agora-field-styling() in mixins/form.less
53 select {
54 padding: 0.35em 0.5em;
55 vertical-align: middle;
56 }
57
58 > label {
59 display: block;
60 color: @colorText;
61 .box-sizing( border-box );
62 width: auto;
63 margin: 0 0 0.2em;
64 padding: 0;
65 font-size: 0.9em;
66
67 * {
68 font-weight: normal;
69 }
70 }
71
72 // Override input styling just for checkboxes and radio inputs.
73 input[ type='radio' ] {
74 display: inline;
75 .box-sizing( content-box );
76 width: auto;
77 }
78
79 // Styles for information boxes
80 //
81 // Regular HTMLForm uses .error class, some special pages like
82 // SpecialUserlogin (login and create account) use .errorbox.
83 //
84 // Markup:
85 // <form class="mw-ui-vform">
86 // <div class="errorbox">An error occurred</div>
87 // <div class="warningbox">A warning to be noted</div>
88 // <div class="successbox">Action successful!</div>
89 // <div class="error">A different kind of error</div>
90 // <div class="error">
91 // <ul><li>There are problems with some of your input.</li></ul>
92 // </div>
93 // <div class="mw-ui-vform-field">
94 // <input type="text" value="input" class="mw-ui-input">
95 // </div>
96 // <div class="mw-ui-vform-field">
97 // <select>
98 // <option value="1">Option 1</option>
99 // <option value="2">Option 2</option>
100 // </select>
101 // <span class="error">The value you specified is not a valid option.</span>
102 // </div>
103 // <div class="mw-ui-vform-field">
104 // <button class="mw-ui-button">Button in vform</button>
105 // </div>
106 // </form>
107 //
108 // Styleguide 5.2.
109 .error,
110 .warning,
111 .errorbox,
112 .warningbox,
113 .successbox {
114 .box-sizing( border-box );
115 font-size: 0.9em;
116 margin: 0 0 1em 0;
117 padding: 0.5em;
118 word-wrap: break-word;
119 }
120
121 // Colours taken from those for .errorbox in shared.css
122 .error {
123 color: @colorErrorText;
124 border: 1px solid #fac5c5;
125 background-color: #fae3e3;
126 }
127
128 // Colours taken from those for .warningbox in shared.css
129 .warning {
130 color: @colorWarningText;
131 border: 1px solid #fde29b;
132 background-color: #fdf1d1;
133 }
134
135 // This specifies styling for individual field validation error messages.
136 // Show them below the fields to prevent line break glitches, and leave
137 // some space between the field and the error message box.
138 .mw-ui-vform-field .error {
139 display: block;
140 margin-top: 5px;
141 }
142
143 }
144
145 // --------------------------------------------------------------------------
146 // Elements
147 // --------------------------------------------------------------------------
148
149 // A wrapper for a single form field: the <input> / <select> / <button> element,
150 // help text, labels, associated error/warning/success messages, and so on.
151 // Elements with this class are generated by HTMLFormField in core MediaWiki.
152 //
153 // (We use a broad definition of 'field' here: a purely textual information
154 // block is also a "field".)
155 .mw-ui-vform-field {
156 display: block;
157 margin: 0 0 15px;
158 padding: 0;
159 width: 100%;
160 }
161
162 // Apply mw-ui-label to individual elements to style them.
163 // You generally don't need to use this class if <label> is within an Agora
164 // form container such as mw-ui-vform
165 .mw-ui-label {
166 color: @colorText;
167 font-size: 0.9em;
168
169 * {
170 font-weight: normal;
171 }
172 }