public/styles/components/_forms.scss (246 lines of code) (raw):
// -----------------------------------------------------------------------------
// This file contains styles for all form elements
// -----------------------------------------------------------------------------
.form {
display: block;
}
// To separate blocks of related fields
.form__section:not(:last-child) {
margin-bottom: 20px;
padding-bottom: 20px;
}
.form__row {
margin-bottom: 20px;
&--field-with-btn {
display: flex;
}
// Not great naming
&--flex-width {
width: 100%;
}
&--nested {
background: $color250Grey;
padding: 10px;
.form__section:not(:last-child),
.form__btn-heading {
border-color: $color400Grey;
}
}
}
.form__field {
background-color: $cWhite;
padding: 11px;
width: 100%;
border: 1px solid $color300Grey;
&:not(:last-child) {
margin-bottom: 10px;
}
&:focus {
border-color: $brandColor;
outline: none;
}
// Because select elements are THE WORST
&--select {
background: url(../images/arrow.png) $cWhite no-repeat right 10px center;
padding-right: 40px;
-webkit-appearance: none;
-moz-appearance: none;
border-radius: 0;
text-indent: 0.01px;
padding: 9px; // Select boxes don't adhere to box-sizing
}
&--error,
&--error:focus {
border-color: $cRedB5;
}
&--move-btn {
display: inline-block;
float: right;
margin-right: 2px;
}
&--nested {
border: none;
}
input[disabled] {
background-color: #d3d3d3;
color: #565a5c;
}
}
.form__field--multiselect {
$multiSelectBtnWidth: 45px;
position: relative;
padding-right: $multiSelectBtnWidth + 10px;
border: 1px solid $color300Grey;
&__btn {
width: $multiSelectBtnWidth;
position: absolute;
right: 0;
top: 0;
height: 100%;
background: $color200Grey;
border-left: 1px solid $color300Grey;
cursor: pointer;
}
&__options {
background: $color200Grey;
border: 1px solid $color300Grey;
box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.1);
position: absolute;
top: 48px;
left: 0;
width: 100%;
max-height: 300px;
overflow: auto;
z-index: $zIndex-raised;
}
&__option {
padding: 5px;
cursor: pointer;
&:not(:last-child) {
border-bottom: 1px solid $color300Grey;
}
&:hover {
background: $color250Grey;
}
}
&__value {
display: inline-block;
padding: 2px 4px;
background: $color200Grey;
border: 1px solid $color300Grey;
border-radius: 2px;
margin-right: 2px;
font-weight: bold;
cursor: pointer;
&:hover {
background: $color250Grey;
}
&:after {
content: '×';
display: inline-block;
font-weight: normal;
margin-left: 4px;
}
}
}
.form__container {
position: relative;
}
.form__group {
margin-bottom: 10px;
border: 1px solid $color300Grey;
&--checkbox {
border: none;
&--ranged-date {
display: flex;
justify-content: space-between;
}
}
&--flex {
display: flex;
margin-bottom: 20px;
align-items: center;
& .form__row--flex {
margin-bottom: 0;
width: 100%;
}
}
}
.form__field-number {
font-size: 16px;
margin-right: 10px;
}
// because they're special snowflakes
.form__radio-btn,
.form__checkbox {
display: inline-block;
& + .form__label {
margin-left: 5px;
}
}
.form__label {
display: block;
font-size: 13px;
font-weight: bold;
margin: 0 0 5px;
&--radio,
&--checkbox {
display: inline-block;
margin: 0;
font-weight: normal;
}
&--caption {
display: block;
font-weight: normal;
}
}
.form__message {
margin-bottom: 10px;
&[data-highlighted='true'] {
overflow: hidden;
background-color: lighten($cYellow, 40);
padding: 5px 10px;
.form__message__title {
margin: -5px 0 5px -10px;
padding: 5px;
background-color: lighten($cYellow, 30);
display: inline-block;
}
}
}
.form__message__title {
font-size: 13px;
font-weight: 700;
}
.form__message__text {
font-size: 13px;
&--error {
color: $cRedB5;
}
}
.form__subheading {
margin-bottom: 10px;
border-bottom: 1px solid $color300Grey;
}
.form__field__suggestions {
border-top: 1px solid $color400Grey;
border-bottom: 1px solid $color400Grey;
max-height: 350px;
overflow: auto;
}
.form__field__suggestion {
display: block;
background-color: $color100Grey;
border: 1px solid $color400Grey;
border-top: 0;
width: 100%;
padding: 5px 10px;
cursor: pointer;
}
.form__btn-heading {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
margin-bottom: 10px;
padding-bottom: 10px;
border-bottom: 1px solid $color300Grey;
&__btn {
background: $darkBrandColor;
padding: 5px 7px;
line-height: 1;
color: $cWhite;
margin-left: 10px;
&:hover {
background: $brandColor;
}
}
}
.form__btn-group {
margin-top: 20px;
text-align: right;
}
// Flex container for side by side fields and other adventures
.form__flex-container {
display: flex;
justify-content: space-between;
align-items: flex-end; // makes sure items without a label line up
&__item {
flex-grow: 1;
&:not(:last-child) {
margin-right: 10px;
}
}
}