Merge pull request #979 from Choices-js/npm-audit-fix

Switch to dart-sass, fix npm audit issues, add stylelint
This commit is contained in:
Matt Triff 2021-12-19 18:25:44 -05:00 committed by GitHub
commit c4f3a81d41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 3762 additions and 19440 deletions

View file

@ -20,17 +20,13 @@ jobs:
node-version: 12
- name: Install dependencies
run: npm install --no-optional --no-audit --ignore-scripts
run: npm ci
env:
CYPRESS_INSTALL_BINARY: 0
HUSKY_SKIP_INSTALL: true
- name: run eslint
run: |
CHANGED_TS=$(git --no-pager diff --name-only ..origin/master | grep '^src\/scripts\/.*\.ts$' | xargs ls -d 2>/dev/null | paste -sd " " -)
if [[ -z $(sed -e 's/[[:space:]]*$//' <<<${CHANGED_TS}) ]]; then CHANGED_TS="src/scripts"; fi
echo $CHANGED_TS
node node_modules/eslint/bin/eslint.js $CHANGED_TS
run: npm run lint:js
## Can't use same eslint config for TypeScript and JavaScript
## TypeScript rules cause rule definition not found errors
@ -39,3 +35,6 @@ jobs:
# run: |
# npm run js:build
# npx eslint --no-ignore ./public/assets/scripts/*.js
- name: run stylelint
run: npm run lint:scss

6
.stylelintrc.json Normal file
View file

@ -0,0 +1,6 @@
{
"extends": "stylelint-config-standard-scss",
"rules": {
"declaration-block-no-redundant-longhand-properties": null
}
}

View file

@ -62,5 +62,11 @@
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"stylelint.validate": [
"css",
"less",
"postcss",
"scss"
]
}

