Use pixels instead of REMs for units to stop conflicts with other stylesheets

This commit is contained in:
Josh Johnson 2016-08-03 19:36:37 +01:00
parent 42e650b597
commit 6b0ec77a30
7 changed files with 81 additions and 75 deletions

View file

@ -41,6 +41,7 @@ A lightweight, configurable select box/text input plugin. Similar to Select2 and
search: true,
flip: true,
regexFilter: null,
sortFilter: sortByAlpha,
sortFields: ['label', 'value'],
placeholder: true,
placeholderValue: null,
@ -222,6 +223,13 @@ Pass an array of objects:
<strong>Usage:</strong> A filter that will need to pass for a user to successfully add an item.
### sortFilter
<strong>Type:</strong> `Function` <strong>Default:</strong>sortByAlpha
<strong>Input types affected:</strong> `select-one`, `select-multiple`
<strong>Usage:</strong> The function that will sort choices before they are displayed (unless a user is searching). By default choices are sorted by alphabetical order.
### sortFields
<strong>Type:</strong> `Array/String` <strong>Default:</strong>`['label', 'value']`

View file

@ -8,9 +8,6 @@
*, *:before, *:after {
box-sizing: border-box; }
html {
font-size: 62.5%; }
html, body {
position: relative;
margin: 0;
@ -19,7 +16,7 @@ html, body {
body {
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 1.6rem;
font-size: 16px;
line-height: 1.4;
color: #FFFFFF;
background-color: #333;
@ -27,20 +24,20 @@ body {
label {
display: block;
margin-bottom: .8rem;
font-size: 1.4rem;
margin-bottom: 8px;
font-size: 14px;
font-weight: 500; }
hr {
display: block;
margin: 3.6rem 0;
margin: 36px 0;
border: 0;
border-bottom: 1px solid #eaeaea;
height: 1px; }
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 1.2rem;
margin-bottom: 12px;
font-weight: 400;
line-height: 1.2; }
@ -50,35 +47,35 @@ a, a:visited, a:focus {
font-weight: 600; }
h1, .h1 {
font-size: 3.2rem; }
font-size: 32px; }
h2, .h2 {
font-size: 2.4rem; }
font-size: 24px; }
h3, .h3 {
font-size: 2rem; }
font-size: 20px; }
h4, .h4 {
font-size: 1.8rem; }
font-size: 18px; }
h5, .h5 {
font-size: 1.6rem; }
font-size: 16px; }
h6, .h6 {
font-size: 1.4rem; }
font-size: 14px; }
.container {
display: block;
margin: auto;
max-width: 40em;
padding: 4.8rem; }
padding: 48px; }
@media (max-width: 620px) {
.container {
padding: 0; } }
.section {
background-color: #FFFFFF;
padding: 2.4rem;
padding: 24px;
color: #333; }
.section a, .section a:visited, .section a:focus {
color: #00bcd4; }

View file

@ -1 +1 @@
*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,:after,:before{box-sizing:border-box}body,html{position:relative;margin:0;width:100%;height:100%}html{font-size:62.5%}body{font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;font-size:1.6rem;line-height:1.4;color:#fff;background-color:#333;overflow-x:hidden}hr,label{display:block}label{margin-bottom:.8rem;font-size:1.4rem;font-weight:500}hr{margin:3.6rem 0;border:0;border-bottom:1px solid #eaeaea;height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:1.2rem;font-weight:400;line-height:1.2}a,a:focus,a:visited{color:#fff;text-decoration:none;font-weight:600}.h1,h1{font-size:3.2rem}.h2,h2{font-size:2.4rem}.h3,h3{font-size:2rem}.h4,h4{font-size:1.8rem}.h5,h5{font-size:1.6rem}.h6,h6{font-size:1.4rem}.container{display:block;margin:auto;max-width:40em;padding:4.8rem}@media (max-width:620px){.container{padding:0}}.section{background-color:#fff;padding:2.4rem;color:#333}.section a,.section a:focus,.section a:visited{color:#00bcd4}
*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,:after,:before{box-sizing:border-box}body,html{position:relative;margin:0;width:100%;height:100%}body{font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;font-size:16px;line-height:1.4;color:#fff;background-color:#333;overflow-x:hidden}hr,label{display:block}label{margin-bottom:8px;font-size:14px;font-weight:500}hr{margin:36px 0;border:0;border-bottom:1px solid #eaeaea;height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:12px;font-weight:400;line-height:1.2}a,a:focus,a:visited{color:#fff;text-decoration:none;font-weight:600}.h1,h1{font-size:32px}.h2,h2{font-size:24px}.h3,h3{font-size:20px}.h4,h4{font-size:18px}.h5,h5{font-size:16px}.h6,h6{font-size:14px}.container{display:block;margin:auto;max-width:40em;padding:48px}@media (max-width:620px){.container{padding:0}}.section{background-color:#fff;padding:24px;color:#333}.section a,.section a:focus,.section a:visited{color:#00bcd4}

View file

@ -2,8 +2,9 @@
= Choices =
===============================*/
.choices {
font-size: 16px;
position: relative;
margin-bottom: 2.4rem; }
margin-bottom: 24px; }
.choices:last-child {
margin-bottom: 0; }
.choices.is-disabled .choices__inner, .choices.is-disabled .choices__input {
@ -20,12 +21,12 @@
.choices[data-type*="select-one"] .choices__inner {
cursor: pointer;
padding-bottom: .75rem; }
padding-bottom: 7.5px; }
.choices[data-type*="select-one"] .choices__input {
display: block;
width: 100%;
padding: 1rem;
padding: 10px;
border-bottom: 1px solid #DDDDDD;
background-color: #FFFFFF;
margin: 0; }
@ -42,7 +43,7 @@
border-color: #333333 transparent transparent transparent;
border-width: 5px;
position: absolute;
right: 1.15rem;
right: 11.5px;
top: 50%;
margin-top: -2.5px;
pointer-events: none; }
@ -52,17 +53,17 @@
.choices__inner {
background-color: #f9f9f9;
padding: .75rem .75rem .375rem;
padding: 7.5px 7.5px 3.75px;
border: 1px solid #DDDDDD;
border-radius: 0.25rem;
font-size: 1.4rem;
border-radius: 2.5px;
font-size: 14px;
overflow: hidden; }
.is-focused .choices__inner, .is-open .choices__inner {
border-color: #b7b7b7; }
.is-open .choices__inner {
border-radius: 0.25rem 0.25rem 0 0; }
border-radius: 2.5px 2.5px 0 0; }
.is-flipped.is-open .choices__inner {
border-radius: 0 0 0.25rem 0.25rem; }
border-radius: 0 0 2.5px 2.5px; }
.choices__list {
margin: 0;
@ -71,7 +72,7 @@
.choices__list--single {
display: inline-block;
padding: .4rem;
padding: 4px;
pointer-events: none; }
.choices__list--multiple {
@ -79,18 +80,18 @@
.choices__list--multiple .choices__item {
display: inline-block;
vertical-align: middle;
border-radius: 2rem;
padding: .4rem 1rem;
font-size: 1.2rem;
border-radius: 20px;
padding: 4px 10px;
font-size: 12px;
font-weight: 500;
margin-right: .375rem;
margin-bottom: .375rem;
margin-right: 3.75px;
margin-bottom: 3.75px;
background-color: #00BCD4;
border: 1px solid #00a5bb;
color: #FFFFFF;
word-break: break-all; }
.choices__list--multiple .choices__item[data-deletable] {
padding-right: .5rem; }
padding-right: 5px; }
.choices__list--multiple .choices__item.is-highlighted {
background-color: #00a5bb;
border: 1px solid #008fa1; }
@ -107,8 +108,8 @@
border: 1px solid #DDDDDD;
top: 100%;
margin-top: -1px;
border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
border-bottom-left-radius: 2.5px;
border-bottom-right-radius: 2.5px;
overflow: hidden; }
.choices__list--dropdown.is-active {
display: block; }
@ -127,8 +128,8 @@
-webkit-overflow-scrolling: touch;
will-change: scroll-position; }
.choices__list--dropdown .choices__item {
padding: 1rem;
font-size: 1.4rem; }
padding: 10px;
font-size: 14px; }
.choices__list--dropdown .choices__item--selectable:after {
content: "Press to select";
font-size: 12px;
@ -155,8 +156,8 @@
.choices__group .choices__heading {
font-weight: 600;
font-size: 1.2rem;
padding: 1rem;
font-size: 12px;
padding: 10px;
border-bottom: 1px solid #f7f7f7;
color: gray; }
@ -181,15 +182,15 @@
.choices__input {
background-color: #f9f9f9;
font-size: 1.4rem;
font-size: 14px;
padding: 0;
margin-bottom: .5rem;
margin-bottom: 5px;
display: inline-block;
vertical-align: baseline;
border: 0;
border-radius: 0;
max-width: 100%;
padding: .4rem 0 .4rem .2rem; }
padding: 4px 0 4px 2px; }
.choices__input:focus {
outline: 0; }

