| 1 |
// Form elements and layouts |
| 2 |
|
| 3 |
@import 'mediawiki.skin.variables.less'; |
| 4 |
|
| 5 |
/* stylelint-disable selector-class-pattern */ |
| 6 |
|
| 7 |
// -------------------------------------------------------------------------- |
| 8 |
// Layouts |
| 9 |
// -------------------------------------------------------------------------- |
| 10 |
|
| 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; |
| 15 |
|
| 16 |
// Forms |
| 17 |
|
| 18 |
// VForm |
| 19 |
// |
| 20 |
// Style a compact vertical stacked form ("VForm") and the elements in divs |
| 21 |
// within it. See button and inputs section on guidance of how and when to use them. |
| 22 |
// |
| 23 |
// Markup: |
| 24 |
// <form class="mw-ui-vform"> |
| 25 |
// <div class="mw-ui-vform-field">This is a form example.</div> |
| 26 |
// <div class="mw-ui-vform-field"> |
| 27 |
// <label>Username </label> |
| 28 |
// <input class="mw-ui-input" value="input"> |
| 29 |
// </div> |
| 30 |
// <div class="mw-ui-vform-field"> |
| 31 |
// <button class="mw-ui-button mw-ui-progressive">Button in vform</button> |
| 32 |
// </div> |
| 33 |
// </form> |
| 34 |
.mw-ui-vform { |
| 35 |
box-sizing: border-box; |
| 36 |
width: @defaultFormWidth; |
| 37 |
|
| 38 |
// MW currently doesn't use the type attribute everywhere on inputs. |
| 39 |
select, |
| 40 |
.mw-ui-button { |
| 41 |
display: block; |
| 42 |
width: 100%; |
| 43 |
} |
| 44 |
|
| 45 |
// Give dropdown lists the same spacing as input fields for consistency. |
| 46 |
// Values taken from .agora-field-styling() in mixins/form.less |
| 47 |
select { |
| 48 |
box-sizing: border-box; |
| 49 |
padding: 0.35em 0.5em; |
| 50 |
vertical-align: middle; |
| 51 |
} |
| 52 |
|
| 53 |
> label { |
| 54 |
display: block; |
| 55 |
color: @color-base; |
| 56 |
box-sizing: border-box; |
| 57 |
width: auto; |
| 58 |
margin: 0 0 0.2em; |
| 59 |
padding: 0; |
| 60 |
font-size: 0.9em; |
| 61 |
|
| 62 |
* { |
| 63 |
font-weight: normal; |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
// Override input styling just for checkboxes and radio inputs. |
| 68 |
input[ type='radio' ] { |
| 69 |
display: inline; |
| 70 |
box-sizing: content-box; |
| 71 |
width: auto; |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
// -------------------------------------------------------------------------- |
| 76 |
// Elements |
| 77 |
// -------------------------------------------------------------------------- |
| 78 |
|
| 79 |
// A wrapper for a single form field: the <input> / <select> / <button> element, |
| 80 |
// help text, labels, associated error/warning/success messages, and so on. |
| 81 |
// Elements with this class are generated by HTMLFormField in core MediaWiki. |
| 82 |
// |
| 83 |
// (We use a broad definition of 'field' here: a purely textual information |
| 84 |
// block is also a "field".) |
| 85 |
.mw-ui-vform-field, |
| 86 |
.mw-ui-vform .htmlform-tip { |
| 87 |
display: block; |
| 88 |
margin: 0 0 15px; |
| 89 |
padding: 0; |
| 90 |
width: 100%; |
| 91 |
} |
| 92 |
|
| 93 |
// Apply mw-ui-label to individual elements to style them. |
| 94 |
// You generally don't need to use this class if <label> is within an Agora |
| 95 |
// form container such as mw-ui-vform |
| 96 |
.mw-ui-label { |
| 97 |
color: @color-base; |
| 98 |
font-size: 0.9em; |
| 99 |
|
| 100 |
* { |
| 101 |
font-weight: normal; |
| 102 |
} |
| 103 |
} |