ddm-selecty
Version:
A select component patterned after selectize
1,875 lines (1,520 loc) • 188 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["UISelecty"] = factory(require("react"), require("react-dom"));
else
root["UISelecty"] = factory(root["react"], root["react-dom"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_169__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SimpleSelectyStateless = exports.SimpleSelecty = undefined;
var _stateful = __webpack_require__(48);
var _stateful2 = _interopRequireDefault(_stateful);
var _stateless = __webpack_require__(25);
var _stateless2 = _interopRequireDefault(_stateless);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.SimpleSelecty = _stateful2.default;
exports.SimpleSelectyStateless = _stateless2.default;
/***/ },
/* 1 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
/***/ },
/* 2 */
/***/ function(module, exports) {
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
module.exports = isArray;
/***/ },
/* 3 */
/***/ function(module, exports) {
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = isObject;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__(37);
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
var baseIsNative = __webpack_require__(89),
getValue = __webpack_require__(112);
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
module.exports = getNative;
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
var isFunction = __webpack_require__(16),
isLength = __webpack_require__(23);
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
module.exports = isArrayLike;
/***/ },
/* 7 */
/***/ function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _isFunction2 = __webpack_require__(16);
var _isFunction3 = _interopRequireDefault(_isFunction2);
var _extendReactClass = __webpack_require__(161);
var _extendReactClass2 = _interopRequireDefault(_extendReactClass);
var _wrapStatelessFunction = __webpack_require__(167);
var _wrapStatelessFunction2 = _interopRequireDefault(_wrapStatelessFunction);
var _makeConfiguration = __webpack_require__(164);
var _makeConfiguration2 = _interopRequireDefault(_makeConfiguration);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Determines if the given object has the signature of a class that inherits React.Component.
*/
/**
* @see https://github.com/gajus/react-css-modules#options
*/
var isReactComponent = function isReactComponent(maybeReactComponent) {
return 'prototype' in maybeReactComponent && (0, _isFunction3.default)(maybeReactComponent.prototype.render);
};
/**
* When used as a function.
*/
var functionConstructor = function functionConstructor(Component, defaultStyles, options) {
var decoratedClass = void 0;
var configuration = (0, _makeConfiguration2.default)(options);
if (isReactComponent(Component)) {
decoratedClass = (0, _extendReactClass2.default)(Component, defaultStyles, configuration);
} else {
decoratedClass = (0, _wrapStatelessFunction2.default)(Component, defaultStyles, configuration);
}
if (Component.displayName) {
decoratedClass.displayName = Component.displayName;
} else {
decoratedClass.displayName = Component.name;
}
return decoratedClass;
};
/**
* When used as a ES7 decorator.
*/
var decoratorConstructor = function decoratorConstructor(defaultStyles, options) {
return function (Component) {
return functionConstructor(Component, defaultStyles, options);
};
};
exports.default = function () {
if ((0, _isFunction3.default)(arguments.length <= 0 ? undefined : arguments[0])) {
return functionConstructor(arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1], arguments.length <= 2 ? undefined : arguments[2]);
} else {
return decoratorConstructor(arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1]);
}
};
module.exports = exports['default'];
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
var listCacheClear = __webpack_require__(123),
listCacheDelete = __webpack_require__(124),
listCacheGet = __webpack_require__(125),
listCacheHas = __webpack_require__(126),
listCacheSet = __webpack_require__(127);
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
var eq = __webpack_require__(15);
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
var isKeyable = __webpack_require__(121);
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
module.exports = getMapData;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var isArray = __webpack_require__(2),
isSymbol = __webpack_require__(24);
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
module.exports = isKey;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(5);
/* Built-in method references that are verified to be native. */
var nativeCreate = getNative(Object, 'create');
module.exports = nativeCreate;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var isSymbol = __webpack_require__(24);
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
module.exports = toKey;
/***/ },
/* 15 */
/***/ function(module, exports) {
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
module.exports = eq;
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(3);
/** `Object#toString` result references. */
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
module.exports = isFunction;
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
var arrayLikeKeys = __webpack_require__(77),
baseKeys = __webpack_require__(91),
isArrayLike = __webpack_require__(6);
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
module.exports = keys;
/***/ },
/* 18 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var wordFilter = exports.wordFilter = function wordFilter(phrase, term) {
// If nothing is passed back to search for, always return true
if (term === null || term === '' || term.length === 0) {
return true;
} else if (phrase === null || phrase === '') {
return false;
}
var words = phrase.split(' ');
var contains = false;
for (var index = 0; index < words.length; index++) {
var word = words[index].substring(0, term.length);
if (word.indexOf(term) > -1) {
contains = true;
break;
}
}
return contains;
};
var filterOpts = exports.filterOpts = function filterOpts(label, value, limit, opts) {
var amount = limit;
var options = opts.slice(0);
if (value !== '') {
var TERM = value.toLowerCase();
var filtered = [];
for (var i = 0; i < options.length; i++) {
var LABEL = '';
if (typeof options[i][label] === 'string') {
LABEL = options[i][label].toLowerCase();
} else if (typeof options[i][label] === 'number') {
LABEL = options[i][label].toString();
}
if (wordFilter(LABEL, TERM)) {
filtered.push(options[i]);
}
}
amount = amount ? amount : filtered.length;
return filtered.slice(0, amount);
}
amount = amount ? amount : options.length;
return options.slice(0, amount);
};
var filterGroupings = exports.filterGroupings = function filterGroupings(label, value, limit, options, groups) {
var proceed = groups ? Object.keys(groups).length > 0 : false;
if (value !== '' && proceed) {
var _ret = function () {
var term = value.toLowerCase();
var groupHash = {};
for (var marker = 0; marker < groups.length; marker++) {
groupHash[groups[marker].value.toLowerCase()] = groups[marker];
}
// Determine the options that would be displayed if they weren't grouped
var displayedOptions = [];
var objKeys = Object.keys(options);
for (var index = 0; index < objKeys.length; index++) {
var current = groupHash[objKeys[index]];
if (typeof current === 'undefined') {
continue;
}
var items = options[objKeys[index]].items;
if (objKeys[index] === '__default__' || typeof current.filterable === 'undefined' || current.filterable) {
items = items.filter(function (result) {
var lowerResult = result[label].toLowerCase();
return wordFilter(lowerResult, term);
});
}
// Longer if statement in case someone passes back a limit of 0 for a group
if (current.limit !== null && typeof current.limit !== 'undefined' && current.limit !== 'all' || limit) {
if (current.limit) {
items = items.slice(0, current.limit);
} else {
items = items.slice(0, limit);
}
}
displayedOptions = displayedOptions.concat(items);
}
return {
v: displayedOptions
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
return options;
};
exports.default = function (options, text) {
var opts = Object.assign({}, options);
var filtered = [];
if (options.groupings) {
filtered = filterGroupings(opts.label, text, opts.limit, opts['grouped'], opts.groupings);
} else {
filtered = filterOpts(opts.label, text, opts.limit, opts['original']);
}
return filtered;
};
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
}());
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(5),
root = __webpack_require__(4);
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');
module.exports = Map;
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
var mapCacheClear = __webpack_require__(128),
mapCacheDelete = __webpack_require__(129),
mapCacheGet = __webpack_require__(130),
mapCacheHas = __webpack_require__(131),
mapCacheSet = __webpack_require__(132);
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
module.exports = MapCache;
/***/ },
/* 22 */
/***/ function(module, exports) {
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
module.exports = isIndex;
/***/ },
/* 23 */
/***/ function(module, exports) {
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
module.exports = isLength;
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
var isObjectLike = __webpack_require__(7);
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
module.exports = isSymbol;
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SimpleSelectyStateless = undefined;
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactCssModules = __webpack_require__(8);
var _reactCssModules2 = _interopRequireDefault(_reactCssModules);
var _input = __webpack_require__(47);
var _input2 = _interopRequireDefault(_input);
var _defaultProps = __webpack_require__(49);
var _defaultProps2 = _interopRequireDefault(_defaultProps);
var _propTypes = __webpack_require__(50);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _create = __webpack_require__(55);
var _create2 = _interopRequireDefault(_create);
var _sort = __webpack_require__(57);
var _filter = __webpack_require__(18);
var _filter2 = _interopRequireDefault(_filter);
var _keyEvents = __webpack_require__(59);
var _suggestions = __webpack_require__(51);
var _suggestions2 = _interopRequireDefault(_suggestions);
var _styles = __webpack_require__(62);
var _styles2 = _interopRequireDefault(_styles);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var SimpleSelectyStateless = exports.SimpleSelectyStateless = function SimpleSelectyStateless(_ref) {
var autofocus = _ref.autofocus;
var autoHighlight = _ref.autoHighlight;
var autoSuggest = _ref.autoSuggest;
var disabled = _ref.disabled;
var filterable = _ref.filterable;
var filteredOptions = _ref.filteredOptions;
var item = _ref.item;
var lazyLoading = _ref.lazyLoading;
var limit = _ref.limit;
var loading = _ref.loading;
var name = _ref.name;
var noResults = _ref.noResults;
var _onBlur = _ref.onBlur;
var onChange = _ref.onChange;
var _onClicked = _ref.onClicked;
var onFilter = _ref.onFilter;
var onFocus = _ref.onFocus;
var onKeyDown = _ref.onKeyDown;
var onFiltered = _ref.onFiltered;
var onChosen = _ref.onChosen;
var optionGroups = _ref.optionGroups;
var options = _ref.options;
var optLabel = _ref.optLabel;
var optValue = _ref.optValue;
var placeholder = _ref.placeholder;
var required = _ref.required;
var sortable = _ref.sortable;
var tabIndex = _ref.tabIndex;
var typedValue = _ref.typedValue;
var value = _ref.value;
var visible = _ref.visible;
var updateFunctions = {
onChange: onChange,
onFilter: onFilter,
onFiltered: onFiltered,
onKeyDown: onKeyDown,
onChosen: onChosen,
onBlur: _onBlur
};
var Options = {
filtered: null,
grouped: null,
groupings: optionGroups.length ? optionGroups : null,
label: optLabel,
limit: limit,
original: options,
selected: item,
sorted: null,
value: optValue
};
Options.filtered = filterable && typedValue.length && !lazyLoading ? filteredOptions : options;
if (Options.filtered.length <= 0) {
Options.sorted = (0, _sort.sortOptions)(options, optLabel, sortable);
Options.grouped = (0, _create2.default)(Options.sorted, optionGroups);
Options.filtered = (0, _filter.filterGroupings)(optLabel, optValue, limit, Options.grouped, optionGroups);
} else {
Options.sorted = (0, _sort.sortOptions)(Options.filtered, optLabel, sortable);
Options.grouped = (0, _create2.default)(Options.sorted, optionGroups);
}
return _react2.default.createElement(
'div',
{ onFocus: onFocus, onBlur: function onBlur() {
return setTimeout(function () {
return _onBlur();
}, 300);
}, styleName: 'wrapper' },
_react2.default.createElement(_input2.default, {
autofocus: autofocus,
disabled: disabled,
name: name,
placeholder: placeholder,
required: required,
value: value,
onKeyDown: function onKeyDown(e) {
return (0, _keyEvents.keyEvents)(e, 'down', filterable, lazyLoading, Options, sortable, typedValue, updateFunctions);
},
onKeyUp: function onKeyUp(e) {
return (0, _keyEvents.keyEvents)(e, 'up', filterable, lazyLoading, Options, sortable, typedValue, updateFunctions);
},
onChange: onChange,
tabIndex: tabIndex
}),
_react2.default.createElement(_suggestions2.default, {
autoHighlight: autoHighlight,
autoSuggest: autoSuggest,
selected: item,
limit: limit,
loading: loading,
noResults: noResults,
optLabel: optLabel,
optValue: optValue,
options: Options.grouped,
value: value,
visible: visible,
onClicked: function onClicked(clickedItem) {
var updatedOptions = (0, _filter2.default)(Options, clickedItem[optLabel]);
onFiltered(updatedOptions);
_onClicked(clickedItem);
}
})
);
};
SimpleSelectyStateless.propTypes = _propTypes2.default;
SimpleSelectyStateless.defaultProps = _defaultProps2.default;
exports.default = (0, _reactCssModules2.default)(SimpleSelectyStateless, _styles2.default, { allowMultiple: true });
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
var ListCache = __webpack_require__(9),
stackClear = __webpack_require__(140),
stackDelete = __webpack_require__(141),
stackGet = __webpack_require__(142),
stackHas = __webpack_require__(143),
stackSet = __webpack_require__(144);
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
this.__data__ = new ListCache(entries);
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
module.exports = Stack;
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
var root = __webpack_require__(4);
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
var eq = __webpack_require__(15);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
object[key] = value;
}
}
module.exports = assignValue;
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
var baseForOwn = __webpack_require__(83),
createBaseEach = __webpack_require__(106);
/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
module.exports = baseEach;
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
var castPath = __webpack_require__(35),
isKey = __webpack_require__(12),
toKey = __webpack_require__(14);
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
module.exports = baseGet;
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
var baseFindIndex = __webpack_require__(81),
baseIsNaN = __webpack_require__(88);
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
return baseFindIndex(array, baseIsNaN, fromIndex);
}
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
module.exports = baseIndexOf;
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
var baseIsEqualDeep = __webpack_require__(86),
isObject = __webpack_require__(3),
isObjectLike = __webpack_require__(7);
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
* @param {boolean} [bitmask] The bitmask of comparison flags.
* The bitmask may be composed of the following flags:
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, bitmask, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
}
module.exports = baseIsEqual;
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
var baseMatches = __webpack_require__(92),
baseMatchesProperty = __webpack_require__(93),
identity = __webpack_require__(152),
isArray = __webpack_require__(2),
property = __webpack_require__(158);
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}
module.exports = baseIteratee;
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(27),
isSymbol = __webpack_require__(24);
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
module.exports = baseToString;
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
var isArray = __webpack_require__(2),
stringToPath = __webpack_require__(146);
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
module.exports = castPath;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
var SetCache = __webpack_require__(71),
arraySome = __webpack_require__(78);
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!seen.has(othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
return seen.add(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, customizer, bitmask, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
module.exports = equalArrays;
/***/ },
/* 37 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
module.exports = freeGlobal;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 38 */
/***/ function(module, exports) {
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
module.exports = isHostObject;
/***/ },
/* 39 */
/***/ function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
module.exports = isPrototype;
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(3);
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
module.exports = isStrictComparable;
/***/ },
/* 41 */
/***/ function(module, exports) {
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue &&
(srcValue !== undefined || (key in Object(object)));
};
}
module.exports = matchesStrictComparable;
/***/ },
/* 42 */
/***/ function(module, exports) {
/** Used for built-in method references. */
var funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
module.exports = toSource;
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
var assignValue = __webpack_require__(28),
copyObject = __webpack_require__(103),
createAssigner = __webpack_require__(105),
isArrayLike = __webpack_require__(6),
isPrototype = __webpack_require__(39),
keys = __webpack_require__(17);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */
var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
/**
* Assigns own enumerable string keyed properties of source objects to the
* destination object. Source objects are applied from left to right.
* Subsequent sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object` and is loosely based on
* [`Object.assign`](https://mdn.io/Object/assign).
*
* @static
* @memberOf _
* @since 0.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.assignIn
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* function Bar() {
* this.c = 3;
* }
*
* Foo.prototype.b = 2;
* Bar.prototype.d = 4;
*
* _.assign({ 'a': 0 }, new Foo, new Bar);
* // => { 'a': 1, 'c': 3 }
*/
var assign = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
copyObject(source, keys(source), object);
return;
}
for (var key in source) {
if (hasOwnProperty.call(source, key)) {
assignValue(object, key, source[key]);
}
}
});
module.exports = assign;
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
var isArrayLikeObject = __webpack_require__(153);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
module.exports = isArguments;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
var baseToString = __webpack_require__(34);
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
module.exports = toString;
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _isObject2 = __webpack_require__(3);
var _isObject3 = _interopRequireDefault(_isObject2);
var _isArray2 = __webpack_require__(2);
var _isArray3 = _interopRequireDefault(_isArray2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _objectUnfreeze = __webpack_require__(160);
var _objectUnfreeze2 = _interopRequireDefault(_objectUnfreeze);
var _isIterable = __webpack_require__(163);
var _isIterable2 = _interopRequireDefault(_isIterable);
var _parseStyleName = __webpack_require__(165);
var _parseStyleName2 = _interopRequireDefault(_parseStyleName);
var _generateAppendClassName = __webpack_require__(162);
var _generateAppendClassName2 = _interopRequireDefault(_generateAppendClassName);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var linkElement = function linkElement(element, styles, configuration) {
var appendClassName = void 0,
elementIsFrozen = void 0,
elementShallowCopy = void 0;
elementShallowCopy = element;
if (Object.isFrozen && Object.isFrozen(elementShallowCopy)) {
elementIsFrozen = true;
// https://github.com/facebook/react/blob/v0.13.3/src/classic/element/ReactElement.js#L131
elementShallowCopy = (0, _objectUnfreeze2.default)(elementShallowCopy);
elementShallowCopy.props = (0, _objectUnfreeze2.default)(elementShallowCopy.props);
}
var styleNames = (0