mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-10 01:26:34 +02:00
Bit of styling
This commit is contained in:
parent
fb38d7bf55
commit
50c53ce3ad
2
assets/scripts/dist/bundle.js
vendored
2
assets/scripts/dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
|
@ -360,4 +360,18 @@ export const strToEl = (function() {
|
|||
|
||||
return r;
|
||||
};
|
||||
}());
|
||||
}());
|
||||
|
||||
/**
|
||||
* Calculates the width of a passed input based on its value
|
||||
* @return {Number} Width of input
|
||||
*/
|
||||
export const getWidthOfInput = function() {
|
||||
var tmp = document.createElement("span");
|
||||
tmp.className = "input-element tmp-element";
|
||||
tmp.innerHTML = inputEl.value.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
||||
document.body.appendChild(tmp);
|
||||
var theWidth = tmp.getBoundingClientRect().width;
|
||||
document.body.removeChild(tmp);
|
||||
return theWidth;
|
||||
}
|
|
@ -10,22 +10,39 @@ html, body {
|
|||
widows: 100%; }
|
||||
|
||||
body {
|
||||
background-color: #FAFAFA;
|
||||
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
|
||||
background-color: #333333;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
font-size: 1.6rem;
|
||||
color: #222222;
|
||||
padding: 2.4rem; }
|
||||
color: #FFFFFF; }
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: .8rem; }
|
||||
margin-bottom: .8rem;
|
||||
font-size: 1.4rem;
|
||||
font-weight: 500; }
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.2rem;
|
||||
font-weight: 500; }
|
||||
|
||||
.container {
|
||||
display: block;
|
||||
margin: auto;
|
||||
max-width: 35em;
|
||||
padding: 2.4rem; }
|
||||
|
||||
.section {
|
||||
background-color: #FFFFFF;
|
||||
padding: 2.4rem;
|
||||
color: #333; }
|
||||
|
||||
.choices {
|
||||
margin-bottom: 2.4rem;
|
||||
position: relative; }
|
||||
|
||||
.choices__inner {
|
||||
background-color: #FFFFFF;
|
||||
background-color: #f9f9f9;
|
||||
padding: .75rem .75rem .375rem;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: .25rem;
|
||||
|
@ -43,21 +60,20 @@ label {
|
|||
display: inline; }
|
||||
.choices__list--items .choices__item {
|
||||
display: inline-block;
|
||||
border-radius: .4rem;
|
||||
border-radius: .8rem;
|
||||
padding: .4rem .8rem;
|
||||
font-size: 1.2rem;
|
||||
margin-right: .375rem;
|
||||
margin-bottom: .375rem;
|
||||
background-color: #00BCD4;
|
||||
text-shadow: 0px 1px 0px #008fa1;
|
||||
border: 1px solid #00a5bb;
|
||||
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
|
||||
color: #FFFFFF;
|
||||
cursor: pointer; }
|
||||
.choices__list--items .choices__item.is-selected {
|
||||
background-color: #00a5bb; }
|
||||
|
||||
.choices__input {
|
||||
background-color: #f9f9f9;
|
||||
font-size: 1.4rem;
|
||||
padding: 0;
|
||||
margin-bottom: .5rem;
|
||||
|
|
2
assets/styles/css/choices.min.css
vendored
2
assets/styles/css/choices.min.css
vendored
|
@ -1 +1 @@
|
|||
*,:after,:before{box-sizing:border-box}body,html{margin:0;height:100%;widows:100%}html{font-size:62.5%}body{background-color:#fafafa;font-family:'Helvetica Neue','Helvetica','Arial',sans-serif;font-size:1.6rem;color:#222;padding:2.4rem}label{display:block;margin-bottom:.8rem}.choices{margin-bottom:2.4rem;position:relative}.choices__inner{background-color:#fff;padding:.75rem .75rem .375rem;border:1px solid #ddd;border-radius:.25rem;font-size:1.4rem}.choices__inner:focus{outline:1px solid #00bcd4;outline-offset:-1px}.choices__list{margin:0;padding-left:0;list-style-type:none}.choices__list--items{display:inline}.choices__list--items .choices__item{display:inline-block;border-radius:.4rem;padding:.4rem .8rem;font-size:1.2rem;margin-right:.375rem;margin-bottom:.375rem;background-color:#00bcd4;text-shadow:0 1px 0 #008fa1;border:1px solid #00a5bb;box-shadow:0 1px 1px rgba(0,0,0,.2);color:#fff;cursor:pointer}.choices__list--items .choices__item.is-selected{background-color:#00a5bb}.choices__input{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}
|
||||
*,:after,:before{box-sizing:border-box}body,html{margin:0;height:100%;widows:100%}html{font-size:62.5%}body{background-color:#333;font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;font-size:1.6rem;color:#fff}label{display:block;margin-bottom:.8rem;font-size:1.4rem;font-weight:500}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:1.2rem;font-weight:500}.container{display:block;margin:auto;max-width:35em;padding:2.4rem}.section{background-color:#fff;padding:2.4rem;color:#333}.choices{margin-bottom:2.4rem;position:relative}.choices__inner{background-color:#f9f9f9;padding:.75rem .75rem .375rem;border:1px solid #ddd;border-radius:.25rem;font-size:1.4rem}.choices__inner:focus{outline:1px solid #00bcd4;outline-offset:-1px}.choices__list{margin:0;padding-left:0;list-style-type:none}.choices__list--items{display:inline}.choices__list--items .choices__item{display:inline-block;border-radius:.8rem;padding:.4rem .8rem;font-size:1.2rem;margin-right:.375rem;margin-bottom:.375rem;background-color:#00bcd4;border:1px solid #00a5bb;color:#fff;cursor:pointer}.choices__list--items .choices__item.is-selected{background-color:#00a5bb}.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}
|
|
@ -1,3 +1,5 @@
|
|||
$global-guttering: 2.4rem;
|
||||
|
||||
*, *:before, *:after {
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
@ -13,25 +15,45 @@ html, body {
|
|||
}
|
||||
|
||||
body {
|
||||
background-color: #FAFAFA;
|
||||
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
|
||||
background-color: #333333;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
font-size: 1.6rem;
|
||||
color: #222222;
|
||||
padding: 2.4rem;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: .8rem;
|
||||
font-size: 1.4rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 0;
|
||||
margin-bottom: $global-guttering/2;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: block;
|
||||
margin: auto;
|
||||
max-width: 35em;
|
||||
padding: $global-guttering;
|
||||
}
|
||||
|
||||
.section {
|
||||
background-color: #FFFFFF;
|
||||
padding: $global-guttering;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.choices {
|
||||
margin-bottom: 2.4rem;
|
||||
margin-bottom: $global-guttering;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.choices__inner {
|
||||
background-color: #FFFFFF;
|
||||
background-color: mix(#000000, #FFFFFF, 2.5%);
|
||||
padding: .75rem .75rem .375rem;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: .25rem;
|
||||
|
@ -54,15 +76,13 @@ label {
|
|||
display: inline;
|
||||
.choices__item {
|
||||
display: inline-block;
|
||||
border-radius: .4rem;
|
||||
border-radius: .8rem;
|
||||
padding: .4rem .8rem;
|
||||
font-size: 1.2rem;
|
||||
margin-right: .375rem;
|
||||
margin-bottom: .375rem;
|
||||
background-color: #00BCD4;
|
||||
text-shadow: 0px 1px 0px darken(#00BCD4, 10%);
|
||||
border: 1px solid darken(#00BCD4, 5%);
|
||||
box-shadow: 0px 1px 1px rgba(#000000, 0.2);
|
||||
color: #FFFFFF;
|
||||
cursor: pointer;
|
||||
&.is-selected { background-color: darken(#00BCD4, 5%); }
|
||||
|
@ -70,6 +90,7 @@ label {
|
|||
}
|
||||
|
||||
.choices__input {
|
||||
background-color: mix(#000000, #FFFFFF, 2.5%);
|
||||
font-size: 1.4rem;
|
||||
padding: 0;
|
||||
margin-bottom: .5rem;
|
||||
|
|
28
index.html
28
index.html
|
@ -7,24 +7,26 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<label for="1">Text input with no values and a limit of 5 items</label>
|
||||
<input id="1" type="text" data-choice value="preset-1 preset-2">
|
||||
<div class="section">
|
||||
<h1>Choices</h1>
|
||||
<label for="1">Text input with no values and a limit of 5 items</label>
|
||||
<input id="1" type="text" data-choice value="preset-1 preset-2">
|
||||
|
||||
<label for="2">Text input with preset values, custom classes and a placeholder. No duplicate values allowed</label>
|
||||
<input id="2" type="text" data-choice value="preset-1, preset-2" placeholder="This is a placeholder" class="custom class">
|
||||
<label for="2">Text input with preset values, custom classes and a placeholder. No duplicate values allowed</label>
|
||||
<input id="2" type="text" data-choice value="preset-1, preset-2" placeholder="This is a placeholder" class="custom class">
|
||||
|
||||
<label for="3">Text input that only allows email addresses</label>
|
||||
<input id="3" type="text" data-choice placeholder="This is a placeholder">
|
||||
<label for="3">Text input that only allows email addresses</label>
|
||||
<input id="3" type="text" data-choice placeholder="This is a placeholder">
|
||||
|
||||
<label for="4">Text input that disables adding items</label>
|
||||
<input id="4" type="text" data-choice value="josh@joshuajohnson.co.uk, joe@bloggs.co.uk" placeholder="This is a placeholder">
|
||||
<label for="4">Text input that disables adding items</label>
|
||||
<input id="4" type="text" data-choice value="josh@joshuajohnson.co.uk, joe@bloggs.co.uk" placeholder="This is a placeholder">
|
||||
|
||||
<label for="5">Text input that prepends and appends a value to each item</label>
|
||||
<input id="5" type="text" data-choice value="preset-1, preset-2" placeholder="This is a placeholder">
|
||||
|
||||
<label for="6">Text input with preset values passed through options</label>
|
||||
<input id="6" type="text" data-choice placeholder="This is a placeholder">
|
||||
<label for="5">Text input that prepends and appends a value to each item</label>
|
||||
<input id="5" type="text" data-choice value="preset-1, preset-2" placeholder="This is a placeholder">
|
||||
|
||||
<label for="6">Text input with preset values passed through options</label>
|
||||
<input id="6" type="text" data-choice placeholder="This is a placeholder">
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/scripts/dist/bundle.js"></script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue