mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-21 15:06:45 +02:00
258 lines
6.1 KiB
SCSS
258 lines
6.1 KiB
SCSS
$global-guttering: 2.4rem;
|
|
|
|
/*=============================================
|
|
= Generic styling =
|
|
=============================================*/
|
|
|
|
*, *:before, *:after {
|
|
box-sizing: border-box
|
|
}
|
|
|
|
html {
|
|
font-size: 62.5%;
|
|
}
|
|
|
|
html, body {
|
|
margin: 0;
|
|
height: 100%;
|
|
widows: 100%;
|
|
}
|
|
|
|
body {
|
|
background-color: #333333;
|
|
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
|
font-size: 1.6rem;
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: .8rem;
|
|
font-size: 1.4rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
hr {
|
|
display: block;
|
|
margin: $global-guttering*1.5 0;
|
|
border: 0;
|
|
border-bottom: 1px solid #eaeaea;
|
|
height: 1px;
|
|
}
|
|
|
|
h1, h2, h3, h4, h5, h6 {
|
|
margin-top: 0;
|
|
margin-bottom: $global-guttering/2;
|
|
font-weight: 400;
|
|
}
|
|
|
|
.container {
|
|
display: block;
|
|
margin: auto;
|
|
max-width: 35em;
|
|
padding: $global-guttering;
|
|
}
|
|
|
|
.section {
|
|
background-color: #FFFFFF;
|
|
padding: $global-guttering;
|
|
color: #333;
|
|
}
|
|
|
|
/*===== End of Section comment block ======*/
|
|
|
|
|
|
/*===============================
|
|
= Choices =
|
|
===============================*/
|
|
|
|
$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 {
|
|
margin-bottom: $global-guttering;
|
|
position: relative;
|
|
&.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"] {
|
|
&.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__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;
|
|
cursor: text;
|
|
overflow: hidden;
|
|
.is-focused & { 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;
|
|
.choices__item { padding: .4rem; }
|
|
}
|
|
|
|
.choices__list--multiple {
|
|
display: inline;
|
|
.choices__item {
|
|
display: inline-block;
|
|
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, 10%);
|
|
color: #FFFFFF;
|
|
word-break: break-all;
|
|
&[data-deletable] { padding-right: .5rem; }
|
|
&.is-selected {
|
|
background-color: darken($choices-primary-color, 5%);
|
|
border: 1px solid darken($choices-primary-color, 15%);
|
|
}
|
|
.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;
|
|
max-height: 300px;
|
|
overflow: auto;
|
|
will-change: scroll-position;
|
|
&.is-active { display: block; }
|
|
|
|
.choices__item {
|
|
padding: 1rem;
|
|
font-size: 1.4rem;
|
|
&.is-selected {
|
|
opacity: .5;
|
|
&:hover { background-color: $choices-bg-color-dropdown; }
|
|
}
|
|
}
|
|
.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; }
|
|
}
|
|
}
|
|
|
|
.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__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;
|
|
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 ======*/ |