mirror of
https://github.com/Choices-js/Choices.git
synced 2024-04-26 03:10:33 +02:00
68313da412
* Typescript config setup * Add type annotations to components * Further type additions * And more... * Add types to actions * Add types to templates * Further type checks * Further type additons * Install fuse latest * Housekeeping * Remove old type definitions * Fix remaning type issues * Fix some failing tests * Remove types workflow * Fix failing unit tests * Resolve back space event regression * Convert cypress files to .ts * Fix eslint issues * Remove cachebusting urls * Resolve delete button bug * Resolve regression bugs * Fix lint script * Fix lint workflow * Pass args instead of object to keyboard handlers * Flatten misc reducer * Resolve keyboad action test failures * Use Pick instead of Partial * Use interfaces in action tests * Update firefox image * Incorporate #791 * Incorporate #788
198 lines
6 KiB
HTML
198 lines
6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta
|
|
name="viewport"
|
|
content="width=device-width,initial-scale=1,user-scalable=no"
|
|
/>
|
|
<title>Choices</title>
|
|
<meta
|
|
name="description"
|
|
itemprop="description"
|
|
content="A lightweight, configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency."
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="180x180"
|
|
href="../../assets/images/apple-touch-icon.png"
|
|
/>
|
|
<link
|
|
rel="icon"
|
|
type="image/png"
|
|
href="../../assets/images/favicon-32x32.png"
|
|
sizes="32x32"
|
|
/>
|
|
<link
|
|
rel="icon"
|
|
type="image/png"
|
|
href="../../assets/images/favicon-16x16.png"
|
|
sizes="16x16"
|
|
/>
|
|
<link rel="manifest" href="../../assets/images/manifest.json" />
|
|
<link
|
|
rel="mask-icon"
|
|
href="../../assets/images/safari-pinned-tab.svg"
|
|
color="#00bcd4"
|
|
/>
|
|
<link rel="shortcut icon" href="../../assets/images/favicon.ico" />
|
|
<meta
|
|
name="msapplication-config"
|
|
content="../../assets/images/browserconfig.xml"
|
|
/>
|
|
<meta name="theme-color" content="#ffffff" />
|
|
|
|
<!-- Ignore these -->
|
|
<link rel="stylesheet" href="../../assets/styles/base.min.css" />
|
|
<!-- End ignore these -->
|
|
|
|
<!-- Choices includes -->
|
|
<link rel="stylesheet" href="../../assets/styles/choices.min.css" />
|
|
<script src="../../assets/scripts/choices.min.js"></script>
|
|
<!-- End Choices includes -->
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<div class="section">
|
|
<h2>Text inputs</h2>
|
|
<div data-test-hook="basic">
|
|
<label for="choices-basic">Basic</label>
|
|
<input class="form-control" id="choices-basic" type="text" />
|
|
</div>
|
|
|
|
<div data-test-hook="edit-items">
|
|
<label for="choices-edit-items">Edit items</label>
|
|
<input class="form-control" id="choices-edit-items" type="text" />
|
|
</div>
|
|
|
|
<div data-test-hook="remove-button">
|
|
<label for="choices-remove-button">Remove button</label>
|
|
<input class="form-control" id="choices-remove-button" type="text" />
|
|
</div>
|
|
|
|
<div data-test-hook="unique-values">
|
|
<label for="choices-unique-values">Unique values</label>
|
|
<input class="form-control" id="choices-unique-values" type="text" />
|
|
</div>
|
|
|
|
<div data-test-hook="input-limit">
|
|
<label for="choices-input-limit">Input limit</label>
|
|
<input class="form-control" id="choices-input-limit" type="text" />
|
|
</div>
|
|
|
|
<div data-test-hook="add-item-filter">
|
|
<label for="choices-add-item-filter">Add item filter</label>
|
|
<input
|
|
class="form-control"
|
|
id="choices-add-item-filter"
|
|
type="text"
|
|
/>
|
|
</div>
|
|
|
|
<div data-test-hook="adding-items-disabled">
|
|
<label for="choices-adding-items-disabled">Add items disabled</label>
|
|
<input
|
|
class="form-control"
|
|
id="choices-adding-items-disabled"
|
|
type="text"
|
|
/>
|
|
</div>
|
|
|
|
<div data-test-hook="disabled-via-attr">
|
|
<label for="choices-disabled-via-attr">Disabled via attribute</label>
|
|
<input
|
|
class="form-control"
|
|
id="choices-disabled-via-attr"
|
|
type="text"
|
|
disabled
|
|
/>
|
|
</div>
|
|
|
|
<div data-test-hook="prepend-append">
|
|
<label for="choices-prepend-append">Prepend/append</label>
|
|
<input class="form-control" id="choices-prepend-append" type="text" />
|
|
</div>
|
|
|
|
<div data-test-hook="prepopulated">
|
|
<label for="choices-prepopulated">Pre-populated choices</label>
|
|
<input class="form-control" id="choices-prepopulated" type="text" />
|
|
</div>
|
|
|
|
<div data-test-hook="placeholder">
|
|
<label for="choices-placeholder">Placeholder</label>
|
|
<input class="form-control" id="choices-placeholder" type="text" />
|
|
</div>
|
|
|
|
<div data-test-hook="within-form">
|
|
<form>
|
|
<label for="choices-within-form">Within form</label>
|
|
<input class="form-control" id="choices-within-form" type="text" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
new Choices('#choices-basic');
|
|
|
|
new Choices('#choices-edit-items', {
|
|
editItems: true,
|
|
});
|
|
|
|
new Choices('#choices-remove-button', {
|
|
removeItemButton: true,
|
|
});
|
|
|
|
new Choices('#choices-unique-values', {
|
|
duplicateItemsAllowed: false,
|
|
});
|
|
|
|
new Choices('#choices-input-limit', {
|
|
maxItemCount: 5,
|
|
});
|
|
|
|
new Choices('#choices-add-item-filter', {
|
|
addItems: true,
|
|
addItemFilter: value => {
|
|
const regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
const expression = new RegExp(regex.source, 'i');
|
|
return expression.test(value);
|
|
},
|
|
});
|
|
|
|
new Choices('#choices-adding-items-disabled', {
|
|
addItems: false,
|
|
});
|
|
|
|
new Choices('#choices-disabled-via-attr');
|
|
|
|
new Choices('#choices-prepend-append', {
|
|
prependValue: 'before-',
|
|
appendValue: '-after',
|
|
});
|
|
|
|
new Choices('#choices-prepopulated', {
|
|
items: [
|
|
'Josh Johnson',
|
|
{
|
|
value: 'joe@bloggs.co.uk',
|
|
label: 'Joe Bloggs',
|
|
customProperties: {
|
|
description: 'Joe Blogg is such a generic name',
|
|
},
|
|
},
|
|
],
|
|
});
|
|
|
|
new Choices('#choices-placeholder', {
|
|
placeholder: true,
|
|
placeholderValue: 'I am a placeholder',
|
|
});
|
|
|
|
new Choices('#choices-within-form');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|