ratchet_design 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/app/assets/images/ratchet/favicon.ico +0 -0
- data/app/assets/javascripts/ratchet/_svg.js +55 -0
- data/app/assets/javascripts/ratchet/base/form.js +220 -0
- data/app/assets/javascripts/ratchet/base/mobilemenu.js +62 -0
- data/app/assets/javascripts/ratchet/base/validation.js +230 -0
- data/app/assets/javascripts/ratchet/core.js +92 -0
- data/app/assets/javascripts/ratchet/enhancement/_collapse.js +96 -0
- data/app/assets/javascripts/ratchet/enhancement/_lightbox.js +93 -0
- data/app/assets/javascripts/ratchet/enhancement/_swap.js +120 -0
- data/app/assets/javascripts/ratchet/enhancement/_switcheroo.js +28 -0
- data/app/assets/javascripts/ratchet/enhancement/_textcounter.js +92 -0
- data/app/assets/javascripts/ratchet/enhancement/loader.js +77 -0
- data/app/assets/javascripts/ratchet/enhancement/notice.js +70 -0
- data/app/assets/javascripts/ratchet/enhancement/sticky.js +128 -0
- data/app/assets/javascripts/ratchet/enhancement/waypoints.js +328 -0
- data/app/assets/javascripts/ratchet/shim/classlist.js +234 -0
- data/app/assets/javascripts/ratchet/shim/object.assign.js +30 -0
- data/app/assets/javascripts/ratchet/utility/compile_data.js +32 -0
- data/app/assets/javascripts/ratchet/utility/from_top.js +14 -0
- data/app/assets/javascripts/ratchet/utility/full_stop.js +55 -0
- data/app/assets/javascripts/ratchet/utility/get_closest.js +20 -0
- data/app/assets/javascripts/ratchet/utility/get_next.js +17 -0
- data/app/assets/javascripts/ratchet/utility/load_font.js +72 -0
- data/app/assets/javascripts/ratchet/utility/load_script.js +34 -0
- data/app/assets/javascripts/ratchet/utility/matches.js +15 -0
- data/app/assets/javascripts/ratchet/utility/scroll_to.js +74 -0
- data/app/assets/javascripts/ratchet/utility/throttle.js +25 -0
- data/app/assets/javascripts/ratchet/utility/timeout.js +45 -0
- data/app/assets/javascripts/ratchet/utility/unhover.js +56 -0
- data/app/assets/javascripts/ratchet/utility/word_count.js +15 -0
- data/app/assets/stylesheets/ratchet/_core.scss +20 -0
- data/app/assets/stylesheets/ratchet/base/_button.scss +101 -0
- data/app/assets/stylesheets/ratchet/base/_document.scss +306 -0
- data/app/assets/stylesheets/ratchet/base/_form.scss +614 -0
- data/app/assets/stylesheets/ratchet/base/_list.scss +114 -0
- data/app/assets/stylesheets/ratchet/base/_media.scss +41 -0
- data/app/assets/stylesheets/ratchet/base/_table.scss +81 -0
- data/app/assets/stylesheets/ratchet/base/_text.scss +411 -0
- data/app/assets/stylesheets/ratchet/enhancement/_contrast-section.scss +22 -0
- data/app/assets/stylesheets/ratchet/enhancement/_feature.scss +49 -0
- data/app/assets/stylesheets/ratchet/enhancement/_hero.scss +44 -0
- data/app/assets/stylesheets/ratchet/enhancement/_loader.scss +109 -0
- data/app/assets/stylesheets/ratchet/enhancement/_notice.scss +74 -0
- data/app/assets/stylesheets/ratchet/enhancement/_signup.scss +206 -0
- data/app/assets/stylesheets/ratchet/enhancement/_sticky-sidebar.scss +36 -0
- data/app/assets/stylesheets/ratchet/fonts-woff.css +55 -0
- data/app/assets/stylesheets/ratchet/fonts-woff2.css +55 -0
- data/app/assets/stylesheets/ratchet/utility/_global.scss +255 -0
- data/app/assets/stylesheets/ratchet/utility/_grid.scss +102 -0
- data/app/assets/svgs/ratchet/facebook.svg +1 -0
- data/app/assets/svgs/ratchet/github.svg +1 -0
- data/app/assets/svgs/ratchet/google-plus.svg +1 -0
- data/app/assets/svgs/ratchet/ibm.svg +1 -0
- data/app/assets/svgs/ratchet/inbox.svg +1 -0
- data/app/assets/svgs/ratchet/linkedin.svg +1 -0
- data/app/assets/svgs/ratchet/ratchet.svg +1 -0
- data/app/assets/svgs/ratchet/search.svg +1 -0
- data/app/assets/svgs/ratchet/subscribe.svg +1 -0
- data/app/assets/svgs/ratchet/twitter.svg +1 -0
- data/app/assets/svgs/ratchet/y-combinator.svg +1 -0
- data/app/helpers/ratchet/application_helper.rb +51 -0
- data/app/views/layouts/ratchet/default.html.slim +61 -0
- data/app/views/shared/ratchet/_footer.html.slim +2 -0
- data/app/views/shared/ratchet/_header.html.slim +17 -0
- data/app/views/shared/ratchet/_icons.html.slim +89 -0
- data/lib/ratchet_design.rb +12 -0
- data/lib/ratchet_design/version.rb +3 -0
- data/public/assets/ratchet/core-0.1.0.js +103 -0
- data/public/assets/ratchet/core-0.1.0.js.gz +0 -0
- data/public/assets/ratchet/core-0.1.0.map.json +1 -0
- data/public/assets/ratchet/fonts-woff-0.1.0.css +55 -0
- data/public/assets/ratchet/fonts-woff-0.1.0.css.gz +0 -0
- data/public/assets/ratchet/fonts-woff2-0.1.0.css +55 -0
- data/public/assets/ratchet/fonts-woff2-0.1.0.css.gz +0 -0
- metadata +177 -0
@@ -0,0 +1,614 @@
|
|
1
|
+
/* ========================================================================== *
|
2
|
+
* e. Form module
|
3
|
+
* -------------------------------------------------------------------------- */
|
4
|
+
|
5
|
+
/* ===================================== *
|
6
|
+
* i. Utility
|
7
|
+
* ------------------------------------- */
|
8
|
+
|
9
|
+
// Nested labels
|
10
|
+
@mixin nested-label($size: normal) {
|
11
|
+
|
12
|
+
// Scoped variables
|
13
|
+
$font-size: if($size == large, 17px, 16px);
|
14
|
+
$margin: if($size == large, 19px, 25px);
|
15
|
+
$padding-y: if($size == large, 12px, 9px);
|
16
|
+
$padding-x: if($size == large, 14px, 12px);
|
17
|
+
$distance: if($size == large, -24px, -22px);
|
18
|
+
$scale: if($size == large, .824, .875);
|
19
|
+
|
20
|
+
// Active state
|
21
|
+
%active {
|
22
|
+
z-index: 2;
|
23
|
+
transform: translate3d(0, $distance, 0) scale($scale);
|
24
|
+
}
|
25
|
+
|
26
|
+
// Hide input placeholder text
|
27
|
+
::placeholder {
|
28
|
+
opacity: 0;
|
29
|
+
color: transparent;
|
30
|
+
}
|
31
|
+
|
32
|
+
// Input labels
|
33
|
+
label {
|
34
|
+
display: flex;
|
35
|
+
width: 100%;
|
36
|
+
padding: 0;
|
37
|
+
background: $white;
|
38
|
+
font-size: $font-size;
|
39
|
+
margin-bottom: $margin;
|
40
|
+
}
|
41
|
+
|
42
|
+
// Default active color
|
43
|
+
:not(.valid):not(.invalid) > {
|
44
|
+
input,
|
45
|
+
textarea {
|
46
|
+
&:focus + span,
|
47
|
+
&:active + span {
|
48
|
+
color: darken($aluminum, 10);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
// Validated label
|
54
|
+
.valid > {
|
55
|
+
input,
|
56
|
+
textarea {
|
57
|
+
|
58
|
+
// Active state
|
59
|
+
+ span {
|
60
|
+
@extend %active;
|
61
|
+
}
|
62
|
+
|
63
|
+
// Non-required active color
|
64
|
+
&:not(:required):focus + span,
|
65
|
+
&:not(:required):active + span {
|
66
|
+
color: darken($aluminum, 10);
|
67
|
+
}
|
68
|
+
|
69
|
+
// Required active color
|
70
|
+
&:required + span {
|
71
|
+
color: $lima;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
// Invalidated label
|
77
|
+
.invalid > {
|
78
|
+
input,
|
79
|
+
textarea {
|
80
|
+
|
81
|
+
// Active state
|
82
|
+
+ span {
|
83
|
+
@extend %active;
|
84
|
+
}
|
85
|
+
|
86
|
+
// Non-required active color
|
87
|
+
&:not(:required):focus + span,
|
88
|
+
&:not(:required):active + span {
|
89
|
+
color: darken($aluminum, 10);
|
90
|
+
}
|
91
|
+
|
92
|
+
// Required active color
|
93
|
+
&:required + span {
|
94
|
+
color: $punch;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
// Select-specific styles
|
100
|
+
select {
|
101
|
+
font-size: $font-size;
|
102
|
+
line-height: inherit;
|
103
|
+
padding: $padding-y $padding-x;
|
104
|
+
}
|
105
|
+
|
106
|
+
// Inputs
|
107
|
+
input,
|
108
|
+
select,
|
109
|
+
textarea {
|
110
|
+
z-index: 1;
|
111
|
+
margin: 0;
|
112
|
+
font-size: $font-size;
|
113
|
+
line-height: inherit;
|
114
|
+
background: transparent;
|
115
|
+
padding: $padding-y $padding-x;
|
116
|
+
|
117
|
+
// Faux-placeholder labels
|
118
|
+
& + span {
|
119
|
+
background: $white;
|
120
|
+
box-shadow:
|
121
|
+
-6px 0 $white,
|
122
|
+
6px 0 $white;
|
123
|
+
font-size: inherit;
|
124
|
+
height: vr(2); // 30px
|
125
|
+
position: absolute;
|
126
|
+
top: $padding-y;
|
127
|
+
left: $padding-x;
|
128
|
+
padding: 1px 0 0 1px;
|
129
|
+
transform-origin: left top 0;
|
130
|
+
will-change: transform;
|
131
|
+
-webkit-filter: blur(0);
|
132
|
+
backface-visibility: hidden;
|
133
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
134
|
+
z-index: 0;
|
135
|
+
color: $alto;
|
136
|
+
transform: perspective(1px) translate3d(0, 0, 0) scale(1);
|
137
|
+
transition:
|
138
|
+
z-index .2s,
|
139
|
+
color .2s,
|
140
|
+
transform .2s;
|
141
|
+
}
|
142
|
+
|
143
|
+
// Move labels out of the way on focus
|
144
|
+
&:focus + span,
|
145
|
+
&:active + span {
|
146
|
+
@extend %active;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
%success-btn {
|
152
|
+
@include button($color: $lima);
|
153
|
+
}
|
154
|
+
|
155
|
+
/* ===================================== *
|
156
|
+
* ii. Common
|
157
|
+
* ------------------------------------- */
|
158
|
+
|
159
|
+
// Remove default fieldset styles
|
160
|
+
fieldset {
|
161
|
+
border: 0;
|
162
|
+
padding: 0;
|
163
|
+
margin-left: 0;
|
164
|
+
margin-right: 0;
|
165
|
+
}
|
166
|
+
|
167
|
+
// Fieldset legends
|
168
|
+
legend {
|
169
|
+
font-size: 14px;
|
170
|
+
text-transform: uppercase;
|
171
|
+
letter-spacing: .02em;
|
172
|
+
font-weight: 700;
|
173
|
+
padding-top: 11px;
|
174
|
+
box-shadow: 0 1px $iron;
|
175
|
+
width: 100%;
|
176
|
+
margin-bottom: 19px;
|
177
|
+
}
|
178
|
+
|
179
|
+
// Placeholder text color
|
180
|
+
::placeholder {
|
181
|
+
opacity: 1;
|
182
|
+
color: $alto;
|
183
|
+
}
|
184
|
+
|
185
|
+
// Remove FF’s default input outline
|
186
|
+
input::-moz-focus-inner {
|
187
|
+
border: 0;
|
188
|
+
}
|
189
|
+
|
190
|
+
// Labels
|
191
|
+
label {
|
192
|
+
display: flex;
|
193
|
+
flex-direction: column;
|
194
|
+
position: relative;
|
195
|
+
font-size: 15px;
|
196
|
+
padding-top: 10px;
|
197
|
+
margin-bottom: 10px;
|
198
|
+
|
199
|
+
// Checkbox- & radio-specific labels
|
200
|
+
&.tick-label {
|
201
|
+
flex-direction: row;
|
202
|
+
align-items: center;
|
203
|
+
margin-bottom: 5px;
|
204
|
+
}
|
205
|
+
|
206
|
+
// Bare text-based inputs
|
207
|
+
+ input,
|
208
|
+
+ select,
|
209
|
+
+ textarea {
|
210
|
+
margin-top: -5px;
|
211
|
+
}
|
212
|
+
|
213
|
+
// Nested text-based inputs
|
214
|
+
> input,
|
215
|
+
> select,
|
216
|
+
> textarea {
|
217
|
+
margin-top: 5px;
|
218
|
+
}
|
219
|
+
|
220
|
+
// Nested range inputs
|
221
|
+
> input[type=range] {
|
222
|
+
margin-top: 12px;
|
223
|
+
margin-bottom: 5px;
|
224
|
+
}
|
225
|
+
}
|
226
|
+
|
227
|
+
/* ===================================== *
|
228
|
+
* iii. Text-based
|
229
|
+
* ------------------------------------- */
|
230
|
+
|
231
|
+
// Inputs
|
232
|
+
input,
|
233
|
+
select,
|
234
|
+
textarea {
|
235
|
+
width: 100%;
|
236
|
+
font-size: 16px;
|
237
|
+
line-height: vr(2); // 30px
|
238
|
+
padding: 9px 12px;
|
239
|
+
border: 1px solid $alto;
|
240
|
+
border-radius: $radius;
|
241
|
+
transition: border-color .2s;
|
242
|
+
appearance: none;
|
243
|
+
|
244
|
+
// Keep Chrome’s autofilled fields white
|
245
|
+
&:-webkit-autofill {
|
246
|
+
-webkit-box-shadow: 0 0 0 1000px $white inset;
|
247
|
+
}
|
248
|
+
|
249
|
+
&:hover,
|
250
|
+
&:focus,
|
251
|
+
&:active {
|
252
|
+
outline: 0;
|
253
|
+
border-color: $aluminum;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
// Bare inputs
|
258
|
+
:not(label) > {
|
259
|
+
input,
|
260
|
+
select,
|
261
|
+
textarea {
|
262
|
+
margin-bottom: 10px;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
// Override default search styling
|
267
|
+
input[type=search] {
|
268
|
+
&,
|
269
|
+
&::-webkit-search-decoration,
|
270
|
+
&::-webkit-search-cancel-button {
|
271
|
+
-webkit-appearance: none;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
// Confine resizing of textareas
|
276
|
+
textarea {
|
277
|
+
display: block;
|
278
|
+
resize: vertical;
|
279
|
+
max-height: vr(20) + 5px; // 305px
|
280
|
+
min-height: vr(8) + 5px; // 125px;
|
281
|
+
}
|
282
|
+
|
283
|
+
/* ===================================== *
|
284
|
+
* iv. Select
|
285
|
+
* ------------------------------------- */
|
286
|
+
|
287
|
+
// Select inputs
|
288
|
+
select {
|
289
|
+
height: 50px;
|
290
|
+
cursor: pointer;
|
291
|
+
background: $white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 14'%3E%3Cpolygon fill='%237A7B7C' points='3.5,0 0,6 7,6'/%3E%3Cpolygon fill='%237A7B7C' points='3.5,14 0,8 7,8'/%3E%3C/svg%3E") calc(100% - 14px) 50% / 7px 14px no-repeat;
|
292
|
+
}
|
293
|
+
|
294
|
+
/* ===================================== *
|
295
|
+
* v. Radio button & checkbox
|
296
|
+
* ------------------------------------- */
|
297
|
+
|
298
|
+
// Radios & checkboxes
|
299
|
+
input[type=radio],
|
300
|
+
input[type=checkbox] {
|
301
|
+
display: none;
|
302
|
+
|
303
|
+
+ span {
|
304
|
+
width: 20px;
|
305
|
+
height: 20px;
|
306
|
+
margin: 0 8px 0 0;
|
307
|
+
cursor: pointer;
|
308
|
+
background: $white;
|
309
|
+
transition: .2s box-shadow;
|
310
|
+
box-shadow: 0 0 0 1px $alto inset;
|
311
|
+
|
312
|
+
&:hover,
|
313
|
+
&:focus,
|
314
|
+
&:active {
|
315
|
+
outline: 0;
|
316
|
+
box-shadow: 0 0 0 1px $aluminum inset;
|
317
|
+
}
|
318
|
+
}
|
319
|
+
}
|
320
|
+
|
321
|
+
// Radios
|
322
|
+
input[type=radio] {
|
323
|
+
|
324
|
+
+ span {
|
325
|
+
border-radius: 50%;
|
326
|
+
}
|
327
|
+
|
328
|
+
&:checked + span {
|
329
|
+
box-shadow: 0 0 0 8px $cerulean inset;
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
// Checkboxes
|
334
|
+
input[type=checkbox] {
|
335
|
+
|
336
|
+
+ span {
|
337
|
+
border-radius: $radius;
|
338
|
+
position: relative;
|
339
|
+
|
340
|
+
&:before {
|
341
|
+
content: '';
|
342
|
+
position: absolute;
|
343
|
+
left: 0;
|
344
|
+
top: 0;
|
345
|
+
width: 100%;
|
346
|
+
height: 60%;
|
347
|
+
margin: 15% 0 0 0;
|
348
|
+
border: solid $white;
|
349
|
+
border-width: 0 0 3px 3px;
|
350
|
+
transition: transform .2s;
|
351
|
+
transform: scale(0) rotate(-45deg);
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
&:checked + span {
|
356
|
+
box-shadow: 0 0 0 10px $cerulean inset;
|
357
|
+
}
|
358
|
+
|
359
|
+
&:checked + span:before {
|
360
|
+
transform: scale(.5) rotate(-45deg);
|
361
|
+
}
|
362
|
+
}
|
363
|
+
|
364
|
+
/* ===================================== *
|
365
|
+
* vi. Range slider
|
366
|
+
* ------------------------------------- */
|
367
|
+
|
368
|
+
// Range sliders
|
369
|
+
input[type=range] {
|
370
|
+
background-color: $alto;
|
371
|
+
width: 100%;
|
372
|
+
height: 8px;
|
373
|
+
border-radius: 4px;
|
374
|
+
outline: 0;
|
375
|
+
border: 0;
|
376
|
+
padding: 0;
|
377
|
+
display: flex;
|
378
|
+
position: relative;
|
379
|
+
-webkit-appearance: none;
|
380
|
+
cursor: pointer;
|
381
|
+
|
382
|
+
// Firefox track
|
383
|
+
&::-moz-range-track {
|
384
|
+
-moz-appearance: none;
|
385
|
+
opacity: 0;
|
386
|
+
}
|
387
|
+
|
388
|
+
// Remove default Firefox focus styles
|
389
|
+
&::-moz-focus-outer {
|
390
|
+
border: 0;
|
391
|
+
}
|
392
|
+
|
393
|
+
// Webkit thumb
|
394
|
+
&::-webkit-slider-thumb {
|
395
|
+
border: 0;
|
396
|
+
width: 22px;
|
397
|
+
height: 22px;
|
398
|
+
border-radius: 50%;
|
399
|
+
background: $white;
|
400
|
+
-webkit-appearance: none;
|
401
|
+
background: rgba($aluminum, .25);
|
402
|
+
border: 1px solid rgba($aluminum, .25);
|
403
|
+
box-shadow:
|
404
|
+
0 0 0 8px $white inset,
|
405
|
+
0 0 0 10px $aluminum inset;
|
406
|
+
transition:
|
407
|
+
border .2s,
|
408
|
+
box-shadow .2s;
|
409
|
+
}
|
410
|
+
|
411
|
+
&:hover::-webkit-slider-thumb {
|
412
|
+
border: 1px solid $aluminum;
|
413
|
+
}
|
414
|
+
|
415
|
+
&:focus::-webkit-slider-thumb,
|
416
|
+
&:active::-webkit-slider-thumb {
|
417
|
+
border: 1px solid $cerulean;
|
418
|
+
box-shadow:
|
419
|
+
0 0 0 8px $white inset,
|
420
|
+
0 0 0 10px $cerulean inset;
|
421
|
+
}
|
422
|
+
|
423
|
+
// Firefox thumb
|
424
|
+
&::-moz-range-thumb {
|
425
|
+
border: 0;
|
426
|
+
width: 22px;
|
427
|
+
height: 22px;
|
428
|
+
cursor: pointer;
|
429
|
+
border-radius: 50%;
|
430
|
+
-moz-appearance: none;
|
431
|
+
box-sizing: border-box;
|
432
|
+
background: rgba($aluminum, .25);
|
433
|
+
border: 1px solid rgba($aluminum, .25);
|
434
|
+
box-shadow:
|
435
|
+
0 0 0 8px $white inset,
|
436
|
+
0 0 0 10px $aluminum inset;
|
437
|
+
transition:
|
438
|
+
border .2s,
|
439
|
+
box-shadow .2s;
|
440
|
+
}
|
441
|
+
|
442
|
+
&:hover::-moz-range-thumb {
|
443
|
+
border: 1px solid $aluminum;
|
444
|
+
}
|
445
|
+
|
446
|
+
&:focus::-moz-range-thumb,
|
447
|
+
&:active::-moz-range-thumb {
|
448
|
+
border: 1px solid $cerulean;
|
449
|
+
box-shadow:
|
450
|
+
0 0 0 8px $white inset,
|
451
|
+
0 0 0 10px $cerulean inset;
|
452
|
+
}
|
453
|
+
}
|
454
|
+
|
455
|
+
/* ===================================== *
|
456
|
+
* vii. Other HTML5
|
457
|
+
* ------------------------------------- */
|
458
|
+
|
459
|
+
// Color inputs
|
460
|
+
input[type=color] {
|
461
|
+
appearance: none;
|
462
|
+
width: 50px;
|
463
|
+
height: 50px;
|
464
|
+
padding: 5px 3px;
|
465
|
+
background: $white;
|
466
|
+
border: 1px solid $alto;
|
467
|
+
border-radius: $radius;
|
468
|
+
cursor: crosshair;
|
469
|
+
|
470
|
+
&:hover,
|
471
|
+
&:focus,
|
472
|
+
&:active {
|
473
|
+
border-color: $aluminum;
|
474
|
+
}
|
475
|
+
|
476
|
+
&::-webkit-color-swatch-wrapper {
|
477
|
+
background: $white;
|
478
|
+
padding: 0 2px;
|
479
|
+
}
|
480
|
+
}
|
481
|
+
|
482
|
+
input[type=date],
|
483
|
+
input[type=month],
|
484
|
+
input[type=week],
|
485
|
+
input[type=datetime],
|
486
|
+
input[type=datetime-local] {
|
487
|
+
height: 50px;
|
488
|
+
}
|
489
|
+
|
490
|
+
/* ===================================== *
|
491
|
+
* viii. Button
|
492
|
+
* ------------------------------------- */
|
493
|
+
|
494
|
+
// Form buttons
|
495
|
+
input[type=button],
|
496
|
+
button[type=button] {
|
497
|
+
@include button;
|
498
|
+
}
|
499
|
+
|
500
|
+
// Form submit buttons
|
501
|
+
input[type=submit],
|
502
|
+
button[type=submit] {
|
503
|
+
@extend %success-btn;
|
504
|
+
}
|
505
|
+
|
506
|
+
/* ===================================== *
|
507
|
+
* ix. Validation
|
508
|
+
* ------------------------------------- */
|
509
|
+
|
510
|
+
// Apply validation styles to inputs & textareas
|
511
|
+
textarea,
|
512
|
+
input[type=url],
|
513
|
+
input[type=tel],
|
514
|
+
input[type=text],
|
515
|
+
input[type=email],
|
516
|
+
input[type=number],
|
517
|
+
input[type=password] {
|
518
|
+
|
519
|
+
// Strip default styling
|
520
|
+
&:invalid {
|
521
|
+
outline: 0;
|
522
|
+
box-shadow: none;
|
523
|
+
}
|
524
|
+
|
525
|
+
// Apply valid state color to required fields & adjacent labels
|
526
|
+
&.valid:required,
|
527
|
+
.valid &:required {
|
528
|
+
color: $lima;
|
529
|
+
}
|
530
|
+
|
531
|
+
// Apply valid state to required fields
|
532
|
+
&.valid:required,
|
533
|
+
.valid &:required {
|
534
|
+
border-color: $lima;
|
535
|
+
}
|
536
|
+
|
537
|
+
// Apply invalid state color to required fields & adjacent labels
|
538
|
+
&.invalid:required,
|
539
|
+
.invalid &:required {
|
540
|
+
color: $punch;
|
541
|
+
}
|
542
|
+
|
543
|
+
// Apply invalid state to required fields
|
544
|
+
&.invalid:required,
|
545
|
+
.invalid &:required {
|
546
|
+
border-color: $punch;
|
547
|
+
}
|
548
|
+
|
549
|
+
// Apply valid state to Chrome’s autofilled fields
|
550
|
+
&.valid:required:-webkit-autofill,
|
551
|
+
.valid &:required:-webkit-autofill {
|
552
|
+
-webkit-text-fill-color: $lima;
|
553
|
+
}
|
554
|
+
|
555
|
+
// Apply invalid state to Chrome’s autofilled fields
|
556
|
+
&.invalid:required::-webkit-autofill,
|
557
|
+
.invalid &:required::-webkit-autofill {
|
558
|
+
-webkit-text-fill-color: $punch;
|
559
|
+
}
|
560
|
+
}
|
561
|
+
|
562
|
+
// Validation message animation declaration
|
563
|
+
@keyframes scale-fade-in {
|
564
|
+
0% {
|
565
|
+
opacity: 0;
|
566
|
+
transform: translate(-50%, -6px) scale(.5);
|
567
|
+
}
|
568
|
+
|
569
|
+
100% {
|
570
|
+
opacity: 1;
|
571
|
+
transform: translate(-50%, 6px) scale(1);
|
572
|
+
}
|
573
|
+
}
|
574
|
+
|
575
|
+
// Inline validation messages
|
576
|
+
.validation-message {
|
577
|
+
position: absolute;
|
578
|
+
left: 50%;
|
579
|
+
top: 100%;
|
580
|
+
width: 325px;
|
581
|
+
max-width: 100vw;
|
582
|
+
z-index: 3;
|
583
|
+
text-align: center;
|
584
|
+
transform: translate(-50%, 6px) scale(1);
|
585
|
+
transform-origin: center top;
|
586
|
+
animation: scale-fade-in .2s ease-out;
|
587
|
+
|
588
|
+
// Message bubble (also a hack to maintain proper word wrap)
|
589
|
+
p {
|
590
|
+
display: inline-block;
|
591
|
+
margin: 0;
|
592
|
+
padding: 12px 18px;
|
593
|
+
border-radius: $radius;
|
594
|
+
background: $punch;
|
595
|
+
color: $white;
|
596
|
+
font-size: 14px;
|
597
|
+
line-height: 21px;
|
598
|
+
|
599
|
+
|
600
|
+
// Message bubble triangle
|
601
|
+
&:before {
|
602
|
+
content: '';
|
603
|
+
position: absolute;
|
604
|
+
left: 50%;
|
605
|
+
margin-left: -6px;
|
606
|
+
bottom: 100%;
|
607
|
+
width: 0;
|
608
|
+
height: 0;
|
609
|
+
border-style: solid;
|
610
|
+
border-width: 0 6px 6px 6px;
|
611
|
+
border-color: transparent transparent $punch transparent;
|
612
|
+
}
|
613
|
+
}
|
614
|
+
}
|