Merge "Improve @covers tags for ComposerJson and ComposerLock tests"
[lhc/web/wiklou.git] / resources / src / mediawiki.ui / components / inputs.less
1 // Inputs
2
3 @import "mediawiki.mixins";
4 @import "mediawiki.ui/variables";
5 @import "mediawiki.ui/mixins";
6
7 // Placeholder text styling helper
8 .field-placeholder-styling() {
9 font-style: italic;
10 font-weight: normal;
11 }
12 // Text inputs
13 //
14 // Apply the mw-ui-input class to input and textarea fields.
15 //
16 // Styleguide 1.
17
18 // mw-ui-input
19 //
20 // Style an input using MediaWiki UI.
21 // Currently in draft status and subject to change.
22 // When focused a progressive highlight appears to the left of the field.
23 //
24 // Markup:
25 // <input class="mw-ui-input" placeholder="Enter your name">
26 // <textarea class="mw-ui-input">Text here</textarea>
27 //
28 // Styleguide 1.1.
29 .mw-ui-input {
30 .box-sizing( border-box );
31 display: block;
32 width: 100%;
33 border: 1px solid @colorFieldBorder;
34 border-radius: @borderRadius;
35 padding: 0.3em 0.3em 0.3em 0.6em;
36 font-family: inherit;
37 font-size: inherit;
38 line-height: inherit;
39 vertical-align: middle;
40
41 // Placeholder text styling must be set individually for each browser @winter
42 &::-webkit-input-placeholder { // webkit
43 .field-placeholder-styling;
44 }
45 &::-moz-placeholder { // FF 4-18
46 .field-placeholder-styling;
47 }
48 &:-moz-placeholder { // FF >= 19
49 .field-placeholder-styling;
50 }
51 &:-ms-input-placeholder { // IE >= 10
52 .field-placeholder-styling;
53 }
54
55 // Remove red outline from inputs which have required field and invalid content.
56 // This is a Firefox only issue
57 // See https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid
58 // This should be above :focus so focus behaviour takes preference
59 &:invalid {
60 box-shadow: none;
61 }
62
63 &:focus {
64 border-color: @colorProgressive;
65 box-shadow: inset 0 0 0 1px @colorProgressive;
66 outline: 0;
67 }
68
69 &:disabled {
70 border-color: @colorGray14;
71 color: @colorGray12;
72 }
73
74 // Normalize styling for `<input type="search">`
75 &[type="search"] {
76 // Correct the odd appearance in Chrome and Safari 5
77 -webkit-appearance: textfield;
78
79 // Remove proprietary clear button in IE 10-11
80 &::-ms-clear {
81 display: none;
82 }
83
84 // Remove the inner padding and cancel buttons in Chrome on OS X and Safari on OS X
85 &::-webkit-search-cancel-button,
86 &::-webkit-search-decoration {
87 -webkit-appearance: none;
88 }
89 }
90 }
91
92 textarea.mw-ui-input {
93 min-height: 8em;
94 }
95
96 // mw-ui-input-inline
97 //
98 // Use mw-ui-input-inline with mw-ui-input in cases where you want a button to line up with the input.
99 //
100 // Markup:
101 // <input class="mw-ui-input mw-ui-input-inline">
102 // <button class="mw-ui-button mw-ui-progressive">Submit</button>
103 //
104 // Styleguide 1.2.
105 input[type="number"],
106 .mw-ui-input-inline {
107 display: inline-block;
108 width: auto;
109 // Make sure we limit `width` to parent element because
110 // in case of text `input` fields, `width: auto;` equals `size` attribute.
111 max-width: 100%;
112 }
113
114 // mw-ui-input-large
115 //
116 // Use mw-ui-input-large with mw-ui-input in cases where there are multiple inputs on a screen and you
117 // want to draw attention to one instance. For example, replying with a subject line and more text.
118 // Currently in draft status and subject to change. When used on an input field, the text is styled
119 // in a large font. When used alongside another mw-ui-input large they are pushed together to form one
120 // contiguous block.
121 //
122 // Markup:
123 // <input value="input" class="mw-ui-input mw-ui-input-large" value="input" placeholder="Enter subject">
124 // <textarea class="mw-ui-input mw-ui-input-large" placeholder="Provide additional details"></textarea>
125 //
126 // Styleguide 1.3.
127 .mw-ui-input-large {
128 margin-top: 0;
129 margin-bottom: 0;
130
131 // When two large inputs are together, we make them flush by hiding one of the borders
132 & + .mw-ui-input-large {
133 margin-top: -1px;
134 }
135 // When focusing, make the input relative to raise it above any attached inputs to unhide its borders
136 &:focus {
137 position: relative;
138 }
139 }
140
141 input.mw-ui-input-large {
142 font-size: 1.75em;
143 font-weight: bold;
144 line-height: 1.25em;
145 }