mediawiki.ui: Move remaining mixin to buttons.less; remove mixins.less
[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 /* stylelint-disable indentation */
41 .mixin-placeholder( {
42 color: @colorGray7;
43 opacity: 1;
44 } );
45 /* stylelint-enable indentation */
46
47 // Firefox: Remove red outline when `required` attribute set and invalid content.
48 // See https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid
49 // This should come before `:focus` so latter rules take preference.
50 &:invalid {
51 box-shadow: none;
52 }
53
54 &:hover {
55 border-color: @colorGray7;
56 }
57
58 &:focus {
59 border-color: @colorProgressive;
60 box-shadow: inset 0 0 0 1px @colorProgressive;
61 outline: 0;
62 }
63
64 // `:not()` is used exclusively for `transition`s as both are not supported by IE < 9.
65 &:not( :disabled ) {
66 .transition( ~'color 100ms, border-color 100ms, box-shadow 100ms' );
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, Edge 12+
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 .mw-ui-input-inline {
106 display: inline-block;
107 width: auto;
108 // Make sure we limit `width` to parent element because
109 // in case of text `input` fields, `width: auto;` equals `size` attribute.
110 max-width: 100%;
111 }
112
113 // mw-ui-input-large
114 //
115 // Use mw-ui-input-large with mw-ui-input in cases where there are multiple inputs on a screen and you
116 // want to draw attention to one instance. For example, replying with a subject line and more text.
117 // Currently in draft status and subject to change. When used on an input field, the text is styled
118 // in a large font. When used alongside another mw-ui-input large they are pushed together to form one
119 // contiguous block.
120 //
121 // Markup:
122 // <input value="input" class="mw-ui-input mw-ui-input-large" value="input" placeholder="Enter subject">
123 // <textarea class="mw-ui-input mw-ui-input-large" placeholder="Provide additional details"></textarea>
124 //
125 // Styleguide 1.3.
126 .mw-ui-input-large {
127 margin-top: 0;
128 margin-bottom: 0;
129
130 // When two large inputs are together, we make them flush by hiding one of the borders
131 & + .mw-ui-input-large {
132 margin-top: -1px;
133 }
134 // When focusing, make the input relative to raise it above any attached inputs to unhide its borders
135 &:focus {
136 position: relative;
137 }
138 }
139
140 input.mw-ui-input-large {
141 font-size: 1.75em;
142 font-weight: bold;
143 line-height: 1.25em;
144 padding: 0.3673em 0.3265em 0.3265em;
145 }