Merge "inputs.less: Change focus state"
[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 // turn off default input styling for input[type="search"] fields
31 -webkit-appearance: none;
32 border: 1px solid @colorFieldBorder;
33 .box-sizing(border-box);
34 width: 100%;
35 padding: .3em .3em .3em .6em;
36 display: block;
37 vertical-align: middle;
38 border-radius: @borderRadius;
39 font-family: inherit;
40 font-size: inherit;
41 line-height: inherit;
42 .transition(~"border 0.2s cubic-bezier(0.39, 0.575, 0.565, 1), box-shadow 0.2s cubic-bezier(0.39, 0.575, 0.565, 1)");
43
44 // Placeholder text styling must be set individually for each browser @winter
45 &::-webkit-input-placeholder { // webkit
46 .field-placeholder-styling;
47 }
48 &::-moz-placeholder { // FF 4-18
49 .field-placeholder-styling;
50 }
51 &:-moz-placeholder { // FF >= 19
52 .field-placeholder-styling;
53 }
54 &:-ms-input-placeholder { // IE >= 10
55 .field-placeholder-styling;
56 }
57
58 // Remove red outline from inputs which have required field and invalid content.
59 // This is a Firefox only issue
60 // See https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid
61 // This should be above :focus so focus behaviour takes preference
62 &:invalid {
63 box-shadow: none;
64 }
65
66 &:focus {
67 box-shadow: inset 0 0 0 2px @colorProgressive;
68 // Color being used to match inset shadow, not semantic reasons
69 border-color: @colorProgressive;
70 // Remove focus glow on input[type="search"]
71 outline: 0;
72 }
73
74 &:disabled {
75 border-color: @colorGray14;
76 color: @colorGray12;
77 }
78 }
79
80 textarea.mw-ui-input {
81 min-height: 8em;
82 }
83
84 // mw-ui-input-inline
85 //
86 // Use mw-ui-input-inline with mw-ui-input in cases where you want a button to line up with the input.
87 //
88 // Markup:
89 // <input class="mw-ui-input mw-ui-input-inline">
90 // <button class="mw-ui-button mw-ui-constructive">Submit</button>
91 //
92 // Styleguide 1.2.
93 input[type="number"],
94 .mw-ui-input-inline {
95 display: inline-block;
96 width: auto;
97 }
98
99 // mw-ui-input-large
100 //
101 // Use mw-ui-input-large with mw-ui-input in cases where there are multiple inputs on a screen and you
102 // want to draw attention to one instance. For example, replying with a subject line and more text.
103 // Currently in draft status and subject to change. When used on an input field, the text is styled
104 // in a large font. When used alongside another mw-ui-input large they are pushed together to form one
105 // contiguous block.
106 //
107 // Markup:
108 // <input value="input" class="mw-ui-input mw-ui-input-large" value="input" placeholder="Enter subject">
109 // <textarea class="mw-ui-input mw-ui-input-large" placeholder="Provide additional details"></textarea>
110 //
111 // Styleguide 1.3.
112 .mw-ui-input-large {
113 margin-top: 0;
114 margin-bottom: 0;
115
116 // When two large inputs are together, we make them flush by hiding one of the borders
117 & + .mw-ui-input-large {
118 margin-top: -1px;
119 }
120 // When focusing, make the input relative to raise it above any attached inputs to unhide its borders
121 &:focus {
122 position: relative;
123 }
124 }
125
126 input.mw-ui-input-large {
127 font-size: 1.75em;
128 font-weight: bold;
129 line-height: 1.25em;
130 }
131
132 // Tablet and desktop specific styling tweaks.
133 @media all and (min-width: 768px) {
134 // Make inline elements take up a sensible amount of the screen on wider devices.
135 .mw-ui-input-inline {
136 min-width: 320px;
137 }
138 }