Commit graph

80 commits

Author SHA1 Message Date
Josh Johnson 62e849d1b4
Resolve 774 (#777)
* Include customProperties in removeItem

* Add tests

* Housekeeping

* Update mac vm label

* Add .nvmrc
2019-11-24 17:32:02 +00:00
Josh Johnson 67266a3aae
Resolve #762 (#767)
* Update value with character value

* Remove .only

* Lowercase character before updating value

* Add cypress tests covering change

* Update logic to affect both select inputs

* Update cypress

* Emphasise remove button focus

* Text change

* Revert "Update cypress"

This reverts commit 81e406de85.

* Remove false positive tests
2019-11-22 19:09:45 +00:00
Josh Johnson 592c326442
Update polyfill list (#765)
* Update polyfill list

* Update eslintrc.json

* Add keydown methods to types

* Resolve type issue
2019-11-19 18:34:08 +00:00
Kazuki Nishikawa 0e8e42e015 Fix #573 (#574)
* add specs

* fix to restore preset choices after destroy

* avoid to modify `this.config.choices` directly

* Update cypress/integration/select-one.spec.js

Co-Authored-By: Josh Johnson <josh@joshuajohnson.co.uk>

* Update public/test/select-one.html

Co-Authored-By: Josh Johnson <josh@joshuajohnson.co.uk>

* Update public/test/select-one.html

Co-Authored-By: Josh Johnson <josh@joshuajohnson.co.uk>

* Update public/test/select-one.html

Co-Authored-By: Josh Johnson <josh@joshuajohnson.co.uk>

* Update public/test/select-one.html

Co-Authored-By: Josh Johnson <josh@joshuajohnson.co.uk>

* fix specs

* restoring passed element initial options

 - Save `passedElement.options` values as `this._presetOptions`
 - Restore saved `this._presetOptions` to `passedElement.options` on `destroy`
 - It avoids restoring options in `this.config.choices`

* Update cypress/integration/select-one.spec.js

Co-Authored-By: Josh Johnson <josh@joshuajohnson.co.uk>

* Update cypress/integration/select-one.spec.js

Co-Authored-By: Josh Johnson <josh@joshuajohnson.co.uk>

* Update public/test/select-one.html

Co-Authored-By: Josh Johnson <josh@joshuajohnson.co.uk>

* move preset options assignment statement
2019-11-17 12:34:34 +00:00
Josh Johnson 933ea6093f
Remove redundant check (#755)
* Remove redundant check

* Add integration tests covering fix

* Add missing test
2019-11-13 15:40:47 +00:00
Konstantin Vyatkin 8775bacdd9 improve whole-page performance by scoping events handlers (#740)
* scope onMouseDown event capture

* supercedes #710

* make isIE11 a const

* scope keydown

* scope mouseover

* fix removeEventListener for keyup
2019-11-12 09:47:41 +00:00
Josh Johnson d04031e02f
Fix id types (#743)
* Set ids to be numbers

* Split out _setLoading into start/stop methods

* Build
2019-11-08 09:19:18 +00:00
Josh Johnson b5b593a62f
Resolve bug 473 (#739)
* Fix #473

* Add tests

* Tweak cypress tests

* Build
2019-11-07 08:50:19 +00:00
Josh Johnson f30b976424
Resolve bug 533 (#736)
* Add placeholder options to demo page

* Use constant types in components

* Refactor adding predefined groups/items/choices

* Add 'highlighted' flag to Item type

* Fix dispatch param type

* Build

* Add jsdoc comments to utils

* Remove unused file

* Add default values to js doc comments

* Use Redux Action type

* Housekeeping

* Increase utils coverage

* Apply suggestions from code review

* Add _getTemplate unit tests

* Resolve #533

* Add tests
2019-11-03 18:12:47 +00:00
Josh Johnson ab22347d7b
Code refactoring (#735)
* Add placeholder options to demo page

* Use constant types in components

* Refactor adding predefined groups/items/choices

* Add 'highlighted' flag to Item type

* Fix dispatch param type

* Build

* Add jsdoc comments to utils

* Remove unused file

* Add default values to js doc comments

* Use Redux Action type

* Housekeeping

* Increase utils coverage

* Apply suggestions from code review

* Add _getTemplate unit tests
2019-11-03 17:45:16 +00:00
Josh Johnson e6882f3e4b
Add missing type definitions + rename sortFn (#734)
* Add wrapped element getters + fix some types

* Remove comment

* Add missing config options to types

* Add types to constants

* Rename sortFn to sorter

* Update PR template

* Add refactor to PR template

* Add passed element types to constants

* Add js doc comments to actions

* Add "returns" to js doc comments

* Add missing choice prop to type

* Add types to store.js

* Add jsdoc comments to components

* Ignore strict null checks

* Move loading action into misc.js

* Further type def additions

* Rename itemCompare to valueCompare

* Update badges

* Rename scrollToChoice to scrollToChildElement
2019-11-03 13:18:16 +00:00
Josh Johnson a0fe05f926
Fix #727 (#731)
* Housekeeping

* Resolve placeholder bug + hide from choice list

* Restructure test folder

* Update cypress test to assert one placeholder

* Fix breaking e2e test

* Remove ability to pass placeholder via config for select boxes

* Add further e2e tests covering placeholders

* Add unit tests for _generatePlaceholderValue

* Display placeholder choice for select one

* Add further e2e test to assert on placeholder ordering

* Add labels to exclude from draft releases

* Add failure case to e2e test workflow

* Resolve broken e2e test

* Update puppeteer snapshot baseline
2019-11-02 13:49:33 +00:00
Konstantin Vyatkin 939a73b762 fix setChoices flow (#730)
* fix setChoices flow

* ignore Promise as it gate checked

* re-run cypress
2019-11-02 12:58:18 +00:00
Konstantin Vyatkin 034191c78a use CSS queries (#718)
* use matchMedia

* use last-of-type

* better type check

* simplify distanceFromTopWindow

* use visibility

* update JSDoc
2019-10-30 17:28:15 +00:00
Josh Johnson 0e44a916e3
Fix constructor (#693)
* breaking test

* Remove ablity to pass multiple elements + tests

* Update readme

* Update README.md

* 🔖 Version 8.0.0

* Remove type definition hack

* Update coverage command

* Add some missing list tests

* Remove .only

* Update demo page to loop over elements

* Update constructor to set initialised flag if already active

* Make templates private

* Throw type error once if element is invalid

* Fix list children bug

* Re-add generic examples to index.html

* Housekeeping

* Use typeof instead of isType where applicable

* Remove isElement

* Add test for isIE11
2019-10-29 21:19:56 +00:00
Josh Johnson 88f63faa0b
Update code styling rules (#713)
* Enforce curly braces around conditionals

* Install sort class members + update rules

* Satisfy linting changes

* Add todo

* Add tests for clearChoices

* Update eslint-plugin-prettier to latest

* Resolve conflicts

* Fix linting errors
2019-10-29 18:26:11 +00:00
Konstantin Vyatkin e3cc6eaf1b [MAJOR] Remove .ajax and allow async function for .setChoices (#701)
* WIP: remove ajax

* copy #700

* remove ajax, add fetchChoices

* extend setChoices

* update README
2019-10-29 18:12:32 +00:00
Konstantin Vyatkin 1f5192b4ad remove delegateEvents (#703) 2019-10-29 17:46:10 +00:00
Konstantin Vyatkin 2e004015d5 fix preventPaste (#707)
* what is preventPaste?

* fix preventPaste
2019-10-29 17:35:20 +00:00
Konstantin Vyatkin b080bcda7d rename addItemFilterFn (#699) 2019-10-29 17:29:31 +00:00
Konstantin Vyatkin 9504cfcec5 [MAJOR] expose defaults and original Template rendering functions (#708)
* expose original Template rendering functions

* add to types

* add moduleResolution

* use `defaults`
2019-10-29 15:13:00 +00:00
Konstantin Vyatkin b48395ce36 fix dir (#711) 2019-10-29 14:02:24 +00:00
Konstantin Vyatkin ef2c70fb7a use default parameters (#698)
* use default parameters

* Fix argument name in README
2019-10-25 13:21:38 +01:00
Konstantin Vyatkin 69582349bb remove redundant CSS (#697)
* remove redundant CSS

* fix error with lack of test for false

* destruct dataset

* fix typo
2019-10-25 13:09:27 +01:00
Konstantin Vyatkin 6848970fd9 improve Babel and webpack configurations --> reduce JS bundle size (#670)
* simplify babel config

* fix Cypress VSCode checks

* introduce webpack base config

* fix flacky cypress test

* fix class properties definition

* fix default export

* upgrade affected deps, decrease bundlesize

* run ESLint only on changed files
2019-10-22 17:08:43 +01:00
Josh Johnson 1285602b2f
Publish version after npm publish (#672)
* Add publish to github step

* Include file with release

* Supress logs if silent mode = true

* 🔖 Version 7.1.1

* Rejig console logs

* Update error log conditional
2019-10-22 12:50:40 +01:00
Josh Johnson f597bc9aff
Remove travis (#667)
* Remove travis.yml

* Remove versioning from index file

* Resolve linting issues

* Resolve further linting issues

* Uppercase NPM_TOKEN

* Run audit fix

* Update postversion command

* Update @babel/core to latest

* Update post version command

* Housekeeping

* Revert cypress upgrade

* Enforce cypress version

* Update package.lock

* Add cypress project id
2019-10-21 20:03:57 +01:00
Konstantin Vyatkin 7de0887e7d use templates from instance, fixes #461 (#660)
* use template from instance

* adjust test

* fix lint

* try to move `this` out of loop

* fixes late init bound
2019-10-21 10:48:49 +01:00
Chris DeLuca e7d775e2ae Use event delegation (#644)
Instead of attaching a new root-level event listener for bubbling events
for every choices instance, use a simple event delegation script to
handle each event type.

Each event callback function already is coded as if it were fully
delegated, since the events are attached at the document level, so
no changes are needed to detect which element is being called.

Note that focus and blur event do not bubble, so they have been left as
they are.

Also note that the event delegation uses an IIFE purposely instead of
ES6 modules, since the event list should be globally cached, and it
doesn't make sense to instantiate a new scope for each instance (then
we're back where we started!)

fix #643
2019-10-15 08:42:31 +01:00
bradwade 5cf226f166 ADA accessibility label fixes (#642)
* Update incorrect 'label-for' in demo index.html file.

* Use placeholder value for search input aria label.

* Updated input template test.

* Adding the compiled, uglified JS.
2019-10-10 09:49:00 +01:00
Tomakava 37db45e651 fix unhighlightAll performance issue (#648) 2019-10-03 09:41:53 +01:00
Josh Johnson 67382a3f31 Use v3 of polyfill 2019-03-29 09:12:29 +00:00
Josh Johnson 3c05016920 Merge branch 'master' of https://github.com/DarrenMack-OD/Choices into DarrenMack-OD-master 2019-03-29 08:57:38 +00:00
Darren Mackintosh aceb838988
Rolled back webpack changes in Choices.js 2019-03-15 16:57:35 +00:00
Darren Mackintosh 2247eff08a
Added linting exclusion for WebPack 2019-03-14 12:03:22 +00:00
Darren Mackintosh f9f63e7aba
Fix for the webpack issue
export choices as a class to circumvent the webpack issue
2019-03-14 11:23:12 +00:00
Hans Lemuet 5c17250e20
Allow passing an empty array to setChoices 2019-03-13 10:34:06 +01:00
Hans Lemuet fc9bca2ece
Rename _clearChoices to clearChoices 2019-03-13 10:05:38 +01:00
Darren Mackintosh 2fa92520ef
Updated Choices.js
Fixes scrollbar issue in IE11. There is an EDGE-CASE where-by if a user were to select the same option twice, the dropdown doesn't go away. This is, however a very extreme case and we are on the right track
2019-03-12 20:27:54 +00:00
Christophe Coevoet 56845e3897 Remove the CustomEvent polyfill from the bundle 2019-02-28 11:51:04 +01:00
Josh Johnson 879c97f64c
Resolve undefined error (#528)
* Remove run-p from test command

* Remove dropdown interaction tests

* Tidy utils

* Use merge lib

* Remove string casting

* Sanitise in constants

* Housekeeping

* Add non-string value tests
2019-02-22 22:04:55 +00:00
Josh Johnson 8540d5aabd
Api changes (#515)
* Combine regexFilter and addItemFilter + minor tweaks

* Update tests to accomodate fixed dropdown notice

* Remove broken `toggleDropdown` method

* Unskip dropdown interaction tests

* Remove reference to removed method
2019-02-12 18:35:46 +00:00
Glade ba09fb00e6 callback to filter items before adding (#485)
* Add item custom callback

* Minor unit test updates

* Test updates, Changed callback name to more clearly distinguish it's function

* Fix description wording in cypress

* Update README

* Updated filter item callback name to be addItemFilter
2019-02-11 22:56:21 +00:00
Guilherme de Oliveira Costa 71a3131d3c Added custom properties to options
Added custom properties to options to be searchable on select.
2019-02-11 16:05:59 -02:00
Josh Johnson 437651411f
Fix render blocking (#456)
* Reapply changes from PR #310

* Version 4.1.1

* Update action name

* Update test

* Resolved broken test
2019-01-26 12:36:47 +00:00
Jeremy Hou 48b74a91bc fixes the 'invalid input type' check (#498) 2019-01-21 08:46:14 +00:00
Jeremy Hou 9c001487ba Fixes an issue where deepmerge concatenates array configs (#496) 2019-01-19 14:47:22 +00:00
Josh Johnson 826384b9d5
Fix set choice by value bug (#471)
* Resolve bug with setChoiceByValue not removing choice from dropdown

* 4.1.3

* Version 4.1.3
2018-11-25 12:48:49 +00:00
Josh Johnson c3e46e55aa
Fix form submission bug in firefox (#470)
* Fix form submission bug in firefox

* 4.1.1
2018-11-24 17:48:03 +00:00
Josh Johnson 496db95153 Disable input when loading remote data 2018-11-03 13:24:52 +00:00