17960
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,11 +7,13 @@
"scripts": {
"start": "run-p js:watch css:watch",
"build": "run-p js:build css:build",
"lint": "eslint src/scripts/**/*.ts",
"lint": "run-p lint:js lint:scss",
"lint:js": "eslint src/scripts/**/*.ts",
"lint:scss": "stylelint src/**/*.scss",
"bundlesize": "bundlesize",
"cypress:run": "cypress run --browser chrome",
"cypress:open": "cypress open",
"cypress:ci": "cypress run --record --group $GITHUB_REF --ci-build-id $GITHUB_SHA",
"cypress:ci": "cypress run --browser chrome --record --group $GITHUB_REF --ci-build-id $GITHUB_SHA",
"test": "run-s test:unit test:e2e",
"test:unit": "cross-env TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha",
"test:unit:watch": "npm run test:unit -- --watch --inspect=5556",
@ -21,7 +23,7 @@
"js:build": "webpack --config webpack.config.prod.js",
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
"css:build": "run-s css:sass css:prefix css:min",
"css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css",
"css:sass": "sass -I scss src/styles/base.scss public/assets/styles/base.css && sass -I scss src/styles/choices.scss public/assets/styles/choices.css",
"css:prefix": "postcss public/assets/styles/*.css --use autoprefixer --no-map --env prod --dir public/assets/styles",
"css:min": "csso public/assets/styles/base.css --output public/assets/styles/base.min.css && csso public/assets/styles/choices.css --output public/assets/styles/choices.min.css",
"deploy": "git subtree push --prefix public origin gh-pages",
@ -69,7 +71,7 @@
"cross-env": "^7.0.3",
"csso-cli": "^3.0.0",
"cypress": "9.1.1",
"eslint": "^8.4.1",
"eslint": "^8.5.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^16.1.0",
"eslint-config-prettier": "^8.3.0",
@ -84,15 +86,18 @@
"jsdom": "^19.0.0",
"lint-staged": "^12.1.3",
"mocha": "^9.1.3",
"node-sass": "^7.0.0",
"nodemon": "^2.0.15",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"postcss": "^8.4.5",
"postcss-cli": "^9.1.0",
"prettier": "^2.5.1",
"sass": "^1.45.0",
"sinon": "^12.0.1",
"sinon-chai": "^3.7.0",
"stylelint": "^14.1.0",
"stylelint-config-standard": "^24.0.0",
"stylelint-config-standard-scss": "^3.0.0",
"ts-loader": "^9.2.6",
"ts-node": "^10.4.0",
"typescript": "^4.5.4",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,14 +1,14 @@
/*=============================================
/* =============================================
= Generic styling =
=============================================*/
============================================= */
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
*,
*:before,
*:after {
*::before,
*::after {
box-sizing: border-box;
}
@ -21,10 +21,10 @@ body {
}
body {
font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 16px;
line-height: 1.4;
color: #ffffff;
color: #fff;
background-color: #333;
overflow-x: hidden;
}
@ -39,6 +39,7 @@ label {
p {
margin-top: 0;
margin-bottom: 8px;
}
hr {
@ -64,7 +65,7 @@ h6 {
a,
a:visited,
a:focus {
color: #ffffff;
color: #fff;
text-decoration: none;
font-weight: 600;
}
@ -78,7 +79,7 @@ a:focus {
border-radius: 2.5px;
font-size: 14px;
-webkit-appearance: none;
appearance: none;
appearance: none;
margin-bottom: 24px;
}
@ -112,10 +113,6 @@ h6,
font-size: 14px;
}
p {
margin-bottom: 8px;
}
label + p {
margin-top: -4px;
}
@ -126,7 +123,6 @@ label + p {
max-width: 40em;
padding: 48px;
}
@media (max-width: 620px) {
.container {
padding: 0;
@ -134,11 +130,10 @@ label + p {
}
.section {
background-color: #ffffff;
background-color: #fff;
padding: 24px;
color: #333;
}
.section a,
.section a:visited,
.section a:focus {
@ -150,7 +145,7 @@ label + p {
margin-bottom: 12px;
}
.logo__img {
.logo-img {
width: 100%;
height: auto;
display: inline-block;
@ -183,4 +178,4 @@ label + p {
margin-bottom: 24px;
}
/*===== End of Section comment block ======*/
/* ===== End of Section comment block ====== */

View file

@ -0,0 +1 @@
{"version":3,"sourceRoot":"","sources":["../../../src/styles/base.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAYA;EACE;EACA;;;AAGF;AAAA;AAAA;EAGE;;;AAGF;AAAA;EAEE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;EAME;EACA;EACA;EACA;;;AAGF;AAAA;AAAA;EAGE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAtFiB;;;AAyFnB;AAAA;EAEE,WA1FoB;;;AA6FtB;AAAA;EAEE,WA9FoB;;;AAiGtB;AAAA;EAEE,WAlGoB;;;AAqGtB;AAAA;EAEE,WAtGoB;;;AAyGtB;AAAA;EAEE,WA1GoB;;;AA6GtB;AAAA;EAEE,WA9GoB;;;AAiHtB;EACE;;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EANF;IAOI;;;;AAIJ;EACE;EACA,SAxIiB;EAyIjB;;AAEA;AAAA;AAAA;EAGE;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE,eArKiB;;;AAwKnB;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE,eArLiB;;;AAwLnB","file":"base.css"}

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%}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,p{margin-bottom:8px}label{font-size:14px;font-weight:500;cursor:pointer}p{margin-top:0}hr{margin:30px 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}.form-control{display:block;width:100%;background-color:#f9f9f9;padding:12px;border:1px solid #ddd;border-radius:2.5px;font-size:14px;-webkit-appearance:none;appearance:none;margin-bottom:24px}.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}label+p{margin-top:-4px}.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}.logo{display:block;margin-bottom:12px}.logo__img{width:100%;height:auto;display:inline-block;max-width:100%;vertical-align:top;padding:6px 0}.visible-ie{display:none}.push-bottom{margin-bottom:24px}.zero-bottom{margin-bottom:0}.zero-top{margin-top:0}.text-center{text-align:center}[data-test-hook]{margin-bottom:24px}
*{-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,p{margin-bottom:8px}label{font-size:14px;font-weight:500;cursor:pointer}p{margin-top:0}hr{margin:30px 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}.form-control{display:block;width:100%;background-color:#f9f9f9;padding:12px;border:1px solid #ddd;border-radius:2.5px;font-size:14px;-webkit-appearance:none;appearance:none;margin-bottom:24px}.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}label+p{margin-top:-4px}.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}.logo{display:block;margin-bottom:12px}.logo-img{width:100%;height:auto;display:inline-block;max-width:100%;vertical-align:top;padding:6px 0}.visible-ie{display:none}.push-bottom{margin-bottom:24px}.zero-bottom{margin-bottom:0}.zero-top{margin-top:0}.text-center{text-align:center}[data-test-hook]{margin-bottom:24px}

View file

@ -1,25 +1,21 @@
/*===============================
/* ===============================
= Choices =
===============================*/
=============================== */
.choices {
position: relative;
overflow: hidden;
margin-bottom: 24px;
font-size: 16px;
}
.choices:focus {
outline: none;
}
.choices:last-child {
margin-bottom: 0;
}
.choices.is-open {
overflow: initial;
}
.choices.is-disabled .choices__inner,
.choices.is-disabled .choices__input {
background-color: #eaeaea;
@ -27,34 +23,29 @@
-webkit-user-select: none;
user-select: none;
}
.choices.is-disabled .choices__item {
cursor: not-allowed;
}
.choices [hidden] {
display: none !important;
}
.choices[data-type*='select-one'] {
.choices[data-type*=select-one] {
cursor: pointer;
}
.choices[data-type*='select-one'] .choices__inner {
.choices[data-type*=select-one] .choices__inner {
padding-bottom: 7.5px;
}
.choices[data-type*='select-one'] .choices__input {
.choices[data-type*=select-one] .choices__input {
display: block;
width: 100%;
padding: 10px;
border-bottom: 1px solid #dddddd;
background-color: #ffffff;
border-bottom: 1px solid #ddd;
background-color: #fff;
margin: 0;
}
.choices[data-type*='select-one'] .choices__button {
background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);
.choices[data-type*=select-one] .choices__button {
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==");
padding: 0;
background-size: 8px;
position: absolute;
@ -67,25 +58,21 @@
border-radius: 10em;
opacity: 0.25;
}
.choices[data-type*='select-one'] .choices__button:hover, .choices[data-type*='select-one'] .choices__button:focus {
.choices[data-type*=select-one] .choices__button:hover, .choices[data-type*=select-one] .choices__button:focus {
opacity: 1;
}
.choices[data-type*='select-one'] .choices__button:focus {
box-shadow: 0px 0px 0px 2px #00bcd4;
.choices[data-type*=select-one] .choices__button:focus {
box-shadow: 0 0 0 2px #00bcd4;
}
.choices[data-type*='select-one'] .choices__item[data-value=''] .choices__button {
.choices[data-type*=select-one] .choices__item[data-value=""] .choices__button {
display: none;
}
.choices[data-type*='select-one']:after {
content: '';
.choices[data-type*=select-one]::after {
content: "";
height: 0;
width: 0;
border-style: solid;
border-color: #333333 transparent transparent transparent;
border-color: #333 transparent transparent transparent;
border-width: 5px;
position: absolute;
right: 11.5px;
@ -93,31 +80,27 @@
margin-top: -2.5px;
pointer-events: none;
}
.choices[data-type*='select-one'].is-open:after {
border-color: transparent transparent #333333 transparent;
.choices[data-type*=select-one].is-open::after {
border-color: transparent transparent #333 transparent;
margin-top: -7.5px;
}
.choices[data-type*='select-one'][dir='rtl']:after {
.choices[data-type*=select-one][dir=rtl]::after {
left: 11.5px;
right: auto;
}
.choices[data-type*='select-one'][dir='rtl'] .choices__button {
.choices[data-type*=select-one][dir=rtl] .choices__button {
right: auto;
left: 0;
margin-left: 25px;
margin-right: 0;
}
.choices[data-type*='select-multiple'] .choices__inner,
.choices[data-type*='text'] .choices__inner {
.choices[data-type*=select-multiple] .choices__inner,
.choices[data-type*=text] .choices__inner {
cursor: text;
}
.choices[data-type*='select-multiple'] .choices__button,
.choices[data-type*='text'] .choices__button {
.choices[data-type*=select-multiple] .choices__button,
.choices[data-type*=text] .choices__button {
position: relative;
display: inline-block;
margin-top: 0;
@ -126,17 +109,16 @@
margin-left: 8px;
padding-left: 16px;
border-left: 1px solid #008fa1;
background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==");
background-size: 8px;
width: 8px;
line-height: 1;
opacity: 0.75;
border-radius: 0;
}
.choices[data-type*='select-multiple'] .choices__button:hover, .choices[data-type*='select-multiple'] .choices__button:focus,
.choices[data-type*='text'] .choices__button:hover,
.choices[data-type*='text'] .choices__button:focus {
.choices[data-type*=select-multiple] .choices__button:hover, .choices[data-type*=select-multiple] .choices__button:focus,
.choices[data-type*=text] .choices__button:hover,
.choices[data-type*=text] .choices__button:focus {
opacity: 1;
}
@ -146,22 +128,18 @@
width: 100%;
background-color: #f9f9f9;
padding: 7.5px 7.5px 3.75px;
border: 1px solid #dddddd;
border: 1px solid #ddd;
border-radius: 2.5px;
font-size: 14px;
min-height: 44px;
overflow: hidden;
}
.is-focused .choices__inner,
.is-open .choices__inner {
.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;
}
@ -177,12 +155,10 @@
padding: 4px 16px 4px 4px;
width: 100%;
}
[dir='rtl'] .choices__list--single {
[dir=rtl] .choices__list--single {
padding-right: 4px;
padding-left: 16px;
}
.choices__list--single .choices__item {
width: 100%;
}
@ -190,7 +166,6 @@
.choices__list--multiple {
display: inline;
}
.choices__list--multiple .choices__item {
display: inline-block;
vertical-align: middle;
@ -202,25 +177,21 @@
margin-bottom: 3.75px;
background-color: #00bcd4;
border: 1px solid #00a5bb;
color: #ffffff;
color: #fff;
word-break: break-all;
box-sizing: border-box;
}
.choices__list--multiple .choices__item[data-deletable] {
padding-right: 5px;
}
[dir='rtl'] .choices__list--multiple .choices__item {
[dir=rtl] .choices__list--multiple .choices__item {
margin-right: 0;
margin-left: 3.75px;
}
.choices__list--multiple .choices__item.is-highlighted {
background-color: #00a5bb;
border: 1px solid #008fa1;
}
.is-disabled .choices__list--multiple .choices__item {
background-color: #aaaaaa;
border: 1px solid #919191;
@ -231,8 +202,8 @@
z-index: 1;
position: absolute;
width: 100%;
background-color: #ffffff;
border: 1px solid #dddddd;
background-color: #fff;
border: 1px solid #ddd;
top: 100%;
margin-top: -1px;
border-bottom-left-radius: 2.5px;
@ -241,15 +212,12 @@
word-break: break-all;
will-change: visibility;
}
.choices__list--dropdown.is-active {
visibility: visible;
}
.is-open .choices__list--dropdown {
border-color: #b7b7b7;
}
.is-flipped .choices__list--dropdown {
top: auto;
bottom: 100%;
@ -257,7 +225,6 @@
margin-bottom: -1px;
border-radius: 0.25rem 0.25rem 0 0;
}
.choices__list--dropdown .choices__list {
position: relative;
max-height: 300px;
@ -265,22 +232,19 @@
-webkit-overflow-scrolling: touch;
will-change: scroll-position;
}
.choices__list--dropdown .choices__item {
position: relative;
padding: 10px;
font-size: 14px;
}
[dir='rtl'] .choices__list--dropdown .choices__item {
[dir=rtl] .choices__list--dropdown .choices__item {
text-align: right;
}
@media (min-width: 640px) {
.choices__list--dropdown .choices__item--selectable {
padding-right: 100px;
}
.choices__list--dropdown .choices__item--selectable:after {
.choices__list--dropdown .choices__item--selectable::after {
content: attr(data-select-text);
font-size: 12px;
opacity: 0;
@ -289,22 +253,20 @@
top: 50%;
transform: translateY(-50%);
}
[dir='rtl'] .choices__list--dropdown .choices__item--selectable {
[dir=rtl] .choices__list--dropdown .choices__item--selectable {
text-align: right;
padding-left: 100px;
padding-right: 10px;
}
[dir='rtl'] .choices__list--dropdown .choices__item--selectable:after {
[dir=rtl] .choices__list--dropdown .choices__item--selectable::after {
right: auto;
left: 10px;
}
}
.choices__list--dropdown .choices__item--selectable.is-highlighted {
background-color: #f2f2f2;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted:after {
.choices__list--dropdown .choices__item--selectable.is-highlighted::after {
opacity: 0.5;
}
@ -334,14 +296,13 @@
.choices__button {
text-indent: -9999px;
-webkit-appearance: none;
appearance: none;
appearance: none;
border: 0;
background-color: transparent;
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
}
.choices__button:focus {
outline: none;
}
@ -357,12 +318,10 @@
max-width: 100%;
padding: 4px 0 4px 2px;
}
.choices__input:focus {
outline: 0;
}
[dir='rtl'] .choices__input {
[dir=rtl] .choices__input {
padding-right: 2px;
padding-left: 0;
}
@ -371,4 +330,4 @@
opacity: 0.5;
}
/*===== End of Choices ======*/
/* ===== End of Choices ====== */

View file

@ -0,0 +1 @@
{"version":3,"sourceRoot":"","sources":["../../../src/styles/choices.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AA2BA;EACE;EACA;EACA,eApBkB;EAqBlB,WAxBqB;;AA0BrB;EACE;;AAGF;EACE;;AAGF;EACE;;AAIA;AAAA;EAEE,kBAlCsB;EAmCtB;EACA;;AAEF;EACE;;AAIJ;EACE;;;AAIJ;EACE;;AACA;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE,kBApDyB;EAqDzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;;AAGJ;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;AAIA;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;;;AAOJ;AAAA;EACE;;AAEF;AAAA;EACE;EACA;EACA;EACA;EACA;EACA,aA5HoB;EA6HpB;EACA;EACA,kBA9HiB;EA+HjB,iBAjIuB;EAkIvB,OAlIuB;EAmIvB;EACA;EACA;;AAEA;AAAA;AAAA;EAEE;;;AAKN;EACE;EACA;EACA;EACA,kBA1JiB;EA2JjB;EACA;EACA,eA/JsB;EAgKtB,WAnKqB;EAoKrB;EACA;;AAEA;EAEE;;AAGF;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAEF;EACE;;;AAIJ;EACE;;AACA;EACE;EACA;EACA,eA1MyB;EA2MzB;EACA,WA/MmB;EAgNnB;EACA;EACA;EACA,kBA1MoB;EA2MpB;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA,SAhOgB;EAiOhB;EACA;EACA,kBA7O0B;EA8O1B;EACA;EACA;EACA,2BArPsB;EAsPtB,4BAtPsB;EAuPtB;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA,WAvRmB;;AAyRnB;EACE;;AAIF;EADF;IAEI;;EAEA;IACE;IACA,WAlSe;IAmSf;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;;EAEA;IACE;IACA;;;AAKN;EACE;;AAEA;EACE;;;AAMR;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA,WAhVqB;EAiVrB;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAIJ;EACE;EACA;EACA,kBAnWiB;EAoWjB,WAzWqB;EA0WrB;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;;AAIJ;EACE;;;AAGF","file":"choices.css"}

File diff suppressed because one or more lines are too long

View file

@ -74,7 +74,7 @@
<img
src="assets/images/logo.svg"
alt="Choices.js logo"
class="logo__img hidden-ie"
class="logo-img hidden-ie"
/>
<h1 class="visible-ie">Choices.js</h1>
</a>

View file

@ -1,6 +1,6 @@
/*=============================================
/* =============================================
= Generic styling =
=============================================*/
============================================= */
$global-guttering: 24px;
$global-font-size-h1: 32px;
@ -16,8 +16,8 @@ $global-font-size-h6: 14px;
}
*,
*:before,
*:after {
*::before,
*::after {
box-sizing: border-box;
}
@ -30,10 +30,10 @@ body {
}
body {
font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 16px;
line-height: 1.4;
color: #ffffff;
color: #fff;
background-color: #333;
overflow-x: hidden;
}
@ -48,6 +48,7 @@ label {
p {
margin-top: 0;
margin-bottom: 8px;
}
hr {
@ -73,7 +74,7 @@ h6 {
a,
a:visited,
a:focus {
color: #ffffff;
color: #fff;
text-decoration: none;
font-weight: 600;
}
@ -86,7 +87,6 @@ a:focus {
border: 1px solid #ddd;
border-radius: 2.5px;
font-size: 14px;
-webkit-appearance: none;
appearance: none;
margin-bottom: $global-guttering;
}
@ -121,10 +121,6 @@ h6,
font-size: $global-font-size-h6;
}
p {
margin-bottom: 8px;
}
label + p {
margin-top: -4px;
}
@ -134,15 +130,17 @@ label + p {
margin: auto;
max-width: 40em;
padding: $global-guttering * 2;
@media (max-width: 620px) {
padding: 0;
}
}
.section {
background-color: #ffffff;
background-color: #fff;
padding: $global-guttering;
color: #333;
a,
a:visited,
a:focus {
@ -155,7 +153,7 @@ label + p {
margin-bottom: $global-guttering * 0.5;
}
.logo__img {
.logo-img {
width: 100%;
height: auto;
display: inline-block;
@ -188,4 +186,4 @@ label + p {
margin-bottom: $global-guttering;
}
/*===== End of Section comment block ======*/
/* ===== End of Section comment block ====== */

View file

@ -1,8 +1,10 @@
/*===============================
/* ===============================
= Choices =
===============================*/
=============================== */
$choices-selector: 'choices' !default;
@use "sass:color";
$choices-selector: "choices" !default;
$choices-font-size-lg: 16px !default;
$choices-font-size-md: 14px !default;
$choices-font-size-sm: 12px !default;
@ -11,16 +13,16 @@ $choices-border-radius: 2.5px !default;
$choices-border-radius-item: 20px !default;
$choices-bg-color: #f9f9f9 !default;
$choices-bg-color-disabled: #eaeaea !default;
$choices-bg-color-dropdown: #ffffff !default;
$choices-text-color: #333333 !default;
$choices-keyline-color: #dddddd !default;
$choices-bg-color-dropdown: #fff !default;
$choices-text-color: #333 !default;
$choices-keyline-color: #ddd !default;
$choices-primary-color: #00bcd4 !default;
$choices-disabled-color: #eaeaea !default;
$choices-highlight-color: $choices-primary-color !default;
$choices-button-dimension: 8px !default;
$choices-button-offset: 8px !default;
$choices-icon-cross: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==) !default;
$choices-icon-cross-inverse: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==) !default;
$choices-icon-cross: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==") !default;
$choices-icon-cross-inverse: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==") !default;
$choices-z-index: 1;
.#{$choices-selector} {
@ -28,15 +30,19 @@ $choices-z-index: 1;
overflow: hidden;
margin-bottom: $choices-guttering;
font-size: $choices-font-size-lg;
&:focus {
outline: none;
}
&:last-child {
margin-bottom: 0;
}
&.is-open {
overflow: initial;
}
&.is-disabled {
.#{$choices-selector}__inner,
.#{$choices-selector}__input {
@ -64,7 +70,7 @@ $choices-z-index: 1;
width: 100%;
padding: 10px;
border-bottom: 1px solid $choices-keyline-color;
background-color: #ffffff;
background-color: #fff;
margin: 0;
}
.#{$choices-selector}__button {
@ -80,19 +86,22 @@ $choices-z-index: 1;
width: 20px;
border-radius: 10em;
opacity: 0.25;
&:hover,
&:focus {
opacity: 1;
}
&:focus {
box-shadow: 0px 0px 0px 2px $choices-highlight-color;
box-shadow: 0 0 0 2px $choices-highlight-color;
}
}
.#{$choices-selector}__item[data-value=''] .#{$choices-selector}__button {
display: none;
}
&:after {
content: '';
&::after {
content: "";
height: 0;
width: 0;
border-style: solid;
@ -104,12 +113,14 @@ $choices-z-index: 1;
margin-top: -2.5px;
pointer-events: none;
}
&.is-open:after {
&.is-open::after {
border-color: transparent transparent $choices-text-color transparent;
margin-top: -7.5px;
}
&[dir='rtl'] {
&:after {
&[dir="rtl"] {
&::after {
left: 11.5px;
right: auto;
}
@ -135,13 +146,14 @@ $choices-z-index: 1;
margin-bottom: 0;
margin-left: $choices-button-offset;
padding-left: $choices-button-offset * 2;
border-left: 1px solid darken($choices-primary-color, 10%);
border-left: 1px solid color.adjust($choices-primary-color, $lightness: -10%);
background-image: $choices-icon-cross;
background-size: $choices-button-dimension;
width: $choices-button-dimension;
line-height: 1;
opacity: 0.75;
border-radius: 0;
&:hover,
&:focus {
opacity: 1;
@ -160,13 +172,16 @@ $choices-z-index: 1;
font-size: $choices-font-size-md;
min-height: 44px;
overflow: hidden;
.is-focused &,
.is-open & {
border-color: darken($choices-keyline-color, 15%);
border-color: color.adjust($choices-keyline-color, $lightness: -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;
}
@ -182,7 +197,8 @@ $choices-z-index: 1;
display: inline-block;
padding: 4px 16px 4px 4px;
width: 100%;
[dir='rtl'] & {
[dir="rtl"] & {
padding-right: 4px;
padding-left: 16px;
}
@ -203,24 +219,28 @@ $choices-z-index: 1;
margin-right: 3.75px;
margin-bottom: 3.75px;
background-color: $choices-primary-color;
border: 1px solid darken($choices-primary-color, 5%);
color: #ffffff;
border: 1px solid color.adjust($choices-primary-color, $lightness: -5%);
color: #fff;
word-break: break-all;
box-sizing: border-box;
&[data-deletable] {
padding-right: 5px;
}
[dir='rtl'] & {
[dir="rtl"] & {
margin-right: 0;
margin-left: 3.75px;
}
&.is-highlighted {
background-color: darken($choices-primary-color, 5%);
border: 1px solid darken($choices-primary-color, 10%);
background-color: color.adjust($choices-primary-color, $lightness: -5%);
border: 1px solid color.adjust($choices-primary-color, $lightness: -10%);
}
.is-disabled & {
background-color: darken($choices-disabled-color, 25%);
border: 1px solid darken($choices-disabled-color, 35%);
background-color: color.adjust($choices-disabled-color, $lightness: -25%);
border: 1px solid color.adjust($choices-disabled-color, $lightness: -35%);
}
}
}
@ -239,12 +259,15 @@ $choices-z-index: 1;
overflow: hidden;
word-break: break-all;
will-change: visibility;
&.is-active {
visibility: visible;
}
.is-open & {
border-color: darken($choices-keyline-color, 15%);
border-color: color.adjust($choices-keyline-color, $lightness: -15%);
}
.is-flipped & {
top: auto;
bottom: 100%;
@ -263,14 +286,16 @@ $choices-z-index: 1;
position: relative;
padding: 10px;
font-size: $choices-font-size-md;
[dir='rtl'] & {
[dir="rtl"] & {
text-align: right;
}
}
.#{$choices-selector}__item--selectable {
@media (min-width: 640px) {
padding-right: 100px;
&:after {
&::after {
content: attr(data-select-text);
font-size: $choices-font-size-sm;
opacity: 0;
@ -279,19 +304,23 @@ $choices-z-index: 1;
top: 50%;
transform: translateY(-50%);
}
[dir='rtl'] & {
[dir="rtl"] & {
text-align: right;
padding-left: 100px;
padding-right: 10px;
&:after {
&::after {
right: auto;
left: 10px;
}
}
}
&.is-highlighted {
background-color: mix(#000000, #ffffff, 5%);
&:after {
background-color: color.mix(#000, #fff, 5%);
&::after {
opacity: 0.5;
}
}
@ -316,19 +345,19 @@ $choices-z-index: 1;
font-weight: 600;
font-size: $choices-font-size-sm;
padding: 10px;
border-bottom: 1px solid lighten($choices-keyline-color, 10%);
color: lighten(#333, 30%);
border-bottom: 1px solid color.adjust($choices-keyline-color, $lightness: 10%);
color: color.adjust(#333, $lightness: 30%);
}
.#{$choices-selector}__button {
text-indent: -9999px;
-webkit-appearance: none;
appearance: none;
border: 0;
background-color: transparent;
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
&:focus {
outline: none;
}
@ -344,10 +373,12 @@ $choices-z-index: 1;
border-radius: 0;
max-width: 100%;
padding: 4px 0 4px 2px;
&:focus {
outline: 0;
}
[dir='rtl'] & {
[dir="rtl"] & {
padding-right: 2px;
padding-left: 0;
}
@ -357,4 +388,4 @@ $choices-z-index: 1;
opacity: 0.5;
}
/*===== End of Choices ======*/
/* ===== End of Choices ====== */