Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

downshift

Package Overview
Dependencies
Maintainers
1
Versions
354
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

downshift - npm Package Compare versions

Comparing version 1.0.0-beta.19 to 1.0.0-beta.20

95

dist/downshift.cjs.js

@@ -328,2 +328,17 @@ 'use strict';

/**
* Determines whether the two given objects have shallow
* equality with respect to the keys given in obj2.
* In other words, every value in obj2 is equal to the
* value of the same key in obj1.
* @param {Object} obj1 the first
* @param {Object} obj2 the second
* @return {Boolean} whether they are shallowly equal
*/
function containsSubset(obj1, obj2) {
return Object.keys(obj2).every(function (key) {
return obj1[key] === obj2[key];
});
}
/* eslint camelcase:0 */

@@ -470,2 +485,3 @@

_this.getRootProps.called = true;
_this.getRootProps.refKey = refKey;
return _extends((_babelHelpers$extends = {}, defineProperty(_babelHelpers$extends, refKey, _this.rootRef), defineProperty(_babelHelpers$extends, 'onClick', composeEventHandlers(onClick, _this.root_handleClick)), _babelHelpers$extends), rest);

@@ -770,7 +786,11 @@ };

var onChangeArg = {};
var onStateChangeArg = void 0;
var onStateChangeArg = void 0,
stateChanged = void 0;
return this.setState(function (state) {
state = _this3.getState(state);
onStateChangeArg = typeof stateToSet === 'function' ? stateToSet(state) : stateToSet;
// this keeps track of the object we want to call with setState
var nextState = {};
// this is just used to tell whether the state changed
var nextFullState = {};
// we need to call on change if the outside world is controlling any of our state

@@ -793,2 +813,3 @@ // and we're trying to update that state. OR if the selection has changed and we're

}
nextFullState[key] = onStateChangeArg[key];
// if it's coming from props, then we don't want to set it internally

@@ -799,2 +820,3 @@ if (!_this3.props.hasOwnProperty(key)) {

});
stateChanged = !containsSubset(state, nextFullState);
return nextState;

