react-input-ui
Version:
Collection of input fields for ReactJs
172 lines (144 loc) • 3.95 kB
CSS
:root {
--i-mUI-activeTextColor: #101010;
--i-mUI-focusColor: #2196f3;
--i-mUI-hoverColor: #252525;
--i-mUI-mainColor: #727272;
}
.i-mUI {
border: none;
padding: 0;
position: relative;
}
.i-mUI__input {
-o-transition: box-shadow .3s;
-webkit-appearance: none;
-webkit-box-shadow: none;
-webkit-box-sizing: border-box;
-webkit-transition: -webkit-box-shadow .3s;
background: transparent;
border-bottom: 1px solid var(--i-mUI-mainColor);
border-left: none;
border-radius: 0;
border-right: none;
border-top: none;
box-shadow: none;
box-sizing: border-box;
color: var(--i-mUI-mainColor);
cursor: text;
outline: none;
padding: .7em;
transition: -webkit-box-shadow .3s;
transition: box-shadow .3s;
width: 100%;
}
.i-mUI__input:hover {
border-bottom-color: var(--i-mUI-hoverColor);
color: var(--i-mUI-hoverColor);
}
.i-mUI__input:focus {
color: var(--i-mUI-activeTextColor);
}
/*Label*/
.i-mUI__label {
-o-transition: all .3s ease;
-o-transition-property: bottom, color, font-size;
-webkit-transition: all .3s ease;
-webkit-transition-property: bottom, color, font-size;
bottom: 5px;
color: var(--i-mUI-mainColor);
left: 0;
pointer-events: none;
position: absolute;
transition: all .3s ease;
transition-property: bottom, color, font-size;
}
.i-mUI__input:hover ~ .i-mUI__label {
color: var(--i-mUI-hoverColor);
}
.i-mUI__input:focus ~ .i-mUI__label {
color: var(--i-mUI-focusColor);
}
.i-mUI__input:focus ~ .i-mUI__label,
.i-mUI__input:not([value=""]) ~ .i-mUI__label {
bottom: 100%;
font-size: small;
}
/*Underline*/
.i-mUI__underline {
-ms-transform: scaleX(0);
-o-transition: transform .3s ease-out;
-webkit-transform: scaleX(0);
-webkit-transition: transform .3s ease-out;
background: var(--i-mUI-focusColor);
border: none;
bottom: 0;
content: '';
display: block;
font-size: 1px;
height: 2px;
left: 0;
margin: 0;
padding: 0;
position: absolute;
transform: scaleX(0);
transition: transform .3s ease-out;
width: 100%;
z-index: 9;
}
.i-mUI__input:focus ~ .i-mUI__underline {
-ms-transform: scaleX(1);
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
/*Placeholder*/
.i-mUI__input::-webkit-input-placeholder {
-o-transition: color .3s ease;
-webkit-transition: color .3s ease;
transition: color .3s ease;
}
.i-mUI__input:-ms-input-placeholder {
-webkit-transition: color .3s ease;
-o-transition: color .3s ease;
transition: color .3s ease;
}
.i-mUI__input::-ms-input-placeholder {
-webkit-transition: color .3s ease;
-o-transition: color .3s ease;
transition: color .3s ease;
}
.i-mUI__input::placeholder {
-webkit-transition: color .3s ease;
-o-transition: color .3s ease;
transition: color .3s ease;
}
.i-mUI__input::-webkit-input-placeholder {
-webkit-transition: color .3s ease;
-o-transition: color .3s ease;
transition: color .3s ease;
}
.i-mUI__input::-ms-input-placeholder {
-webkit-transition: color .3s ease;
-o-transition: color .3s ease;
transition: color .3s ease;
}
.i-mUI__input:not(:focus)::-webkit-input-placeholder {
color: transparent;
}
.i-mUI__input:not(:focus):-ms-input-placeholder {
color: transparent;
}
.i-mUI__input:not(:focus)::-ms-input-placeholder {
color: transparent;
}
.i-mUI__input:not(:focus)::placeholder {
color: transparent;
}
.i-mUI__input:not(:focus)::-webkit-input-placeholder {
color: transparent;
}
.i-mUI__input:not(:focus)::-ms-input-placeholder {
color: transparent;
}
.i-mUI__input:not(:focus)::-moz-placeholder {
color: transparent;
}