Choices/assets/styles/scss/choices.scss

236 lines
6.3 KiB
SCSS

/*===============================
= Choices =
===============================*/
$choices-guttering: 24px;
$choices-border-radius: 2.5px;
$choices-border-radius-item: 20px;
$choices-bg-color: #f9f9f9;
$choices-bg-color-dropdown: #FFFFFF;
$choices-text-color: #333333;
$choices-keyline-color: #DDDDDD;
$choices-primary-color: #00BCD4;
$choices-disabled-color: #eaeaea;
$choices-button-icon-path: '../../icons/';
.choices {
font-size: 16px;
position: relative;
margin-bottom: $choices-guttering;
&:last-child { margin-bottom: 0; }
&.is-disabled {
.choices__inner, .choices__input {
background-color: lighten(#DDDDDD, 5%);
cursor: not-allowed;
user-select: none;
}
.choices__item { cursor: not-allowed; }
}
&:focus { outline: none; }
}
.choices[data-type*="select-one"] {
cursor: pointer;
.choices__inner { padding-bottom: 7.5px; }
.choices__input {
display: block;
width: 100%;
padding: 10px;
border-bottom: 1px solid $choices-keyline-color;
background-color: #FFFFFF;
margin: 0;
}
.choices__button {
background-image: url($choices-button-icon-path + '/cross-inverse.svg');
padding: 0;
background-size: 8px;
height: 100%;
position: absolute;
top: 50%;
right: 15px;
margin-top: -10px;
margin-right: 25px;
height: 20px;
width: 20px;
}
&.is-open:after {
border-color: transparent transparent $choices-text-color transparent;
margin-top: -7.5px;
}
&:after {
content: "";
height: 0;
width: 0;
border-style: solid;
border-color: $choices-text-color transparent transparent transparent;
border-width: 5px;
position: absolute;
right: 7.5px + 4px;
top: 50%;
margin-top: -2.5px;
pointer-events: none;
}
}
.choices[data-type*="select-multiple"], .choices[data-type*="text"] {
.choices__inner { cursor: text; }
.choices__button {
position: relative;
margin: -2px -4px -2px 4px;
padding: 4px 6px;
border-left: 1px solid darken($choices-primary-color, 10%);
background-image: url($choices-button-icon-path + '/cross.svg');
background-size: 8px;
line-height: 1;
}
}
.choices__inner {
background-color: $choices-bg-color;
padding: 7.5px 7.5px 3.75px;
border: 1px solid $choices-keyline-color;
border-radius: $choices-border-radius;
font-size: 14px;
overflow: hidden;
.is-focused &, .is-open & { border-color: darken($choices-keyline-color, 15%); }
.is-open & { border-radius: $choices-border-radius $choices-border-radius 0 0; }
.is-flipped.is-open & { border-radius: 0 0 $choices-border-radius $choices-border-radius; }
}
.choices__list {
margin: 0;
padding-left: 0;
list-style-type: none;
}
.choices__list--single {
display: inline-block;
padding: 4px 16px 4px 4px;
width: 100%;
.choices__item { width: 100%; }
}
.choices__list--multiple {
display: inline;
.choices__item {
display: inline-block;
vertical-align: middle;
border-radius: $choices-border-radius-item;
padding: 4px 10px;
font-size: 12px;
font-weight: 500;
margin-right: 3.75px;
margin-bottom: 3.75px;
background-color: $choices-primary-color;
border: 1px solid darken($choices-primary-color, 5%);
color: #FFFFFF;
word-break: break-all;
&[data-deletable] { padding-right: 5px; }
&.is-highlighted {
background-color: darken($choices-primary-color, 5%);
border: 1px solid darken($choices-primary-color, 10%);
}
.is-disabled & {
background-color: darken($choices-disabled-color, 25%);
border: 1px solid darken($choices-disabled-color, 35%);
}
}
}
.choices__list--dropdown {
display: none;
z-index: 1;
position: absolute;
width: 100%;
background-color: $choices-bg-color-dropdown;
border: 1px solid $choices-keyline-color;
top: 100%;
margin-top: -1px;
border-bottom-left-radius: $choices-border-radius;
border-bottom-right-radius: $choices-border-radius;
overflow: hidden;
&.is-active { display: block; }
.is-open & { border-color: darken(#DDDDDD, 15%); }
.is-flipped & {
top: auto;
bottom: 100%;
margin-top: 0;
margin-bottom: -1px;
border-radius: .25rem .25rem 0 0;
}
.choices__list {
position: relative;
max-height: 300px;
overflow: auto;
-webkit-overflow-scrolling: touch;
will-change: scroll-position;
}
.choices__item {
position: relative;
padding: 10px;
font-size: 14px;
}
.choices__item--selectable {
@media (min-width: 640px) {
padding-right: 100px;
&:after {
content: "Press to select";
font-size: 12px;
opacity: 0;
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
}
}
&.is-highlighted {
background-color: mix(#000000, #FFFFFF, 5%);
&:after { opacity: .5; }
}
}
}
.choices__item { cursor: default; }
.choices__item--selectable { cursor: pointer; }
.choices__item--disabled {
cursor: not-allowed;
user-select: none;
opacity: .5;
}
.choices__group {
.choices__heading {
font-weight: 600;
font-size: 12px;
padding: 10px;
border-bottom: 1px solid lighten($choices-keyline-color, 10%);
color: lighten(#333, 30%);
}
}
.choices__button {
text-indent: -9999px;
-webkit-appearance: none;
appearance: none;
border: 0;
background-color: transparent;
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
}
.choices__input {
background-color: mix(#000000, #FFFFFF, 2.5%);
font-size: 14px;
padding: 0;
margin-bottom: 5px;
display: inline-block;
vertical-align: baseline;
border: 0;
border-radius: 0;
max-width: 100%;
padding: 4px 0 4px 2px;
&:focus { outline: 0; }
}
/*===== End of Choices ======*/