@@ -804,10 +826,12 @@ }, function () {

cbToCb(cb)();
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
// if the selectedItem changed
// then let's call onChange!
if (stateChanged) {
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
}
if (Object.keys(onChangeArg).length) {
// if the selectedItem changed
// then let's call onChange!
_this3.props.onChange(onChangeArg);

@@ -918,5 +942,3 @@ }

_this4.isMouseDown = false;
var target = event.target;
if (!_this4._rootNode.contains(target)) {
if (!_this4._rootNode.contains(event.target)) {
_this4.reset(Autocomplete.stateChangeTypes.mouseUp);

@@ -957,2 +979,3 @@ }

this.getRootProps.called = false;
this.getRootProps.refKey = undefined;
// we do something similar for getLabelProps

@@ -962,10 +985,11 @@ this.getLabelProps.called = false;

this.getInputProps.called = false;
var uiDescriptor = children && children(this.getControllerStateAndHelpers());
if (!uiDescriptor) {
return null;
}
// doing React.Children.only for Preact support ⚛️
var element = React__default.Children.only(children(this.getControllerStateAndHelpers()));
if (!element) {
// returned null or something...
var element = React__default.Children.only(uiDescriptor);
if (this.getRootProps.called) {
validateGetRootPropsCalledCorrectly(element, this.getRootProps);
return element;
} else if (this.getRootProps.called) {
// we assumed they applied the root props correctly
return element;
} else if (typeof element.type === 'string') {

@@ -986,3 +1010,3 @@ // they didn't apply the root props, but we can clone

Autocomplete.propTypes = {
children: PropTypes.func.isRequired,
children: PropTypes.func,
defaultHighlightedIndex: PropTypes.number,

@@ -994,3 +1018,3 @@ defaultSelectedItem: PropTypes.any,

itemToString: PropTypes.func,
onChange: PropTypes.func.isRequired,
onChange: PropTypes.func,
onStateChange: PropTypes.func,

@@ -1013,9 +1037,9 @@ onClick: PropTypes.func,

// eslint-disable-next-line complexity
getA11yStatusMessage: function getA11yStatusMessage(_ref8) {
var isOpen = _ref8.isOpen,
highlightedItem = _ref8.highlightedItem,
selectedItem = _ref8.selectedItem,
resultCount = _ref8.resultCount,
previousResultCount = _ref8.previousResultCount,
itemToString = _ref8.itemToString;
getA11yStatusMessage: function getA11yStatusMessage(_ref9) {
var isOpen = _ref9.isOpen,
highlightedItem = _ref9.highlightedItem,
selectedItem = _ref9.selectedItem,
resultCount = _ref9.resultCount,
previousResultCount = _ref9.previousResultCount,
itemToString = _ref9.itemToString;

@@ -1046,2 +1070,21 @@ if (!isOpen) {

function validateGetRootPropsCalledCorrectly(element, _ref8) {
var refKey = _ref8.refKey;
var refKeySpecified = refKey !== 'ref';
var isComposite = typeof element.type !== 'string';
if (isComposite && !refKeySpecified) {
throw new Error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
} else if (!isComposite && refKeySpecified) {
throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + refKey + '"');
}
if (!element.props.hasOwnProperty(refKey)) {
throw new Error('downshift: You must apply the ref prop "' + refKey + '" from getRootProps onto your root element.');
}
if (!element.props.hasOwnProperty('onClick')) {
throw new Error('downshift: You must apply the "onClick" prop from getRootProps onto your root element.');
}
}
module.exports = Autocomplete;

@@ -323,2 +323,17 @@ import React, { Component } from 'react';

/**
* Determines whether the two given objects have shallow
* equality with respect to the keys given in obj2.
* In other words, every value in obj2 is equal to the
* value of the same key in obj1.
* @param {Object} obj1 the first
* @param {Object} obj2 the second
* @return {Boolean} whether they are shallowly equal
*/
function containsSubset(obj1, obj2) {
return Object.keys(obj2).every(function (key) {
return obj1[key] === obj2[key];
});
}
/* eslint camelcase:0 */

@@ -465,2 +480,3 @@

_this.getRootProps.called = true;
_this.getRootProps.refKey = refKey;
return _extends((_babelHelpers$extends = {}, defineProperty(_babelHelpers$extends, refKey, _this.rootRef), defineProperty(_babelHelpers$extends, 'onClick', composeEventHandlers(onClick, _this.root_handleClick)), _babelHelpers$extends), rest);

@@ -765,7 +781,11 @@ };

var onChangeArg = {};
var onStateChangeArg = void 0;
var onStateChangeArg = void 0,
stateChanged = void 0;
return this.setState(function (state) {
state = _this3.getState(state);
onStateChangeArg = typeof stateToSet === 'function' ? stateToSet(state) : stateToSet;
// this keeps track of the object we want to call with setState
var nextState = {};
// this is just used to tell whether the state changed
var nextFullState = {};
// we need to call on change if the outside world is controlling any of our state

@@ -788,2 +808,3 @@ // and we're trying to update that state. OR if the selection has changed and we're

}
nextFullState[key] = onStateChangeArg[key];
// if it's coming from props, then we don't want to set it internally

@@ -794,2 +815,3 @@ if (!_this3.props.hasOwnProperty(key)) {

});
stateChanged = !containsSubset(state, nextFullState);
return nextState;

@@ -799,10 +821,12 @@ }, function () {

cbToCb(cb)();
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
// if the selectedItem changed
// then let's call onChange!
if (stateChanged) {
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
}
if (Object.keys(onChangeArg).length) {
// if the selectedItem changed
// then let's call onChange!
_this3.props.onChange(onChangeArg);

@@ -913,5 +937,3 @@ }

_this4.isMouseDown = false;
var target = event.target;
if (!_this4._rootNode.contains(target)) {
if (!_this4._rootNode.contains(event.target)) {
_this4.reset(Autocomplete.stateChangeTypes.mouseUp);

@@ -952,2 +974,3 @@ }

this.getRootProps.called = false;
this.getRootProps.refKey = undefined;
// we do something similar for getLabelProps

@@ -957,10 +980,11 @@ this.getLabelProps.called = false;

this.getInputProps.called = false;
var uiDescriptor = children && children(this.getControllerStateAndHelpers());
if (!uiDescriptor) {
return null;
}
// doing React.Children.only for Preact support ⚛️
var element = React.Children.only(children(this.getControllerStateAndHelpers()));
if (!element) {
// returned null or something...
var element = React.Children.only(uiDescriptor);
if (this.getRootProps.called) {
validateGetRootPropsCalledCorrectly(element, this.getRootProps);
return element;
} else if (this.getRootProps.called) {
// we assumed they applied the root props correctly
return element;
} else if (typeof element.type === 'string') {

@@ -981,3 +1005,3 @@ // they didn't apply the root props, but we can clone

Autocomplete.propTypes = {
children: PropTypes.func.isRequired,
children: PropTypes.func,
defaultHighlightedIndex: PropTypes.number,

@@ -989,3 +1013,3 @@ defaultSelectedItem: PropTypes.any,

itemToString: PropTypes.func,
onChange: PropTypes.func.isRequired,
onChange: PropTypes.func,
onStateChange: PropTypes.func,

@@ -1008,9 +1032,9 @@ onClick: PropTypes.func,

// eslint-disable-next-line complexity
getA11yStatusMessage: function getA11yStatusMessage(_ref8) {
var isOpen = _ref8.isOpen,
highlightedItem = _ref8.highlightedItem,
selectedItem = _ref8.selectedItem,
resultCount = _ref8.resultCount,
previousResultCount = _ref8.previousResultCount,
itemToString = _ref8.itemToString;
getA11yStatusMessage: function getA11yStatusMessage(_ref9) {
var isOpen = _ref9.isOpen,
highlightedItem = _ref9.highlightedItem,
selectedItem = _ref9.selectedItem,
resultCount = _ref9.resultCount,
previousResultCount = _ref9.previousResultCount,
itemToString = _ref9.itemToString;

@@ -1041,2 +1065,21 @@ if (!isOpen) {

function validateGetRootPropsCalledCorrectly(element, _ref8) {
var refKey = _ref8.refKey;
var refKeySpecified = refKey !== 'ref';
var isComposite = typeof element.type !== 'string';
if (isComposite && !refKeySpecified) {
throw new Error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
} else if (!isComposite && refKeySpecified) {
throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + refKey + '"');
}
if (!element.props.hasOwnProperty(refKey)) {
throw new Error('downshift: You must apply the ref prop "' + refKey + '" from getRootProps onto your root element.');
}
if (!element.props.hasOwnProperty('onClick')) {
throw new Error('downshift: You must apply the "onClick" prop from getRootProps onto your root element.');
}
}
export default Autocomplete;

@@ -354,2 +354,17 @@ 'use strict';

/**
* Determines whether the two given objects have shallow
* equality with respect to the keys given in obj2.
* In other words, every value in obj2 is equal to the
* value of the same key in obj1.
* @param {Object} obj1 the first
* @param {Object} obj2 the second
* @return {Boolean} whether they are shallowly equal
*/
function containsSubset(obj1, obj2) {
return Object.keys(obj2).every(function (key) {
return obj1[key] === obj2[key];
});
}
/* eslint camelcase:0 */

@@ -496,2 +511,3 @@

_this.getRootProps.called = true;
_this.getRootProps.refKey = refKey;
return _extends((_babelHelpers$extends = {}, defineProperty(_babelHelpers$extends, refKey, _this.rootRef), defineProperty(_babelHelpers$extends, 'onClick', composeEventHandlers(onClick, _this.root_handleClick)), _babelHelpers$extends), rest);

@@ -796,7 +812,11 @@ };

var onChangeArg = {};
var onStateChangeArg = void 0;
var onStateChangeArg = void 0,
stateChanged = void 0;
return this.setState(function (state) {
state = _this3.getState(state);
onStateChangeArg = typeof stateToSet === 'function' ? stateToSet(state) : stateToSet;
// this keeps track of the object we want to call with setState
var nextState = {};
// this is just used to tell whether the state changed
var nextFullState = {};
// we need to call on change if the outside world is controlling any of our state

@@ -819,2 +839,3 @@ // and we're trying to update that state. OR if the selection has changed and we're

}
nextFullState[key] = onStateChangeArg[key];
// if it's coming from props, then we don't want to set it internally

@@ -825,2 +846,3 @@ if (!_this3.props.hasOwnProperty(key)) {

});
stateChanged = !containsSubset(state, nextFullState);
return nextState;

@@ -830,10 +852,12 @@ }, function () {

cbToCb(cb)();
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
// if the selectedItem changed
// then let's call onChange!
if (stateChanged) {
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
}
if (Object.keys(onChangeArg).length) {
// if the selectedItem changed
// then let's call onChange!
_this3.props.onChange(onChangeArg);

@@ -944,5 +968,3 @@ }

_this4.isMouseDown = false;
var target = event.target;
if (!_this4._rootNode.contains(target)) {
if (!_this4._rootNode.contains(event.target)) {
_this4.reset(Autocomplete.stateChangeTypes.mouseUp);

@@ -983,2 +1005,3 @@ }

this.getRootProps.called = false;
this.getRootProps.refKey = undefined;
// we do something similar for getLabelProps

@@ -988,10 +1011,11 @@ this.getLabelProps.called = false;

this.getInputProps.called = false;
var uiDescriptor = children && children(this.getControllerStateAndHelpers());
if (!uiDescriptor) {
return null;
}
// doing React.Children.only for Preact support ⚛️
var element = preact__default.Children.only(children(this.getControllerStateAndHelpers()));
if (!element) {
// returned null or something...
var element = preact__default.Children.only(uiDescriptor);
if (this.getRootProps.called) {
validateGetRootPropsCalledCorrectly(element, this.getRootProps);
return element;
} else if (this.getRootProps.called) {
// we assumed they applied the root props correctly
return element;
} else if (typeof element.type === 'string') {

@@ -1012,3 +1036,3 @@ // they didn't apply the root props, but we can clone

Autocomplete.propTypes = {
children: PropTypes.func.isRequired,
children: PropTypes.func,
defaultHighlightedIndex: PropTypes.number,

@@ -1020,3 +1044,3 @@ defaultSelectedItem: PropTypes.any,

itemToString: PropTypes.func,
onChange: PropTypes.func.isRequired,
onChange: PropTypes.func,
onStateChange: PropTypes.func,

@@ -1039,9 +1063,9 @@ onClick: PropTypes.func,

// eslint-disable-next-line complexity
getA11yStatusMessage: function getA11yStatusMessage(_ref8) {
var isOpen = _ref8.isOpen,
highlightedItem = _ref8.highlightedItem,
selectedItem = _ref8.selectedItem,
resultCount = _ref8.resultCount,
previousResultCount = _ref8.previousResultCount,
itemToString = _ref8.itemToString;
getA11yStatusMessage: function getA11yStatusMessage(_ref9) {
var isOpen = _ref9.isOpen,
highlightedItem = _ref9.highlightedItem,
selectedItem = _ref9.selectedItem,
resultCount = _ref9.resultCount,
previousResultCount = _ref9.previousResultCount,
itemToString = _ref9.itemToString;

@@ -1072,2 +1096,21 @@ if (!isOpen) {

function validateGetRootPropsCalledCorrectly(element, _ref8) {
var refKey = _ref8.refKey;
var refKeySpecified = refKey !== 'ref';
var isComposite = typeof element.type !== 'string';
if (isComposite && !refKeySpecified) {
throw new Error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
} else if (!isComposite && refKeySpecified) {
throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + refKey + '"');
}
if (!element.props.hasOwnProperty(refKey)) {
throw new Error('downshift: You must apply the ref prop "' + refKey + '" from getRootProps onto your root element.');
}
if (!element.props.hasOwnProperty('onClick')) {
throw new Error('downshift: You must apply the "onClick" prop from getRootProps onto your root element.');
}
}
module.exports = Autocomplete;

@@ -353,2 +353,17 @@ import { Component } from 'preact';

/**
* Determines whether the two given objects have shallow
* equality with respect to the keys given in obj2.
* In other words, every value in obj2 is equal to the
* value of the same key in obj1.
* @param {Object} obj1 the first
* @param {Object} obj2 the second
* @return {Boolean} whether they are shallowly equal
*/
function containsSubset(obj1, obj2) {
return Object.keys(obj2).every(function (key) {
return obj1[key] === obj2[key];
});
}
/* eslint camelcase:0 */

@@ -495,2 +510,3 @@

_this.getRootProps.called = true;
_this.getRootProps.refKey = refKey;
return _extends((_babelHelpers$extends = {}, defineProperty(_babelHelpers$extends, refKey, _this.rootRef), defineProperty(_babelHelpers$extends, 'onClick', composeEventHandlers(onClick, _this.root_handleClick)), _babelHelpers$extends), rest);

@@ -795,7 +811,11 @@ };

var onChangeArg = {};
var onStateChangeArg = void 0;
var onStateChangeArg = void 0,
stateChanged = void 0;
return this.setState(function (state) {
state = _this3.getState(state);
onStateChangeArg = typeof stateToSet === 'function' ? stateToSet(state) : stateToSet;
// this keeps track of the object we want to call with setState
var nextState = {};
// this is just used to tell whether the state changed
var nextFullState = {};
// we need to call on change if the outside world is controlling any of our state

@@ -818,2 +838,3 @@ // and we're trying to update that state. OR if the selection has changed and we're

}
nextFullState[key] = onStateChangeArg[key];
// if it's coming from props, then we don't want to set it internally

@@ -824,2 +845,3 @@ if (!_this3.props.hasOwnProperty(key)) {

});
stateChanged = !containsSubset(state, nextFullState);
return nextState;

@@ -829,10 +851,12 @@ }, function () {

cbToCb(cb)();
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
// if the selectedItem changed
// then let's call onChange!
if (stateChanged) {
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
}
if (Object.keys(onChangeArg).length) {
// if the selectedItem changed
// then let's call onChange!
_this3.props.onChange(onChangeArg);

@@ -943,5 +967,3 @@ }

_this4.isMouseDown = false;
var target = event.target;
if (!_this4._rootNode.contains(target)) {
if (!_this4._rootNode.contains(event.target)) {
_this4.reset(Autocomplete.stateChangeTypes.mouseUp);

@@ -982,2 +1004,3 @@ }

this.getRootProps.called = false;
this.getRootProps.refKey = undefined;
// we do something similar for getLabelProps

@@ -987,10 +1010,11 @@ this.getLabelProps.called = false;

this.getInputProps.called = false;
var uiDescriptor = children && children(this.getControllerStateAndHelpers());
if (!uiDescriptor) {
return null;
}
// doing React.Children.only for Preact support ⚛️
var element = preact__default.Children.only(children(this.getControllerStateAndHelpers()));
if (!element) {
// returned null or something...
var element = preact__default.Children.only(uiDescriptor);
if (this.getRootProps.called) {
validateGetRootPropsCalledCorrectly(element, this.getRootProps);
return element;
} else if (this.getRootProps.called) {
// we assumed they applied the root props correctly
return element;
} else if (typeof element.type === 'string') {

@@ -1011,3 +1035,3 @@ // they didn't apply the root props, but we can clone

Autocomplete.propTypes = {
children: PropTypes.func.isRequired,
children: PropTypes.func,
defaultHighlightedIndex: PropTypes.number,

@@ -1019,3 +1043,3 @@ defaultSelectedItem: PropTypes.any,

itemToString: PropTypes.func,
onChange: PropTypes.func.isRequired,
onChange: PropTypes.func,
onStateChange: PropTypes.func,

@@ -1038,9 +1062,9 @@ onClick: PropTypes.func,

// eslint-disable-next-line complexity
getA11yStatusMessage: function getA11yStatusMessage(_ref8) {
var isOpen = _ref8.isOpen,
highlightedItem = _ref8.highlightedItem,
selectedItem = _ref8.selectedItem,
resultCount = _ref8.resultCount,
previousResultCount = _ref8.previousResultCount,
itemToString = _ref8.itemToString;
getA11yStatusMessage: function getA11yStatusMessage(_ref9) {
var isOpen = _ref9.isOpen,
highlightedItem = _ref9.highlightedItem,
selectedItem = _ref9.selectedItem,
resultCount = _ref9.resultCount,
previousResultCount = _ref9.previousResultCount,
itemToString = _ref9.itemToString;

@@ -1071,2 +1095,21 @@ if (!isOpen) {

function validateGetRootPropsCalledCorrectly(element, _ref8) {
var refKey = _ref8.refKey;
var refKeySpecified = refKey !== 'ref';
var isComposite = typeof element.type !== 'string';
if (isComposite && !refKeySpecified) {
throw new Error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
} else if (!isComposite && refKeySpecified) {
throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + refKey + '"');
}
if (!element.props.hasOwnProperty(refKey)) {
throw new Error('downshift: You must apply the ref prop "' + refKey + '" from getRootProps onto your root element.');
}
if (!element.props.hasOwnProperty('onClick')) {
throw new Error('downshift: You must apply the "onClick" prop from getRootProps onto your root element.');
}
}
export default Autocomplete;

@@ -357,2 +357,17 @@ (function (global, factory) {

/**
* Determines whether the two given objects have shallow
* equality with respect to the keys given in obj2.
* In other words, every value in obj2 is equal to the
* value of the same key in obj1.
* @param {Object} obj1 the first
* @param {Object} obj2 the second
* @return {Boolean} whether they are shallowly equal
*/
function containsSubset(obj1, obj2) {
return Object.keys(obj2).every(function (key) {
return obj1[key] === obj2[key];
});
}
/* eslint camelcase:0 */

@@ -499,2 +514,3 @@

_this.getRootProps.called = true;
_this.getRootProps.refKey = refKey;
return _extends((_babelHelpers$extends = {}, defineProperty(_babelHelpers$extends, refKey, _this.rootRef), defineProperty(_babelHelpers$extends, 'onClick', composeEventHandlers(onClick, _this.root_handleClick)), _babelHelpers$extends), rest);

@@ -799,7 +815,11 @@ };

var onChangeArg = {};
var onStateChangeArg = void 0;
var onStateChangeArg = void 0,
stateChanged = void 0;
return this.setState(function (state) {
state = _this3.getState(state);
onStateChangeArg = typeof stateToSet === 'function' ? stateToSet(state) : stateToSet;
// this keeps track of the object we want to call with setState
var nextState = {};
// this is just used to tell whether the state changed
var nextFullState = {};
// we need to call on change if the outside world is controlling any of our state

@@ -822,2 +842,3 @@ // and we're trying to update that state. OR if the selection has changed and we're

}
nextFullState[key] = onStateChangeArg[key];
// if it's coming from props, then we don't want to set it internally

@@ -828,2 +849,3 @@ if (!_this3.props.hasOwnProperty(key)) {

});
stateChanged = !containsSubset(state, nextFullState);
return nextState;

@@ -833,10 +855,12 @@ }, function () {

cbToCb(cb)();
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
// if the selectedItem changed
// then let's call onChange!
if (stateChanged) {
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
}
if (Object.keys(onChangeArg).length) {
// if the selectedItem changed
// then let's call onChange!
_this3.props.onChange(onChangeArg);

@@ -947,5 +971,3 @@ }

_this4.isMouseDown = false;
var target = event.target;
if (!_this4._rootNode.contains(target)) {
if (!_this4._rootNode.contains(event.target)) {
_this4.reset(Autocomplete.stateChangeTypes.mouseUp);

@@ -986,2 +1008,3 @@ }

this.getRootProps.called = false;
this.getRootProps.refKey = undefined;
// we do something similar for getLabelProps

@@ -991,10 +1014,11 @@ this.getLabelProps.called = false;

this.getInputProps.called = false;
var uiDescriptor = children && children(this.getControllerStateAndHelpers());
if (!uiDescriptor) {
return null;
}
// doing React.Children.only for Preact support ⚛️
var element = preact__default.Children.only(children(this.getControllerStateAndHelpers()));
if (!element) {
// returned null or something...
var element = preact__default.Children.only(uiDescriptor);
if (this.getRootProps.called) {
validateGetRootPropsCalledCorrectly(element, this.getRootProps);
return element;
} else if (this.getRootProps.called) {
// we assumed they applied the root props correctly
return element;
} else if (typeof element.type === 'string') {

@@ -1015,3 +1039,3 @@ // they didn't apply the root props, but we can clone

Autocomplete.propTypes = {
children: PropTypes.func.isRequired,
children: PropTypes.func,
defaultHighlightedIndex: PropTypes.number,

@@ -1023,3 +1047,3 @@ defaultSelectedItem: PropTypes.any,

itemToString: PropTypes.func,
onChange: PropTypes.func.isRequired,
onChange: PropTypes.func,
onStateChange: PropTypes.func,

@@ -1042,9 +1066,9 @@ onClick: PropTypes.func,

// eslint-disable-next-line complexity
getA11yStatusMessage: function getA11yStatusMessage(_ref8) {
var isOpen = _ref8.isOpen,
highlightedItem = _ref8.highlightedItem,
selectedItem = _ref8.selectedItem,
resultCount = _ref8.resultCount,
previousResultCount = _ref8.previousResultCount,
itemToString = _ref8.itemToString;
getA11yStatusMessage: function getA11yStatusMessage(_ref9) {
var isOpen = _ref9.isOpen,
highlightedItem = _ref9.highlightedItem,
selectedItem = _ref9.selectedItem,
resultCount = _ref9.resultCount,
previousResultCount = _ref9.previousResultCount,
itemToString = _ref9.itemToString;

@@ -1075,2 +1099,21 @@ if (!isOpen) {

function validateGetRootPropsCalledCorrectly(element, _ref8) {
var refKey = _ref8.refKey;
var refKeySpecified = refKey !== 'ref';
var isComposite = typeof element.type !== 'string';
if (isComposite && !refKeySpecified) {
throw new Error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
} else if (!isComposite && refKeySpecified) {
throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + refKey + '"');
}
if (!element.props.hasOwnProperty(refKey)) {
throw new Error('downshift: You must apply the ref prop "' + refKey + '" from getRootProps onto your root element.');
}
if (!element.props.hasOwnProperty('onClick')) {
throw new Error('downshift: You must apply the "onClick" prop from getRootProps onto your root element.');
}
}
return Autocomplete;

@@ -1077,0 +1120,0 @@

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("preact")):"function"==typeof define&&define.amd?define(["preact"],t):e.downshift=t(e.preact)}(this,function(e){"use strict";function t(){}function n(e){var t=k[k.length-1]===e;k=t?[].concat(w(k),[e]):[e],i().innerHTML=""+k.filter(Boolean).map(o).join("")}function o(e,t){return'<div style="display:'+(t===k.length-1?"block":"none")+';">'+e+"</div>"}function i(){return C||((C=document.createElement("div")).setAttribute("id","a11y-status-message"),C.setAttribute("role","status"),C.setAttribute("aria-live","assertive"),C.setAttribute("aria-relevant","additions text"),Object.assign(C.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(C),C)}function r(e){return"function"==typeof e?e:u}function u(){}function l(e,t){return null!==e&&e!==t?e.scrollHeight>e.clientHeight?e:l(e.parentNode):null}function a(e,t,n){var o=l(e,t);if(null!==o){var i=getComputedStyle(o),r=o.getBoundingClientRect(),u=parseInt(i.borderTopWidth,10),a=r.top+u,s=e.getBoundingClientRect(),d=s.top+o.scrollTop-a;n||d<o.scrollTop?o.scrollTop=d:d+s.height>o.scrollTop+r.height&&(o.scrollTop=d+s.height-r.height)}}function s(e,t){var n=void 0;return function(){for(var o=arguments.length,i=Array(o),r=0;r<o;r++)i[r]=arguments[r];n&&clearTimeout(n),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}}function d(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.defaultPrevented})}}function c(e){return e+"-"+O++}function h(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.find(function(e){return void 0!==e})}function p(e){return e===e&&"number"==typeof e}var g=e.default;g.Children={only:function(e){return e&&e[0]}},t.isRequired=t;var f={element:t,func:t,number:t,any:t,bool:t,string:t},m=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},I=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),y=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},b=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},S=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},x=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},w=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},C="undefined"==typeof document?null:document.getElementById("a11y-status-message"),k=[],O=1,P=function(e){function t(){var e;m(this,t);for(var o=arguments.length,i=Array(o),u=0;u<o;u++)i[u]=arguments[u];var l=x(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return l.input=null,l.items=[],l.previousResultCount=0,l.getItemFromIndex=function(e){return l.items&&l.items[0]?l.items[e]:null},l.getIndexFromItem=function(e){var t=l.items.findIndex(function(t){return t===e});return-1===t?null:t},l.getItemNodeFromIndex=function(e){return document.getElementById(l.getItemId(e))},l.setHighlightedIndex=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.props.defaultHighlightedIndex;l.internalSetState({highlightedIndex:e},function(){l.maybeScrollToHighlightedElement(e)})},l.highlightSelectedItem=function(){var e=l.getIndexFromItem(l.getState().selectedItem)||0;l.internalSetState({highlightedIndex:e},function(){l.maybeScrollToHighlightedElement(e,!0)})},l.highlightIndex=function(e){l.openMenu(function(){l.setHighlightedIndex(e)})},l.moveHighlightedIndex=function(e){l.getState().isOpen?l.changeHighlighedIndex(e):l.highlightIndex()},l.changeHighlighedIndex=function(e){var t=l.items.length-1;if(!(t<0)){var n=l.getState().highlightedIndex;null===n&&(n=e>0?-1:t+1);var o=n+e;o<0?o=t:o>t&&(o=0),l.setHighlightedIndex(o)}},l.clearSelection=function(){l.internalSetState({selectedItem:null,inputValue:"",isOpen:!1},function(){var e=document.getElementById(l.inputId);e&&e.focus&&e.focus()})},l.selectItem=function(e){l.reset(),l.internalSetState({selectedItem:e,inputValue:l.props.itemToString(e)})},l.selectItemAtIndex=function(e){if(null!==e){var t=l.getItemFromIndex(e);t&&l.selectItem(t)}},l.selectHighlightedItem=function(){return l.selectItemAtIndex(l.getState().highlightedIndex)},l.rootRef=function(e){return l._rootNode=e},l.getRootProps=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.refKey,o=void 0===n?"ref":n,i=t.onClick,r=S(t,["refKey","onClick"]);return l.getRootProps.called=!0,v((e={},y(e,o,l.rootRef),y(e,"onClick",d(i,l.root_handleClick)),e),r)},l.root_handleClick=function(e){e.preventDefault();var t=e.target;if(t){var n=l.getItemIndexFromId(t.getAttribute("id"));p(n)&&l.selectItemAtIndex(n)}},l.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t)},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t)},Enter:function(e){e.preventDefault(),this.getState().isOpen&&this.selectHighlightedItem()},Escape:function(e){e.preventDefault(),this.reset()}},l.buttonKeyDownHandlers=v({},l.keyDownHandlers,{" ":function(e){e.preventDefault();var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;n?null===o?this.closeMenu():this.selectHighlightedItem():this.openMenu()}}),l.getButtonProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onClick,n=e.onKeyDown,o=S(e,["onClick","onKeyDown"]),i=l.getState().isOpen;return v({role:"button","aria-label":i?"close menu":"open menu","aria-expanded":i,"aria-haspopup":!0,onClick:d(t,l.button_handleClick),onKeyDown:d(n,l.button_handleKeyDown)},o)},l.button_handleKeyDown=function(e){l.buttonKeyDownHandlers[e.key]&&l.buttonKeyDownHandlers[e.key].call(l,e)},l.button_handleClick=function(e){e.preventDefault(),l.toggleMenu()},l.getLabelProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(l.getLabelProps.called=!0,l.getInputProps.called&&e.htmlFor&&e.htmlFor!==l.inputId)throw new Error('downshift: You provided the htmlFor of "'+e.htmlFor+'" for your label, but the id of your input is "'+l.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');return l.inputId=h(l.inputId,e.htmlFor,c("downshift-input")),v({},e,{htmlFor:l.inputId})},l.getInputProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onChange,n=e.onKeyDown,o=e.onBlur,i=S(e,["onChange","onKeyDown","onBlur"]);if(l.getInputProps.called=!0,l.getLabelProps.called&&i.id&&i.id!==l.inputId)throw new Error('downshift: You provided the id of "'+i.id+'" for your input, but the htmlFor of your label is "'+l.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');l.inputId=h(l.inputId,i.id,c("downshift-input"));var r=l.getState(),u=r.inputValue,a=r.isOpen,s=r.highlightedIndex;return v({role:"combobox","aria-autocomplete":"list","aria-expanded":a,"aria-activedescendant":"number"==typeof s&&s>=0?l.getItemId(s):null,autoComplete:"off",value:u,onChange:d(t,l.input_handleChange),onKeyDown:d(n,l.input_handleKeyDown),onBlur:d(o,l.input_handleBlur)},i,{id:l.inputId})},l.input_handleKeyDown=function(e){e.key&&l.keyDownHandlers[e.key]?l.keyDownHandlers[e.key].call(l,e):["Shift","Meta","Alt","Control"].includes(e.key)||l.openMenu()},l.input_handleChange=function(e){l.internalSetState({inputValue:e.target.value})},l.input_handleBlur=function(){l.isMouseDown||l.reset()},l.getItemProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onMouseEnter,n=e.item,o=e.index,i=S(e,["onMouseEnter","item","index"]);return l.items[o]=n,v({id:l.getItemId(o),onMouseEnter:d(t,function(){l.setHighlightedIndex(o)})},i)},l.reset=function(e){l.internalSetState(function(t){var n=t.selectedItem;return{type:e,isOpen:!1,highlightedIndex:null,inputValue:l.props.itemToString(n)}})},l.toggleMenu=function(e,t){l.internalSetState(function(t){var n=!t.isOpen;return"boolean"==typeof e&&(n=e),{isOpen:n}},function(){l.getState().isOpen&&l.setHighlightedIndex(),r(t)()})},l.openMenu=function(e){l.toggleMenu(!0,e)},l.closeMenu=function(e){l.toggleMenu(!1,e)},l.updateStatus=s(function(){if(l._isMounted){var e=l.getState(),t=l.getItemFromIndex(e.highlightedIndex)||{},o=l.items.length,i=l.props.getA11yStatusMessage(v({itemToString:l.props.itemToString,previousResultCount:l.previousResultCount,resultCount:o,highlightedItem:t},e));l.previousResultCount=o,n(i)}},200),l.id=c("downshift"),l.state={highlightedIndex:l.props.defaultHighlightedIndex,inputValue:l.props.defaultInputValue,isOpen:l.props.defaultIsOpen,selectedItem:l.props.defaultSelectedItem},l.root_handleClick=d(l.props.onClick,l.root_handleClick),l}return b(t,e),I(t,[{key:"getState",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return Object.keys(t).reduce(function(t,n){return t[n]=void 0===e.props[n]?e.state[n]:e.props[n],t},{})}},{key:"maybeScrollToHighlightedElement",value:function(e,t){a(this.getItemNodeFromIndex(e),this._rootNode,t)}},{key:"internalSetState",value:function(e,t){var n=this,o={},i=void 0;return this.setState(function(t){t=n.getState(t);var r={};return(i="function"==typeof e?e(t):e).hasOwnProperty("selectedItem")&&(o.selectedItem=i.selectedItem,o.previousItem=t.selectedItem),Object.keys(i).forEach(function(e){"type"!==e&&(n.props.hasOwnProperty(e)||(r[e]=i[e]))}),r},function(){r(t)(),n.props.onStateChange(i),Object.keys(o).length&&n.props.onChange(o)})}},{key:"getControllerStateAndHelpers",value:function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,i=e.isOpen;return{getRootProps:this.getRootProps,getButtonProps:this.getButtonProps,getLabelProps:this.getLabelProps,getInputProps:this.getInputProps,getItemProps:this.getItemProps,openMenu:this.openMenu,closeMenu:this.closeMenu,toggleMenu:this.toggleMenu,selectItem:this.selectItem,selectItemAtIndex:this.selectItemAtIndex,selectHighlightedItem:this.selectHighlightedItem,setHighlightedIndex:this.setHighlightedIndex,clearSelection:this.clearSelection,highlightedIndex:t,inputValue:n,isOpen:i,selectedItem:o}}},{key:"getItemId",value:function(e){return this.id+"-item-"+e}},{key:"getItemIndexFromId",value:function(e){return e?Number(e.split(this.id+"-item-")[1]):null}},{key:"componentDidMount",value:function(){var e=this;this._isMounted=!0;var n=function(){e.isMouseDown=!0},o=function(n){e.isMouseDown=!1;var o=n.target;e._rootNode.contains(o)||e.reset(t.stateChangeTypes.mouseUp)};document.body.addEventListener("mousedown",n),document.body.addEventListener("mouseup",o),this.cleanup=function(){e._isMounted=!1,document.body.removeEventListener("mousedown",n),document.body.removeEventListener("mouseup",o)}}},{key:"componentDidUpdate",value:function(){this.updateStatus()}},{key:"componentWillUnmount",value:function(){this.cleanup()}},{key:"render",value:function(){var e=this.props.children;this.items=[],this.getRootProps.called=!1,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=g.Children.only(e(this.getControllerStateAndHelpers()));if(t){if(this.getRootProps.called)return t;if("string"==typeof t.type)return g.cloneElement(t,this.getRootProps(t.props));throw new Error("downshift: If you return a non-DOM element, you must use apply the getRootProps function")}return t}}]),t}(e.Component);return P.propTypes={children:f.func.isRequired,defaultHighlightedIndex:f.number,defaultSelectedItem:f.any,defaultInputValue:f.string,defaultIsOpen:f.bool,getA11yStatusMessage:f.func,itemToString:f.func,onChange:f.func.isRequired,onStateChange:f.func,onClick:f.func,selectedItem:f.any,isOpen:f.bool,inputValue:f.string,highlightedIndex:f.number},P.defaultProps={defaultHighlightedIndex:null,defaultSelectedItem:null,defaultInputValue:"",defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,i=e.resultCount,r=e.previousResultCount,u=e.itemToString;if(!t)return o?u(o):"";var l=i!==r;return i?!n||l?i+" "+(1===i?"result is":"results are")+" available, use up and down arrow keys to navigate.":u(n):"No results."},itemToString:function(e){return null==e?"":String(e)},onStateChange:function(){}},P.stateChangeTypes={mouseUp:"__autocomplete_mouseup__"},P});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("preact")):"function"==typeof define&&define.amd?define(["preact"],t):e.downshift=t(e.preact)}(this,function(e){"use strict";function t(){}function n(e){var t=k[k.length-1]===e;k=t?[].concat(P(k),[e]):[e],r().innerHTML=""+k.filter(Boolean).map(o).join("")}function o(e,t){return'<div style="display:'+(t===k.length-1?"block":"none")+';">'+e+"</div>"}function r(){return O||((O=document.createElement("div")).setAttribute("id","a11y-status-message"),O.setAttribute("role","status"),O.setAttribute("aria-live","assertive"),O.setAttribute("aria-relevant","additions text"),Object.assign(O.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(O),O)}function i(e){return"function"==typeof e?e:u}function u(){}function l(e,t){return null!==e&&e!==t?e.scrollHeight>e.clientHeight?e:l(e.parentNode):null}function s(e,t,n){var o=l(e,t);if(null!==o){var r=getComputedStyle(o),i=o.getBoundingClientRect(),u=parseInt(r.borderTopWidth,10),s=i.top+u,a=e.getBoundingClientRect(),d=a.top+o.scrollTop-s;n||d<o.scrollTop?o.scrollTop=d:d+a.height>o.scrollTop+i.height&&(o.scrollTop=d+a.height-i.height)}}function a(e,t){var n=void 0;return function(){for(var o=arguments.length,r=Array(o),i=0;i<o;i++)r[i]=arguments[i];n&&clearTimeout(n),n=setTimeout(function(){n=null,e.apply(void 0,r)},t)}}function d(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.defaultPrevented})}}function h(e){return e+"-"+H++}function p(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.find(function(e){return void 0!==e})}function c(e){return e===e&&"number"==typeof e}function f(e,t){return Object.keys(t).every(function(n){return e[n]===t[n]})}function g(e,t){var n=t.refKey,o="ref"!==n,r="string"!=typeof e.type;if(r&&!o)throw new Error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps");if(!r&&o)throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"');if(!e.props.hasOwnProperty(n))throw new Error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.');if(!e.props.hasOwnProperty("onClick"))throw new Error('downshift: You must apply the "onClick" prop from getRootProps onto your root element.')}var m=e.default;m.Children={only:function(e){return e&&e[0]}},t.isRequired=t;var y={element:t,func:t,number:t,any:t,bool:t,string:t},I=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},v=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),b=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},S=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},x=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},C=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},P=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},O="undefined"==typeof document?null:document.getElementById("a11y-status-message"),k=[],H=1,M=function(e){function t(){var e;I(this,t);for(var o=arguments.length,r=Array(o),u=0;u<o;u++)r[u]=arguments[u];var l=C(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return l.input=null,l.items=[],l.previousResultCount=0,l.getItemFromIndex=function(e){return l.items&&l.items[0]?l.items[e]:null},l.getIndexFromItem=function(e){var t=l.items.findIndex(function(t){return t===e});return-1===t?null:t},l.getItemNodeFromIndex=function(e){return document.getElementById(l.getItemId(e))},l.setHighlightedIndex=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.props.defaultHighlightedIndex;l.internalSetState({highlightedIndex:e},function(){l.maybeScrollToHighlightedElement(e)})},l.highlightSelectedItem=function(){var e=l.getIndexFromItem(l.getState().selectedItem)||0;l.internalSetState({highlightedIndex:e},function(){l.maybeScrollToHighlightedElement(e,!0)})},l.highlightIndex=function(e){l.openMenu(function(){l.setHighlightedIndex(e)})},l.moveHighlightedIndex=function(e){l.getState().isOpen?l.changeHighlighedIndex(e):l.highlightIndex()},l.changeHighlighedIndex=function(e){var t=l.items.length-1;if(!(t<0)){var n=l.getState().highlightedIndex;null===n&&(n=e>0?-1:t+1);var o=n+e;o<0?o=t:o>t&&(o=0),l.setHighlightedIndex(o)}},l.clearSelection=function(){l.internalSetState({selectedItem:null,inputValue:"",isOpen:!1},function(){var e=document.getElementById(l.inputId);e&&e.focus&&e.focus()})},l.selectItem=function(e){l.reset(),l.internalSetState({selectedItem:e,inputValue:l.props.itemToString(e)})},l.selectItemAtIndex=function(e){if(null!==e){var t=l.getItemFromIndex(e);t&&l.selectItem(t)}},l.selectHighlightedItem=function(){return l.selectItemAtIndex(l.getState().highlightedIndex)},l.rootRef=function(e){return l._rootNode=e},l.getRootProps=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.refKey,o=void 0===n?"ref":n,r=t.onClick,i=x(t,["refKey","onClick"]);return l.getRootProps.called=!0,l.getRootProps.refKey=o,w((e={},b(e,o,l.rootRef),b(e,"onClick",d(r,l.root_handleClick)),e),i)},l.root_handleClick=function(e){e.preventDefault();var t=e.target;if(t){var n=l.getItemIndexFromId(t.getAttribute("id"));c(n)&&l.selectItemAtIndex(n)}},l.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t)},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t)},Enter:function(e){e.preventDefault(),this.getState().isOpen&&this.selectHighlightedItem()},Escape:function(e){e.preventDefault(),this.reset()}},l.buttonKeyDownHandlers=w({},l.keyDownHandlers,{" ":function(e){e.preventDefault();var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;n?null===o?this.closeMenu():this.selectHighlightedItem():this.openMenu()}}),l.getButtonProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onClick,n=e.onKeyDown,o=x(e,["onClick","onKeyDown"]),r=l.getState().isOpen;return w({role:"button","aria-label":r?"close menu":"open menu","aria-expanded":r,"aria-haspopup":!0,onClick:d(t,l.button_handleClick),onKeyDown:d(n,l.button_handleKeyDown)},o)},l.button_handleKeyDown=function(e){l.buttonKeyDownHandlers[e.key]&&l.buttonKeyDownHandlers[e.key].call(l,e)},l.button_handleClick=function(e){e.preventDefault(),l.toggleMenu()},l.getLabelProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(l.getLabelProps.called=!0,l.getInputProps.called&&e.htmlFor&&e.htmlFor!==l.inputId)throw new Error('downshift: You provided the htmlFor of "'+e.htmlFor+'" for your label, but the id of your input is "'+l.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');return l.inputId=p(l.inputId,e.htmlFor,h("downshift-input")),w({},e,{htmlFor:l.inputId})},l.getInputProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onChange,n=e.onKeyDown,o=e.onBlur,r=x(e,["onChange","onKeyDown","onBlur"]);if(l.getInputProps.called=!0,l.getLabelProps.called&&r.id&&r.id!==l.inputId)throw new Error('downshift: You provided the id of "'+r.id+'" for your input, but the htmlFor of your label is "'+l.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');l.inputId=p(l.inputId,r.id,h("downshift-input"));var i=l.getState(),u=i.inputValue,s=i.isOpen,a=i.highlightedIndex;return w({role:"combobox","aria-autocomplete":"list","aria-expanded":s,"aria-activedescendant":"number"==typeof a&&a>=0?l.getItemId(a):null,autoComplete:"off",value:u,onChange:d(t,l.input_handleChange),onKeyDown:d(n,l.input_handleKeyDown),onBlur:d(o,l.input_handleBlur)},r,{id:l.inputId})},l.input_handleKeyDown=function(e){e.key&&l.keyDownHandlers[e.key]?l.keyDownHandlers[e.key].call(l,e):["Shift","Meta","Alt","Control"].includes(e.key)||l.openMenu()},l.input_handleChange=function(e){l.internalSetState({inputValue:e.target.value})},l.input_handleBlur=function(){l.isMouseDown||l.reset()},l.getItemProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onMouseEnter,n=e.item,o=e.index,r=x(e,["onMouseEnter","item","index"]);return l.items[o]=n,w({id:l.getItemId(o),onMouseEnter:d(t,function(){l.setHighlightedIndex(o)})},r)},l.reset=function(e){l.internalSetState(function(t){var n=t.selectedItem;return{type:e,isOpen:!1,highlightedIndex:null,inputValue:l.props.itemToString(n)}})},l.toggleMenu=function(e,t){l.internalSetState(function(t){var n=!t.isOpen;return"boolean"==typeof e&&(n=e),{isOpen:n}},function(){l.getState().isOpen&&l.setHighlightedIndex(),i(t)()})},l.openMenu=function(e){l.toggleMenu(!0,e)},l.closeMenu=function(e){l.toggleMenu(!1,e)},l.updateStatus=a(function(){if(l._isMounted){var e=l.getState(),t=l.getItemFromIndex(e.highlightedIndex)||{},o=l.items.length,r=l.props.getA11yStatusMessage(w({itemToString:l.props.itemToString,previousResultCount:l.previousResultCount,resultCount:o,highlightedItem:t},e));l.previousResultCount=o,n(r)}},200),l.id=h("downshift"),l.state={highlightedIndex:l.props.defaultHighlightedIndex,inputValue:l.props.defaultInputValue,isOpen:l.props.defaultIsOpen,selectedItem:l.props.defaultSelectedItem},l.root_handleClick=d(l.props.onClick,l.root_handleClick),l}return S(t,e),v(t,[{key:"getState",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return Object.keys(t).reduce(function(t,n){return t[n]=void 0===e.props[n]?e.state[n]:e.props[n],t},{})}},{key:"maybeScrollToHighlightedElement",value:function(e,t){s(this.getItemNodeFromIndex(e),this._rootNode,t)}},{key:"internalSetState",value:function(e,t){var n=this,o={},r=void 0,u=void 0;return this.setState(function(t){t=n.getState(t);var i={},l={};return(r="function"==typeof e?e(t):e).hasOwnProperty("selectedItem")&&(o.selectedItem=r.selectedItem,o.previousItem=t.selectedItem),Object.keys(r).forEach(function(e){"type"!==e&&(l[e]=r[e],n.props.hasOwnProperty(e)||(i[e]=r[e]))}),u=!f(t,l),i},function(){i(t)(),u&&n.props.onStateChange(r),Object.keys(o).length&&n.props.onChange(o)})}},{key:"getControllerStateAndHelpers",value:function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,r=e.isOpen;return{getRootProps:this.getRootProps,getButtonProps:this.getButtonProps,getLabelProps:this.getLabelProps,getInputProps:this.getInputProps,getItemProps:this.getItemProps,openMenu:this.openMenu,closeMenu:this.closeMenu,toggleMenu:this.toggleMenu,selectItem:this.selectItem,selectItemAtIndex:this.selectItemAtIndex,selectHighlightedItem:this.selectHighlightedItem,setHighlightedIndex:this.setHighlightedIndex,clearSelection:this.clearSelection,highlightedIndex:t,inputValue:n,isOpen:r,selectedItem:o}}},{key:"getItemId",value:function(e){return this.id+"-item-"+e}},{key:"getItemIndexFromId",value:function(e){return e?Number(e.split(this.id+"-item-")[1]):null}},{key:"componentDidMount",value:function(){var e=this;this._isMounted=!0;var n=function(){e.isMouseDown=!0},o=function(n){e.isMouseDown=!1,e._rootNode.contains(n.target)||e.reset(t.stateChangeTypes.mouseUp)};document.body.addEventListener("mousedown",n),document.body.addEventListener("mouseup",o),this.cleanup=function(){e._isMounted=!1,document.body.removeEventListener("mousedown",n),document.body.removeEventListener("mouseup",o)}}},{key:"componentDidUpdate",value:function(){this.updateStatus()}},{key:"componentWillUnmount",value:function(){this.cleanup()}},{key:"render",value:function(){var e=this.props.children;this.items=[],this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=e&&e(this.getControllerStateAndHelpers());if(!t)return null;var n=m.Children.only(t);if(this.getRootProps.called)return g(n,this.getRootProps),n;if("string"==typeof n.type)return m.cloneElement(n,this.getRootProps(n.props));throw new Error("downshift: If you return a non-DOM element, you must use apply the getRootProps function")}}]),t}(e.Component);return M.propTypes={children:y.func,defaultHighlightedIndex:y.number,defaultSelectedItem:y.any,defaultInputValue:y.string,defaultIsOpen:y.bool,getA11yStatusMessage:y.func,itemToString:y.func,onChange:y.func,onStateChange:y.func,onClick:y.func,selectedItem:y.any,isOpen:y.bool,inputValue:y.string,highlightedIndex:y.number},M.defaultProps={defaultHighlightedIndex:null,defaultSelectedItem:null,defaultInputValue:"",defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,r=e.resultCount,i=e.previousResultCount,u=e.itemToString;if(!t)return o?u(o):"";var l=r!==i;return r?!n||l?r+" "+(1===r?"result is":"results are")+" available, use up and down arrow keys to navigate.":u(n):"No results."},itemToString:function(e){return null==e?"":String(e)},onStateChange:function(){}},M.stateChangeTypes={mouseUp:"__autocomplete_mouseup__"},M});
//# sourceMappingURL=downshift.preact.umd.min.js.map

@@ -329,2 +329,17 @@ (function (global, factory) {

/**
* Determines whether the two given objects have shallow
* equality with respect to the keys given in obj2.
* In other words, every value in obj2 is equal to the
* value of the same key in obj1.
* @param {Object} obj1 the first
* @param {Object} obj2 the second
* @return {Boolean} whether they are shallowly equal
*/
function containsSubset(obj1, obj2) {
return Object.keys(obj2).every(function (key) {
return obj1[key] === obj2[key];
});
}
/* eslint camelcase:0 */

@@ -471,2 +486,3 @@

_this.getRootProps.called = true;
_this.getRootProps.refKey = refKey;
return _extends((_babelHelpers$extends = {}, defineProperty(_babelHelpers$extends, refKey, _this.rootRef), defineProperty(_babelHelpers$extends, 'onClick', composeEventHandlers(onClick, _this.root_handleClick)), _babelHelpers$extends), rest);

@@ -771,7 +787,11 @@ };

var onChangeArg = {};
var onStateChangeArg = void 0;
var onStateChangeArg = void 0,
stateChanged = void 0;
return this.setState(function (state) {
state = _this3.getState(state);
onStateChangeArg = typeof stateToSet === 'function' ? stateToSet(state) : stateToSet;
// this keeps track of the object we want to call with setState
var nextState = {};
// this is just used to tell whether the state changed
var nextFullState = {};
// we need to call on change if the outside world is controlling any of our state

@@ -794,2 +814,3 @@ // and we're trying to update that state. OR if the selection has changed and we're

}
nextFullState[key] = onStateChangeArg[key];
// if it's coming from props, then we don't want to set it internally

@@ -800,2 +821,3 @@ if (!_this3.props.hasOwnProperty(key)) {

});
stateChanged = !containsSubset(state, nextFullState);
return nextState;

@@ -805,10 +827,12 @@ }, function () {

cbToCb(cb)();
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
// if the selectedItem changed
// then let's call onChange!
if (stateChanged) {
// We call this function whether we're controlled or not
// It's mostly useful if we're controlled, but it can
// definitely be useful for folks to know when something
// happens internally.
_this3.props.onStateChange(onStateChangeArg);
}
if (Object.keys(onChangeArg).length) {
// if the selectedItem changed
// then let's call onChange!
_this3.props.onChange(onChangeArg);

@@ -919,5 +943,3 @@ }

_this4.isMouseDown = false;
var target = event.target;
if (!_this4._rootNode.contains(target)) {
if (!_this4._rootNode.contains(event.target)) {
_this4.reset(Autocomplete.stateChangeTypes.mouseUp);

@@ -958,2 +980,3 @@ }

this.getRootProps.called = false;
this.getRootProps.refKey = undefined;
// we do something similar for getLabelProps

@@ -963,10 +986,11 @@ this.getLabelProps.called = false;

this.getInputProps.called = false;
var uiDescriptor = children && children(this.getControllerStateAndHelpers());
if (!uiDescriptor) {
return null;
}
// doing React.Children.only for Preact support ⚛️
var element = React__default.Children.only(children(this.getControllerStateAndHelpers()));
if (!element) {
// returned null or something...
var element = React__default.Children.only(uiDescriptor);
if (this.getRootProps.called) {
validateGetRootPropsCalledCorrectly(element, this.getRootProps);
return element;
} else if (this.getRootProps.called) {
// we assumed they applied the root props correctly
return element;
} else if (typeof element.type === 'string') {

@@ -987,3 +1011,3 @@ // they didn't apply the root props, but we can clone

Autocomplete.propTypes = {
children: PropTypes.func.isRequired,
children: PropTypes.func,
defaultHighlightedIndex: PropTypes.number,

@@ -995,3 +1019,3 @@ defaultSelectedItem: PropTypes.any,

itemToString: PropTypes.func,
onChange: PropTypes.func.isRequired,
onChange: PropTypes.func,
onStateChange: PropTypes.func,

@@ -1014,9 +1038,9 @@ onClick: PropTypes.func,

// eslint-disable-next-line complexity
getA11yStatusMessage: function getA11yStatusMessage(_ref8) {
var isOpen = _ref8.isOpen,
highlightedItem = _ref8.highlightedItem,
selectedItem = _ref8.selectedItem,
resultCount = _ref8.resultCount,
previousResultCount = _ref8.previousResultCount,
itemToString = _ref8.itemToString;
getA11yStatusMessage: function getA11yStatusMessage(_ref9) {
var isOpen = _ref9.isOpen,
highlightedItem = _ref9.highlightedItem,
selectedItem = _ref9.selectedItem,
resultCount = _ref9.resultCount,
previousResultCount = _ref9.previousResultCount,
itemToString = _ref9.itemToString;

@@ -1047,2 +1071,21 @@ if (!isOpen) {

function validateGetRootPropsCalledCorrectly(element, _ref8) {
var refKey = _ref8.refKey;
var refKeySpecified = refKey !== 'ref';
var isComposite = typeof element.type !== 'string';
if (isComposite && !refKeySpecified) {
throw new Error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
} else if (!isComposite && refKeySpecified) {
throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + refKey + '"');
}
if (!element.props.hasOwnProperty(refKey)) {
throw new Error('downshift: You must apply the ref prop "' + refKey + '" from getRootProps onto your root element.');
}
if (!element.props.hasOwnProperty('onClick')) {
throw new Error('downshift: You must apply the "onClick" prop from getRootProps onto your root element.');
}
}
return Autocomplete;

@@ -1049,0 +1092,0 @@

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):e.downshift=t(e.React,e.PropTypes)}(this,function(e,t){"use strict";function n(e){var t=C[C.length-1]===e;C=t?[].concat(x(C),[e]):[e],i().innerHTML=""+C.filter(Boolean).map(o).join("")}function o(e,t){return'<div style="display:'+(t===C.length-1?"block":"none")+';">'+e+"</div>"}function i(){return w||((w=document.createElement("div")).setAttribute("id","a11y-status-message"),w.setAttribute("role","status"),w.setAttribute("aria-live","assertive"),w.setAttribute("aria-relevant","additions text"),Object.assign(w.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(w),w)}function r(e){return"function"==typeof e?e:u}function u(){}function l(e,t){return null!==e&&e!==t?e.scrollHeight>e.clientHeight?e:l(e.parentNode):null}function a(e,t,n){var o=l(e,t);if(null!==o){var i=getComputedStyle(o),r=o.getBoundingClientRect(),u=parseInt(i.borderTopWidth,10),a=r.top+u,s=e.getBoundingClientRect(),d=s.top+o.scrollTop-a;n||d<o.scrollTop?o.scrollTop=d:d+s.height>o.scrollTop+r.height&&(o.scrollTop=d+s.height-r.height)}}function s(e,t){var n=void 0;return function(){for(var o=arguments.length,i=Array(o),r=0;r<o;r++)i[r]=arguments[r];n&&clearTimeout(n),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}}function d(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.defaultPrevented})}}function h(e){return e+"-"+O++}function c(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.find(function(e){return void 0!==e})}function p(e){return e===e&&"number"==typeof e}var g="default"in e?e.default:e;t=t&&t.hasOwnProperty("default")?t.default:t;var f=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),I=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},b=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},S=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},x=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},w="undefined"==typeof document?null:document.getElementById("a11y-status-message"),C=[],O=1,k=function(e){function t(){var e;f(this,t);for(var o=arguments.length,i=Array(o),u=0;u<o;u++)i[u]=arguments[u];var l=S(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return l.input=null,l.items=[],l.previousResultCount=0,l.getItemFromIndex=function(e){return l.items&&l.items[0]?l.items[e]:null},l.getIndexFromItem=function(e){var t=l.items.findIndex(function(t){return t===e});return-1===t?null:t},l.getItemNodeFromIndex=function(e){return document.getElementById(l.getItemId(e))},l.setHighlightedIndex=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.props.defaultHighlightedIndex;l.internalSetState({highlightedIndex:e},function(){l.maybeScrollToHighlightedElement(e)})},l.highlightSelectedItem=function(){var e=l.getIndexFromItem(l.getState().selectedItem)||0;l.internalSetState({highlightedIndex:e},function(){l.maybeScrollToHighlightedElement(e,!0)})},l.highlightIndex=function(e){l.openMenu(function(){l.setHighlightedIndex(e)})},l.moveHighlightedIndex=function(e){l.getState().isOpen?l.changeHighlighedIndex(e):l.highlightIndex()},l.changeHighlighedIndex=function(e){var t=l.items.length-1;if(!(t<0)){var n=l.getState().highlightedIndex;null===n&&(n=e>0?-1:t+1);var o=n+e;o<0?o=t:o>t&&(o=0),l.setHighlightedIndex(o)}},l.clearSelection=function(){l.internalSetState({selectedItem:null,inputValue:"",isOpen:!1},function(){var e=document.getElementById(l.inputId);e&&e.focus&&e.focus()})},l.selectItem=function(e){l.reset(),l.internalSetState({selectedItem:e,inputValue:l.props.itemToString(e)})},l.selectItemAtIndex=function(e){if(null!==e){var t=l.getItemFromIndex(e);t&&l.selectItem(t)}},l.selectHighlightedItem=function(){return l.selectItemAtIndex(l.getState().highlightedIndex)},l.rootRef=function(e){return l._rootNode=e},l.getRootProps=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.refKey,o=void 0===n?"ref":n,i=t.onClick,r=b(t,["refKey","onClick"]);return l.getRootProps.called=!0,y((e={},I(e,o,l.rootRef),I(e,"onClick",d(i,l.root_handleClick)),e),r)},l.root_handleClick=function(e){e.preventDefault();var t=e.target;if(t){var n=l.getItemIndexFromId(t.getAttribute("id"));p(n)&&l.selectItemAtIndex(n)}},l.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t)},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t)},Enter:function(e){e.preventDefault(),this.getState().isOpen&&this.selectHighlightedItem()},Escape:function(e){e.preventDefault(),this.reset()}},l.buttonKeyDownHandlers=y({},l.keyDownHandlers,{" ":function(e){e.preventDefault();var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;n?null===o?this.closeMenu():this.selectHighlightedItem():this.openMenu()}}),l.getButtonProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onClick,n=e.onKeyDown,o=b(e,["onClick","onKeyDown"]),i=l.getState().isOpen;return y({role:"button","aria-label":i?"close menu":"open menu","aria-expanded":i,"aria-haspopup":!0,onClick:d(t,l.button_handleClick),onKeyDown:d(n,l.button_handleKeyDown)},o)},l.button_handleKeyDown=function(e){l.buttonKeyDownHandlers[e.key]&&l.buttonKeyDownHandlers[e.key].call(l,e)},l.button_handleClick=function(e){e.preventDefault(),l.toggleMenu()},l.getLabelProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(l.getLabelProps.called=!0,l.getInputProps.called&&e.htmlFor&&e.htmlFor!==l.inputId)throw new Error('downshift: You provided the htmlFor of "'+e.htmlFor+'" for your label, but the id of your input is "'+l.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');return l.inputId=c(l.inputId,e.htmlFor,h("downshift-input")),y({},e,{htmlFor:l.inputId})},l.getInputProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onChange,n=e.onKeyDown,o=e.onBlur,i=b(e,["onChange","onKeyDown","onBlur"]);if(l.getInputProps.called=!0,l.getLabelProps.called&&i.id&&i.id!==l.inputId)throw new Error('downshift: You provided the id of "'+i.id+'" for your input, but the htmlFor of your label is "'+l.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');l.inputId=c(l.inputId,i.id,h("downshift-input"));var r=l.getState(),u=r.inputValue,a=r.isOpen,s=r.highlightedIndex;return y({role:"combobox","aria-autocomplete":"list","aria-expanded":a,"aria-activedescendant":"number"==typeof s&&s>=0?l.getItemId(s):null,autoComplete:"off",value:u,onChange:d(t,l.input_handleChange),onKeyDown:d(n,l.input_handleKeyDown),onBlur:d(o,l.input_handleBlur)},i,{id:l.inputId})},l.input_handleKeyDown=function(e){e.key&&l.keyDownHandlers[e.key]?l.keyDownHandlers[e.key].call(l,e):["Shift","Meta","Alt","Control"].includes(e.key)||l.openMenu()},l.input_handleChange=function(e){l.internalSetState({inputValue:e.target.value})},l.input_handleBlur=function(){l.isMouseDown||l.reset()},l.getItemProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onMouseEnter,n=e.item,o=e.index,i=b(e,["onMouseEnter","item","index"]);return l.items[o]=n,y({id:l.getItemId(o),onMouseEnter:d(t,function(){l.setHighlightedIndex(o)})},i)},l.reset=function(e){l.internalSetState(function(t){var n=t.selectedItem;return{type:e,isOpen:!1,highlightedIndex:null,inputValue:l.props.itemToString(n)}})},l.toggleMenu=function(e,t){l.internalSetState(function(t){var n=!t.isOpen;return"boolean"==typeof e&&(n=e),{isOpen:n}},function(){l.getState().isOpen&&l.setHighlightedIndex(),r(t)()})},l.openMenu=function(e){l.toggleMenu(!0,e)},l.closeMenu=function(e){l.toggleMenu(!1,e)},l.updateStatus=s(function(){if(l._isMounted){var e=l.getState(),t=l.getItemFromIndex(e.highlightedIndex)||{},o=l.items.length,i=l.props.getA11yStatusMessage(y({itemToString:l.props.itemToString,previousResultCount:l.previousResultCount,resultCount:o,highlightedItem:t},e));l.previousResultCount=o,n(i)}},200),l.id=h("downshift"),l.state={highlightedIndex:l.props.defaultHighlightedIndex,inputValue:l.props.defaultInputValue,isOpen:l.props.defaultIsOpen,selectedItem:l.props.defaultSelectedItem},l.root_handleClick=d(l.props.onClick,l.root_handleClick),l}return v(t,e),m(t,[{key:"getState",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return Object.keys(t).reduce(function(t,n){return t[n]=void 0===e.props[n]?e.state[n]:e.props[n],t},{})}},{key:"maybeScrollToHighlightedElement",value:function(e,t){a(this.getItemNodeFromIndex(e),this._rootNode,t)}},{key:"internalSetState",value:function(e,t){var n=this,o={},i=void 0;return this.setState(function(t){t=n.getState(t);var r={};return(i="function"==typeof e?e(t):e).hasOwnProperty("selectedItem")&&(o.selectedItem=i.selectedItem,o.previousItem=t.selectedItem),Object.keys(i).forEach(function(e){"type"!==e&&(n.props.hasOwnProperty(e)||(r[e]=i[e]))}),r},function(){r(t)(),n.props.onStateChange(i),Object.keys(o).length&&n.props.onChange(o)})}},{key:"getControllerStateAndHelpers",value:function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,i=e.isOpen;return{getRootProps:this.getRootProps,getButtonProps:this.getButtonProps,getLabelProps:this.getLabelProps,getInputProps:this.getInputProps,getItemProps:this.getItemProps,openMenu:this.openMenu,closeMenu:this.closeMenu,toggleMenu:this.toggleMenu,selectItem:this.selectItem,selectItemAtIndex:this.selectItemAtIndex,selectHighlightedItem:this.selectHighlightedItem,setHighlightedIndex:this.setHighlightedIndex,clearSelection:this.clearSelection,highlightedIndex:t,inputValue:n,isOpen:i,selectedItem:o}}},{key:"getItemId",value:function(e){return this.id+"-item-"+e}},{key:"getItemIndexFromId",value:function(e){return e?Number(e.split(this.id+"-item-")[1]):null}},{key:"componentDidMount",value:function(){var e=this;this._isMounted=!0;var n=function(){e.isMouseDown=!0},o=function(n){e.isMouseDown=!1;var o=n.target;e._rootNode.contains(o)||e.reset(t.stateChangeTypes.mouseUp)};document.body.addEventListener("mousedown",n),document.body.addEventListener("mouseup",o),this.cleanup=function(){e._isMounted=!1,document.body.removeEventListener("mousedown",n),document.body.removeEventListener("mouseup",o)}}},{key:"componentDidUpdate",value:function(){this.updateStatus()}},{key:"componentWillUnmount",value:function(){this.cleanup()}},{key:"render",value:function(){var e=this.props.children;this.items=[],this.getRootProps.called=!1,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=g.Children.only(e(this.getControllerStateAndHelpers()));if(t){if(this.getRootProps.called)return t;if("string"==typeof t.type)return g.cloneElement(t,this.getRootProps(t.props));throw new Error("downshift: If you return a non-DOM element, you must use apply the getRootProps function")}return t}}]),t}(e.Component);return k.propTypes={children:t.func.isRequired,defaultHighlightedIndex:t.number,defaultSelectedItem:t.any,defaultInputValue:t.string,defaultIsOpen:t.bool,getA11yStatusMessage:t.func,itemToString:t.func,onChange:t.func.isRequired,onStateChange:t.func,onClick:t.func,selectedItem:t.any,isOpen:t.bool,inputValue:t.string,highlightedIndex:t.number},k.defaultProps={defaultHighlightedIndex:null,defaultSelectedItem:null,defaultInputValue:"",defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,i=e.resultCount,r=e.previousResultCount,u=e.itemToString;if(!t)return o?u(o):"";var l=i!==r;return i?!n||l?i+" "+(1===i?"result is":"results are")+" available, use up and down arrow keys to navigate.":u(n):"No results."},itemToString:function(e){return null==e?"":String(e)},onStateChange:function(){}},k.stateChangeTypes={mouseUp:"__autocomplete_mouseup__"},k});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):e.downshift=t(e.React,e.PropTypes)}(this,function(e,t){"use strict";function n(e){var t=O[O.length-1]===e;O=t?[].concat(P(O),[e]):[e],r().innerHTML=""+O.filter(Boolean).map(o).join("")}function o(e,t){return'<div style="display:'+(t===O.length-1?"block":"none")+';">'+e+"</div>"}function r(){return C||((C=document.createElement("div")).setAttribute("id","a11y-status-message"),C.setAttribute("role","status"),C.setAttribute("aria-live","assertive"),C.setAttribute("aria-relevant","additions text"),Object.assign(C.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(C),C)}function i(e){return"function"==typeof e?e:u}function u(){}function l(e,t){return null!==e&&e!==t?e.scrollHeight>e.clientHeight?e:l(e.parentNode):null}function s(e,t,n){var o=l(e,t);if(null!==o){var r=getComputedStyle(o),i=o.getBoundingClientRect(),u=parseInt(r.borderTopWidth,10),s=i.top+u,a=e.getBoundingClientRect(),d=a.top+o.scrollTop-s;n||d<o.scrollTop?o.scrollTop=d:d+a.height>o.scrollTop+i.height&&(o.scrollTop=d+a.height-i.height)}}function a(e,t){var n=void 0;return function(){for(var o=arguments.length,r=Array(o),i=0;i<o;i++)r[i]=arguments[i];n&&clearTimeout(n),n=setTimeout(function(){n=null,e.apply(void 0,r)},t)}}function d(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.defaultPrevented})}}function p(e){return e+"-"+k++}function h(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.find(function(e){return void 0!==e})}function c(e){return e===e&&"number"==typeof e}function f(e,t){return Object.keys(t).every(function(n){return e[n]===t[n]})}function g(e,t){var n=t.refKey,o="ref"!==n,r="string"!=typeof e.type;if(r&&!o)throw new Error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps");if(!r&&o)throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"');if(!e.props.hasOwnProperty(n))throw new Error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.');if(!e.props.hasOwnProperty("onClick"))throw new Error('downshift: You must apply the "onClick" prop from getRootProps onto your root element.')}var m="default"in e?e.default:e;t=t&&t.hasOwnProperty("default")?t.default:t;var y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},I=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),v=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},w=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},S=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},x=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},P=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},C="undefined"==typeof document?null:document.getElementById("a11y-status-message"),O=[],k=1,H=function(e){function t(){var e;y(this,t);for(var o=arguments.length,r=Array(o),u=0;u<o;u++)r[u]=arguments[u];var l=x(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return l.input=null,l.items=[],l.previousResultCount=0,l.getItemFromIndex=function(e){return l.items&&l.items[0]?l.items[e]:null},l.getIndexFromItem=function(e){var t=l.items.findIndex(function(t){return t===e});return-1===t?null:t},l.getItemNodeFromIndex=function(e){return document.getElementById(l.getItemId(e))},l.setHighlightedIndex=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.props.defaultHighlightedIndex;l.internalSetState({highlightedIndex:e},function(){l.maybeScrollToHighlightedElement(e)})},l.highlightSelectedItem=function(){var e=l.getIndexFromItem(l.getState().selectedItem)||0;l.internalSetState({highlightedIndex:e},function(){l.maybeScrollToHighlightedElement(e,!0)})},l.highlightIndex=function(e){l.openMenu(function(){l.setHighlightedIndex(e)})},l.moveHighlightedIndex=function(e){l.getState().isOpen?l.changeHighlighedIndex(e):l.highlightIndex()},l.changeHighlighedIndex=function(e){var t=l.items.length-1;if(!(t<0)){var n=l.getState().highlightedIndex;null===n&&(n=e>0?-1:t+1);var o=n+e;o<0?o=t:o>t&&(o=0),l.setHighlightedIndex(o)}},l.clearSelection=function(){l.internalSetState({selectedItem:null,inputValue:"",isOpen:!1},function(){var e=document.getElementById(l.inputId);e&&e.focus&&e.focus()})},l.selectItem=function(e){l.reset(),l.internalSetState({selectedItem:e,inputValue:l.props.itemToString(e)})},l.selectItemAtIndex=function(e){if(null!==e){var t=l.getItemFromIndex(e);t&&l.selectItem(t)}},l.selectHighlightedItem=function(){return l.selectItemAtIndex(l.getState().highlightedIndex)},l.rootRef=function(e){return l._rootNode=e},l.getRootProps=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.refKey,o=void 0===n?"ref":n,r=t.onClick,i=S(t,["refKey","onClick"]);return l.getRootProps.called=!0,l.getRootProps.refKey=o,b((e={},v(e,o,l.rootRef),v(e,"onClick",d(r,l.root_handleClick)),e),i)},l.root_handleClick=function(e){e.preventDefault();var t=e.target;if(t){var n=l.getItemIndexFromId(t.getAttribute("id"));c(n)&&l.selectItemAtIndex(n)}},l.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t)},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t)},Enter:function(e){e.preventDefault(),this.getState().isOpen&&this.selectHighlightedItem()},Escape:function(e){e.preventDefault(),this.reset()}},l.buttonKeyDownHandlers=b({},l.keyDownHandlers,{" ":function(e){e.preventDefault();var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;n?null===o?this.closeMenu():this.selectHighlightedItem():this.openMenu()}}),l.getButtonProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onClick,n=e.onKeyDown,o=S(e,["onClick","onKeyDown"]),r=l.getState().isOpen;return b({role:"button","aria-label":r?"close menu":"open menu","aria-expanded":r,"aria-haspopup":!0,onClick:d(t,l.button_handleClick),onKeyDown:d(n,l.button_handleKeyDown)},o)},l.button_handleKeyDown=function(e){l.buttonKeyDownHandlers[e.key]&&l.buttonKeyDownHandlers[e.key].call(l,e)},l.button_handleClick=function(e){e.preventDefault(),l.toggleMenu()},l.getLabelProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(l.getLabelProps.called=!0,l.getInputProps.called&&e.htmlFor&&e.htmlFor!==l.inputId)throw new Error('downshift: You provided the htmlFor of "'+e.htmlFor+'" for your label, but the id of your input is "'+l.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');return l.inputId=h(l.inputId,e.htmlFor,p("downshift-input")),b({},e,{htmlFor:l.inputId})},l.getInputProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onChange,n=e.onKeyDown,o=e.onBlur,r=S(e,["onChange","onKeyDown","onBlur"]);if(l.getInputProps.called=!0,l.getLabelProps.called&&r.id&&r.id!==l.inputId)throw new Error('downshift: You provided the id of "'+r.id+'" for your input, but the htmlFor of your label is "'+l.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');l.inputId=h(l.inputId,r.id,p("downshift-input"));var i=l.getState(),u=i.inputValue,s=i.isOpen,a=i.highlightedIndex;return b({role:"combobox","aria-autocomplete":"list","aria-expanded":s,"aria-activedescendant":"number"==typeof a&&a>=0?l.getItemId(a):null,autoComplete:"off",value:u,onChange:d(t,l.input_handleChange),onKeyDown:d(n,l.input_handleKeyDown),onBlur:d(o,l.input_handleBlur)},r,{id:l.inputId})},l.input_handleKeyDown=function(e){e.key&&l.keyDownHandlers[e.key]?l.keyDownHandlers[e.key].call(l,e):["Shift","Meta","Alt","Control"].includes(e.key)||l.openMenu()},l.input_handleChange=function(e){l.internalSetState({inputValue:e.target.value})},l.input_handleBlur=function(){l.isMouseDown||l.reset()},l.getItemProps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onMouseEnter,n=e.item,o=e.index,r=S(e,["onMouseEnter","item","index"]);return l.items[o]=n,b({id:l.getItemId(o),onMouseEnter:d(t,function(){l.setHighlightedIndex(o)})},r)},l.reset=function(e){l.internalSetState(function(t){var n=t.selectedItem;return{type:e,isOpen:!1,highlightedIndex:null,inputValue:l.props.itemToString(n)}})},l.toggleMenu=function(e,t){l.internalSetState(function(t){var n=!t.isOpen;return"boolean"==typeof e&&(n=e),{isOpen:n}},function(){l.getState().isOpen&&l.setHighlightedIndex(),i(t)()})},l.openMenu=function(e){l.toggleMenu(!0,e)},l.closeMenu=function(e){l.toggleMenu(!1,e)},l.updateStatus=a(function(){if(l._isMounted){var e=l.getState(),t=l.getItemFromIndex(e.highlightedIndex)||{},o=l.items.length,r=l.props.getA11yStatusMessage(b({itemToString:l.props.itemToString,previousResultCount:l.previousResultCount,resultCount:o,highlightedItem:t},e));l.previousResultCount=o,n(r)}},200),l.id=p("downshift"),l.state={highlightedIndex:l.props.defaultHighlightedIndex,inputValue:l.props.defaultInputValue,isOpen:l.props.defaultIsOpen,selectedItem:l.props.defaultSelectedItem},l.root_handleClick=d(l.props.onClick,l.root_handleClick),l}return w(t,e),I(t,[{key:"getState",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return Object.keys(t).reduce(function(t,n){return t[n]=void 0===e.props[n]?e.state[n]:e.props[n],t},{})}},{key:"maybeScrollToHighlightedElement",value:function(e,t){s(this.getItemNodeFromIndex(e),this._rootNode,t)}},{key:"internalSetState",value:function(e,t){var n=this,o={},r=void 0,u=void 0;return this.setState(function(t){t=n.getState(t);var i={},l={};return(r="function"==typeof e?e(t):e).hasOwnProperty("selectedItem")&&(o.selectedItem=r.selectedItem,o.previousItem=t.selectedItem),Object.keys(r).forEach(function(e){"type"!==e&&(l[e]=r[e],n.props.hasOwnProperty(e)||(i[e]=r[e]))}),u=!f(t,l),i},function(){i(t)(),u&&n.props.onStateChange(r),Object.keys(o).length&&n.props.onChange(o)})}},{key:"getControllerStateAndHelpers",value:function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,r=e.isOpen;return{getRootProps:this.getRootProps,getButtonProps:this.getButtonProps,getLabelProps:this.getLabelProps,getInputProps:this.getInputProps,getItemProps:this.getItemProps,openMenu:this.openMenu,closeMenu:this.closeMenu,toggleMenu:this.toggleMenu,selectItem:this.selectItem,selectItemAtIndex:this.selectItemAtIndex,selectHighlightedItem:this.selectHighlightedItem,setHighlightedIndex:this.setHighlightedIndex,clearSelection:this.clearSelection,highlightedIndex:t,inputValue:n,isOpen:r,selectedItem:o}}},{key:"getItemId",value:function(e){return this.id+"-item-"+e}},{key:"getItemIndexFromId",value:function(e){return e?Number(e.split(this.id+"-item-")[1]):null}},{key:"componentDidMount",value:function(){var e=this;this._isMounted=!0;var n=function(){e.isMouseDown=!0},o=function(n){e.isMouseDown=!1,e._rootNode.contains(n.target)||e.reset(t.stateChangeTypes.mouseUp)};document.body.addEventListener("mousedown",n),document.body.addEventListener("mouseup",o),this.cleanup=function(){e._isMounted=!1,document.body.removeEventListener("mousedown",n),document.body.removeEventListener("mouseup",o)}}},{key:"componentDidUpdate",value:function(){this.updateStatus()}},{key:"componentWillUnmount",value:function(){this.cleanup()}},{key:"render",value:function(){var e=this.props.children;this.items=[],this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=e&&e(this.getControllerStateAndHelpers());if(!t)return null;var n=m.Children.only(t);if(this.getRootProps.called)return g(n,this.getRootProps),n;if("string"==typeof n.type)return m.cloneElement(n,this.getRootProps(n.props));throw new Error("downshift: If you return a non-DOM element, you must use apply the getRootProps function")}}]),t}(e.Component);return H.propTypes={children:t.func,defaultHighlightedIndex:t.number,defaultSelectedItem:t.any,defaultInputValue:t.string,defaultIsOpen:t.bool,getA11yStatusMessage:t.func,itemToString:t.func,onChange:t.func,onStateChange:t.func,onClick:t.func,selectedItem:t.any,isOpen:t.bool,inputValue:t.string,highlightedIndex:t.number},H.defaultProps={defaultHighlightedIndex:null,defaultSelectedItem:null,defaultInputValue:"",defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,r=e.resultCount,i=e.previousResultCount,u=e.itemToString;if(!t)return o?u(o):"";var l=r!==i;return r?!n||l?r+" "+(1===r?"result is":"results are")+" available, use up and down arrow keys to navigate.":u(n):"No results."},itemToString:function(e){return null==e?"":String(e)},onStateChange:function(){}},H.stateChangeTypes={mouseUp:"__autocomplete_mouseup__"},H});
//# sourceMappingURL=downshift.umd.min.js.map
{
"name": "downshift",
"version": "1.0.0-beta.19",
"version": "1.0.0-beta.20",
"description": "A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete components",

@@ -5,0 +5,0 @@ "main": "dist/downshift.cjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc