, including its score
if ((exists || mainSearchResult.isMatch) && checkTextMatches) {
// Check if the item already exists in our results
var existingResult = resultMap[index];
if (existingResult) {
// Use the lowest score
// existingResult.score, bitapResult.score
existingResult.output.push({
key: key,
arrayIndex: arrayIndex,
value: value,
score: finalScore,
matchedIndices: mainSearchResult.matchedIndices
});
} else {
// Add it to the raw result list
resultMap[index] = {
item: record,
output: [{
key: key,
arrayIndex: arrayIndex,
value: value,
score: finalScore,
matchedIndices: mainSearchResult.matchedIndices
}]
};
results.push(resultMap[index]);
}
}
} else if (isArray(value)) {
for (var _i3 = 0, len = value.length; _i3 < len; _i3 += 1) {
this._analyze({
key: key,
arrayIndex: _i3,
value: value[_i3],
record: record,
index: index
}, {
resultMap: resultMap,
results: results,
tokenSearchers: tokenSearchers,
fullSearcher: fullSearcher
});
}
}
}
}, {
key: "_computeScore",
value: function _computeScore(weights, results) {
this._log('\n\nComputing score:\n');
for (var i = 0, len = results.length; i < len; i += 1) {
var output = results[i].output;
var scoreLen = output.length;
var currScore = 1;
var bestScore = 1;
for (var j = 0; j < scoreLen; j += 1) {
var weight = weights ? weights[output[j].key].weight : 1;
var score = weight === 1 ? output[j].score : output[j].score || 0.001;
var nScore = score * weight;
if (weight !== 1) {
bestScore = Math.min(bestScore, nScore);
} else {
output[j].nScore = nScore;
currScore *= nScore;
}
}
results[i].score = bestScore === 1 ? currScore : bestScore;
this._log(results[i]);
}
}
}, {
key: "_sort",
value: function _sort(results) {
this._log('\n\nSorting....');
results.sort(this.options.sortFn);
}
}, {
key: "_format",
value: function _format(results) {
var finalOutput = [];
if (this.options.verbose) {
var cache = [];
this._log('\n\nOutput:\n\n', JSON.stringify(results, function (key, value) {
if (_typeof(value) === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Circular reference found, discard key
return;
} // Store value in our collection
cache.push(value);
}
return value;
}));
cache = null;
}
var transformers = [];
if (this.options.includeMatches) {
transformers.push(function (result, data) {
var output = result.output;
data.matches = [];
for (var i = 0, len = output.length; i < len; i += 1) {
var item = output[i];
if (item.matchedIndices.length === 0) {
continue;
}
var obj = {
indices: item.matchedIndices,
value: item.value
};
if (item.key) {
obj.key = item.key;
}
if (item.hasOwnProperty('arrayIndex') && item.arrayIndex > -1) {
obj.arrayIndex = item.arrayIndex;
}
data.matches.push(obj);
}
});
}
if (this.options.includeScore) {
transformers.push(function (result, data) {
data.score = result.score;
});
}
for (var i = 0, len = results.length; i < len; i += 1) {
var result = results[i];
if (this.options.id) {
result.item = this.options.getFn(result.item, this.options.id)[0];
}
if (!transformers.length) {
finalOutput.push(result.item);
continue;
}
var data = {
item: result.item
};
for (var j = 0, _len2 = transformers.length; j < _len2; j += 1) {
transformers[j](result, data);
}
finalOutput.push(data);
}
return finalOutput;
}
}, {
key: "_log",
value: function _log() {
if (this.options.verbose) {
var _console;
(_console = console).log.apply(_console, arguments);
}
}
}]);
return Fuse;
}();
module.exports = Fuse;
/***/ })
/******/ });
});
/***/ }),
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
var isMergeableObject = function isMergeableObject(value) {
return isNonNullObject(value)
&& !isSpecial(value)
};
function isNonNullObject(value) {
return !!value && typeof value === 'object'
}
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === '[object RegExp]'
|| stringValue === '[object Date]'
|| isReactElement(value)
}
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {}
}
function cloneUnlessOtherwiseSpecified(value, options) {
return (options.clone !== false && options.isMergeableObject(value))
? deepmerge(emptyTarget(value), value, options)
: value
}
function defaultArrayMerge(target, source, options) {
return target.concat(source).map(function(element) {
return cloneUnlessOtherwiseSpecified(element, options)
})
}
function mergeObject(target, source, options) {
var destination = {};
if (options.isMergeableObject(target)) {
Object.keys(target).forEach(function(key) {
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
});
}
Object.keys(source).forEach(function(key) {
if (!options.isMergeableObject(source[key]) || !target[key]) {
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
} else {
destination[key] = deepmerge(target[key], source[key], options);
}
});
return destination
}
function deepmerge(target, source, options) {
options = options || {};
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneUnlessOtherwiseSpecified(source, options)
} else if (sourceIsArray) {
return options.arrayMerge(target, source, options)
} else {
return mergeObject(target, source, options)
}
}
deepmerge.all = function deepmergeAll(array, options) {
if (!Array.isArray(array)) {
throw new Error('first argument should be an array')
}
return array.reduce(function(prev, next) {
return deepmerge(prev, next, options)
}, {})
};
var deepmerge_1 = deepmerge;
/* harmony default export */ __webpack_exports__["default"] = (deepmerge_1);
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
window.delegateEvent = function delegateEvent() {
var events;
var addedListenerTypes;
if (typeof events === 'undefined') {
events = new Map();
}
if (typeof addedListenerTypes === 'undefined') {
addedListenerTypes = [];
}
function _callback(event) {
var type = events.get(event.type);
if (!type) return;
type.forEach(function (fn) {
return fn(event);
});
}
return {
add: function add(type, fn) {
// Cache list of events.
if (events.has(type)) {
events.get(type).push(fn);
} else {
events.set(type, [fn]);
} // Setup events.
if (addedListenerTypes.indexOf(type) === -1) {
document.documentElement.addEventListener(type, _callback, true);
addedListenerTypes.push(type);
}
},
remove: function remove(type, fn) {
if (!events.get(type)) return;
events.set(type, events.get(type).filter(function (item) {
return item !== fn;
}));
if (!events.get(type).length) {
addedListenerTypes.splice(addedListenerTypes.indexOf(type), 1);
}
}
};
}();
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _redux = __webpack_require__(5);
var _index = _interopRequireDefault(__webpack_require__(15));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Store =
/*#__PURE__*/
function () {
function Store() {
_classCallCheck(this, Store);
this._store = (0, _redux.createStore)(_index.default, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());
}
/**
* Subscribe store to function call (wrapped Redux method)
* @param {Function} onChange Function to trigger when state changes
* @return
*/
_createClass(Store, [{
key: "subscribe",
value: function subscribe(onChange) {
this._store.subscribe(onChange);
}
/**
* Dispatch event to store (wrapped Redux method)
* @param {Function} action Action function to trigger
* @return
*/
}, {
key: "dispatch",
value: function dispatch(action) {
this._store.dispatch(action);
}
/**
* Get store object (wrapping Redux method)
* @return {Object} State
*/
}, {
key: "isLoading",
/**
* Get loading state from store
* @return {Boolean} Loading State
*/
value: function isLoading() {
return this.state.general.loading;
}
/**
* Get single choice by it's ID
* @return {Object} Found choice
*/
}, {
key: "getChoiceById",
value: function getChoiceById(id) {
if (id) {
return this.activeChoices.find(function (choice) {
return choice.id === parseInt(id, 10);
});
}
return false;
}
/**
* Get group by group id
* @param {Number} id Group ID
* @return {Object} Group data
*/
}, {
key: "getGroupById",
value: function getGroupById(id) {
return this.groups.find(function (group) {
return group.id === parseInt(id, 10);
});
}
}, {
key: "state",
get: function get() {
return this._store.getState();
}
/**
* Get items from store
* @return {Array} Item objects
*/
}, {
key: "items",
get: function get() {
return this.state.items;
}
/**
* Get active items from store
* @return {Array} Item objects
*/
}, {
key: "activeItems",
get: function get() {
return this.items.filter(function (item) {
return item.active === true;
});
}
/**
* Get highlighted items from store
* @return {Array} Item objects
*/
}, {
key: "highlightedActiveItems",
get: function get() {
return this.items.filter(function (item) {
return item.active && item.highlighted;
});
}
/**
* Get choices from store
* @return {Array} Option objects
*/
}, {
key: "choices",
get: function get() {
return this.state.choices;
}
/**
* Get active choices from store
* @return {Array} Option objects
*/
}, {
key: "activeChoices",
get: function get() {
var choices = this.choices;
var values = choices.filter(function (choice) {
return choice.active === true;
});
return values;
}
/**
* Get selectable choices from store
* @return {Array} Option objects
*/
}, {
key: "selectableChoices",
get: function get() {
return this.choices.filter(function (choice) {
return choice.disabled !== true;
});
}
/**
* Get choices that can be searched (excluding placeholders)
* @return {Array} Option objects
*/
}, {
key: "searchableChoices",
get: function get() {
return this.selectableChoices.filter(function (choice) {
return choice.placeholder !== true;
});
}
/**
* Get placeholder choice from store
* @return {Object} Found placeholder
*/
}, {
key: "placeholderChoice",
get: function get() {
return [].concat(this.choices).reverse().find(function (choice) {
return choice.placeholder === true;
});
}
/**
* Get groups from store
* @return {Array} Group objects
*/
}, {
key: "groups",
get: function get() {
return this.state.groups;
}
/**
* Get active groups from store
* @return {Array} Group objects
*/
}, {
key: "activeGroups",
get: function get() {
var groups = this.groups,
choices = this.choices;
return groups.filter(function (group) {
var isActive = group.active === true && group.disabled === false;
var hasActiveOptions = choices.some(function (choice) {
return choice.active === true && choice.disabled === false;
});
return isActive && hasActiveOptions;
}, []);
}
}]);
return Store;
}();
exports.default = Store;
/***/ }),
/* 14 */
/***/ (function(module, exports) {
module.exports = function(originalModule) {
if (!originalModule.webpackPolyfill) {
var module = Object.create(originalModule);
// module.parent = undefined by default
if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
return module.l;
}
});
Object.defineProperty(module, "id", {
enumerable: true,
get: function() {
return module.i;
}
});
Object.defineProperty(module, "exports", {
enumerable: true
});
module.webpackPolyfill = 1;
}
return module;
};
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _redux = __webpack_require__(5);
var _items = _interopRequireDefault(__webpack_require__(16));
var _groups = _interopRequireDefault(__webpack_require__(17));
var _choices = _interopRequireDefault(__webpack_require__(18));
var _general = _interopRequireDefault(__webpack_require__(19));
var _utils = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var appReducer = (0, _redux.combineReducers)({
items: _items.default,
groups: _groups.default,
choices: _choices.default,
general: _general.default
});
var rootReducer = function rootReducer(passedState, action) {
var state = passedState; // If we are clearing all items, groups and options we reassign
// state and then pass that state to our proper reducer. This isn't
// mutating our actual state
// See: http://stackoverflow.com/a/35641992
if (action.type === 'CLEAR_ALL') {
state = undefined;
} else if (action.type === 'RESET_TO') {
return (0, _utils.cloneObject)(action.state);
}
return appReducer(state, action);
};
var _default = rootReducer;
exports.default = _default;
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = items;
exports.defaultState = void 0;
var defaultState = [];
exports.defaultState = defaultState;
function items() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
var action = arguments.length > 1 ? arguments[1] : undefined;
switch (action.type) {
case 'ADD_ITEM':
{
// Add object to items array
var newState = [].concat(state, [{
id: action.id,
choiceId: action.choiceId,
groupId: action.groupId,
value: action.value,
label: action.label,
active: true,
highlighted: false,
customProperties: action.customProperties,
placeholder: action.placeholder || false,
keyCode: null
}]);
return newState.map(function (obj) {
var item = obj;
item.highlighted = false;
return item;
});
}
case 'REMOVE_ITEM':
{
// Set item to inactive
return state.map(function (obj) {
var item = obj;
if (item.id === action.id) {
item.active = false;
}
return item;
});
}
case 'HIGHLIGHT_ITEM':
{
return state.map(function (obj) {
var item = obj;
if (item.id === action.id) {
item.highlighted = action.highlighted;
}
return item;
});
}
default:
{
return state;
}
}
}
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = groups;
exports.defaultState = void 0;
var defaultState = [];
exports.defaultState = defaultState;
function groups() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
var action = arguments.length > 1 ? arguments[1] : undefined;
switch (action.type) {
case 'ADD_GROUP':
{
return [].concat(state, [{
id: action.id,
value: action.value,
active: action.active,
disabled: action.disabled
}]);
}
case 'CLEAR_CHOICES':
{
return [];
}
default:
{
return state;
}
}
}
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = choices;
exports.defaultState = void 0;
var defaultState = [];
exports.defaultState = defaultState;
function choices() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
var action = arguments.length > 1 ? arguments[1] : undefined;
switch (action.type) {
case 'ADD_CHOICE':
{
/*
A disabled choice appears in the choice dropdown but cannot be selected
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
return [].concat(state, [{
id: action.id,
elementId: action.elementId,
groupId: action.groupId,
value: action.value,
label: action.label || action.value,
disabled: action.disabled || false,
selected: false,
active: true,
score: 9999,
customProperties: action.customProperties,
placeholder: action.placeholder || false,
keyCode: null
}]);
}
case 'ADD_ITEM':
{
// If all choices need to be activated
if (action.activateOptions) {
return state.map(function (obj) {
var choice = obj;
choice.active = action.active;
return choice;
});
} // When an item is added and it has an associated choice,
// we want to disable it so it can't be chosen again
if (action.choiceId > -1) {
return state.map(function (obj) {
var choice = obj;
if (choice.id === parseInt(action.choiceId, 10)) {
choice.selected = true;
}
return choice;
});
}
return state;
}
case 'REMOVE_ITEM':
{
// When an item is removed and it has an associated choice,
// we want to re-enable it so it can be chosen again
if (action.choiceId > -1) {
return state.map(function (obj) {
var choice = obj;
if (choice.id === parseInt(action.choiceId, 10)) {
choice.selected = false;
}
return choice;
});
}
return state;
}
case 'FILTER_CHOICES':
{
return state.map(function (obj) {
var choice = obj; // Set active state based on whether choice is
// within filtered results
choice.active = action.results.some(function (_ref) {
var item = _ref.item,
score = _ref.score;
if (item.id === choice.id) {
choice.score = score;
return true;
}
return false;
});
return choice;
});
}
case 'ACTIVATE_CHOICES':
{
return state.map(function (obj) {
var choice = obj;
choice.active = action.active;
return choice;
});
}
case 'CLEAR_CHOICES':
{
return defaultState;
}
default:
{
return state;
}
}
}
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.defaultState = void 0;
var defaultState = {
loading: false
};
exports.defaultState = defaultState;
var general = function general() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
var action = arguments.length > 1 ? arguments[1] : undefined;
switch (action.type) {
case 'SET_IS_LOADING':
{
return {
loading: action.isLoading
};
}
default:
{
return state;
}
}
};
var _default = general;
exports.default = _default;
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Dropdown", {
enumerable: true,
get: function get() {
return _dropdown.default;
}
});
Object.defineProperty(exports, "Container", {
enumerable: true,
get: function get() {
return _container.default;
}
});
Object.defineProperty(exports, "Input", {
enumerable: true,
get: function get() {
return _input.default;
}
});
Object.defineProperty(exports, "List", {
enumerable: true,
get: function get() {
return _list.default;
}
});
Object.defineProperty(exports, "WrappedInput", {
enumerable: true,
get: function get() {
return _wrappedInput.default;
}
});
Object.defineProperty(exports, "WrappedSelect", {
enumerable: true,
get: function get() {
return _wrappedSelect.default;
}
});
var _dropdown = _interopRequireDefault(__webpack_require__(21));
var _container = _interopRequireDefault(__webpack_require__(22));
var _input = _interopRequireDefault(__webpack_require__(23));
var _list = _interopRequireDefault(__webpack_require__(24));
var _wrappedInput = _interopRequireDefault(__webpack_require__(25));
var _wrappedSelect = _interopRequireDefault(__webpack_require__(26));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Dropdown =
/*#__PURE__*/
function () {
function Dropdown(_ref) {
var element = _ref.element,
type = _ref.type,
classNames = _ref.classNames;
_classCallCheck(this, Dropdown);
Object.assign(this, {
element: element,
type: type,
classNames: classNames
});
this.isActive = false;
}
/**
* Determine how far the top of our element is from
* the top of the window
* @return {Number} Vertical position
*/
_createClass(Dropdown, [{
key: "distanceFromTopWindow",
value: function distanceFromTopWindow() {
this.dimensions = this.element.getBoundingClientRect();
this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight);
return this.position;
}
/**
* Find element that matches passed selector
* @return {HTMLElement}
*/
}, {
key: "getChild",
value: function getChild(selector) {
return this.element.querySelector(selector);
}
/**
* Show dropdown to user by adding active state class
* @return {Object} Class instance
* @public
*/
}, {
key: "show",
value: function show() {
this.element.classList.add(this.classNames.activeState);
this.element.setAttribute('aria-expanded', 'true');
this.isActive = true;
return this;
}
/**
* Hide dropdown from user
* @return {Object} Class instance
* @public
*/
}, {
key: "hide",
value: function hide() {
this.element.classList.remove(this.classNames.activeState);
this.element.setAttribute('aria-expanded', 'false');
this.isActive = false;
return this;
}
}]);
return Dropdown;
}();
exports.default = Dropdown;
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _utils = __webpack_require__(0);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Container =
/*#__PURE__*/
function () {
function Container(_ref) {
var element = _ref.element,
type = _ref.type,
classNames = _ref.classNames,
position = _ref.position;
_classCallCheck(this, Container);
Object.assign(this, {
element: element,
classNames: classNames,
type: type,
position: position
});
this.isOpen = false;
this.isFlipped = false;
this.isFocussed = false;
this.isDisabled = false;
this.isLoading = false;
this._onFocus = this._onFocus.bind(this);
this._onBlur = this._onBlur.bind(this);
}
/**
* Add event listeners
*/
_createClass(Container, [{
key: "addEventListeners",
value: function addEventListeners() {
this.element.addEventListener('focus', this._onFocus);
this.element.addEventListener('blur', this._onBlur);
}
/**
* Remove event listeners
*/
/** */
}, {
key: "removeEventListeners",
value: function removeEventListeners() {
this.element.removeEventListener('focus', this._onFocus);
this.element.removeEventListener('blur', this._onBlur);
}
/**
* Determine whether container should be flipped
* based on passed dropdown position
* @param {Number} dropdownPos
* @returns
*/
}, {
key: "shouldFlip",
value: function shouldFlip(dropdownPos) {
var windowHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _utils.getWindowHeight)();
if (dropdownPos === undefined) {
return false;
} // If flip is enabled and the dropdown bottom position is
// greater than the window height flip the dropdown.
var shouldFlip = false;
if (this.position === 'auto') {
shouldFlip = dropdownPos >= windowHeight;
} else if (this.position === 'top') {
shouldFlip = true;
}
return shouldFlip;
}
/**
* Set active descendant attribute
* @param {Number} activeDescendant ID of active descendant
*/
}, {
key: "setActiveDescendant",
value: function setActiveDescendant(activeDescendantID) {
this.element.setAttribute('aria-activedescendant', activeDescendantID);
}
/**
* Remove active descendant attribute
*/
}, {
key: "removeActiveDescendant",
value: function removeActiveDescendant() {
this.element.removeAttribute('aria-activedescendant');
}
}, {
key: "open",
value: function open(dropdownPos) {
this.element.classList.add(this.classNames.openState);
this.element.setAttribute('aria-expanded', 'true');
this.isOpen = true;
if (this.shouldFlip(dropdownPos)) {
this.element.classList.add(this.classNames.flippedState);
this.isFlipped = true;
}
}
}, {
key: "close",
value: function close() {
this.element.classList.remove(this.classNames.openState);
this.element.setAttribute('aria-expanded', 'false');
this.removeActiveDescendant();
this.isOpen = false; // A dropdown flips if it does not have space within the page
if (this.isFlipped) {
this.element.classList.remove(this.classNames.flippedState);
this.isFlipped = false;
}
}
}, {
key: "focus",
value: function focus() {
if (!this.isFocussed) {
this.element.focus();
}
}
}, {
key: "addFocusState",
value: function addFocusState() {
this.element.classList.add(this.classNames.focusState);
}
}, {
key: "removeFocusState",
value: function removeFocusState() {
this.element.classList.remove(this.classNames.focusState);
}
/**
* Remove disabled state
*/
}, {
key: "enable",
value: function enable() {
this.element.classList.remove(this.classNames.disabledState);
this.element.removeAttribute('aria-disabled');
if (this.type === 'select-one') {
this.element.setAttribute('tabindex', '0');
}
this.isDisabled = false;
}
/**
* Set disabled state
*/
}, {
key: "disable",
value: function disable() {
this.element.classList.add(this.classNames.disabledState);
this.element.setAttribute('aria-disabled', 'true');
if (this.type === 'select-one') {
this.element.setAttribute('tabindex', '-1');
}
this.isDisabled = true;
}
}, {
key: "wrap",
value: function wrap(element) {
(0, _utils.wrap)(element, this.element);
}
}, {
key: "unwrap",
value: function unwrap(element) {
// Move passed element outside this element
this.element.parentNode.insertBefore(element, this.element); // Remove this element
this.element.parentNode.removeChild(this.element);
}
/**
* Add loading state to element
*/
}, {
key: "addLoadingState",
value: function addLoadingState() {
this.element.classList.add(this.classNames.loadingState);
this.element.setAttribute('aria-busy', 'true');
this.isLoading = true;
}
/**
* Remove loading state from element
*/
}, {
key: "removeLoadingState",
value: function removeLoadingState() {
this.element.classList.remove(this.classNames.loadingState);
this.element.removeAttribute('aria-busy');
this.isLoading = false;
}
/**
* Set focussed state
*/
}, {
key: "_onFocus",
value: function _onFocus() {
this.isFocussed = true;
}
/**
* Remove blurred state
*/
}, {
key: "_onBlur",
value: function _onBlur() {
this.isFocussed = false;
}
}]);
return Container;
}();
exports.default = Container;
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _utils = __webpack_require__(0);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Input =
/*#__PURE__*/
function () {
function Input(_ref) {
var element = _ref.element,
type = _ref.type,
classNames = _ref.classNames,
placeholderValue = _ref.placeholderValue;
_classCallCheck(this, Input);
Object.assign(this, {
element: element,
type: type,
classNames: classNames,
placeholderValue: placeholderValue
});
this.element = element;
this.classNames = classNames;
this.isFocussed = this.element === document.activeElement;
this.isDisabled = false;
this._onPaste = this._onPaste.bind(this);
this._onInput = this._onInput.bind(this);
this._onFocus = this._onFocus.bind(this);
this._onBlur = this._onBlur.bind(this);
}
_createClass(Input, [{
key: "addEventListeners",
value: function addEventListeners() {
this.element.addEventListener('input', this._onInput);
this.element.addEventListener('paste', this._onPaste);
this.element.addEventListener('focus', this._onFocus);
this.element.addEventListener('blur', this._onBlur);
if (this.element.form) {
this.element.form.addEventListener('reset', this._onFormReset);
}
}
}, {
key: "removeEventListeners",
value: function removeEventListeners() {
this.element.removeEventListener('input', this._onInput);
this.element.removeEventListener('paste', this._onPaste);
this.element.removeEventListener('focus', this._onFocus);
this.element.removeEventListener('blur', this._onBlur);
if (this.element.form) {
this.element.form.removeEventListener('reset', this._onFormReset);
}
}
}, {
key: "enable",
value: function enable() {
this.element.removeAttribute('disabled');
this.isDisabled = false;
}
}, {
key: "disable",
value: function disable() {
this.element.setAttribute('disabled', '');
this.isDisabled = true;
}
}, {
key: "focus",
value: function focus() {
if (!this.isFocussed) {
this.element.focus();
}
}
}, {
key: "blur",
value: function blur() {
if (this.isFocussed) {
this.element.blur();
}
}
/**
* Set value of input to blank
* @return {Object} Class instance
* @public
*/
}, {
key: "clear",
value: function clear() {
var setWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (this.element.value) {
this.element.value = '';
}
if (setWidth) {
this.setWidth();
}
return this;
}
/**
* Set the correct input width based on placeholder
* value or input value
* @return
*/
}, {
key: "setWidth",
value: function setWidth(enforceWidth) {
var _this = this;
var callback = function callback(width) {
_this.element.style.width = width;
};
if (this._placeholderValue) {
// If there is a placeholder, we only want to set the width of the input when it is a greater
// length than 75% of the placeholder. This stops the input jumping around.
var valueHasDesiredLength = this.element.value.length >= this._placeholderValue.length / 1.25;
if (this.element.value && valueHasDesiredLength || enforceWidth) {
this.calcWidth(callback);
}
} else {
// If there is no placeholder, resize input to contents
this.calcWidth(callback);
}
}
}, {
key: "calcWidth",
value: function calcWidth(callback) {
return (0, _utils.calcWidthOfInput)(this.element, callback);
}
}, {
key: "setActiveDescendant",
value: function setActiveDescendant(activeDescendantID) {
this.element.setAttribute('aria-activedescendant', activeDescendantID);
}
}, {
key: "removeActiveDescendant",
value: function removeActiveDescendant() {
this.element.removeAttribute('aria-activedescendant');
}
}, {
key: "_onInput",
value: function _onInput() {
if (this.type !== 'select-one') {
this.setWidth();
}
}
}, {
key: "_onPaste",
value: function _onPaste(event) {
var target = event.target;
if (target === this.element && this.preventPaste) {
event.preventDefault();
}
}
}, {
key: "_onFocus",
value: function _onFocus() {
this.isFocussed = true;
}
}, {
key: "_onBlur",
value: function _onBlur() {
this.isFocussed = false;
}
}, {
key: "placeholder",
set: function set(placeholder) {
this.element.placeholder = placeholder;
}
}, {
key: "value",
set: function set(value) {
this.element.value = value;
},
get: function get() {
return (0, _utils.sanitise)(this.element.value);
}
}]);
return Input;
}();
exports.default = Input;
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _constants = __webpack_require__(1);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var List =
/*#__PURE__*/
function () {
function List(_ref) {
var element = _ref.element;
_classCallCheck(this, List);
Object.assign(this, {
element: element
});
this.scrollPos = this.element.scrollTop;
this.height = this.element.offsetHeight;
this.hasChildren = !!this.element.children;
}
_createClass(List, [{
key: "clear",
value: function clear() {
this.element.innerHTML = '';
}
}, {
key: "append",
value: function append(node) {
this.element.appendChild(node);
}
}, {
key: "getChild",
value: function getChild(selector) {
return this.element.querySelector(selector);
}
}, {
key: "scrollToTop",
value: function scrollToTop() {
this.element.scrollTop = 0;
}
}, {
key: "scrollToChoice",
value: function scrollToChoice(choice, direction) {
var _this = this;
if (!choice) {
return;
}
var dropdownHeight = this.element.offsetHeight;
var choiceHeight = choice.offsetHeight; // Distance from bottom of element to top of parent
var choicePos = choice.offsetTop + choiceHeight; // Scroll position of dropdown
var containerScrollPos = this.element.scrollTop + dropdownHeight; // Difference between the choice and scroll position
var endpoint = direction > 0 ? this.element.scrollTop + choicePos - containerScrollPos : choice.offsetTop;
requestAnimationFrame(function (time) {
_this._animateScroll(time, endpoint, direction);
});
}
}, {
key: "_scrollDown",
value: function _scrollDown(scrollPos, strength, endpoint) {
var easing = (endpoint - scrollPos) / strength;
var distance = easing > 1 ? easing : 1;
this.element.scrollTop = scrollPos + distance;
}
}, {
key: "_scrollUp",
value: function _scrollUp(scrollPos, strength, endpoint) {
var easing = (scrollPos - endpoint) / strength;
var distance = easing > 1 ? easing : 1;
this.element.scrollTop = scrollPos - distance;
}
}, {
key: "_animateScroll",
value: function _animateScroll(time, endpoint, direction) {
var _this2 = this;
var strength = _constants.SCROLLING_SPEED;
var choiceListScrollTop = this.element.scrollTop;
var continueAnimation = false;
if (direction > 0) {
this._scrollDown(choiceListScrollTop, strength, endpoint);
if (choiceListScrollTop < endpoint) {
continueAnimation = true;
}
} else {
this._scrollUp(choiceListScrollTop, strength, endpoint);
if (choiceListScrollTop > endpoint) {
continueAnimation = true;
}
}
if (continueAnimation) {
requestAnimationFrame(function () {
_this2._animateScroll(time, endpoint, direction);
});
}
}
}]);
return List;
}();
exports.default = List;
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _wrappedElement = _interopRequireDefault(__webpack_require__(4));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var WrappedInput =
/*#__PURE__*/
function (_WrappedElement) {
_inherits(WrappedInput, _WrappedElement);
function WrappedInput(_ref) {
var _this;
var element = _ref.element,
classNames = _ref.classNames,
delimiter = _ref.delimiter;
_classCallCheck(this, WrappedInput);
_this = _possibleConstructorReturn(this, _getPrototypeOf(WrappedInput).call(this, {
element: element,
classNames: classNames
}));
_this.delimiter = delimiter;
return _this;
}
_createClass(WrappedInput, [{
key: "value",
set: function set(items) {
var itemValues = items.map(function (_ref2) {
var value = _ref2.value;
return value;
});
var joinedValues = itemValues.join(this.delimiter);
this.element.setAttribute('value', joinedValues);
this.element.value = joinedValues;
} // @todo figure out why we need this? Perhaps a babel issue
,
get: function get() {
return _get(_getPrototypeOf(WrappedInput.prototype), "value", this);
}
}]);
return WrappedInput;
}(_wrappedElement.default);
exports.default = WrappedInput;
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _wrappedElement = _interopRequireDefault(__webpack_require__(4));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var WrappedSelect =
/*#__PURE__*/
function (_WrappedElement) {
_inherits(WrappedSelect, _WrappedElement);
function WrappedSelect(_ref) {
var _this;
var element = _ref.element,
classNames = _ref.classNames,
template = _ref.template;
_classCallCheck(this, WrappedSelect);
_this = _possibleConstructorReturn(this, _getPrototypeOf(WrappedSelect).call(this, {
element: element,
classNames: classNames
}));
_this.template = template;
return _this;
}
_createClass(WrappedSelect, [{
key: "appendDocFragment",
value: function appendDocFragment(fragment) {
this.element.innerHTML = '';
this.element.appendChild(fragment);
}
}, {
key: "placeholderOption",
get: function get() {
return this.element.querySelector('option[value=""]') || // Backward compatibility layer for the non-standard placeholder attribute supported in older versions.
this.element.querySelector('option[placeholder]');
}
}, {
key: "optionGroups",
get: function get() {
return Array.from(this.element.getElementsByTagName('OPTGROUP'));
}
}, {
key: "options",
get: function get() {
return Array.from(this.element.options);
},
set: function set(options) {
var _this2 = this;
var fragment = document.createDocumentFragment();
var addOptionToFragment = function addOptionToFragment(data) {
// Create a standard select option
var option = _this2.template(data); // Append it to fragment
fragment.appendChild(option);
}; // Add each list item to list
options.forEach(function (optionData) {
return addOptionToFragment(optionData);
});
this.appendDocFragment(fragment);
}
}]);
return WrappedSelect;
}(_wrappedElement.default);
exports.default = WrappedSelect;
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.TEMPLATES = void 0;
var _classnames = _interopRequireDefault(__webpack_require__(28));
var _utils = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var TEMPLATES = {
containerOuter: function containerOuter(globalClasses, direction, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) {
var tabIndex = isSelectOneElement ? 'tabindex="0"' : '';
var role = isSelectElement ? 'role="listbox"' : '';
var ariaAutoComplete = '';
if (isSelectElement && searchEnabled) {
role = 'role="combobox"';
ariaAutoComplete = 'aria-autocomplete="list"';
}
return (0, _utils.strToEl)("\n \n
\n "));
},
containerInner: function containerInner(globalClasses) {
return (0, _utils.strToEl)("\n \n "));
},
itemList: function itemList(globalClasses, isSelectOneElement) {
var _classNames;
var localClasses = (0, _classnames.default)(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !isSelectOneElement), _classNames));
return (0, _utils.strToEl)("\n \n "));
},
placeholder: function placeholder(globalClasses, value) {
return (0, _utils.strToEl)("\n \n ").concat(value, "\n
\n "));
},
item: function item(globalClasses, data, removeItemButton) {
var _classNames2;
var ariaSelected = data.active ? 'aria-selected="true"' : '';
var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
var localClasses = (0, _classnames.default)(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _defineProperty(_classNames2, globalClasses.placeholder, data.placeholder), _classNames2));
if (removeItemButton) {
var _classNames3;
localClasses = (0, _classnames.default)(globalClasses.item, (_classNames3 = {}, _defineProperty(_classNames3, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames3, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames3, globalClasses.placeholder, data.placeholder), _classNames3));
return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n
\n "));
}
return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n
\n "));
},
choiceList: function choiceList(globalClasses, isSelectOneElement) {
var ariaMultiSelectable = !isSelectOneElement ? 'aria-multiselectable="true"' : '';
return (0, _utils.strToEl)("\n \n
\n "));
},
choiceGroup: function choiceGroup(globalClasses, data) {
var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
var localClasses = (0, _classnames.default)(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled));
return (0, _utils.strToEl)("\n \n
").concat(data.value, "
\n
\n "));
},
choice: function choice(globalClasses, data, itemSelectText) {
var _classNames5;
var role = data.groupId > 0 ? 'role="treeitem"' : 'role="option"';
var localClasses = (0, _classnames.default)(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames5, globalClasses.placeholder, data.placeholder), _classNames5));
return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n
\n "));
},
input: function input(globalClasses, placeholderValue) {
var localClasses = (0, _classnames.default)(globalClasses.input, globalClasses.inputCloned);
return (0, _utils.strToEl)("\n \n "));
},
dropdown: function dropdown(globalClasses) {
var localClasses = (0, _classnames.default)(globalClasses.list, globalClasses.listDropdown);
return (0, _utils.strToEl)("\n \n
\n "));
},
notice: function notice(globalClasses, label) {
var _classNames6;
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var localClasses = (0, _classnames.default)(globalClasses.item, globalClasses.itemChoice, (_classNames6 = {}, _defineProperty(_classNames6, globalClasses.noResults, type === 'no-results'), _defineProperty(_classNames6, globalClasses.noChoices, type === 'no-choices'), _classNames6));
return (0, _utils.strToEl)("\n \n ").concat(label, "\n
\n "));
},
option: function option(data) {
return (0, _utils.strToEl)("\n \n "));
}
};
exports.TEMPLATES = TEMPLATES;
var _default = TEMPLATES;
exports.default = _default;
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2017 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) && arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
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 {}
}());
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.clearChoices = exports.activateChoices = exports.filterChoices = exports.addChoice = void 0;
var _constants = __webpack_require__(1);
var addChoice = function addChoice(_ref) {
var value = _ref.value,
label = _ref.label,
id = _ref.id,
groupId = _ref.groupId,
disabled = _ref.disabled,
elementId = _ref.elementId,
customProperties = _ref.customProperties,
placeholder = _ref.placeholder,
keyCode = _ref.keyCode;
return {
type: _constants.ACTION_TYPES.ADD_CHOICE,
value: value,
label: label,
id: id,
groupId: groupId,
disabled: disabled,
elementId: elementId,
customProperties: customProperties,
placeholder: placeholder,
keyCode: keyCode
};
};
exports.addChoice = addChoice;
var filterChoices = function filterChoices(results) {
return {
type: _constants.ACTION_TYPES.FILTER_CHOICES,
results: results
};
};
exports.filterChoices = filterChoices;
var activateChoices = function activateChoices() {
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
return {
type: _constants.ACTION_TYPES.ACTIVATE_CHOICES,
active: active
};
};
exports.activateChoices = activateChoices;
var clearChoices = function clearChoices() {
return {
type: _constants.ACTION_TYPES.CLEAR_CHOICES
};
};
exports.clearChoices = clearChoices;
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.highlightItem = exports.removeItem = exports.addItem = void 0;
var _constants = __webpack_require__(1);
var addItem = function addItem(_ref) {
var value = _ref.value,
label = _ref.label,
id = _ref.id,
choiceId = _ref.choiceId,
groupId = _ref.groupId,
customProperties = _ref.customProperties,
placeholder = _ref.placeholder,
keyCode = _ref.keyCode;
return {
type: _constants.ACTION_TYPES.ADD_ITEM,
value: value,
label: label,
id: id,
choiceId: choiceId,
groupId: groupId,
customProperties: customProperties,
placeholder: placeholder,
keyCode: keyCode
};
};
exports.addItem = addItem;
var removeItem = function removeItem(id, choiceId) {
return {
type: _constants.ACTION_TYPES.REMOVE_ITEM,
id: id,
choiceId: choiceId
};
};
exports.removeItem = removeItem;
var highlightItem = function highlightItem(id, highlighted) {
return {
type: _constants.ACTION_TYPES.HIGHLIGHT_ITEM,
id: id,
highlighted: highlighted
};
};
exports.highlightItem = highlightItem;
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addGroup = void 0;
var _constants = __webpack_require__(1);
/* eslint-disable import/prefer-default-export */
var addGroup = function addGroup(value, id, active, disabled) {
return {
type: _constants.ACTION_TYPES.ADD_GROUP,
value: value,
id: id,
active: active,
disabled: disabled
};
};
exports.addGroup = addGroup;
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.resetTo = exports.clearAll = void 0;
var clearAll = function clearAll() {
return {
type: 'CLEAR_ALL'
};
};
exports.clearAll = clearAll;
var resetTo = function resetTo(state) {
return {
type: 'RESET_TO',
state: state
};
};
exports.resetTo = resetTo;
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setIsLoading = void 0;
/* eslint-disable import/prefer-default-export */
var setIsLoading = function setIsLoading(isLoading) {
return {
type: 'SET_IS_LOADING',
isLoading: isLoading
};
};
exports.setIsLoading = setIsLoading;
/***/ })
/******/ ]);
});