forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_form.scss
306 lines (267 loc) · 5.73 KB
/
_form.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/**
* Forms
* --------------------------------------------------
*/
// Make all forms have space below them
form {
margin: 0 0 $line-height-base;
}
// Groups of fields with labels on top (legends)
legend {
display: block;
margin-bottom: $line-height-base;
padding: 0;
width: 100%;
border: $input-border-width solid $input-border;
color: $dark;
font-size: $font-size-base * 1.5;
line-height: $line-height-base * 2;
small {
color: $stable;
font-size: $line-height-base * .75;
}
}
// Set font for forms
label,
input,
button,
select,
textarea {
@include font-shorthand($font-size-base, normal, $line-height-base); // Set size, weight, line-height here
}
input,
button,
select,
textarea {
font-family: $font-family-base; // And only set font-family here for those that need it (note the missing label element)
}
// Input List
// -------------------------------
.item-input {
@include display-flex();
@include align-items(center);
position: relative;
overflow: hidden;
padding: 6px 0 5px 8px;
input {
@include border-radius(0);
@include flex(1, 0, 220px);
@include appearance(none);
margin: 0;
padding-right: 24px;
background-color: transparent;
}
.button .icon {
@include flex(0, 0, 24px);
position: static;
display: inline-block;
height: auto;
text-align: center;
font-size: 16px;
}
.button-bar {
@include border-radius(0);
@include flex(1, 0, 220px);
@include appearance(none);
}
.icon {
min-width: 14px;
}
}
.item-input-inset {
@include display-flex();
@include align-items(center);
position: relative;
overflow: hidden;
padding: ($item-padding / 3) * 2;
}
.item-input-wrapper {
@include display-flex();
@include flex(1, 0);
@include align-items(center);
@include border-radius(4px);
padding-right: 8px;
padding-left: 8px;
background: #eee;
}
.item-input-inset .item-input-wrapper input {
padding-left: 4px;
height: 29px;
background: transparent;
line-height: 18px;
}
.item-input-wrapper ~ .button {
margin-left: ($item-padding / 3) * 2;
}
.input-label {
@include flex(1, 0, 100px);
display: table;
padding: 7px 10px 7px 3px;
max-width: 200px;
width: 35%;
color: $input-label-color;
font-weight: bold;
font-size: $font-size-base;
}
.placeholder-icon {
color: #aaa;
&:first-child {
padding-right: 6px;
}
&:last-child {
padding-left: 6px;
}
}
.item-stacked-label {
display: block;
background-color: transparent;
box-shadow: none;
.input-label, .icon {
display: inline-block;
padding: 4px 0;
vertical-align: middle;
}
}
.item-stacked-label input,
.item-stacked-label textarea {
@include border-radius(2px);
padding: 4px 8px 3px;
border: none;
background-color: $input-bg;
}
.item-stacked-label input {
overflow: hidden;
height: $line-height-computed + $font-size-base + 12px;
}
.item-floating-label {
display: block;
background-color: transparent;
box-shadow: none;
.input-label {
position: relative;
padding: 5px 0 0 0;
opacity: 0;
top: 10px;
@include transition(opacity .15s ease-in, top .2s linear);
&.has-input {
opacity: 1;
top: 0;
@include transition(opacity .15s ease-in, top .2s linear);
}
}
}
// Form Controls
// -------------------------------
// Shared size and type resets
textarea,
input[type="text"],
input[type="password"],
input[type="datetime"],
input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="week"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="color"] {
display: block;
padding-top: 2px;
height: $line-height-computed + $font-size-base;
color: $input-color;
vertical-align: middle;
font-size: $font-size-base;
line-height: $font-size-base + 2;
}
.platform-ios,
.platform-android {
input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="week"] {
padding-top: 8px;
}
}
input,
textarea {
width: 100%;
}
// Reset height since textareas have rows
textarea {
height: auto;
}
// Everything else
textarea,
input[type="text"],
input[type="password"],
input[type="datetime"],
input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="week"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="color"] {
border: 0;
}
// Position radios and checkboxes better
input[type="radio"],
input[type="checkbox"] {
margin: 0;
line-height: normal;
}
// Reset width of input images, buttons, radios, checkboxes
input[type="file"],
input[type="image"],
input[type="submit"],
input[type="reset"],
input[type="button"],
input[type="radio"],
input[type="checkbox"] {
width: auto; // Override of generic input selector
}
// Set the height of file to match text inputs
input[type="file"] {
line-height: $input-height-base;
}
// Text input classes to hide text caret during scroll
.previous-input-focus,
.cloned-text-input + input,
.cloned-text-input + textarea {
position: absolute;
left: -9999px;
width: 200px;
}
// Placeholder
// -------------------------------
input,
textarea {
@include placeholder();
}
// DISABLED STATE
// -------------------------------
// Disabled and read-only inputs
input[disabled],
select[disabled],
textarea[disabled],
input[readonly]:not(.cloned-text-input),
textarea[readonly]:not(.cloned-text-input),
select[readonly] {
background-color: $input-bg-disabled;
cursor: not-allowed;
}
// Explicitly reset the colors here
input[type="radio"][disabled],
input[type="checkbox"][disabled],
input[type="radio"][readonly],
input[type="checkbox"][readonly] {
background-color: transparent;
}