mdb-ui-kit/less/inputs.less

208 lines
5.6 KiB
Plaintext
Raw Normal View History

2014-08-18 18:25:33 +04:00
// main: material.less
2014-09-11 16:30:55 +04:00
fieldset[disabled] .form-control, .form-control-wrapper .form-control, .form-control {
2014-09-09 17:22:45 +04:00
&, &:focus, &.focus {
2014-09-12 13:35:52 +04:00
&:not(textarea):not(select) {
2014-09-12 13:34:03 +04:00
height: 28px;
}
2014-09-07 22:00:49 +04:00
padding: 0;
2014-08-18 18:25:33 +04:00
float: none;
border: 0;
box-shadow: none;
border-radius: 0;
background: transparent;
border-bottom: 1px solid #757575;
&:disabled {
border-style: dashed;
}
2014-08-18 18:25:33 +04:00
}
}
2014-09-07 22:12:16 +04:00
select.form-control {
height: 23px;
}
select[multiple].form-control {
2014-09-09 17:22:45 +04:00
&, &:focus, &.focus {
2014-09-07 22:12:16 +04:00
height: 85px;
}
}
.form-control-wrapper {
position: relative;
2014-09-09 17:22:45 +04:00
.form-control:focus, .form-control.focus {
2014-08-18 18:25:33 +04:00
outline: none;
}
.floating-label {
color: #7E7E7E;
font-size: 14px;
position: absolute;
pointer-events: none;
2014-09-07 22:12:16 +04:00
left: 0px;
top: 5px;
2014-08-18 18:25:33 +04:00
transition: 0.2s ease all;
opacity: 0;
}
.form-control:not(.empty) ~ .floating-label {
top: -10px;
font-size: 10px;
opacity: 1;
}
2014-09-09 17:22:45 +04:00
.form-control:focus:invalid ~ .floating-label, .form-control.focus:invalid ~ .floating-label {
2014-08-18 18:25:33 +04:00
color: @input-danger;
}
2014-09-09 17:22:45 +04:00
.form-control:focus ~ .material-input:after, .form-control.focus ~ .material-input:after {
2014-08-18 18:25:33 +04:00
background-color: @input-default;
}
2014-09-09 17:22:45 +04:00
.form-control:focus:invalid ~ .material-input, .form-control.focus:invalid ~ .material-input {
2014-08-18 18:25:33 +04:00
&:before, &:after {
background-color: @input-danger;
}
}
.form-control.empty ~ .floating-label {
opacity: 1;
}
.material-input:before {
position: absolute;
content: "";
width: 100%;
left: 0;
height: 2px;
background-color: @input-default;
bottom: -1px;
transform: scaleX(0);
transition: transform 0s;
}
2014-09-09 17:22:45 +04:00
.form-control:focus ~ .material-input:before, .form-control.focus ~ .material-input:before {
2014-08-18 18:25:33 +04:00
transform: scaleX(1);
transition: transform 0.2s ease-out;
}
.material-input:after {
content: "";
position: absolute;
height: 18px;
width: 100px;
margin-top: -1px;
2014-09-17 12:35:59 +04:00
top: 7px;
2014-08-18 18:25:33 +04:00
left: 0;
pointer-events: none;
opacity: 0.9;
2014-09-07 21:54:36 +04:00
transform-origin: left;
2014-08-18 18:25:33 +04:00
}
.input-lg ~ .material-input:after {
height: 26px;
}
textarea { resize: none; }
textarea ~ .form-control-highlight {
margin-top: -11px;
}
/* active state */
2014-09-09 17:22:45 +04:00
.form-control:focus ~ .material-input:after, .form-control.focus ~ .material-input:after {
2014-08-18 18:25:33 +04:00
-webkit-animation: input-highlight 0.3s ease;
animation: input-highlight 0.3s ease;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
2014-09-07 21:54:36 +04:00
opacity: 0;
2014-08-18 18:25:33 +04:00
}
select ~ .material-input:before {
bottom: 1px;
}
select ~ .material-input:after {
display: none;
}
2014-08-18 18:25:33 +04:00
}
.form-group {
&.has-warning {
2014-09-09 17:22:45 +04:00
.material-input:before, input.form-control:focus ~ .material-input:after, input.form-control.focus ~ .material-input:after {
2014-08-18 18:25:33 +04:00
background: @input-warning;
}
2014-09-07 22:12:16 +04:00
.control-label, input.form-control:not(.empty) ~ .floating-label {
2014-08-18 18:25:33 +04:00
color: @input-warning;
}
}
&.has-error {
2014-09-09 17:22:45 +04:00
.material-input:before, input.form-control:focus ~ .material-input:after, input.form-control.focus ~ .material-input:after {
2014-08-18 18:25:33 +04:00
background: @input-danger;
}
2014-09-07 22:12:16 +04:00
.control-label, input.form-control:not(.empty) ~ .floating-label {
2014-08-18 18:25:33 +04:00
color: @input-danger;
}
}
&.has-success {
2014-09-09 17:22:45 +04:00
.material-input:before, input.form-control:focus ~ .material-input:after, input.form-control.focus ~ .material-input:after {
2014-08-18 18:25:33 +04:00
background: @input-success;
}
2014-09-07 22:12:16 +04:00
.control-label, input.form-control:not(.empty) ~ .floating-label {
2014-08-18 18:25:33 +04:00
color: @input-success;
}
}
&.has-info {
2014-09-09 17:22:45 +04:00
.material-input:before, input.form-control:focus ~ .material-input:after, input.form-control.focus ~ .material-input:after {
2014-08-18 18:25:33 +04:00
background: @input-info;
}
2014-09-07 22:12:16 +04:00
.control-label, input.form-control:not(.empty) ~ .floating-label {
2014-08-18 18:25:33 +04:00
color: @input-info;
}
}
2014-08-20 15:01:56 +04:00
.variations(~" .material-input:before", background-color, @indigo);
.variations(~" input.form-control:focus ~ .material-input:after", background-color, @indigo);
2014-09-09 17:22:45 +04:00
.variations(~" input.form-control.focus ~ .material-input:after", background-color, @indigo);
.variations(~" .control-label", color, @lightbg-text);
2014-09-07 22:12:16 +04:00
.variations(~" input.form-control:not(.empty) ~ .floating-label", color, @indigo);
2014-08-18 18:25:33 +04:00
}
.input-group {
.form-control-wrapper {
.form-control {
float: none;
}
margin-right: 5px;
margin-left: 5px;
bottom: -10px;
}
.input-group-addon {
border: 0;
}
.input-group-btn .btn {
border-radius: 4px;
}
}
select.form-control {
border: 0;
box-shadow: none;
border-bottom: 1px solid #757575;
border-radius: 0;
2014-09-09 17:22:45 +04:00
&:focus, &.focus {
2014-08-18 18:25:33 +04:00
box-shadow: none;
border-color: #757575;
}
}
2014-09-07 21:54:36 +04:00
.keyframe-input-highlight() {
0% {
left: 20%;
transform: scaleX(20%);
}
99% {
transform: scaleX(0);
left: 0;
opacity: 1;
}
100% {
opacity: 0;
}
}
@-webkit-keyframes input-highlight {.keyframe-input-highlight()}
@-moz-keyframes input-highlight {.keyframe-input-highlight()}
@-ms-keyframes input-highlight {.keyframe-input-highlight()}
@-o-keyframes input-highlight {.keyframe-input-highlight()}
@keyframes input-highlight {.keyframe-input-highlight()}