Revert "ApiSandbox: Display params as JSON on request page"
[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 // Text inputs
8 //
9 // Apply the mw-ui-input class to input and textarea fields.
10 //
11 // Styleguide 1.
12
13 // mw-ui-input
14 //
15 // Style an input using MediaWiki UI.
16 // Currently in draft status and subject to change.
17 // When focused a progressive highlight appears to the left of the field.
18 //
19 // Markup:
20 // <input class="mw-ui-input" placeholder="Enter your name">
21 // <textarea class="mw-ui-input">Text here</textarea>
22 //
23 // Styleguide 1.1.
24 .mw-ui-input {
25 background-color: #fff;
26 .box-sizing( border-box );
27 display: block;
28 width: 100%;
29 border: 1px solid @colorFieldBorder;
30 border-radius: @borderRadius;
31 padding: 0.3em 0.3em 0.3em 0.6em;
32 // necessary for smooth transition
33 box-shadow: inset 0 0 0 0.1em #fff;
34 font-family: inherit;
35 font-size: inherit;
36 line-height: inherit;
37 vertical-align: middle;
38
39 // Normalize & style placeholder text, see T139034
40 // Placeholder styles can't be grouped, otherwise they're ignored as invalid.
41
42 // Placeholder mixin
43 .mixin-placeholder() {
44 color: @colorGray7;
45 font-style: italic;
46 }
47 // Firefox 4-18
48 &:-moz-placeholder { // stylelint-disable-line selector-no-vendor-prefix
49 .mixin-placeholder;
50 opacity: 1;
51 }
52 // Firefox 19-
53 &::-moz-placeholder { // stylelint-disable-line selector-no-vendor-prefix
54 .mixin-placeholder;
55 opacity: 1;
56 }
57 // Internet Explorer 10-11
58 &:-ms-input-placeholder { // stylelint-disable-line selector-no-vendor-prefix
59 .mixin-placeholder;
60 }
61 // WebKit, Blink, Edge
62 // Don't set `opacity < 1`, see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/3901363/
63 &::-webkit-input-placeholder { // stylelint-disable-line selector-no-vendor-prefix
64 .mixin-placeholder;
65 }
66 // W3C Standard Selectors Level 4
67 &:placeholder-shown {
68 .mixin-placeholder;
69 }
70
71 // Firefox: Remove red outline when `required` attribute set and invalid content.
72 // See https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid
73 // This should come before `:focus` so latter rules take preference.
74 &:invalid {
75 box-shadow: none;
76 }
77
78 &:hover {
79 border-color: @colorGray7;
80 }
81
82 &:focus {
83 border-color: @colorProgressive;
84 box-shadow: inset 0 0 0 1px @colorProgressive;
85 outline: 0;
86 }
87
88 // `:not()` is used exclusively for `transition`s as both are not supported by IE < 9.
89 &:not( :disabled ) {
90 .transition( ~'color 100ms, border-color 100ms, box-shadow 100ms' );
91 }
92
93 &:disabled {
94 border-color: @colorGray14;
95 color: @colorGray12;
96 }
97
98 // Normalize styling for `<input type="search">`
99 &[type="search"] {
100 // Correct the odd appearance in Chrome and Safari 5
101 -webkit-appearance: textfield;
102
103 // Remove proprietary clear button in IE 10-11, Edge 12+
104 &::-ms-clear {
105 display: none;
106 }
107
108 // Remove the inner padding and cancel buttons in Chrome on OS X and Safari on OS X
109 &::-webkit-search-cancel-button,
110 &::-webkit-search-decoration {
111 -webkit-appearance: none;
112 }
113 }
114 }
115
116 textarea.mw-ui-input {
117 min-height: 8em;
118 }
119
120 // mw-ui-input-inline
121 //
122 // Use mw-ui-input-inline with mw-ui-input in cases where you want a button to line up with the input.
123 //
124 // Markup:
125 // <input class="mw-ui-input mw-ui-input-inline">
126 // <button class="mw-ui-button mw-ui-progressive">Submit</button>
127 //
128 // Styleguide 1.2.
129 input[type="number"],
130 .mw-ui-input-inline {
131 display: inline-block;
132 width: auto;
133 // Make sure we limit `width` to parent element because
134 // in case of text `input` fields, `width: auto;` equals `size` attribute.
135 max-width: 100%;
136 }
137
138 // mw-ui-input-large
139 //
140 // Use mw-ui-input-large with mw-ui-input in cases where there are multiple inputs on a screen and you
141 // want to draw attention to one instance. For example, replying with a subject line and more text.
142 // Currently in draft status and subject to change. When used on an input field, the text is styled
143 // in a large font. When used alongside another mw-ui-input large they are pushed together to form one
144 // contiguous block.
145 //
146 // Markup:
147 // <input value="input" class="mw-ui-input mw-ui-input-large" value="input" placeholder="Enter subject">
148 // <textarea class="mw-ui-input mw-ui-input-large" placeholder="Provide additional details"></textarea>
149 //
150 // Styleguide 1.3.
151 .mw-ui-input-large {
152 margin-top: 0;
153 margin-bottom: 0;
154
155 // When two large inputs are together, we make them flush by hiding one of the borders
156 & + .mw-ui-input-large {
157 margin-top: -1px;
158 }
159 // When focusing, make the input relative to raise it above any attached inputs to unhide its borders
160 &:focus {
161 position: relative;
162 }
163 }
164
165 input.mw-ui-input-large {
166 font-size: 1.75em;
167 font-weight: bold;
168 line-height: 1.25em;
169 }