399 lines
7.1 KiB
SCSS
399 lines
7.1 KiB
SCSS
/**
|
|
* FORMS
|
|
*
|
|
* Markup:
|
|
* ---------
|
|
* <div class="input input-fullWidth">
|
|
* <input id="#" placeholder="#" type="text">
|
|
* </div>
|
|
*
|
|
* <div class="select select-fullWidth">
|
|
* <select name="#" id="#">
|
|
* <option>Option 1</option>
|
|
* <option>Option 2</option>
|
|
* </select>
|
|
* </div>
|
|
*
|
|
* <div class="textarea">
|
|
* <textarea id="#"></textarea>
|
|
* </div>
|
|
*
|
|
* <div class="radio">
|
|
* <input id="#" name="#" type="radio" value="">
|
|
* <label for="#">Radio button</label>
|
|
* </div>
|
|
*
|
|
* <div class="checkbox">
|
|
* <input id="#" name="#" type="checkbox" value="">
|
|
* <label for="#">Checkbox</label>
|
|
* </div>
|
|
*/
|
|
|
|
|
|
// prevent input default appearence on webkit
|
|
input,
|
|
textarea {
|
|
appearance: none;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
font-weight: normal;
|
|
}
|
|
|
|
// Disable webkit background color
|
|
input:-webkit-autofill {
|
|
box-shadow: 0 0 0 1000px $bgc-form inset;
|
|
}
|
|
|
|
// Common styles
|
|
.textarea,
|
|
.input,
|
|
.select {
|
|
border: $bd-form;
|
|
border-radius: $bdr-form;
|
|
box-shadow: none;
|
|
display: inline-block;
|
|
font-weight: normal;
|
|
margin-bottom: 20px;
|
|
overflow: hidden;
|
|
|
|
:focus {
|
|
outline: none;
|
|
}
|
|
|
|
&.has-error {
|
|
background: $bgc-form-error;
|
|
border: $bd-form-error;
|
|
margin-bottom: 0; // we should display an error message
|
|
}
|
|
}
|
|
|
|
.select {
|
|
background-color: $bgc-form;
|
|
display: inline-block;
|
|
margin-right: $m-medium;
|
|
position: relative;
|
|
|
|
&:last-child {
|
|
margin-right: 0;
|
|
}
|
|
|
|
&-fullWidth {
|
|
display: block;
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
width: 100%;
|
|
}
|
|
|
|
select {
|
|
appearance: none;
|
|
background-color: transparent;
|
|
border: 0;
|
|
border-radius: 0;
|
|
color: $c-form;
|
|
display: block;
|
|
font-size: $fz-form;
|
|
line-height: $lh-medium;
|
|
margin: 0;
|
|
padding: $p-form;
|
|
padding-right: 30px;
|
|
transition: $trs-form;
|
|
width: 100%;
|
|
|
|
&:active,
|
|
&:focus {
|
|
background-color: $bgc-form-focus;
|
|
border: 0;
|
|
outline: none;
|
|
}
|
|
|
|
&::-ms-expand {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
&::after,
|
|
&::before {
|
|
background: $c-primary;
|
|
content: '';
|
|
display: block;
|
|
height: 2px;
|
|
margin-top: 2px;
|
|
position: absolute;
|
|
right: 5px;
|
|
top: 50%;
|
|
transform-origin: 1px;
|
|
width: 10px;
|
|
}
|
|
|
|
&::after {
|
|
transform: rotate(-135deg);
|
|
}
|
|
|
|
&::before {
|
|
transform: rotate(-45deg);
|
|
}
|
|
}
|
|
|
|
// textarea
|
|
.textarea {
|
|
background-color: $bgc-form;
|
|
padding: 0;
|
|
|
|
&-fullWidth {
|
|
display: block;
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
width: 100%;
|
|
}
|
|
|
|
textarea {
|
|
background: transparent;
|
|
border: 0;
|
|
color: $c-form;
|
|
display: block;
|
|
font-family: $ff-body;
|
|
font-size: $fz-form;
|
|
line-height: $lh-medium;
|
|
margin: 0;
|
|
min-height: $mih-form-textarea;
|
|
padding: $p-form;
|
|
transition: $trs-form;
|
|
width: 100%;
|
|
|
|
&::placeholder {
|
|
color: $c-form-placeholder;
|
|
}
|
|
|
|
&:focus,
|
|
&:active {
|
|
background-color: $bgc-form-focus;
|
|
border: 0;
|
|
outline: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
.checkbox {
|
|
margin-bottom: $m-small;
|
|
position: relative;
|
|
|
|
input[type='checkbox'] {
|
|
display: none;
|
|
|
|
&:checked + label::after {
|
|
animation: checkboxAndRadioAnimation .25s;
|
|
content: '';
|
|
transform: scale(1) rotate(45deg);
|
|
}
|
|
|
|
& + label {
|
|
display: block;
|
|
overflow: hidden;
|
|
padding-left: 30px;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
|
|
&::before {
|
|
background-color: $bgc-form;
|
|
border: $bd-form;
|
|
border-radius: $bdr-medium;
|
|
content: '';
|
|
display: inline-block;
|
|
height: 20px;
|
|
left: 0;
|
|
margin-top: -10px;
|
|
position: absolute;
|
|
top: 50%;
|
|
width: 20px;
|
|
}
|
|
|
|
&::after {
|
|
border-bottom: 3px solid $c-primary;
|
|
border-right: 3px solid $c-primary;
|
|
display: block;
|
|
height: 12px;
|
|
left: 11px;
|
|
margin-left: -4px;
|
|
margin-top: -7px;
|
|
position: absolute;
|
|
top: 50%;
|
|
width: 7px;
|
|
z-index: 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.radio {
|
|
margin-bottom: $m-small;
|
|
position: relative;
|
|
|
|
input[type='radio'] {
|
|
display: none;
|
|
|
|
&:checked + label::after {
|
|
animation: checkboxAndRadioAnimation .25s;
|
|
content: '';
|
|
transform: scale(1) rotate(45deg);
|
|
}
|
|
|
|
& + label {
|
|
display: block;
|
|
overflow: hidden;
|
|
padding-left: 30px;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
|
|
&::before {
|
|
background-color: $bgc-form;
|
|
border: $bd-form;
|
|
border-radius: 20px;
|
|
content: '';
|
|
display: inline-block;
|
|
height: 20px;
|
|
left: 0;
|
|
margin-top: -10px;
|
|
position: absolute;
|
|
top: 50%;
|
|
width: 20px;
|
|
}
|
|
|
|
&::after {
|
|
background-color: $c-primary;
|
|
border-radius: 20px;
|
|
display: block;
|
|
height: 10px;
|
|
left: 11px;
|
|
margin-left: -6px;
|
|
margin-top: -6px;
|
|
position: absolute;
|
|
top: 13px;
|
|
width: 10px;
|
|
z-index: 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@keyframes checkboxAndRadioAnimation {
|
|
0% {
|
|
transform: scale(0) rotate(45deg);
|
|
}
|
|
|
|
50% {
|
|
transform: scale(1.5) rotate(45deg);
|
|
}
|
|
|
|
100% {
|
|
transform: scale(1) rotate(45deg);
|
|
}
|
|
}
|
|
|
|
|
|
.input {
|
|
background-color: $bgc-form;
|
|
margin-right: 10px;
|
|
padding: 0;
|
|
position: relative;
|
|
|
|
:focus,
|
|
:active {
|
|
background-color: $bgc-form-focus;
|
|
border-radius: $bdr-form;
|
|
}
|
|
|
|
input {
|
|
background: transparent;
|
|
border: 0;
|
|
box-shadow: none;
|
|
color: $c-form;
|
|
font-size: $fz-form;
|
|
line-height: $lh-medium;
|
|
margin: 0;
|
|
outline: none;
|
|
padding: $p-form;
|
|
width: 100%;
|
|
|
|
&::placeholder {
|
|
color: $c-form-placeholder;
|
|
}
|
|
}
|
|
|
|
&-withIcon {
|
|
input {
|
|
padding-right: $size-form-input-icon * 2;
|
|
}
|
|
}
|
|
|
|
&-icon {
|
|
fill: $c-form-input-icon;
|
|
height: $size-form-input-icon;
|
|
margin-top: -$size-form-input-icon / 2;
|
|
position: absolute;
|
|
right: $m-medium;
|
|
top: 50%;
|
|
width: $size-form-input-icon;
|
|
}
|
|
|
|
// input variations
|
|
&-fullWidth {
|
|
display: block;
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* FORM COLLAPSED (items in row without gap between them)
|
|
*
|
|
* Markup:
|
|
* -------
|
|
*
|
|
* <div class="formCollapsed">
|
|
* <div class="input formCollapsed-item formCollapsed-itemPrimary">
|
|
* <input id="name" placeholder="Klingon search" type="text" />
|
|
* </div>
|
|
* <div class="select formCollapsed-item">
|
|
* <select name="country-code" id="country-code">
|
|
* <option value="AO"> Angola</option>
|
|
* </select>
|
|
* </div>
|
|
* <button class="formCollapsed-item button button-primary">
|
|
* Search
|
|
* </button>
|
|
* </div>
|
|
**/
|
|
|
|
.formCollapsed {
|
|
display: flex;
|
|
margin-bottom: 20px;
|
|
|
|
&-item {
|
|
border-radius: 0 !important;
|
|
margin: 0 !important;
|
|
|
|
|
|
&:first-child {
|
|
border-bottom-left-radius: $bdr-form !important;
|
|
border-top-left-radius: $bdr-form !important;
|
|
}
|
|
|
|
&:last-child {
|
|
border-bottom-right-radius: $bdr-form !important;
|
|
border-top-right-radius: $bdr-form !important;
|
|
}
|
|
|
|
&:not(:last-child) {
|
|
border-right: 0;
|
|
}
|
|
|
|
&Primary {
|
|
flex: 1;
|
|
}
|
|
}
|
|
}
|