Merge "(bug 47070) check content model namespace on import."
[lhc/web/wiklou.git] / resources / mediawiki.ui / components / default / forms.less
1 // Form elements and layouts
2
3 @import "../../mixins/utilities";
4 @import "../../mixins/forms";
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 3.
18
19 // VForm
20 //
21 // Style a compact vertical stacked form ("VForm") and the elements in divs
22 // within it. See button section on guidance of how and when to use mw-ui-constructive.
23 //
24 // Markup:
25 // <form class="mw-ui-vform">
26 // <div class="mw-ui-vform-div">This is a form example.</div>
27 // <div>
28 // <label>Username </label>
29 // <input value="input">
30 // </div>
31 // <div>
32 // <button class="mw-ui-button mw-ui-constructive">Button in vform</button>
33 // </div>
34 // </form>
35 //
36 // Styleguide 3.1.
37 .mw-ui-vform {
38 .box-sizing(border-box);
39
40 width: @defaultFormWidth;
41
42 // Immediate divs in a vform are block and spaced-out.
43 & > div {
44 display: block;
45 margin: 0 0 15px 0;
46 padding: 0;
47 width: 100%;
48
49 // MW currently doesn't use the type attribute everywhere on inputs.
50 input,
51 .mw-ui-button {
52 display: block;
53 .box-sizing(border-box);
54 margin: 0;
55 width: 100%;
56 }
57
58 // We exclude these because they'll generally use mw-ui-button.
59 // Otherwise, we'll unintentionally override that.
60 input:not([type=button]):not([type=submit]):not([type=file]), {
61 .agora-field-styling(); // mixins/forms.less
62 }
63
64 label {
65 display: block;
66 .box-sizing(border-box);
67 .agora-label-styling();
68 width: auto;
69 margin: 0 0 0.2em 0;
70 padding: 0;
71 }
72
73 // Override input styling just for checkboxes and radio inputs.
74 input[type="checkbox"],
75 input[type="radio"] {
76 display: inline;
77 .box-sizing(content-box);
78 width: auto;
79 }
80
81 }
82
83 // Styles for information boxes
84 //
85 // Regular HTMLForm uses .error class, some special pages like
86 // SpecialUserlogin (login and create account) use .errorbox.
87 //
88 // Markup:
89 // <form class="mw-ui-vform">
90 // <div class="errorbox">An error occurred</div>
91 // <div class="warningbox">A warning to be noted</div>
92 // <div class="successbox">Action successful!</div>
93 // <div class="error">A different kind of error</div>
94 // <div>
95 // <input type="text" value="input" class="mw-ui-input">
96 // <div>
97 // </div>
98 // <button class="mw-ui-button">Button in vform</button>
99 // </div>
100 // </form>
101 //
102 // Styleguide 3.1.
103 .error {
104 .box-sizing(border-box);
105 font-size: 0.9em;
106 margin: 0 0 1em 0;
107 padding: 0.5em;
108 color: #cc0000;
109 border: 1px solid #fac5c5;
110 background-color: #fae3e3;
111 text-shadow: 0 1px #fae3e3;
112 word-wrap: break-word;
113 }
114
115 .errorbox,
116 .warningbox,
117 .successbox {
118 .box-sizing(border-box);
119 font-size: 0.9em;
120 margin: 0 0 1em 0;
121 padding: 0.5em;
122 word-wrap: break-word;
123 }
124
125 }
126
127 // --------------------------------------------------------------------------
128 // Elements
129 // --------------------------------------------------------------------------
130
131 // Apply this to individual elements to style them.
132 // You generally don't need to use this class on divs within an Agora
133 // form container such as mw-ui-vform
134 // XXX DRY: This repeats earlier styling, use an @include agora-div-styling ?
135 .mw-ui-vform-div {
136 display: block;
137 margin: 0 0 15px 0;
138 padding: 0;
139 width: 100%;
140 }
141
142 // Apply mw-ui-input to individual input fields to style them.
143 // You generally don't need to use this class if <input> is within an Agora
144 // form container such as mw-ui-vform
145 .mw-ui-input {
146 .agora-field-styling(); // mixins/forms.less
147 }
148
149 // Apply mw-ui-label to individual elements to style them.
150 // You generally don't need to use this class if <label> is within an Agora
151 // form container such as mw-ui-vform
152 .mw-ui-label {
153 .agora-label-styling(); // mixins/forms.less
154 }
155
156 // Nesting an input checkbox or radio button inside a label with this class
157 // improves alignment, e.g.
158 // <label class="mw-ui-checkbox-label">
159 // <input type="checkbox">The label text
160 // </label>
161 .mw-ui-checkbox-label, .mw-ui-radio-label {
162 .agora-inline-label-styling();
163 }