1 | @import 'default-theme';
|
2 | @import 'mixins';
|
3 | @import 'variables';
|
4 |
|
5 | $md-input-floating-placeholder-scale-factor: 0.75 !default;
|
6 |
|
7 |
|
8 | $md-input-placeholder-color: md-color($md-foreground, hint-text);
|
9 | $md-input-floating-placeholder-color: md-color($md-primary);
|
10 | $md-input-required-placeholder-color: md-color($md-accent);
|
11 |
|
12 |
|
13 | $md-input-underline-color: md-color($md-foreground, hint-text);
|
14 | $md-input-underline-color-accent: md-color($md-accent);
|
15 | $md-input-underline-color-warn: md-color($md-warn);
|
16 | $md-input-underline-disabled-color: md-color($md-foreground, hint-text);
|
17 | $md-input-underline-focused-color: md-color($md-primary);
|
18 |
|
19 |
|
20 | $md-input-underline-disabled-background-image: linear-gradient(to right,
|
21 | rgba(0, 0, 0, 0.26) 0%, rgba(0, 0, 0, 0.26) 33%, transparent 0%);
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | :-moz-ui-invalid {
|
28 | box-shadow: none;
|
29 | }
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | @mixin md-input-placeholder-floating {
|
35 | display: block;
|
36 | padding-bottom: 5px;
|
37 | transform: translateY(-100%) scale($md-input-floating-placeholder-scale-factor);
|
38 | width: 100% / $md-input-floating-placeholder-scale-factor;
|
39 |
|
40 | .md-placeholder-required {
|
41 | color: $md-input-required-placeholder-color;
|
42 | }
|
43 | }
|
44 |
|
45 | :host {
|
46 | display: inline-block;
|
47 | position: relative;
|
48 | font-family: $md-font-family;
|
49 |
|
50 |
|
51 | text-align: left;
|
52 |
|
53 |
|
54 |
|
55 | .md-input-wrapper {
|
56 | margin: 16px 0;
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | .md-input-table {
|
65 | display: inline-table;
|
66 | flex-flow: column;
|
67 | vertical-align: bottom;
|
68 | width: 100%;
|
69 |
|
70 | & > * {
|
71 | display: table-cell;
|
72 | }
|
73 | }
|
74 |
|
75 |
|
76 | .md-input-element {
|
77 |
|
78 | font: inherit;
|
79 |
|
80 |
|
81 | background: transparent;
|
82 |
|
83 |
|
84 | border: none;
|
85 | outline: none;
|
86 | padding: 0;
|
87 | width: 100%;
|
88 |
|
89 | &.md-end {
|
90 | text-align: right;
|
91 | }
|
92 | }
|
93 |
|
94 | .md-input-infix {
|
95 | position: relative;
|
96 | }
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | .md-input-placeholder {
|
102 |
|
103 |
|
104 | position: absolute;
|
105 | left: 0;
|
106 | top: 0;
|
107 |
|
108 | font-size: 100%;
|
109 | pointer-events: none;
|
110 | color: $md-input-placeholder-color;
|
111 | z-index: 1;
|
112 |
|
113 |
|
114 | width: 100%;
|
115 | display: none;
|
116 | white-space: nowrap;
|
117 | text-overflow: ellipsis;
|
118 | overflow-x: hidden;
|
119 |
|
120 | transform: translateY(0);
|
121 | transform-origin: bottom left;
|
122 | transition: transform $swift-ease-out-duration $swift-ease-out-timing-function,
|
123 | scale $swift-ease-out-duration $swift-ease-out-timing-function,
|
124 | color $swift-ease-out-duration $swift-ease-out-timing-function,
|
125 | width $swift-ease-out-duration $swift-ease-out-timing-function;
|
126 |
|
127 | &.md-empty {
|
128 | display: block;
|
129 | cursor: text;
|
130 | }
|
131 |
|
132 |
|
133 | &.md-float:not(.md-empty), &.md-float.md-focused {
|
134 | @include md-input-placeholder-floating;
|
135 | }
|
136 |
|
137 |
|
138 |
|
139 | &.md-focused {
|
140 | color: $md-input-floating-placeholder-color;
|
141 |
|
142 | &.md-accent {
|
143 | color: $md-input-underline-color-accent;
|
144 | }
|
145 | &.md-warn {
|
146 | color: $md-input-underline-color-warn;
|
147 | }
|
148 | }
|
149 | }
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | input:-webkit-autofill + .md-input-placeholder {
|
157 | @include md-input-placeholder-floating;
|
158 | }
|
159 |
|
160 |
|
161 |
|
162 | .md-input-underline {
|
163 | position: absolute;
|
164 | height: 1px;
|
165 | width: 100%;
|
166 | margin-top: 4px;
|
167 | border-top: 1px solid $md-input-underline-color;
|
168 |
|
169 | &.md-disabled {
|
170 | border-top: 0;
|
171 | background-image: $md-input-underline-disabled-background-image;
|
172 | background-position: 0;
|
173 | background-size: 4px 1px;
|
174 | background-repeat: repeat-x;
|
175 | }
|
176 |
|
177 | .md-input-ripple {
|
178 | position: absolute;
|
179 | height: 2px;
|
180 | z-index: 1;
|
181 | background-color: $md-input-underline-focused-color;
|
182 | top: -1px;
|
183 | width: 100%;
|
184 | transform-origin: top;
|
185 | opacity: 0;
|
186 | transform: scaleY(0);
|
187 | transition: transform $swift-ease-out-duration $swift-ease-out-timing-function,
|
188 | opacity $swift-ease-out-duration $swift-ease-out-timing-function;
|
189 |
|
190 | &.md-accent {
|
191 | background-color: $md-input-underline-color-accent;
|
192 | }
|
193 | &.md-warn {
|
194 | background-color: $md-input-underline-color-warn;
|
195 | }
|
196 |
|
197 | &.md-focused {
|
198 | opacity: 1;
|
199 | transform: scaleY(1);
|
200 | }
|
201 | }
|
202 | }
|
203 |
|
204 |
|
205 |
|
206 | .md-hint {
|
207 | position: absolute;
|
208 | font-size: 75%;
|
209 | bottom: -0.5em;
|
210 |
|
211 | &.md-right {
|
212 | right: 0;
|
213 | }
|
214 | }
|
215 | }
|
216 |
|
217 |
|
218 |
|
219 | :host-context([dir='rtl']) {
|
220 | text-align: right;
|
221 |
|
222 | .md-input-placeholder {
|
223 | transform-origin: bottom right;
|
224 | }
|
225 |
|
226 | .md-input-element.md-end {
|
227 | text-align: left;
|
228 | }
|
229 |
|
230 | .md-hint {
|
231 | right: 0;
|
232 | left: auto;
|
233 |
|
234 | &.md-right {
|
235 | right: auto;
|
236 | left: 0;
|
237 | }
|
238 | }
|
239 | }
|