1 // Form elements and layouts
3 @import "mediawiki.mixins";
4 @import "../../mixins/utilities";
5 @import "../../mixins/forms";
7 // --------------------------------------------------------------------------
9 // --------------------------------------------------------------------------
11 // The FancyCaptcha image CAPTCHA used on WMF wikis drives the width of the
12 // 'VForm' design, the form can't be narrower than this.
13 @captchaContainerWidth: 290px;
14 @defaultFormWidth: @captchaContainerWidth;
22 // Style a compact vertical stacked form ("VForm") and the elements in divs
23 // within it. See button section on guidance of how and when to use mw-ui-constructive.
26 // <form class="mw-ui-vform">
27 // <div class="mw-ui-vform-div">This is a form example.</div>
28 // <div class="mw-ui-vform-div">
29 // <label>Username </label>
30 // <input value="input">
33 // <button class="mw-ui-button mw-ui-constructive">Button in vform</button>
39 .box-sizing(border-box);
41 width: @defaultFormWidth;
43 // Immediate divs in a vform are block and spaced-out.
44 // XXX: We shouldn't depend on the tag name here...
52 // MW currently doesn't use the type attribute everywhere on inputs.
57 .box-sizing(border-box);
62 // We exclude buttons because they'll generally use mw-ui-button.
63 // Otherwise, we'll unintentionally override that.
64 input:not([type=button]):not([type=submit]):not([type=file]) {
65 .agora-field-styling(); // mixins/forms.less
68 // Give dropdown lists the same spacing as input fields for consistency.
69 // Values taken from .agora-field-styling() in mixins/form.less
71 padding: 0.35em 0.5em 0.35em 0.5em;
72 vertical-align: middle;
77 .box-sizing(border-box);
78 .agora-label-styling();
84 // Override input styling just for checkboxes and radio inputs.
85 input[type="checkbox"],
88 .box-sizing(content-box);
93 // Styles for information boxes
95 // Regular HTMLForm uses .error class, some special pages like
96 // SpecialUserlogin (login and create account) use .errorbox.
99 // <form class="mw-ui-vform">
100 // <div class="errorbox">An error occurred</div>
101 // <div class="warningbox">A warning to be noted</div>
102 // <div class="successbox">Action successful!</div>
103 // <div class="error">A different kind of error</div>
104 // <div class="error">
105 // <ul><li>There are problems with some of your input.</li></ul>
107 // <div class="mw-ui-vform-div">
108 // <input type="text" value="input" class="mw-ui-input">
110 // <div class="mw-ui-vform-div">
112 // <option value="1">Option 1</option>
113 // <option value="2">Option 2</option>
115 // <span class="error">The value you specified is not a valid option.</span>
118 // <button class="mw-ui-button">Button in vform</button>
127 .box-sizing(border-box);
131 word-wrap: break-word;
134 // Colours taken from those for .errorbox in skins/common/shared.css
137 border: 1px solid #fac5c5;
138 background-color: #fae3e3;
139 text-shadow: 0 1px #fae3e3;
142 // This specifies styling for individual field validation error messages.
143 // Show them below the fields to prevent line break glitches, and leave
144 // some space between the field and the error message box.
145 .mw-ui-vform-div .error {
152 // --------------------------------------------------------------------------
154 // --------------------------------------------------------------------------
156 // Apply this to individual elements to style them.
157 // You generally don't need to use this class on divs within an Agora
158 // form container such as mw-ui-vform
159 // XXX DRY: This repeats earlier styling, use an @include agora-div-styling ?
160 // XXX: What is this even for?
168 // Apply mw-ui-input to individual input fields to style them.
169 // You generally don't need to use this class if <input> is within an Agora
170 // form container such as mw-ui-vform
172 .agora-field-styling(); // mixins/forms.less
175 // Apply mw-ui-label to individual elements to style them.
176 // You generally don't need to use this class if <label> is within an Agora
177 // form container such as mw-ui-vform
179 .agora-label-styling(); // mixins/forms.less
182 // Nesting an input checkbox or radio button inside a label with this class
183 // improves alignment, e.g.
184 // <label class="mw-ui-checkbox-label">
185 // <input type="checkbox">The label text
187 .mw-ui-checkbox-label, .mw-ui-radio-label {
188 .agora-inline-label-styling();