From 49ea94852354b23f8827d7c43adf40d923bd74f4 Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Thu, 20 Oct 2016 22:00:25 +0100 Subject: [PATCH 1/2] Update README.md --- README.md | 160 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 83 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 0d939684b..45056b924 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,15 @@ A vanilla, lightweight (~15kb gzipped 🎉), configurable select box/text input * Custom templates ## Installation - -`npm install choices.js --save` - -## Setup - +With [NPM](https://www.npmjs.com/package/choices.js): +```bash +npm install choices.js --save +``` +With [Bower](https://bower.io/): +```bash +bower install choices.js --save +``` +Or include Choices directly: ```html @@ -26,82 +30,84 @@ A vanilla, lightweight (~15kb gzipped 🎉), configurable select box/text input - + // Passing options (with default options) + const choices = new Choices(elements, { + items: [], + choices: [], + maxItemCount: -1, + addItems: true, + removeItems: true, + removeItemButton: false, + editItems: false, + duplicateItems: true, + delimiter: ',', + paste: true, + search: true, + searchFloor: 1, + flip: true, + regexFilter: null, + shouldSort: true, + sortFilter: sortByAlpha, + sortFields: ['label', 'value'], + placeholder: true, + placeholderValue: null, + prependValue: null, + appendValue: null, + loadingText: 'Loading...', + noResultsText: 'No results round', + noChoicesText: 'No choices to choose from', + itemSelectText: 'Press to select', + classNames: { + containerOuter: 'choices', + containerInner: 'choices__inner', + input: 'choices__input', + inputCloned: 'choices__input--cloned', + list: 'choices__list', + listItems: 'choices__list--multiple', + listSingle: 'choices__list--single', + listDropdown: 'choices__list--dropdown', + item: 'choices__item', + itemSelectable: 'choices__item--selectable', + itemDisabled: 'choices__item--disabled', + itemChoice: 'choices__item--choice', + group: 'choices__group', + groupHeading : 'choices__heading', + button: 'choices__button', + activeState: 'is-active', + focusState: 'is-focused', + openState: 'is-open', + disabledState: 'is-disabled', + highlightedState: 'is-highlighted', + hiddenState: 'is-hidden', + flippedState: 'is-flipped', + loadingState: 'is-loading', + }, + callbackOnInit: null, + callbackOnAddItem: null, + callbackOnRemoveItem: null, + callbackOnHighlightItem: null, + callbackOnUnhighlightItem: null, + callbackOnCreateTemplates: null, + callbackOnChange: null, + callbackOnSearch: null, + }); ``` ## Terminology From af970ec7765b69b9cb0e99788ba645b69e70070b Mon Sep 17 00:00:00 2001 From: Nathaniel Watson Date: Fri, 21 Oct 2016 17:43:32 +1300 Subject: [PATCH 2/2] Fix noResultsText typo (`round` -> `found`) --- README.md | 2 +- assets/scripts/src/choices.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 45056b924..bfeab90d6 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Or include Choices directly: prependValue: null, appendValue: null, loadingText: 'Loading...', - noResultsText: 'No results round', + noResultsText: 'No results found', noChoicesText: 'No choices to choose from', itemSelectText: 'Press to select', classNames: { diff --git a/assets/scripts/src/choices.js b/assets/scripts/src/choices.js index 1bcda6816..39f35ce5d 100644 --- a/assets/scripts/src/choices.js +++ b/assets/scripts/src/choices.js @@ -68,7 +68,7 @@ class Choices { prependValue: null, appendValue: null, loadingText: 'Loading...', - noResultsText: 'No results round', + noResultsText: 'No results found', noChoicesText: 'No choices to choose from', itemSelectText: 'Press to select', classNames: {