Version 2.8.9

This commit is contained in:
Josh Johnson 2017-07-19 20:48:25 +01:00
parent 73940d7d04
commit f862a3a055
7 changed files with 570 additions and 566 deletions

View file

@ -1,4 +1,4 @@
/*! choices.js v2.8.8 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ /*! choices.js v2.8.9 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(); module.exports = factory();
@ -249,10 +249,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.baseId = (0, _utils.generateId)(this.passedElement, 'choices-'); this.baseId = (0, _utils.generateId)(this.passedElement, 'choices-');
// Bind methods // Bind methods
this.init = this.init.bind(this);
this.render = this.render.bind(this); this.render = this.render.bind(this);
this.destroy = this.destroy.bind(this);
this.disable = this.disable.bind(this);
// Bind event handlers // Bind event handlers
this._onFocus = this._onFocus.bind(this); this._onFocus = this._onFocus.bind(this);
@ -494,8 +491,10 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.isTextElement) { if (this.isTextElement) {
// Simplify store data to just values // Simplify store data to just values
var itemsFiltered = this.store.getItemsReducedToValues(items); var itemsFiltered = this.store.getItemsReducedToValues(items);
// Assign hidden input array of values var itemsFilteredString = itemsFiltered.join(this.config.delimiter);
this.passedElement.setAttribute('value', itemsFiltered.join(this.config.delimiter)); // Update the value of the hidden input
this.passedElement.setAttribute('value', itemsFilteredString);
this.passedElement.value = itemsFilteredString;
} else { } else {
var selectedOptionsFragment = document.createDocumentFragment(); var selectedOptionsFragment = document.createDocumentFragment();
@ -2634,12 +2633,16 @@ return /******/ (function(modules) { // webpackBootstrap
// Hide passed input // Hide passed input
this.passedElement.classList.add(this.config.classNames.input, this.config.classNames.hiddenState); this.passedElement.classList.add(this.config.classNames.input, this.config.classNames.hiddenState);
// Remove element from tab index
this.passedElement.tabIndex = '-1'; this.passedElement.tabIndex = '-1';
// Backup original styles if any // Backup original styles if any
var origStyle = this.passedElement.getAttribute('style'); var origStyle = this.passedElement.getAttribute('style');
if (Boolean(origStyle)) { if (Boolean(origStyle)) {
this.passedElement.setAttribute('data-choice-orig-style', origStyle); this.passedElement.setAttribute('data-choice-orig-style', origStyle);
} }
this.passedElement.setAttribute('style', 'display:none;'); this.passedElement.setAttribute('style', 'display:none;');
this.passedElement.setAttribute('aria-hidden', 'true'); this.passedElement.setAttribute('aria-hidden', 'true');
this.passedElement.setAttribute('data-choice', 'active'); this.passedElement.setAttribute('data-choice', 'active');
@ -3947,6 +3950,7 @@ return /******/ (function(modules) { // webpackBootstrap
*/ */
var ActionTypes = exports.ActionTypes = { var ActionTypes = exports.ActionTypes = {
INIT: '@@redux/INIT' INIT: '@@redux/INIT'
};
/** /**
* Creates a Redux store that holds the state tree. * Creates a Redux store that holds the state tree.
@ -3965,7 +3969,7 @@ return /******/ (function(modules) { // webpackBootstrap
* If you use `combineReducers` to produce the root reducer function, this must be * If you use `combineReducers` to produce the root reducer function, this must be
* an object with the same shape as `combineReducers` keys. * an object with the same shape as `combineReducers` keys.
* *
* @param {Function} [enhancer] The store enhancer. You may optionally specify it * @param {Function} enhancer The store enhancer. You may optionally specify it
* to enhance the store with third-party capabilities such as middleware, * to enhance the store with third-party capabilities such as middleware,
* time travel, persistence, etc. The only store enhancer that ships with Redux * time travel, persistence, etc. The only store enhancer that ships with Redux
* is `applyMiddleware()`. * is `applyMiddleware()`.
@ -3973,7 +3977,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @returns {Store} A Redux store that lets you read the state, dispatch actions * @returns {Store} A Redux store that lets you read the state, dispatch actions
* and subscribe to changes. * and subscribe to changes.
*/ */
};function createStore(reducer, preloadedState, enhancer) { function createStore(reducer, preloadedState, enhancer) {
var _ref2; var _ref2;
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
@ -4107,8 +4111,7 @@ return /******/ (function(modules) { // webpackBootstrap
var listeners = currentListeners = nextListeners; var listeners = currentListeners = nextListeners;
for (var i = 0; i < listeners.length; i++) { for (var i = 0; i < listeners.length; i++) {
var listener = listeners[i]; listeners[i]();
listener();
} }
return action; return action;
@ -4137,7 +4140,7 @@ return /******/ (function(modules) { // webpackBootstrap
* Interoperability point for observable/reactive libraries. * Interoperability point for observable/reactive libraries.
* @returns {observable} A minimal observable of state changes. * @returns {observable} A minimal observable of state changes.
* For more information, see the observable proposal: * For more information, see the observable proposal:
* https://github.com/tc39/proposal-observable * https://github.com/zenparsing/es-observable
*/ */
function observable() { function observable() {
var _ref; var _ref;
@ -4584,7 +4587,7 @@ return /******/ (function(modules) { // webpackBootstrap
var actionType = action && action.type; var actionType = action && action.type;
var actionName = actionType && '"' + actionType.toString() + '"' || 'an action'; var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state. ' + 'If you want this reducer to hold no value, you can return null instead of undefined.'; return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state.';
} }
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
@ -4612,18 +4615,18 @@ return /******/ (function(modules) { // webpackBootstrap
} }
} }
function assertReducerShape(reducers) { function assertReducerSanity(reducers) {
Object.keys(reducers).forEach(function (key) { Object.keys(reducers).forEach(function (key) {
var reducer = reducers[key]; var reducer = reducers[key];
var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT }); var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT });
if (typeof initialState === 'undefined') { if (typeof initialState === 'undefined') {
throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined. If you don\'t want to set a value for this reducer, ' + 'you can use null instead of undefined.'); throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined.');
} }
var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.'); var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
if (typeof reducer(undefined, { type: type }) === 'undefined') { if (typeof reducer(undefined, { type: type }) === 'undefined') {
throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined, but can be null.'); throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined.');
} }
}); });
} }
@ -4662,24 +4665,23 @@ return /******/ (function(modules) { // webpackBootstrap
} }
var finalReducerKeys = Object.keys(finalReducers); var finalReducerKeys = Object.keys(finalReducers);
var unexpectedKeyCache = void 0;
if (false) { if (false) {
unexpectedKeyCache = {}; var unexpectedKeyCache = {};
} }
var shapeAssertionError = void 0; var sanityError;
try { try {
assertReducerShape(finalReducers); assertReducerSanity(finalReducers);
} catch (e) { } catch (e) {
shapeAssertionError = e; sanityError = e;
} }
return function combination() { return function combination() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var action = arguments[1]; var action = arguments[1];
if (shapeAssertionError) { if (sanityError) {
throw shapeAssertionError; throw sanityError;
} }
if (false) { if (false) {
@ -4691,16 +4693,16 @@ return /******/ (function(modules) { // webpackBootstrap
var hasChanged = false; var hasChanged = false;
var nextState = {}; var nextState = {};
for (var _i = 0; _i < finalReducerKeys.length; _i++) { for (var i = 0; i < finalReducerKeys.length; i++) {
var _key = finalReducerKeys[_i]; var key = finalReducerKeys[i];
var reducer = finalReducers[_key]; var reducer = finalReducers[key];
var previousStateForKey = state[_key]; var previousStateForKey = state[key];
var nextStateForKey = reducer(previousStateForKey, action); var nextStateForKey = reducer(previousStateForKey, action);
if (typeof nextStateForKey === 'undefined') { if (typeof nextStateForKey === 'undefined') {
var errorMessage = getUndefinedStateErrorMessage(_key, action); var errorMessage = getUndefinedStateErrorMessage(key, action);
throw new Error(errorMessage); throw new Error(errorMessage);
} }
nextState[_key] = nextStateForKey; nextState[key] = nextStateForKey;
hasChanged = hasChanged || nextStateForKey !== previousStateForKey; hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
} }
return hasChanged ? nextState : state; return hasChanged ? nextState : state;
@ -4890,11 +4892,13 @@ return /******/ (function(modules) { // webpackBootstrap
return funcs[0]; return funcs[0];
} }
return funcs.reduce(function (a, b) { var last = funcs[funcs.length - 1];
var rest = funcs.slice(0, -1);
return function () { return function () {
return a(b.apply(undefined, arguments)); return rest.reduceRight(function (composed, f) {
return f(composed);
}, last.apply(undefined, arguments));
}; };
});
} }
/***/ }), /***/ }),

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,6 +1,6 @@
{ {
"name": "choices.js", "name": "choices.js",
"version": "2.8.8", "version": "2.8.9",
"description": "A vanilla JS customisable text input/select box plugin", "description": "A vanilla JS customisable text input/select box plugin",
"main": [ "main": [
"./assets/scripts/dist/choices.js", "./assets/scripts/dist/choices.js",

View file

@ -16,7 +16,7 @@
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<!-- Ignore these --> <!-- Ignore these -->
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=2.8.8"> <link rel="stylesheet" href="assets/styles/css/base.min.css?version=2.8.9">
<!-- End ignore these --> <!-- End ignore these -->
<!-- Optional includes --> <!-- Optional includes -->
@ -24,8 +24,8 @@
<!-- End optional includes --> <!-- End optional includes -->
<!-- Choices includes --> <!-- Choices includes -->
<link rel="stylesheet" href="assets/styles/css/choices.min.css?version=2.8.8"> <link rel="stylesheet" href="assets/styles/css/choices.min.css?version=2.8.9">
<script src="assets/scripts/dist/choices.js?version=2.8.8"></script> <script src="assets/scripts/dist/choices.js?version=2.8.9"></script>
<!-- End Choices includes --> <!-- End Choices includes -->
<!--[if lt IE 9]> <!--[if lt IE 9]>

View file

@ -1,6 +1,6 @@
{ {
"name": "choices.js", "name": "choices.js",
"version": "2.8.8", "version": "2.8.9",
"description": "A vanilla JS customisable text input/select box plugin", "description": "A vanilla JS customisable text input/select box plugin",
"main": "./assets/scripts/dist/choices.min.js", "main": "./assets/scripts/dist/choices.min.js",
"scripts": { "scripts": {

View file

@ -1,4 +1,4 @@
// Example usage: npm --newVersion=2.8.8 run version // Example usage: npm --newVersion=2.8.9 run version
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');