1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

added text input

This commit is contained in:
muerwre 2019-07-30 12:10:37 +07:00
parent 5aca2508ea
commit 578b37716b
7 changed files with 527 additions and 0 deletions

334
src/styles/inputs.scss Normal file
View file

@ -0,0 +1,334 @@
.input_text_wrapper {
position: relative;
min-height: 40px;
border-radius: $input_radius;
box-shadow: $input_shadow;
flex: 1;
display: flex;
opacity: 1;
transition: opacity 0.25s;
z-index: 1;
&::before {
content: ' ';
background: linear-gradient(270deg, white $gap, transparentize(white, 1));
position: absolute;
width: $gap * 2;
height: $input_height - 4px;
top: 2px;
right: 2px;
transform: translateX(0);
transition: transform 0.25s;
border-radius: 0 $input_radius $input_radius 0;
pointer-events: none;
touch-action: none;
}
:global(.react-datepicker-wrapper) {
flex: 1;
padding: 0 18px;
}
&:hover {
opacity: 1;
}
&.focused {
opacity: 1;
z-index: 999;
&.has_status .status {
flex-basis: 0;
div {
opacity: 0;
}
}
&.select {
.title {
opacity: 0;
}
}
.title {
color: transparentize(black, 0.3);
}
}
input {
width: 100%;
}
.input {
display: flex;
align-items: center;
justify-content: stretch;
padding: 0 18px;
flex: 1 0 0;
outline: none;
}
&.required {
&::after {
content: ' ';
width: 5px;
height: 5px;
border-radius: 3px;
top: 8px;
left: 8px;
position: absolute;
background: $red_gradient;
}
}
&.has_loader {
&::before { transform: translateX(-40px); }
.loader {
flex-basis: 40px;
}
}
&.has_status {
&::before { transform: translateX(-40px); }
&.focused::before { transform: translateX(0); }
.status {
flex-basis: 40px;
}
.title {
padding-right: 40px;
}
&.focused {
.title {
padding-right: 16px;
color: black;
}
}
}
&.focused.has_status.has_loader {
&::before { transform: translateX(-80px); }
&.focused::before { transform: translateX(-40px); }
}
&.has_error {
box-shadow: $input_shadow_error;
.title {
color: transparentize(red, 0.4) !important;
}
input, textarea {
color: $red;
}
}
&.numeric {
flex: 0 0 120px;
.input {
padding: 0 10px;
}
.plus {
cursor: pointer;
}
input {
margin: 0 10px;
flex: 0 0 40px;
text-align: center;
}
}
&.select {
.input {
padding: 0 10px;
}
.value {
padding: 0 8px;
}
}
.password_revealer {
width: 40px;
height: 40px;
position: absolute;
top: 0;
right: 0;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
user-select: none;
color: white;
opacity: 0.5;
transition: opacity 0.25s;
&:hover {
opacity: 1;
}
}
.input_text, .textarea {
outline: none;
border: none;
font: inherit;
box-sizing: border-box;
background: transparent;
color: black;
flex: 1;
resize: none;
}
.textarea {
padding: 12px 0;
box-sizing: border-box;
width: 100%;
}
.status, .loader {
flex: 0 0 0;
transition: flex-basis 500ms;
position: relative;
overflow: hidden;
pointer-events: none;
touch-action: none;
& > div {
position: absolute;
left: 0;
top: 0;
width: $input_height;
height: $input_height;
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.25s;
opacity: 0;
&:global(.active) {
opacity: 1;
}
}
}
.title {
font: $font;
position: absolute;
left: 0;
width: 100%;
top: 12px;
bottom: auto;
padding: 0 14px;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: flex-start;
transition: top 0.25s, bottom 0.25s, font 0.25s, color 0.25s;
pointer-events: none;
touch-action: none;
color: transparentize(black, 0.3);
text-transform: capitalize;
span {
background: white;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 0 5px;
}
}
&.focused .title, &.has_value .title {
font: $font_12_regular;
top: -10px;
bottom: auto;
}
&.has_value {
box-shadow: $input_shadow_filled;
.title {
color: #C2C2C2;
}
&.focused {
.title {
color: transparentize(black, 0.3);
}
}
}
.error {
font: $font_12_regular;
bottom: -6px;
left: 15px;
position: absolute;
color: $red;
span {
background: white;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 0 5px;
}
}
.error_icon {
fill: $red;
stroke: $red;
}
.success_icon {
fill: $green;
stroke: $green;
}
}
.options {
position: absolute;
top: 0;
left: 0;
width: 100%;
border-radius: $input_radius;
box-shadow: $input_shadow;
background: white;
z-index: 10;
}
.option:hover {
background: transparentize($red, 0.8);
}
.option_title {
text-transform: capitalize;
color: transparentize(black, 0.5);
pointer-events: none;
}
.options {
.option, .option_title {
height: $input_height;
display: flex;
align-items: center;
justify-content: flex-start;
padding: 0 10px;
cursor: pointer;
transition: background-color 0.1s;
border-radius: $input_radius;
}
.option_title {
box-shadow: $input_shadow;
border-radius: $input_radius;
}
}