View file

@ -1 +1 @@
.choices{position:relative;margin-bottom:2.4rem}.choices:last-child{margin-bottom:0}.choices.is-disabled .choices__inner,.choices.is-disabled .choices__input{background-color:#eaeaea;cursor:not-allowed;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed}.choices:focus{outline:none}.choices[data-type*=select-one] .choices__inner{cursor:pointer;padding-bottom:.75rem}.choices[data-type*=select-one] .choices__input{display:block;width:100%;padding:1rem;border-bottom:1px solid #ddd;background-color:#fff;margin:0}.choices[data-type*=select-one].is-open:after{border-color:transparent transparent #333 transparent;margin-top:-7.5px}.choices[data-type*=select-one]:after{content:"";height:0;width:0;border-style:solid;border-color:#333 transparent transparent transparent;border-width:5px;position:absolute;right:1.15rem;top:50%;margin-top:-2.5px;pointer-events:none}.choices[data-type*=select-multiple] .choices__inner,.choices[data-type*=text] .choices__inner{cursor:text}.choices__inner{background-color:#f9f9f9;padding:.75rem .75rem .375rem;border:1px solid #ddd;border-radius:.25rem;font-size:1.4rem;overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:#b7b7b7}.is-open .choices__inner{border-radius:.25rem .25rem 0 0}.is-flipped.is-open .choices__inner{border-radius:0 0 .25rem .25rem}.choices__list{margin:0;padding-left:0;list-style-type:none}.choices__list--single{display:inline-block;padding:.4rem;pointer-events:none}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:2rem;padding:.4rem 1rem;font-size:1.2rem;font-weight:500;margin-right:.375rem;margin-bottom:.375rem;background-color:#00bcd4;border:1px solid #00a5bb;color:#fff;word-break:break-all}.choices__list--multiple .choices__item[data-deletable]{padding-right:.5rem}.choices__list--multiple .choices__item.is-highlighted{background-color:#00a5bb;border:1px solid #008fa1}.is-disabled .choices__list--multiple .choices__item{background-color:#aaa;border:1px solid #919191}.choices__list--dropdown{display:none;z-index:1;position:absolute;width:100%;background-color:#fff;border:1px solid #ddd;top:100%;margin-top:-1px;border-bottom-left-radius:.25rem;border-bottom-right-radius:.25rem;overflow:hidden}.choices__list--dropdown.is-active{display:block}.is-open .choices__list--dropdown{border-color:#b7b7b7}.is-flipped .choices__list--dropdown{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item{padding:1rem;font-size:1.4rem}.choices__list--dropdown .choices__item--selectable:after{content:"Press to select";font-size:12px;opacity:0;float:right}.choices__list--dropdown .choices__item--selectable.is-highlighted{background-color:#f2f2f2}.choices__list--dropdown .choices__item--selectable.is-highlighted:after{opacity:.5}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:.5}.choices__group .choices__heading{font-weight:600;font-size:1.2rem;padding:1rem;border-bottom:1px solid #f7f7f7;color:gray}.choices__button{text-indent:-9999px;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;background-color:transparent;background-image:url(../../icons/cross.svg);background-repeat:no-repeat;background-position:center;background-size:8px;border-left:1px solid #008fa1;margin-left:4px;margin-right:-4px;padding-left:6px;padding-right:6px;line-height:1;cursor:pointer}.choices__input{background-color:#f9f9f9;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}.choices__input:focus{outline:0}
.choices{font-size:16px;position:relative;margin-bottom:24px}.choices:last-child{margin-bottom:0}.choices.is-disabled .choices__inner,.choices.is-disabled .choices__input{background-color:#eaeaea;cursor:not-allowed;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed}.choices:focus{outline:none}.choices[data-type*=select-one] .choices__inner{cursor:pointer;padding-bottom:7.5px}.choices[data-type*=select-one] .choices__input{display:block;width:100%;padding:10px;border-bottom:1px solid #ddd;background-color:#fff;margin:0}.choices[data-type*=select-one].is-open:after{border-color:transparent transparent #333 transparent;margin-top:-7.5px}.choices[data-type*=select-one]:after{content:"";height:0;width:0;border-style:solid;border-color:#333 transparent transparent transparent;border-width:5px;position:absolute;right:11.5px;top:50%;margin-top:-2.5px;pointer-events:none}.choices[data-type*=select-multiple] .choices__inner,.choices[data-type*=text] .choices__inner{cursor:text}.choices__inner{background-color:#f9f9f9;padding:7.5px 7.5px 3.75px;border:1px solid #ddd;border-radius:2.5px;font-size:14px;overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:#b7b7b7}.is-open .choices__inner{border-radius:2.5px 2.5px 0 0}.is-flipped.is-open .choices__inner{border-radius:0 0 2.5px 2.5px}.choices__list{margin:0;padding-left:0;list-style-type:none}.choices__list--single{display:inline-block;padding:4px;pointer-events:none}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:20px;padding:4px 10px;font-size:12px;font-weight:500;margin-right:3.75px;margin-bottom:3.75px;background-color:#00bcd4;border:1px solid #00a5bb;color:#fff;word-break:break-all}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}.choices__list--multiple .choices__item.is-highlighted{background-color:#00a5bb;border:1px solid #008fa1}.is-disabled .choices__list--multiple .choices__item{background-color:#aaa;border:1px solid #919191}.choices__list--dropdown{display:none;z-index:1;position:absolute;width:100%;background-color:#fff;border:1px solid #ddd;top:100%;margin-top:-1px;border-bottom-left-radius:2.5px;border-bottom-right-radius:2.5px;overflow:hidden}.choices__list--dropdown.is-active{display:block}.is-open .choices__list--dropdown{border-color:#b7b7b7}.is-flipped .choices__list--dropdown{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item{padding:10px;font-size:14px}.choices__list--dropdown .choices__item--selectable:after{content:"Press to select";font-size:12px;opacity:0;float:right}.choices__list--dropdown .choices__item--selectable.is-highlighted{background-color:#f2f2f2}.choices__list--dropdown .choices__item--selectable.is-highlighted:after{opacity:.5}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:.5}.choices__group .choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid #f7f7f7;color:gray}.choices__button{text-indent:-9999px;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;background-color:transparent;background-image:url(../../icons/cross.svg);background-repeat:no-repeat;background-position:center;background-size:8px;border-left:1px solid #008fa1;margin-left:4px;margin-right:-4px;padding-left:6px;padding-right:6px;line-height:1;cursor:pointer}.choices__input{background-color:#f9f9f9;font-size:14px;margin-bottom:5px;display:inline-block;vertical-align:baseline;border:0;border-radius:0;max-width:100%;padding:4px 0 4px 2px}.choices__input:focus{outline:0}

View file

@ -1,10 +1,10 @@
$global-guttering: 2.4rem;
$global-font-size-h1: 3.2rem;
$global-font-size-h2: 2.4rem;
$global-font-size-h3: 2rem;
$global-font-size-h4: 1.8rem;
$global-font-size-h5: 1.6rem;
$global-font-size-h6: 1.4rem;
$global-guttering: 24px;
$global-font-size-h1: 32px;
$global-font-size-h2: 24px;
$global-font-size-h3: 20px;
$global-font-size-h4: 18px;
$global-font-size-h5: 16px;
$global-font-size-h6: 14px;
/*=============================================
= Generic styling =
@ -20,7 +20,6 @@ $global-font-size-h6: 1.4rem;
box-sizing: border-box
}
html { font-size: 62.5%; }
html, body {
position: relative;
@ -31,7 +30,7 @@ html, body {
body {
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 1.6rem;
font-size: 16px;
line-height: 1.4;
color: #FFFFFF;
background-color: #333;
@ -40,8 +39,8 @@ body {
label {
display: block;
margin-bottom: .8rem;
font-size: 1.4rem;
margin-bottom: 8px;
font-size: 14px;
font-weight: 500;
}

View file

@ -1,9 +1,9 @@
/*===============================
= Choices =
===============================*/
$choices-guttering: 2.4rem;
$choices-border-radius: .25rem;
$choices-border-radius-item: 2rem;
$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;
@ -13,6 +13,7 @@ $choices-disabled-color: #eaeaea;
$choices-button-icon-path: '../../icons/cross.svg';
.choices {
font-size: 16px;
position: relative;
margin-bottom: $choices-guttering;
&:last-child { margin-bottom: 0; }
@ -30,12 +31,12 @@ $choices-button-icon-path: '../../icons/cross.svg';
.choices[data-type*="select-one"] {
.choices__inner {
cursor: pointer;
padding-bottom: .75rem;
padding-bottom: 7.5px;
}
.choices__input {
display: block;
width: 100%;
padding: 1rem;
padding: 10px;
border-bottom: 1px solid $choices-keyline-color;
background-color: #FFFFFF;
margin: 0;
@ -52,7 +53,7 @@ $choices-button-icon-path: '../../icons/cross.svg';
border-color: $choices-text-color transparent transparent transparent;
border-width: 5px;
position: absolute;
right: .75rem + .4rem;
right: 7.5px + 4px;
top: 50%;
margin-top: -2.5px;
pointer-events: none;
@ -65,10 +66,10 @@ $choices-button-icon-path: '../../icons/cross.svg';
.choices__inner {
background-color: $choices-bg-color;
padding: .75rem .75rem .375rem;
padding: 7.5px 7.5px 3.75px;
border: 1px solid $choices-keyline-color;
border-radius: $choices-border-radius;
font-size: 1.4rem;
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; }
@ -83,7 +84,7 @@ $choices-button-icon-path: '../../icons/cross.svg';
.choices__list--single {
display: inline-block;
padding: .4rem;
padding: 4px;
pointer-events: none;
}
@ -93,16 +94,16 @@ $choices-button-icon-path: '../../icons/cross.svg';
display: inline-block;
vertical-align: middle;
border-radius: $choices-border-radius-item;
padding: .4rem 1rem;
font-size: 1.2rem;
padding: 4px 10px;
font-size: 12px;
font-weight: 500;
margin-right: .375rem;
margin-bottom: .375rem;
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: .5rem; }
&[data-deletable] { padding-right: 5px; }
&.is-highlighted {
background-color: darken($choices-primary-color, 5%);
border: 1px solid darken($choices-primary-color, 10%);
@ -143,8 +144,8 @@ $choices-button-icon-path: '../../icons/cross.svg';
will-change: scroll-position;
}
.choices__item {
padding: 1rem;
font-size: 1.4rem;
padding: 10px;
font-size: 14px;
}
.choices__item--selectable {
&:after {
@ -171,8 +172,8 @@ $choices-button-icon-path: '../../icons/cross.svg';
.choices__group {
.choices__heading {
font-weight: 600;
font-size: 1.2rem;
padding: 1rem;
font-size: 12px;
padding: 10px;
border-bottom: 1px solid lighten($choices-keyline-color, 10%);
color: lighten(#333, 30%);
}
@ -199,15 +200,15 @@ $choices-button-icon-path: '../../icons/cross.svg';
.choices__input {
background-color: mix(#000000, #FFFFFF, 2.5%);
font-size: 1.4rem;
font-size: 14px;
padding: 0;
margin-bottom: .5rem;
margin-bottom: 5px;
display: inline-block;
vertical-align: baseline;
border: 0;
border-radius: 0;
max-width: 100%;
padding: .4rem 0 .4rem .2rem;
padding: 4px 0 4px 2px;
&:focus { outline: 0; }
}