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