mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-08 08:52:19 +02:00
211 lines
5.6 KiB
SCSS
211 lines
5.6 KiB
SCSS
/*===============================
|
|
= Choices =
|
|
===============================*/
|
|
$choices-guttering: 2.4rem;
|
|
$choices-border-radius: .25rem;
|
|
$choices-border-radius-item: 2rem;
|
|
$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/cross.svg';
|
|
|
|
.choices {
|
|
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; }
|
|
}
|
|
}
|
|
|
|
.choices[data-type*="select-one"] {
|
|
.choices__inner {
|
|
cursor: pointer;
|
|
padding-bottom: .75rem;
|
|
}
|
|
.choices__input {
|
|
display: block;
|
|
width: 100%;
|
|
padding: 1rem;
|
|
border-bottom: 1px solid $choices-keyline-color;
|
|
background-color: #FFFFFF;
|
|
margin: 0;
|
|
}
|
|
&.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: .75rem + .4rem;
|
|
top: 50%;
|
|
margin-top: -2.5px;
|
|
}
|
|
}
|
|
|
|
.choices[data-type*="select-multiple"], .choices[data-type*="text"] {
|
|
.choices__inner { cursor: text; }
|
|
}
|
|
|
|
.choices__inner {
|
|
background-color: $choices-bg-color;
|
|
padding: .75rem .75rem .375rem;
|
|
border: 1px solid $choices-keyline-color;
|
|
border-radius: $choices-border-radius;
|
|
font-size: 1.4rem;
|
|
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: .4rem;
|
|
}
|
|
|
|
.choices__list--multiple {
|
|
display: inline;
|
|
.choices__item {
|
|
display: inline-block;
|
|
vertical-align: middle;
|
|
border-radius: $choices-border-radius-item;
|
|
padding: .4rem 1rem;
|
|
font-size: 1.2rem;
|
|
margin-right: .375rem;
|
|
margin-bottom: .375rem;
|
|
background-color: $choices-primary-color;
|
|
border: 1px solid darken($choices-primary-color, 5%);
|
|
color: #FFFFFF;
|
|
word-break: break-all;
|
|
&[data-deletable] { padding-right: .5rem; }
|
|
&.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 {
|
|
padding: 1rem;
|
|
font-size: 1.4rem;
|
|
}
|
|
.choices__item--selectable {
|
|
&:after {
|
|
content: "Press to select";
|
|
font-size: 12px;
|
|
opacity: 0;
|
|
float: right;
|
|
}
|
|
&.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: 1.2rem;
|
|
padding: 1rem;
|
|
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-image: url($choices-button-icon-path);
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
background-size: 8px;
|
|
border-left: 1px solid darken($choices-primary-color, 10%);
|
|
margin-left: 4px;
|
|
margin-right: -4px;
|
|
padding-left: 6px;
|
|
padding-right: 6px;
|
|
line-height: 1;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.choices__input {
|
|
background-color: mix(#000000, #FFFFFF, 2.5%);
|
|
font-size: 1.4rem;
|
|
padding: 0;
|
|
margin-bottom: .5rem;
|
|
display: inline-block;
|
|
vertical-align: baseline;
|
|
border: 0;
|
|
border-radius: 0;
|
|
max-width: 100%;
|
|
padding: .4rem 0 .4rem .2rem;
|
|
&:focus { outline: 0; }
|
|
}
|
|
|
|
|
|
/*===== End of Choices ======*/ |