fleet/frontend/components/forms/fields/Dropdown/_styles.scss

361 lines
6.6 KiB
SCSS

.dropdown {
&__custom-value {
display: inline-flex;
svg {
padding: 0 $pad-small;
}
&-label {
line-height: 38px;
font-size: $x-small;
}
}
&__custom-arrow {
display: flex;
svg {
transition: transform 0.25s ease;
}
}
&__label {
display: block;
font-size: $x-small;
font-weight: $regular;
color: $core-fleet-black;
margin-bottom: $pad-xsmall;
&--error {
font-weight: $bold;
}
}
&__select {
&--error {
&.Select {
.Select-control {
color: $core-vibrant-red;
border: 1px solid $core-vibrant-red;
box-sizing: border-box;
border-radius: $border-radius;
}
.Select-arrow {
border-top-color: $ui-error;
}
}
}
}
&__option {
display: flex;
flex-direction: column;
gap: $pad-small;
width: 100%;
}
&__help-text {
@include help-text;
font-style: italic;
}
}
.Select {
&.dropdown__select {
border: 1px solid $ui-fleet-black-10;
border-radius: $border-radius;
&:hover:not(.is-disabled) {
box-shadow: none;
border-color: $ui-fleet-black-50;
}
}
.Select-control {
background-color: $core-fleet-white;
border: 0;
border-radius: $border-radius;
cursor: pointer;
.Select-value {
font-size: $x-small;
background-color: $core-fleet-white;
}
}
.Select-value {
font-size: $x-small;
border-radius: $border-radius;
background-color: $core-fleet-white;
.Select-value-icon {
border: 0;
float: right;
position: relative;
line-height: 28px;
width: 20px;
padding: 0;
margin: 0 5px;
text-indent: -999em;
&::after {
transition: color 150ms ease-in-out;
content: url(../assets/images/icon-close-fleet-black-16x16@2x.png);
transform: scale(0.5);
position: absolute;
top: -5px;
left: -5px;
visibility: visible;
font-size: $x-small;
color: $ui-gray;
text-indent: 0;
}
&:hover {
&::after {
content: url("../assets/images/icon-close-fleet-black-16x16@2x.png");
transform: scale(0.5);
}
}
}
.Select-value-label {
font-size: $x-small;
color: $core-fleet-black;
vertical-align: middle;
}
}
&--single {
> .Select-control {
.Select-value {
line-height: 34px;
border: none;
}
}
}
&.is-focused:not(.is-disabled) {
&.dropdown__select {
border: 1px solid $ui-fleet-black-50;
}
}
&.is-focused:not(.is-open) > .Select-control {
box-shadow: none;
border-color: $ui-fleet-black-75; // Override blue border on focus
}
&.is-open {
.dropdown__custom-arrow .dropdown__icon {
svg {
transform: rotate(180deg);
transition: transform 0.25s ease;
path {
stroke: $ui-fleet-black-75-over;
}
}
}
.dropdown__custom-value .dropdown__icon {
svg path {
fill: $ui-fleet-black-75-over;
}
}
.Select-control {
border-radius: $border-radius;
}
}
:hover {
.dropdown__custom-arrow .dropdown__icon {
svg {
path {
stroke: $ui-fleet-black-75-over;
}
}
}
.dropdown__custom-value .dropdown__icon {
svg path {
fill: $ui-fleet-black-75-over;
}
}
&.is-open {
.dropdown__custom-arrow .dropdown__icon {
svg path {
stroke: $ui-fleet-black-75-over;
}
}
.dropdown__custom-value .dropdown__icon {
svg path {
fill: $ui-fleet-black-75-over;
}
}
}
}
&.has-value {
> .Select-control,
&.is-pseudo-focused > .Select-control {
.Select-value {
.Select-value-label {
color: $core-fleet-black;
font-size: $x-small;
}
}
}
&.is-disabled {
> .Select-control .Select-value .Select-value-label {
color: $ui-fleet-black-5;
}
}
}
.Select-menu-outer {
position: relative;
box-shadow: 0 4px 10px rgba(52, 59, 96, 0.15);
z-index: 6;
overflow: auto;
max-height: 198px; // Fits 4 options without scrolling
border: 0;
margin: 1px 0 0;
padding: $pad-small;
animation: fade-in 150ms ease-out;
}
.Select-menu {
max-height: none; // Important to scroll in .Select-menu-outer
overflow: visible;
}
.Select-noresults {
font-size: $x-small;
}
.Select-option {
color: $core-fleet-black;
font-size: $x-small;
margin: 0;
padding: 10px;
display: block;
border-radius: $border-radius;
&.is-selected {
background-color: transparent;
font-weight: bold;
}
&.is-focused {
background-color: $ui-fleet-black-5;
.Select-icon {
color: $ui-fleet-black-10;
}
}
&:active {
background-color: $ui-fleet-black-75-down;
}
&:last-child {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
&.is-disabled {
color: $ui-fleet-black-50;
font-style: italic;
.Select-icon {
visibility: hidden;
opacity: 0;
}
}
}
.Select-icon {
color: $ui-gray;
}
.Select-placeholder {
color: $core-fleet-blue;
font-size: $x-small;
line-height: 34px;
box-sizing: border-box;
}
.Select-input {
color: $core-fleet-blue;
font-size: $x-small;
box-sizing: border-box;
height: 34px;
> input {
line-height: 34px;
padding: 0;
}
}
&.Select--multi {
.Select-control {
display: flex;
align-items: center;
height: auto;
}
.Select-multi-value-wrapper {
flex-grow: 1;
.Select-value {
border: 1px solid $ui-fleet-black-50;
vertical-align: middle;
align-items: center;
margin-top: 0;
display: inline-flex;
flex-direction: row-reverse;
.Select-value-icon:hover {
background-color: initial;
}
.Select-value-label {
font-size: $x-small;
align-self: center;
}
}
}
.Select-arrow-zone {
display: flex;
}
.Select-option {
&.is-disabled {
color: $ui-fleet-black-50;
cursor: default;
&.is-focused {
background-color: $ui-fleet-black-10;
color: $core-fleet-white;
}
}
}
.Select-value-label {
padding: 0 0 0 10px;
}
}
.premium-feature-icon {
position: relative;
top: 4px;
margin-left: 3px;
}
}
.form-field {
&__label {
&--disabled {
color: $ui-fleet-black-50;
}
}
}