This repository was archived by the owner on Apr 25, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,13 @@ export default {
16
16
hasValue: false ,
17
17
isActive: false ,
18
18
label: ' ' ,
19
- placeholderIndentation: 6 ,
20
19
width: ' auto'
21
20
}
22
21
},
23
22
mounted () {
24
23
this .input = this .$el .querySelector (' input, textarea' )
25
- this .width = ` ${ this .input .clientWidth - this . placeholderIndentation } px`
24
+ this .width = ` ${ this .input .clientWidth } px`
26
25
this .label = this .input .placeholder
27
- this .input .placeholder = ' '
28
26
this .input .addEventListener (' input' , this .updateHasValue )
29
27
this .input .addEventListener (' input' , this .updateIsActive )
30
28
this .input .addEventListener (' blur' , this .updateIsActive )
@@ -59,22 +57,29 @@ export default {
59
57
60
58
.vfl-label {
61
59
position : absolute ;
62
- top : 0.25 em ;
63
- left : 0.3 em ;
60
+ top : 0 ;
61
+ left : 0.1 em ;
64
62
overflow : hidden ;
65
63
font-family : sans-serif ;
66
- font-size : 0.7 em ;
64
+ font-size : 0.8 em ;
67
65
color : #aaa ;
68
66
text-overflow : ellipsis ;
69
67
white-space : nowrap ;
70
- transition : top 0.2s ease-out ;
68
+ transition : all 0.2s ease-out ;
69
+ opacity : 0
71
70
}
72
71
73
72
.vfl-label-on-input {
74
73
top : -1.3em ;
74
+ opacity : 1 ;
75
75
}
76
76
77
77
.vfl-label-on-focus {
78
78
color : #0074d9 ;
79
79
}
80
+
81
+ .vfl-has-label input :focus ,
82
+ .vfl-has-label textarea :focus {
83
+ outline : 0 ;
84
+ }
80
85
</style >
Original file line number Diff line number Diff line change @@ -33,10 +33,7 @@ body {
33
33
input ,
34
34
textarea {
35
35
margin-bottom : 2.5em ;
36
- }
37
-
38
- input :focus ,
39
- textarea :focus {
40
- outline : 0 ;
36
+ line-height : 1.15 ;
37
+ font-size : 100% ;
41
38
}
42
39
</style >
Original file line number Diff line number Diff line change @@ -20,9 +20,7 @@ const getFloatLabel = () => {
20
20
test ( 'setup on mount' , ( ) => {
21
21
const vm = getFloatLabel ( )
22
22
expect ( vm . input ) . toBeInstanceOf ( HTMLInputElement )
23
- expect ( vm . width ) . toEqual ( '-6px' ) // clientWidth = 0
24
23
expect ( vm . label ) . toEqual ( 'Name' )
25
- expect ( vm . input . placeholder ) . toEqual ( '' )
26
24
} )
27
25
28
26
test ( 'classObject' , ( ) => {
You can’t perform that action at this time.
0 commit comments