accounts-frontend/packages/app/components/ui/form/form.scss

431 lines
7.2 KiB
SCSS
Raw Normal View History

@import '~app/components/ui/colors.scss';
@import '~app/components/ui/fonts.scss';
@mixin form-transition() {
2020-05-24 04:38:24 +05:30
// Анимация фона должна быть быстрее анимации рамки, т.к. визуально фон заполняется медленнее
transition: border-color 0.25s, background-color 0.2s;
}
/**
* Input
*/
2016-01-09 19:45:03 +05:30
@mixin input-theme($themeName, $color) {
2020-05-24 04:38:24 +05:30
.#{$themeName}TextField {
composes: textField;
2016-01-09 19:45:03 +05:30
2020-05-24 04:38:24 +05:30
&:focus {
border-color: $color;
2016-01-09 19:45:03 +05:30
2020-05-24 04:38:24 +05:30
~ .textFieldIcon {
background: $color;
border-color: $color;
}
2020-05-24 04:38:24 +05:30
&.lightTextField {
color: $color;
}
}
2016-01-09 19:45:03 +05:30
}
}
.formRow {
2020-05-24 04:38:24 +05:30
margin: 10px 0;
}
.formIconRow {
2020-05-24 04:38:24 +05:30
composes: formRow;
2020-05-24 04:38:24 +05:30
.textField {
padding-left: 60px;
}
}
.textFieldContainer {
2020-05-24 04:38:24 +05:30
position: relative;
height: 50px;
max-width: 100%;
}
.textField {
2020-05-24 04:38:24 +05:30
box-sizing: border-box;
height: 50px;
width: 100%;
2020-05-24 04:38:24 +05:30
border: 2px solid;
2020-05-24 04:38:24 +05:30
font-size: 18px;
color: #aaa;
font-family: $font-family-title;
padding: 0 10px;
2020-05-24 04:38:24 +05:30
transition: border-color 0.25s;
2020-05-24 04:38:24 +05:30
&:hover {
&,
~ .textFieldIcon {
border-color: #aaa;
}
}
2020-05-24 04:38:24 +05:30
&:focus {
color: #fff;
outline: none;
2020-05-24 04:38:24 +05:30
~ .textFieldIcon {
color: #fff;
}
}
}
.textFieldIcon {
2020-05-24 04:38:24 +05:30
box-sizing: border-box;
position: absolute;
left: 0;
top: 0;
height: 50px;
width: 50px;
line-height: 46px;
text-align: center;
border: 2px solid;
color: #444;
cursor: default;
2020-05-24 04:38:24 +05:30
@include form-transition();
}
.copyIcon {
2020-05-24 04:38:24 +05:30
position: absolute;
right: 5px;
top: 10px;
2020-05-24 04:38:24 +05:30
padding: 5px;
cursor: pointer;
2020-05-24 04:38:24 +05:30
font-size: 20px;
2020-05-24 04:38:24 +05:30
transition: 0.25s;
}
.copyCheckmark {
2020-05-24 04:38:24 +05:30
color: $green !important;
}
.darkTextField {
2020-05-24 04:38:24 +05:30
background: $black;
2020-05-24 04:38:24 +05:30
&::placeholder {
opacity: 1;
color: #444;
}
2020-05-24 04:38:24 +05:30
&,
~ .textFieldIcon {
border-color: lighter($black);
}
2020-05-24 04:38:24 +05:30
~ .copyIcon {
color: #999;
background: $black;
2020-05-24 04:38:24 +05:30
&:hover {
background: lighter($black);
}
}
}
.lightTextField {
2020-05-24 04:38:24 +05:30
background: #fff;
2020-05-24 04:38:24 +05:30
&:disabled {
background: #dcd8cd;
2020-05-24 04:38:24 +05:30
~ .copyIcon {
background: #dcd8ce;
2020-05-24 04:38:24 +05:30
&:hover {
background: #ebe8e2;
}
}
}
2020-05-24 04:38:24 +05:30
&::placeholder {
opacity: 1;
color: #aaa;
}
2020-05-24 04:38:24 +05:30
&,
~ .textFieldIcon {
border-color: #dcd8cd;
}
2020-05-24 04:38:24 +05:30
~ .copyIcon {
color: #aaa;
background: #fff;
2020-05-24 04:38:24 +05:30
&:hover {
background: #f5f5f5;
}
}
}
2016-04-17 14:51:37 +05:30
.textFieldLabel {
2020-05-24 04:38:24 +05:30
margin: 10px 0;
display: block;
2020-05-24 04:38:24 +05:30
font-family: $font-family-title;
color: #666;
font-size: 18px;
2016-04-17 14:51:37 +05:30
}
.fieldError {
color: $red;
2020-05-24 04:38:24 +05:30
font-size: 12px;
margin: 3px 0;
2020-05-24 04:38:24 +05:30
a {
border-bottom-color: rgba($red, 0.75);
color: $red;
&:hover {
border-bottom-color: transparent;
}
}
}
2016-05-22 22:55:38 +05:30
.textAreaContainer {
2020-05-24 04:38:24 +05:30
height: auto;
2016-05-22 22:55:38 +05:30
}
.textArea {
2020-05-24 04:38:24 +05:30
height: auto; // unset .textField height
min-height: 50px;
padding: 5px 10px;
resize: none;
position: relative;
2016-05-22 22:55:38 +05:30
}
.textFieldCenter {
2020-05-24 04:38:24 +05:30
text-align: center;
}
2016-01-09 19:45:03 +05:30
@include input-theme('green', $green);
@include input-theme('blue', $blue);
@include input-theme('red', $red);
@include input-theme('darkBlue', $dark_blue);
@include input-theme('lightViolet', $light_violet);
2016-05-02 23:06:05 +05:30
@include input-theme('violet', $violet);
2016-01-09 19:45:03 +05:30
/**
* Markable is our common name for checkboxes and radio buttons
*/
@mixin markable-theme($themeName, $color) {
2020-05-24 04:38:24 +05:30
.#{$themeName}MarkableRow {
composes: markableRow;
.markableContainer {
&:hover {
.mark {
border-color: $color;
}
}
2016-01-09 19:45:03 +05:30
}
2020-05-24 04:38:24 +05:30
.markableInput {
&:checked {
+ .mark {
background: $color;
border-color: $color;
}
}
2016-01-09 19:45:03 +05:30
}
}
}
.markableRow {
2020-05-24 04:38:24 +05:30
height: 22px;
}
.markableContainer {
2020-05-24 04:38:24 +05:30
display: inline-block;
position: relative;
padding-left: 27px;
2020-05-24 04:38:24 +05:30
font-family: $font-family-title;
font-size: 16px;
line-height: 24px;
2020-05-24 04:38:24 +05:30
cursor: pointer;
}
.markPosition {
2020-05-24 04:38:24 +05:30
position: absolute;
box-sizing: border-box;
left: 0;
top: 0;
margin: 0;
2020-05-24 04:38:24 +05:30
width: 22px;
height: 22px;
}
.markableInput {
2020-05-24 04:38:24 +05:30
composes: markPosition;
opacity: 0;
2020-05-24 04:38:24 +05:30
&:checked {
+ .mark {
&:before {
opacity: 1;
}
}
}
}
.mark {
2020-05-24 04:38:24 +05:30
composes: markPosition;
composes: checkmark from '~app/components/ui/icons.scss';
2020-05-24 04:38:24 +05:30
border: 2px #dcd8cd solid;
2020-05-24 04:38:24 +05:30
font-size: 10px;
line-height: 18px;
text-align: center;
color: #fff;
2020-05-24 04:38:24 +05:30
@include form-transition();
2020-05-24 04:38:24 +05:30
&:before {
opacity: 0;
transition: opacity 0.3s;
}
}
2016-01-09 19:45:03 +05:30
.checkbox {
2020-05-24 04:38:24 +05:30
composes: mark;
}
.radio {
2020-05-24 04:38:24 +05:30
composes: mark;
2020-05-24 04:38:24 +05:30
border-radius: 50%;
}
.lightMarkableRow {
2020-05-24 04:38:24 +05:30
.markableContainer {
color: #666;
}
}
.darkMarkableRow {
2020-05-24 04:38:24 +05:30
.markableContainer {
color: #fff;
}
}
@include markable-theme('green', $green);
@include markable-theme('blue', $blue);
@include markable-theme('red', $red);
.isFormLoading {
2020-05-24 04:38:24 +05:30
// TODO: надо бы разнести from и input на отдельные модули,
// так как в текущем контексте isLoading немного не логичен,
// пришлось юзать isFormLoading
* {
pointer-events: none;
}
2020-05-24 04:38:24 +05:30
[type='submit'] {
// TODO: duplicate of .loading from components/ui/buttons
background: url('./images/loader_button.gif') #95a5a6 center center !important;
2020-05-24 04:38:24 +05:30
cursor: default;
color: #fff;
transition: 0.25s;
outline: none;
}
}
.captchaContainer {
2020-05-24 04:38:24 +05:30
position: relative;
}
.captcha {
2020-05-24 04:38:24 +05:30
position: relative;
box-sizing: border-box;
width: 100%;
max-width: 302px;
height: 77px;
overflow: hidden;
border: 2px solid;
transition: border-color 0.25s;
> div {
margin: -2px;
}
2020-05-24 04:38:24 +05:30
&:hover {
border-color: #aaa;
}
2020-05-24 04:38:24 +05:30
// minimum captcha width is 302px, which can not be changed
// using transform to scale down to 296px
// transform-origin: 0;
// transform: scaleX(0.98);
2016-08-05 11:28:24 +05:30
}
.darkCaptcha {
2020-05-24 04:38:24 +05:30
border-color: lighter($black);
2016-08-05 11:28:24 +05:30
}
.lightCaptcha {
2020-05-24 04:38:24 +05:30
border-color: #dcd8cd;
}
.captchaLoader {
2020-05-24 04:38:24 +05:30
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
}
/**
* Form validation
*/
// Disable any visual error indication
// .formTouched .textField:invalid {
// box-shadow: none;
// &,
// ~ .textFieldIcon {
// border-color: #3e2727;
// }
// ~ .textFieldIcon {
// color: #3e2727;
// }
// &:hover {
// &,
// ~ .textFieldIcon {
// border-color: $red;
// }
// }
// &:focus {
// border-color: $red;
// ~ .textFieldIcon {
// background: $red;
// border-color: $red;
// color: #fff;
// }
// }
// }
// .formTouched .checkboxInput:invalid {
// ~ .checkbox {
// border-color: $red;
// }
// }