fixed style and behavior of floating labels

This commit is contained in:
FezVrasta 2015-03-17 17:47:58 +01:00
parent 646c2f3750
commit c5eb110d78
9 changed files with 700 additions and 697 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

67
dist/css/material.css vendored
View File

@ -5027,6 +5027,7 @@ fieldset[disabled] .form-control.focus:disabled,
transition: 0.2s ease all; transition: 0.2s ease all;
opacity: 0; opacity: 0;
} }
.form-control-wrapper .form-control:focus ~ .floating-label,
.form-control-wrapper .form-control:not(.empty) ~ .floating-label { .form-control-wrapper .form-control:not(.empty) ~ .floating-label {
top: -10px; top: -10px;
font-size: 10px; font-size: 10px;
@ -5077,7 +5078,7 @@ fieldset[disabled] .form-control.focus:disabled,
box-shadow: none; box-shadow: none;
} }
.form-group.has-warning .control-label, .form-group.has-warning .control-label,
.form-group.has-warning input.form-control:not(.empty) ~ .floating-label { .form-group.has-warning input.form-control:focus ~ .floating-label {
color: #ff5722; color: #ff5722;
} }
.form-group.has-error .form-control { .form-group.has-error .form-control {
@ -5090,7 +5091,7 @@ fieldset[disabled] .form-control.focus:disabled,
box-shadow: none; box-shadow: none;
} }
.form-group.has-error .control-label, .form-group.has-error .control-label,
.form-group.has-error input.form-control:not(.empty) ~ .floating-label { .form-group.has-error input.form-control:focus ~ .floating-label {
color: #f44336; color: #f44336;
} }
.form-group.has-success .form-control { .form-group.has-success .form-control {
@ -5103,7 +5104,7 @@ fieldset[disabled] .form-control.focus:disabled,
box-shadow: none; box-shadow: none;
} }
.form-group.has-success .control-label, .form-group.has-success .control-label,
.form-group.has-success input.form-control:not(.empty) ~ .floating-label { .form-group.has-success input.form-control:focus ~ .floating-label {
color: #0f9d58; color: #0f9d58;
} }
.form-group.has-info .form-control { .form-group.has-info .form-control {
@ -5116,7 +5117,7 @@ fieldset[disabled] .form-control.focus:disabled,
box-shadow: none; box-shadow: none;
} }
.form-group.has-info .control-label, .form-group.has-info .control-label,
.form-group.has-info input.form-control:not(.empty) ~ .floating-label { .form-group.has-info input.form-control:focus ~ .floating-label {
color: #03a9f4; color: #03a9f4;
} }
.form-group .form-control:focus, .form-group .form-control:focus,
@ -5374,89 +5375,89 @@ fieldset[disabled] .form-control.focus:disabled,
.form-group-material-blue-grey .control-label { .form-group-material-blue-grey .control-label {
color: #607d8b; color: #607d8b;
} }
.form-group input.form-control:not(.empty) ~ .floating-label, .form-group input.form-control:focus ~ .floating-label,
.form-group-default input.form-control:not(.empty) ~ .floating-label { .form-group-default input.form-control:focus ~ .floating-label {
color: #009587; color: #009587;
} }
.form-group-black input.form-control:not(.empty) ~ .floating-label { .form-group-black input.form-control:focus ~ .floating-label {
color: #000000; color: #000000;
} }
.form-group-white input.form-control:not(.empty) ~ .floating-label { .form-group-white input.form-control:focus ~ .floating-label {
color: #ffffff; color: #ffffff;
} }
.form-group-inverse input.form-control:not(.empty) ~ .floating-label { .form-group-inverse input.form-control:focus ~ .floating-label {
color: #3f51b5; color: #3f51b5;
} }
.form-group-primary input.form-control:not(.empty) ~ .floating-label { .form-group-primary input.form-control:focus ~ .floating-label {
color: #009587; color: #009587;
} }
.form-group-success input.form-control:not(.empty) ~ .floating-label { .form-group-success input.form-control:focus ~ .floating-label {
color: #0f9d58; color: #0f9d58;
} }
.form-group-info input.form-control:not(.empty) ~ .floating-label { .form-group-info input.form-control:focus ~ .floating-label {
color: #03a9f4; color: #03a9f4;
} }
.form-group-warning input.form-control:not(.empty) ~ .floating-label { .form-group-warning input.form-control:focus ~ .floating-label {
color: #ff5722; color: #ff5722;
} }
.form-group-danger input.form-control:not(.empty) ~ .floating-label { .form-group-danger input.form-control:focus ~ .floating-label {
color: #f44336; color: #f44336;
} }
.form-group-material-red input.form-control:not(.empty) ~ .floating-label { .form-group-material-red input.form-control:focus ~ .floating-label {
color: #f44336; color: #f44336;
} }
.form-group-material-pink input.form-control:not(.empty) ~ .floating-label { .form-group-material-pink input.form-control:focus ~ .floating-label {
color: #e91e63; color: #e91e63;
} }
.form-group-material-purple input.form-control:not(.empty) ~ .floating-label { .form-group-material-purple input.form-control:focus ~ .floating-label {
color: #9c27b0; color: #9c27b0;
} }
.form-group-material-deep-purple input.form-control:not(.empty) ~ .floating-label { .form-group-material-deep-purple input.form-control:focus ~ .floating-label {
color: #673ab7; color: #673ab7;
} }
.form-group-material-indigo input.form-control:not(.empty) ~ .floating-label { .form-group-material-indigo input.form-control:focus ~ .floating-label {
color: #3f51b5; color: #3f51b5;
} }
.form-group-material-blue input.form-control:not(.empty) ~ .floating-label { .form-group-material-blue input.form-control:focus ~ .floating-label {
color: #2196f3; color: #2196f3;
} }
.form-group-material-light-blue input.form-control:not(.empty) ~ .floating-label { .form-group-material-light-blue input.form-control:focus ~ .floating-label {
color: #03a9f4; color: #03a9f4;
} }
.form-group-material-cyan input.form-control:not(.empty) ~ .floating-label { .form-group-material-cyan input.form-control:focus ~ .floating-label {
color: #00bcd4; color: #00bcd4;
} }
.form-group-material-teal input.form-control:not(.empty) ~ .floating-label { .form-group-material-teal input.form-control:focus ~ .floating-label {
color: #009688; color: #009688;
} }
.form-group-material-green input.form-control:not(.empty) ~ .floating-label { .form-group-material-green input.form-control:focus ~ .floating-label {
color: #4caf50; color: #4caf50;
} }
.form-group-material-light-green input.form-control:not(.empty) ~ .floating-label { .form-group-material-light-green input.form-control:focus ~ .floating-label {
color: #8bc34a; color: #8bc34a;
} }
.form-group-material-lime input.form-control:not(.empty) ~ .floating-label { .form-group-material-lime input.form-control:focus ~ .floating-label {
color: #cddc39; color: #cddc39;
} }
.form-group-material-yellow input.form-control:not(.empty) ~ .floating-label { .form-group-material-yellow input.form-control:focus ~ .floating-label {
color: #ffeb3b; color: #ffeb3b;
} }
.form-group-material-amber input.form-control:not(.empty) ~ .floating-label { .form-group-material-amber input.form-control:focus ~ .floating-label {
color: #ffc107; color: #ffc107;
} }
.form-group-material-orange input.form-control:not(.empty) ~ .floating-label { .form-group-material-orange input.form-control:focus ~ .floating-label {
color: #ff9800; color: #ff9800;
} }
.form-group-material-deep-orange input.form-control:not(.empty) ~ .floating-label { .form-group-material-deep-orange input.form-control:focus ~ .floating-label {
color: #ff5722; color: #ff5722;
} }
.form-group-material-brown input.form-control:not(.empty) ~ .floating-label { .form-group-material-brown input.form-control:focus ~ .floating-label {
color: #795548; color: #795548;
} }
.form-group-material-grey input.form-control:not(.empty) ~ .floating-label { .form-group-material-grey input.form-control:focus ~ .floating-label {
color: #9e9e9e; color: #9e9e9e;
} }
.form-group-material-blue-grey input.form-control:not(.empty) ~ .floating-label { .form-group-material-blue-grey input.form-control:focus ~ .floating-label {
color: #607d8b; color: #607d8b;
} }
.input-group .form-control-wrapper { .input-group .form-control-wrapper {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -60,6 +60,7 @@ fieldset[disabled] .form-control:disabled, .form-control-wrapper .form-control:d
transition: 0.2s ease all; transition: 0.2s ease all;
opacity: 0; opacity: 0;
} }
.form-control:focus ~ .floating-label,
.form-control:not(.empty) ~ .floating-label { .form-control:not(.empty) ~ .floating-label {
top: -10px; top: -10px;
font-size: 10px; font-size: 10px;
@ -76,7 +77,7 @@ fieldset[disabled] .form-control:disabled, .form-control-wrapper .form-control:d
background-color: @input-danger; background-color: @input-danger;
} }
} }
.form-control.empty ~ .floating-label { .form-control.empty ~ .floating-label {
opacity: 1; opacity: 1;
} }
textarea { resize: none; } textarea { resize: none; }
@ -109,7 +110,7 @@ fieldset[disabled] .form-control:disabled, .form-control-wrapper .form-control:d
background-image: linear-gradient(@input-warning, @input-warning), linear-gradient(#D2D2D2, #D2D2D2); background-image: linear-gradient(@input-warning, @input-warning), linear-gradient(#D2D2D2, #D2D2D2);
box-shadow: none; box-shadow: none;
} }
.control-label, input.form-control:not(.empty) ~ .floating-label { .control-label, input.form-control:focus ~ .floating-label {
color: @input-warning; color: @input-warning;
} }
} }
@ -121,7 +122,7 @@ fieldset[disabled] .form-control:disabled, .form-control-wrapper .form-control:d
background-image: linear-gradient(@input-danger, @input-danger), linear-gradient(#D2D2D2, #D2D2D2); background-image: linear-gradient(@input-danger, @input-danger), linear-gradient(#D2D2D2, #D2D2D2);
box-shadow: none; box-shadow: none;
} }
.control-label, input.form-control:not(.empty) ~ .floating-label { .control-label, input.form-control:focus ~ .floating-label {
color: @input-danger; color: @input-danger;
} }
} }
@ -133,7 +134,7 @@ fieldset[disabled] .form-control:disabled, .form-control-wrapper .form-control:d
background-image: linear-gradient(@input-success, @input-success), linear-gradient(#D2D2D2, #D2D2D2); background-image: linear-gradient(@input-success, @input-success), linear-gradient(#D2D2D2, #D2D2D2);
box-shadow: none; box-shadow: none;
} }
.control-label, input.form-control:not(.empty) ~ .floating-label { .control-label, input.form-control:focus ~ .floating-label {
color: @input-success; color: @input-success;
} }
} }
@ -145,7 +146,7 @@ fieldset[disabled] .form-control:disabled, .form-control-wrapper .form-control:d
background-image: linear-gradient(@input-info, @input-info), linear-gradient(#D2D2D2, #D2D2D2); background-image: linear-gradient(@input-info, @input-info), linear-gradient(#D2D2D2, #D2D2D2);
box-shadow: none; box-shadow: none;
} }
.control-label, input.form-control:not(.empty) ~ .floating-label { .control-label, input.form-control:focus ~ .floating-label {
color: @input-info; color: @input-info;
} }
} }
@ -156,7 +157,7 @@ fieldset[disabled] .form-control:disabled, .form-control-wrapper .form-control:d
background-image: linear-gradient(@material-color, @material-color), linear-gradient(#D2D2D2, #D2D2D2); background-image: linear-gradient(@material-color, @material-color), linear-gradient(#D2D2D2, #D2D2D2);
}); });
.variations(~" .control-label", color, @lightbg-text); .variations(~" .control-label", color, @lightbg-text);
.variations(~" input.form-control:not(.empty) ~ .floating-label", color, @input-default); .variations(~" input.form-control:focus ~ .floating-label", color, @input-default);
} }