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