UNPKG

232 kBSource Map (JSON)View Raw
1{"version":3,"file":"downshift.umd.min.js","sources":["../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js","../node_modules/object-assign/index.js","../node_modules/prop-types/node_modules/react-is/index.js","../node_modules/prop-types/factoryWithTypeCheckers.js","../node_modules/prop-types/factoryWithThrowingShims.js","../node_modules/prop-types/index.js","../node_modules/prop-types/lib/ReactPropTypesSecret.js","../node_modules/react-is/cjs/react-is.production.min.js","../node_modules/react-is/index.js","../node_modules/compute-scroll-into-view/dist/index.module.js","../src/utils.js","../src/set-a11y-status.js","../src/stateChangeTypes.js","../src/downshift.js","../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","../src/hooks/utils.js","../src/hooks/useSelect/utils.js","../src/hooks/useSelect/reducer.js","../src/hooks/useSelect/index.js","../src/hooks/useCombobox/stateChangeTypes.js","../src/hooks/useCombobox/utils.js","../src/hooks/useCombobox/reducer.js","../src/hooks/useCombobox/index.js","../src/hooks/useMultipleSelection/utils.js","../src/hooks/useMultipleSelection/reducer.js","../src/hooks/useMultipleSelection/index.js"],"sourcesContent":["export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactIs = require('react-is');\nvar assign = require('object-assign');\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\nvar checkPropTypes = require('./checkPropTypes');\n\nvar has = Function.call.bind(Object.prototype.hasOwnProperty);\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\nfunction emptyFunctionThatReturnsNull() {\n return null;\n}\n\nmodule.exports = function(isValidElement, throwOnDirectAccess) {\n /* global Symbol */\n var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.\n\n /**\n * Returns the iterator method function contained on the iterable object.\n *\n * Be sure to invoke the function with the iterable as context:\n *\n * var iteratorFn = getIteratorFn(myIterable);\n * if (iteratorFn) {\n * var iterator = iteratorFn.call(myIterable);\n * ...\n * }\n *\n * @param {?object} maybeIterable\n * @return {?function}\n */\n function getIteratorFn(maybeIterable) {\n var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n /**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n * var Props = require('ReactPropTypes');\n * var MyArticle = React.createClass({\n * propTypes: {\n * // An optional string prop named \"description\".\n * description: Props.string,\n *\n * // A required enum prop named \"category\".\n * category: Props.oneOf(['News','Photos']).isRequired,\n *\n * // A prop named \"dialog\" that requires an instance of Dialog.\n * dialog: Props.instanceOf(Dialog).isRequired\n * },\n * render: function() { ... }\n * });\n *\n * A more formal specification of how these methods are used:\n *\n * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n * decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n * var MyLink = React.createClass({\n * propTypes: {\n * // An optional string or URI prop named \"href\".\n * href: function(props, propName, componentName) {\n * var propValue = props[propName];\n * if (propValue != null && typeof propValue !== 'string' &&\n * !(propValue instanceof URI)) {\n * return new Error(\n * 'Expected a string or an URI for ' + propName + ' in ' +\n * componentName\n * );\n * }\n * }\n * },\n * render: function() {...}\n * });\n *\n * @internal\n */\n\n var ANONYMOUS = '<<anonymous>>';\n\n // Important!\n // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.\n var ReactPropTypes = {\n array: createPrimitiveTypeChecker('array'),\n bool: createPrimitiveTypeChecker('boolean'),\n func: createPrimitiveTypeChecker('function'),\n number: createPrimitiveTypeChecker('number'),\n object: createPrimitiveTypeChecker('object'),\n string: createPrimitiveTypeChecker('string'),\n symbol: createPrimitiveTypeChecker('symbol'),\n\n any: createAnyTypeChecker(),\n arrayOf: createArrayOfTypeChecker,\n element: createElementTypeChecker(),\n elementType: createElementTypeTypeChecker(),\n instanceOf: createInstanceTypeChecker,\n node: createNodeChecker(),\n objectOf: createObjectOfTypeChecker,\n oneOf: createEnumTypeChecker,\n oneOfType: createUnionTypeChecker,\n shape: createShapeTypeChecker,\n exact: createStrictShapeTypeChecker,\n };\n\n /**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n /*eslint-disable no-self-compare*/\n function is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return x !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n }\n /*eslint-enable no-self-compare*/\n\n /**\n * We use an Error-like object for backward compatibility as people may call\n * PropTypes directly and inspect their output. However, we don't use real\n * Errors anymore. We don't inspect their stack anyway, and creating them\n * is prohibitively expensive if they are created too often, such as what\n * happens in oneOfType() for any type before the one that matched.\n */\n function PropTypeError(message) {\n this.message = message;\n this.stack = '';\n }\n // Make `instanceof Error` still work for returned errors.\n PropTypeError.prototype = Error.prototype;\n\n function createChainableTypeChecker(validate) {\n if (process.env.NODE_ENV !== 'production') {\n var manualPropTypeCallCache = {};\n var manualPropTypeWarningCount = 0;\n }\n function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {\n componentName = componentName || ANONYMOUS;\n propFullName = propFullName || propName;\n\n if (secret !== ReactPropTypesSecret) {\n if (throwOnDirectAccess) {\n // New behavior only for users of `prop-types` package\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use `PropTypes.checkPropTypes()` to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {\n // Old behavior for people using React.PropTypes\n var cacheKey = componentName + ':' + propName;\n if (\n !manualPropTypeCallCache[cacheKey] &&\n // Avoid spamming the console because they are often not actionable except for lib authors\n manualPropTypeWarningCount < 3\n ) {\n printWarning(\n 'You are manually calling a React.PropTypes validation ' +\n 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +\n 'and will throw in the standalone `prop-types` package. ' +\n 'You may be seeing this warning due to a third-party PropTypes ' +\n 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'\n );\n manualPropTypeCallCache[cacheKey] = true;\n manualPropTypeWarningCount++;\n }\n }\n }\n if (props[propName] == null) {\n if (isRequired) {\n if (props[propName] === null) {\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));\n }\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));\n }\n return null;\n } else {\n return validate(props, propName, componentName, location, propFullName);\n }\n }\n\n var chainedCheckType = checkType.bind(null, false);\n chainedCheckType.isRequired = checkType.bind(null, true);\n\n return chainedCheckType;\n }\n\n function createPrimitiveTypeChecker(expectedType) {\n function validate(props, propName, componentName, location, propFullName, secret) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== expectedType) {\n // `propValue` being instance of, say, date/regexp, pass the 'object'\n // check, but we can offer a more precise error message here rather than\n // 'of type `object`'.\n var preciseType = getPreciseType(propValue);\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createAnyTypeChecker() {\n return createChainableTypeChecker(emptyFunctionThatReturnsNull);\n }\n\n function createArrayOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');\n }\n var propValue = props[propName];\n if (!Array.isArray(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));\n }\n for (var i = 0; i < propValue.length; i++) {\n var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!isValidElement(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!ReactIs.isValidElementType(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createInstanceTypeChecker(expectedClass) {\n function validate(props, propName, componentName, location, propFullName) {\n if (!(props[propName] instanceof expectedClass)) {\n var expectedClassName = expectedClass.name || ANONYMOUS;\n var actualClassName = getClassName(props[propName]);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createEnumTypeChecker(expectedValues) {\n if (!Array.isArray(expectedValues)) {\n if (process.env.NODE_ENV !== 'production') {\n if (arguments.length > 1) {\n printWarning(\n 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +\n 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'\n );\n } else {\n printWarning('Invalid argument supplied to oneOf, expected an array.');\n }\n }\n return emptyFunctionThatReturnsNull;\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n for (var i = 0; i < expectedValues.length; i++) {\n if (is(propValue, expectedValues[i])) {\n return null;\n }\n }\n\n var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {\n var type = getPreciseType(value);\n if (type === 'symbol') {\n return String(value);\n }\n return value;\n });\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createObjectOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');\n }\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));\n }\n for (var key in propValue) {\n if (has(propValue, key)) {\n var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createUnionTypeChecker(arrayOfTypeCheckers) {\n if (!Array.isArray(arrayOfTypeCheckers)) {\n process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;\n return emptyFunctionThatReturnsNull;\n }\n\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (typeof checker !== 'function') {\n printWarning(\n 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +\n 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'\n );\n return emptyFunctionThatReturnsNull;\n }\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {\n return null;\n }\n }\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createNodeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n if (!isNode(props[propName])) {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createStrictShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n // We need to check all keys in case some are required but missing from\n // props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (!checker) {\n return new PropTypeError(\n 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +\n '\\nBad object: ' + JSON.stringify(props[propName], null, ' ') +\n '\\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')\n );\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n\n return createChainableTypeChecker(validate);\n }\n\n function isNode(propValue) {\n switch (typeof propValue) {\n case 'number':\n case 'string':\n case 'undefined':\n return true;\n case 'boolean':\n return !propValue;\n case 'object':\n if (Array.isArray(propValue)) {\n return propValue.every(isNode);\n }\n if (propValue === null || isValidElement(propValue)) {\n return true;\n }\n\n var iteratorFn = getIteratorFn(propValue);\n if (iteratorFn) {\n var iterator = iteratorFn.call(propValue);\n var step;\n if (iteratorFn !== propValue.entries) {\n while (!(step = iterator.next()).done) {\n if (!isNode(step.value)) {\n return false;\n }\n }\n } else {\n // Iterator will provide entry [k,v] tuples rather than values.\n while (!(step = iterator.next()).done) {\n var entry = step.value;\n if (entry) {\n if (!isNode(entry[1])) {\n return false;\n }\n }\n }\n }\n } else {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n\n function isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === 'symbol') {\n return true;\n }\n\n // falsy value can't be a Symbol\n if (!propValue) {\n return false;\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue['@@toStringTag'] === 'Symbol') {\n return true;\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === 'function' && propValue instanceof Symbol) {\n return true;\n }\n\n return false;\n }\n\n // Equivalent of `typeof` but with special handling for array and regexp.\n function getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return 'array';\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return 'object';\n }\n if (isSymbol(propType, propValue)) {\n return 'symbol';\n }\n return propType;\n }\n\n // This handles more types than `getPropType`. Only used for error messages.\n // See `createPrimitiveTypeChecker`.\n function getPreciseType(propValue) {\n if (typeof propValue === 'undefined' || propValue === null) {\n return '' + propValue;\n }\n var propType = getPropType(propValue);\n if (propType === 'object') {\n if (propValue instanceof Date) {\n return 'date';\n } else if (propValue instanceof RegExp) {\n return 'regexp';\n }\n }\n return propType;\n }\n\n // Returns a string that is postfixed to a warning about an invalid type.\n // For example, \"undefined\" or \"of type array\"\n function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case 'array':\n case 'object':\n return 'an ' + type;\n case 'boolean':\n case 'date':\n case 'regexp':\n return 'a ' + type;\n default:\n return type;\n }\n }\n\n // Returns class name of the object, if any.\n function getClassName(propValue) {\n if (!propValue.constructor || !propValue.constructor.name) {\n return ANONYMOUS;\n }\n return propValue.constructor.name;\n }\n\n ReactPropTypes.checkPropTypes = checkPropTypes;\n ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/** @license React v17.0.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;\nif(\"function\"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x(\"react.element\");c=x(\"react.portal\");d=x(\"react.fragment\");e=x(\"react.strict_mode\");f=x(\"react.profiler\");g=x(\"react.provider\");h=x(\"react.context\");k=x(\"react.forward_ref\");l=x(\"react.suspense\");m=x(\"react.suspense_list\");n=x(\"react.memo\");p=x(\"react.lazy\");q=x(\"react.block\");r=x(\"react.server.block\");u=x(\"react.fundamental\");v=x(\"react.debug_trace_mode\");w=x(\"react.legacy_hidden\")}\nfunction y(a){if(\"object\"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H;\nexports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n};\nexports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||\"object\"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};\nexports.typeOf=y;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","function t(t){return null!=t&&\"object\"==typeof t&&1===t.nodeType}function e(t,e){return(!e||\"hidden\"!==t)&&\"visible\"!==t&&\"clip\"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}export default function(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c=\"function\"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError(\"Invalid target\");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentNode)===f){s.push(p);break}p===document.body&&n(p)&&!n(document.documentElement)||n(p,a)&&s.push(p)}for(var g=o.visualViewport?o.visualViewport.width:innerWidth,m=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,M=W.right,E=W.bottom,V=W.left,x=\"start\"===d||\"nearest\"===d?y:\"end\"===d?E:y+b/2,I=\"center\"===u?V+H/2:\"end\"===u?M:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if(\"if-needed\"===l&&y>=0&&V>=0&&E<=m&&M<=g&&y>=R&&E<=Y&&V>=L&&M<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),N=parseInt(S.borderTopWidth,10),q=parseInt(S.borderRightWidth,10),z=parseInt(S.borderBottomWidth,10),A=0,F=0,G=\"offsetWidth\"in k?k.offsetWidth-k.clientWidth-j-q:0,J=\"offsetHeight\"in k?k.offsetHeight-k.clientHeight-N-z:0;if(f===k)A=\"start\"===d?x:\"end\"===d?x-m:\"nearest\"===d?r(v,v+m,m,N,z,v+x,v+x+b,b):x-m/2,F=\"start\"===u?I:\"center\"===u?I-g/2:\"end\"===u?I-g:r(w,w+g,g,j,q,w+I,w+I+H,H),A=Math.max(0,A+v),F=Math.max(0,F+w);else{A=\"start\"===d?x-R-N:\"end\"===d?x-Y+z+J:\"nearest\"===d?r(R,Y,D,N,z+J,x,x+b,b):x-(R+D/2)+J/2,F=\"start\"===u?I-L-j:\"center\"===u?I-(L+O/2)+G/2:\"end\"===u?I-X+q+G:r(L,X,O,j,q+G,I,I+H,H);var K=k.scrollLeft,P=k.scrollTop;x+=P-(A=Math.max(0,Math.min(P+A,k.scrollHeight-D+J))),I+=K-(F=Math.max(0,Math.min(K+F,k.scrollWidth-O+G)))}C.push({el:k,top:A,left:F})}return C}\n//# sourceMappingURL=index.module.js.map\n","import computeScrollIntoView from 'compute-scroll-into-view'\nimport {isPreact} from './is.macro'\n\nlet idCounter = 0\n\n/**\n * Accepts a parameter and returns it if it's a function\n * or a noop function if it's not. This allows us to\n * accept a callback, but not worry about it if it's not\n * passed.\n * @param {Function} cb the callback\n * @return {Function} a function\n */\nfunction cbToCb(cb) {\n return typeof cb === 'function' ? cb : noop\n}\n\nfunction noop() {}\n\n/**\n * Scroll node into view if necessary\n * @param {HTMLElement} node the element that should scroll into view\n * @param {HTMLElement} menuNode the menu element of the component\n */\nfunction scrollIntoView(node, menuNode) {\n if (!node) {\n return\n }\n\n const actions = computeScrollIntoView(node, {\n boundary: menuNode,\n block: 'nearest',\n scrollMode: 'if-needed',\n })\n actions.forEach(({el, top, left}) => {\n el.scrollTop = top\n el.scrollLeft = left\n })\n}\n\n/**\n * @param {HTMLElement} parent the parent node\n * @param {HTMLElement} child the child node\n * @return {Boolean} whether the parent is the child or the child is in the parent\n */\nfunction isOrContainsNode(parent, child) {\n return parent === child || (child instanceof Node && parent.contains && parent.contains(child))\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\nfunction debounce(fn, time) {\n let timeoutId\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n\n function wrapper(...args) {\n cancel()\n timeoutId = setTimeout(() => {\n timeoutId = null\n fn(...args)\n }, time)\n }\n\n wrapper.cancel = cancel\n\n return wrapper\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param {...Function} fns the event handler functions\n * @return {Function} the event handler to add to an element\n */\nfunction callAllEventHandlers(...fns) {\n return (event, ...args) =>\n fns.some(fn => {\n if (fn) {\n fn(event, ...args)\n }\n return (\n event.preventDownshiftDefault ||\n (event.hasOwnProperty('nativeEvent') &&\n event.nativeEvent.preventDownshiftDefault)\n )\n })\n}\n\nfunction handleRefs(...refs) {\n return node => {\n refs.forEach(ref => {\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref) {\n ref.current = node\n }\n })\n }\n}\n\n/**\n * This generates a unique ID for an instance of Downshift\n * @return {String} the unique ID\n */\nfunction generateId() {\n return String(idCounter++)\n}\n\n/**\n * This is only used in tests\n * @param {Number} num the number to set the idCounter to\n */\nfunction setIdCounter(num) {\n idCounter = num\n}\n\n/**\n * Resets idCounter to 0. Used for SSR.\n */\nfunction resetIdCounter() {\n idCounter = 0\n}\n\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specift if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage({isOpen, resultCount, previousResultCount}) {\n if (!isOpen) {\n return ''\n }\n\n if (!resultCount) {\n return 'No results are available.'\n }\n\n if (resultCount !== previousResultCount) {\n return `${resultCount} result${\n resultCount === 1 ? ' is' : 's are'\n } available, use up and down arrow keys to navigate. Press Enter key to select.`\n }\n\n return ''\n}\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array\n * otherwise returns the argument\n * @param {*} arg the maybe-array\n * @param {*} defaultValue the value if arg is falsey not defined\n * @return {*} the arg or it's first item\n */\nfunction unwrapArray(arg, defaultValue) {\n arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */ arg[0] : arg\n if (!arg && defaultValue) {\n return defaultValue\n } else {\n return arg\n }\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Boolean} whether it's a DOM element\n */\nfunction isDOMElement(element) {\n /* istanbul ignore if */\n if (isPreact) {\n // then this is preact or preact X\n return (\n typeof element.type === 'string' || typeof element.nodeName === 'string'\n )\n }\n\n // then we assume this is react\n return typeof element.type === 'string'\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Object} the props\n */\nfunction getElementProps(element) {\n // props for react, attributes for preact\n\n /* istanbul ignore if */\n if (isPreact) {\n return element.props || element.attributes\n }\n\n return element.props\n}\n\n/**\n * Throws a helpful error message for required properties. Useful\n * to be used as a default in destructuring or object params.\n * @param {String} fnName the function name\n * @param {String} propName the prop name\n */\nfunction requiredProp(fnName, propName) {\n // eslint-disable-next-line no-console\n console.error(`The property \"${propName}\" is required in \"${fnName}\"`)\n}\n\nconst stateKeys = [\n 'highlightedIndex',\n 'inputValue',\n 'isOpen',\n 'selectedItem',\n 'type',\n]\n/**\n * @param {Object} state the state object\n * @return {Object} state that is relevant to downshift\n */\nfunction pickState(state = {}) {\n const result = {}\n stateKeys.forEach(k => {\n if (state.hasOwnProperty(k)) {\n result[k] = state[k]\n }\n })\n return result\n}\n\n/**\n * This will perform a shallow merge of the given state object\n * with the state coming from props\n * (for the controlled component scenario)\n * This is used in state updater functions so they're referencing\n * the right state regardless of where it comes from.\n *\n * @param {Object} state The state of the component/hook.\n * @param {Object} props The props that may contain controlled values.\n * @returns {Object} The merged controlled state.\n */\nfunction getState(state, props) {\n return Object.keys(state).reduce((prevState, key) => {\n prevState[key] = isControlledProp(props, key) ? props[key] : state[key]\n\n return prevState\n }, {})\n}\n\n/**\n * This determines whether a prop is a \"controlled prop\" meaning it is\n * state which is controlled by the outside of this component rather\n * than within this component.\n *\n * @param {Object} props The props that may contain controlled values.\n * @param {String} key the key to check\n * @return {Boolean} whether it is a controlled controlled prop\n */\nfunction isControlledProp(props, key) {\n return props[key] !== undefined\n}\n\n/**\n * Normalizes the 'key' property of a KeyboardEvent in IE/Edge\n * @param {Object} event a keyboardEvent object\n * @return {String} keyboard key\n */\nfunction normalizeArrowKey(event) {\n const {key, keyCode} = event\n /* istanbul ignore next (ie) */\n if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {\n return `Arrow${key}`\n }\n return key\n}\n\n/**\n * Simple check if the value passed is object literal\n * @param {*} obj any things\n * @return {Boolean} whether it's object literal\n */\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === '[object Object]'\n}\n\n/**\n * Returns the new index in the list, in a circular way. If next value is out of bonds from the total,\n * it will wrap to either 0 or itemCount - 1.\n *\n * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.\n * @param {number} baseIndex The initial position to move from.\n * @param {number} itemCount The total number of items.\n * @param {Function} getItemNodeFromIndex Used to check if item is disabled.\n * @param {boolean} circular Specify if navigation is circular. Default is true.\n * @returns {number} The new index after the move.\n */\nfunction getNextWrappingIndex(\n moveAmount,\n baseIndex,\n itemCount,\n getItemNodeFromIndex,\n circular = true,\n) {\n if (itemCount === 0) {\n return -1\n }\n\n const itemsLastIndex = itemCount - 1\n\n if (\n typeof baseIndex !== 'number' ||\n baseIndex < 0 ||\n baseIndex >= itemCount\n ) {\n baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1\n }\n\n let newIndex = baseIndex + moveAmount\n\n if (newIndex < 0) {\n newIndex = circular ? itemsLastIndex : 0\n } else if (newIndex > itemsLastIndex) {\n newIndex = circular ? 0 : itemsLastIndex\n }\n\n const nonDisabledNewIndex = getNextNonDisabledIndex(\n moveAmount,\n newIndex,\n itemCount,\n getItemNodeFromIndex,\n circular,\n )\n\n if (nonDisabledNewIndex === -1) {\n return baseIndex >= itemCount ? -1 : baseIndex\n }\n \n return nonDisabledNewIndex\n}\n\n/**\n * Returns the next index in the list of an item that is not disabled.\n *\n * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.\n * @param {number} baseIndex The initial position to move from.\n * @param {number} itemCount The total number of items.\n * @param {Function} getItemNodeFromIndex Used to check if item is disabled.\n * @param {boolean} circular Specify if navigation is circular. Default is true.\n * @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.\n */\nfunction getNextNonDisabledIndex(\n moveAmount,\n baseIndex,\n itemCount,\n getItemNodeFromIndex,\n circular,\n) {\n const currentElementNode = getItemNodeFromIndex(baseIndex)\n if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {\n return baseIndex\n }\n\n if (moveAmount > 0) {\n for (let index = baseIndex + 1; index < itemCount; index++) {\n if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {\n return index\n }\n }\n } else {\n for (let index = baseIndex - 1; index >= 0; index--) {\n if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {\n return index\n }\n }\n }\n\n if (circular) {\n return moveAmount > 0\n ? getNextNonDisabledIndex(1, 0, itemCount, getItemNodeFromIndex, false)\n : getNextNonDisabledIndex(\n -1,\n itemCount - 1,\n itemCount,\n getItemNodeFromIndex,\n false,\n )\n }\n\n return -1\n}\n\n/**\n * Checks if event target is within the downshift elements.\n *\n * @param {EventTarget} target Target to check.\n * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).\n * @param {Document} document The document.\n * @param {boolean} checkActiveElement Whether to also check activeElement.\n *\n * @returns {boolean} Whether or not the target is within downshift elements.\n */\nfunction targetWithinDownshift(\n target,\n downshiftElements,\n document,\n checkActiveElement = true,\n) {\n return downshiftElements.some(\n contextNode =>\n contextNode &&\n (isOrContainsNode(contextNode, target) ||\n (checkActiveElement &&\n isOrContainsNode(contextNode, document.activeElement))),\n )\n}\n\nexport function validateControlledUnchanged(state, prevProps, nextProps) {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n\n const warningDescription = `This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props`\n\n Object.keys(state).forEach(propKey => {\n if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: A component has changed the controlled prop \"${propKey}\" to be uncontrolled. ${warningDescription}`,\n )\n } else if (\n prevProps[propKey] === undefined &&\n nextProps[propKey] !== undefined\n ) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: A component has changed the uncontrolled prop \"${propKey}\" to be controlled. ${warningDescription}`,\n )\n }\n })\n}\n\nexport {\n cbToCb,\n callAllEventHandlers,\n handleRefs,\n debounce,\n scrollIntoView,\n generateId,\n getA11yStatusMessage,\n unwrapArray,\n isDOMElement,\n getElementProps,\n noop,\n requiredProp,\n setIdCounter,\n resetIdCounter,\n pickState,\n isPlainObject,\n normalizeArrowKey,\n getNextWrappingIndex,\n getNextNonDisabledIndex,\n targetWithinDownshift,\n getState,\n isControlledProp,\n}\n","import {debounce} from './utils'\n\nconst cleanupStatus = debounce((documentProp) => {\n getStatusDiv(documentProp).textContent = ''\n}, 500)\n\n/**\n * @param {String} status the status message\n * @param {Object} documentProp document passed by the user.\n */\nfunction setStatus(status, documentProp) {\n const div = getStatusDiv(documentProp)\n if (!status) {\n return\n }\n\n div.textContent = status\n cleanupStatus(documentProp)\n}\n\n/**\n * Get the status node or create it if it does not already exist.\n * @param {Object} documentProp document passed by the user.\n * @return {HTMLElement} the status node.\n */\nfunction getStatusDiv(documentProp = document) {\n let statusDiv = documentProp.getElementById('a11y-status-message')\n if (statusDiv) {\n return statusDiv\n }\n\n statusDiv = documentProp.createElement('div')\n statusDiv.setAttribute('id', 'a11y-status-message')\n statusDiv.setAttribute('role', 'status')\n statusDiv.setAttribute('aria-live', 'polite')\n statusDiv.setAttribute('aria-relevant', 'additions text')\n Object.assign(statusDiv.style, {\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n })\n documentProp.body.appendChild(statusDiv)\n return statusDiv\n}\n\nexport default setStatus\n","import productionEnum from './productionEnum.macro'\n\nexport const unknown = productionEnum('__autocomplete_unknown__')\nexport const mouseUp = productionEnum('__autocomplete_mouseup__')\nexport const itemMouseEnter = productionEnum('__autocomplete_item_mouseenter__')\nexport const keyDownArrowUp = productionEnum(\n '__autocomplete_keydown_arrow_up__',\n)\nexport const keyDownArrowDown = productionEnum(\n '__autocomplete_keydown_arrow_down__',\n)\nexport const keyDownEscape = productionEnum('__autocomplete_keydown_escape__')\nexport const keyDownEnter = productionEnum('__autocomplete_keydown_enter__')\nexport const keyDownHome = productionEnum('__autocomplete_keydown_home__')\nexport const keyDownEnd = productionEnum('__autocomplete_keydown_end__')\nexport const clickItem = productionEnum('__autocomplete_click_item__')\nexport const blurInput = productionEnum('__autocomplete_blur_input__')\nexport const changeInput = productionEnum('__autocomplete_change_input__')\nexport const keyDownSpaceButton = productionEnum(\n '__autocomplete_keydown_space_button__',\n)\nexport const clickButton = productionEnum('__autocomplete_click_button__')\nexport const blurButton = productionEnum('__autocomplete_blur_button__')\nexport const controlledPropUpdatedSelectedItem = productionEnum(\n '__autocomplete_controlled_prop_updated_selected_item__',\n)\nexport const touchEnd = productionEnum('__autocomplete_touchend__')\n","/* eslint camelcase:0 */\n\nimport PropTypes from 'prop-types'\nimport {Component, cloneElement} from 'react'\nimport {isForwardRef} from 'react-is'\nimport {isPreact, isReactNative} from './is.macro'\nimport setA11yStatus from './set-a11y-status'\nimport * as stateChangeTypes from './stateChangeTypes'\nimport {\n handleRefs,\n callAllEventHandlers,\n cbToCb,\n debounce,\n generateId,\n getA11yStatusMessage,\n getElementProps,\n isDOMElement,\n targetWithinDownshift,\n isPlainObject,\n noop,\n normalizeArrowKey,\n pickState,\n requiredProp,\n scrollIntoView,\n unwrapArray,\n getNextWrappingIndex,\n getNextNonDisabledIndex,\n getState,\n isControlledProp,\n validateControlledUnchanged,\n} from './utils'\n\nclass Downshift extends Component {\n static propTypes = {\n children: PropTypes.func,\n defaultHighlightedIndex: PropTypes.number,\n defaultIsOpen: PropTypes.bool,\n initialHighlightedIndex: PropTypes.number,\n initialSelectedItem: PropTypes.any,\n initialInputValue: PropTypes.string,\n initialIsOpen: PropTypes.bool,\n getA11yStatusMessage: PropTypes.func,\n itemToString: PropTypes.func,\n onChange: PropTypes.func,\n onSelect: PropTypes.func,\n onStateChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n onUserAction: PropTypes.func,\n onOuterClick: PropTypes.func,\n selectedItemChanged: PropTypes.func,\n stateReducer: PropTypes.func,\n itemCount: PropTypes.number,\n id: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n suppressRefError: PropTypes.bool,\n scrollIntoView: PropTypes.func,\n // things we keep in state for uncontrolled components\n // but can accept as props for controlled components\n /* eslint-disable react/no-unused-prop-types */\n selectedItem: PropTypes.any,\n isOpen: PropTypes.bool,\n inputValue: PropTypes.string,\n highlightedIndex: PropTypes.number,\n labelId: PropTypes.string,\n inputId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n /* eslint-enable react/no-unused-prop-types */\n }\n\n static defaultProps = {\n defaultHighlightedIndex: null,\n defaultIsOpen: false,\n getA11yStatusMessage,\n itemToString: i => {\n if (i == null) {\n return ''\n }\n if (\n process.env.NODE_ENV !== 'production' &&\n isPlainObject(i) &&\n !i.hasOwnProperty('toString')\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n 'downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.',\n 'The object that was passed:',\n i,\n )\n }\n return String(i)\n },\n onStateChange: noop,\n onInputValueChange: noop,\n onUserAction: noop,\n onChange: noop,\n onSelect: noop,\n onOuterClick: noop,\n selectedItemChanged: (prevItem, item) => prevItem !== item,\n environment:\n typeof window === 'undefined' /* istanbul ignore next (ssr) */\n ? {}\n : window,\n stateReducer: (state, stateToSet) => stateToSet,\n suppressRefError: false,\n scrollIntoView,\n }\n\n static stateChangeTypes = stateChangeTypes\n\n constructor(props) {\n super(props)\n // fancy destructuring + defaults + aliases\n // this basically says each value of state should either be set to\n // the initial value or the default value if the initial value is not provided\n const {\n defaultHighlightedIndex,\n initialHighlightedIndex: highlightedIndex = defaultHighlightedIndex,\n defaultIsOpen,\n initialIsOpen: isOpen = defaultIsOpen,\n initialInputValue: inputValue = '',\n initialSelectedItem: selectedItem = null,\n } = this.props\n const state = this.getState({\n highlightedIndex,\n isOpen,\n inputValue,\n selectedItem,\n })\n if (\n state.selectedItem != null &&\n this.props.initialInputValue === undefined\n ) {\n state.inputValue = this.props.itemToString(state.selectedItem)\n }\n this.state = state\n }\n\n id = this.props.id || `downshift-${generateId()}`\n menuId = this.props.menuId || `${this.id}-menu`\n labelId = this.props.labelId || `${this.id}-label`\n inputId = this.props.inputId || `${this.id}-input`\n getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`)\n\n input = null\n items = []\n // itemCount can be changed asynchronously\n // from within downshift (so it can't come from a prop)\n // this is why we store it as an instance and use\n // getItemCount rather than just use items.length\n // (to support windowing + async)\n itemCount = null\n previousResultCount = 0\n\n timeoutIds = []\n\n /**\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n */\n internalSetTimeout = (fn, time) => {\n const id = setTimeout(() => {\n this.timeoutIds = this.timeoutIds.filter(i => i !== id)\n fn()\n }, time)\n\n this.timeoutIds.push(id)\n }\n\n /**\n * Clear all running timeouts\n */\n internalClearTimeouts() {\n this.timeoutIds.forEach(id => {\n clearTimeout(id)\n })\n\n this.timeoutIds = []\n }\n\n /**\n * Gets the state based on internal state or props\n * If a state value is passed via props, then that\n * is the value given, otherwise it's retrieved from\n * stateToMerge\n *\n * @param {Object} stateToMerge defaults to this.state\n * @return {Object} the state\n */\n getState(stateToMerge = this.state) {\n return getState(stateToMerge, this.props)\n }\n\n getItemCount() {\n // things read better this way. They're in priority order:\n // 1. `this.itemCount`\n // 2. `this.props.itemCount`\n // 3. `this.items.length`\n let itemCount = this.items.length\n if (this.itemCount != null) {\n itemCount = this.itemCount\n } else if (this.props.itemCount !== undefined) {\n itemCount = this.props.itemCount\n }\n return itemCount\n }\n\n setItemCount = count => {\n this.itemCount = count\n }\n\n unsetItemCount = () => {\n this.itemCount = null\n }\n\n getItemNodeFromIndex(index) {\n return this.props.environment.document.getElementById(this.getItemId(index))\n }\n\n setHighlightedIndex = (\n highlightedIndex = this.props.defaultHighlightedIndex,\n otherStateToSet = {},\n ) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState({highlightedIndex, ...otherStateToSet})\n }\n\n scrollHighlightedItemIntoView() {\n /* istanbul ignore else (react-native) */\n if (!isReactNative) {\n const node = this.getItemNodeFromIndex(this.getState().highlightedIndex)\n this.props.scrollIntoView(node, this._menuNode)\n }\n }\n\n moveHighlightedIndex(amount, otherStateToSet) {\n const itemCount = this.getItemCount()\n const {highlightedIndex} = this.getState()\n if (itemCount > 0) {\n const nextHighlightedIndex = getNextWrappingIndex(\n amount,\n highlightedIndex,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n )\n this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet)\n }\n }\n\n clearSelection = cb => {\n this.internalSetState(\n {\n selectedItem: null,\n inputValue: '',\n highlightedIndex: this.props.defaultHighlightedIndex,\n isOpen: this.props.defaultIsOpen,\n },\n cb,\n )\n }\n\n selectItem = (item, otherStateToSet, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n {\n isOpen: this.props.defaultIsOpen,\n highlightedIndex: this.props.defaultHighlightedIndex,\n selectedItem: item,\n inputValue: this.props.itemToString(item),\n ...otherStateToSet,\n },\n cb,\n )\n }\n\n selectItemAtIndex = (itemIndex, otherStateToSet, cb) => {\n const item = this.items[itemIndex]\n if (item == null) {\n return\n }\n this.selectItem(item, otherStateToSet, cb)\n }\n\n selectHighlightedItem = (otherStateToSet, cb) => {\n return this.selectItemAtIndex(\n this.getState().highlightedIndex,\n otherStateToSet,\n cb,\n )\n }\n\n // any piece of our state can live in two places:\n // 1. Uncontrolled: it's internal (this.state)\n // We will call this.setState to update that state\n // 2. Controlled: it's external (this.props)\n // We will call this.props.onStateChange to update that state\n //\n // In addition, we'll call this.props.onChange if the\n // selectedItem is changed.\n internalSetState = (stateToSet, cb) => {\n let isItemSelected, onChangeArg\n\n const onStateChangeArg = {}\n const isStateToSetFunction = typeof stateToSet === 'function'\n\n // we want to call `onInputValueChange` before the `setState` call\n // so someone controlling the `inputValue` state gets notified of\n // the input change as soon as possible. This avoids issues with\n // preserving the cursor position.\n // See https://github.com/downshift-js/downshift/issues/217 for more info.\n if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {\n this.props.onInputValueChange(stateToSet.inputValue, {\n ...this.getStateAndHelpers(),\n ...stateToSet,\n })\n }\n return this.setState(\n state => {\n state = this.getState(state)\n let newStateToSet = isStateToSetFunction\n ? stateToSet(state)\n : stateToSet\n\n // Your own function that could modify the state that will be set.\n newStateToSet = this.props.stateReducer(state, newStateToSet)\n\n // checks if an item is selected, regardless of if it's different from\n // what was selected before\n // used to determine if onSelect and onChange callbacks should be called\n isItemSelected = newStateToSet.hasOwnProperty('selectedItem')\n // this keeps track of the object we want to call with setState\n const nextState = {}\n // this is just used to tell whether the state changed\n const nextFullState = {}\n // we need to call on change if the outside world is controlling any of our state\n // and we're trying to update that state. OR if the selection has changed and we're\n // trying to update the selection\n if (\n isItemSelected &&\n newStateToSet.selectedItem !== state.selectedItem\n ) {\n onChangeArg = newStateToSet.selectedItem\n }\n newStateToSet.type = newStateToSet.type || stateChangeTypes.unknown\n\n Object.keys(newStateToSet).forEach(key => {\n // onStateChangeArg should only have the state that is\n // actually changing\n if (state[key] !== newStateToSet[key]) {\n onStateChangeArg[key] = newStateToSet[key]\n }\n // the type is useful for the onStateChangeArg\n // but we don't actually want to set it in internal state.\n // this is an undocumented feature for now... Not all internalSetState\n // calls support it and I'm not certain we want them to yet.\n // But it enables users controlling the isOpen state to know when\n // the isOpen state changes due to mouseup events which is quite handy.\n if (key === 'type') {\n return\n }\n nextFullState[key] = newStateToSet[key]\n // if it's coming from props, then we don't care to set it internally\n if (!isControlledProp(this.props, key)) {\n nextState[key] = newStateToSet[key]\n }\n })\n\n // if stateToSet is a function, then we weren't able to call onInputValueChange\n // earlier, so we'll call it now that we know what the inputValue state will be.\n if (\n isStateToSetFunction &&\n newStateToSet.hasOwnProperty('inputValue')\n ) {\n this.props.onInputValueChange(newStateToSet.inputValue, {\n ...this.getStateAndHelpers(),\n ...newStateToSet,\n })\n }\n\n return nextState\n },\n () => {\n // call the provided callback if it's a function\n cbToCb(cb)()\n\n // only call the onStateChange and onChange callbacks if\n // we have relevant information to pass them.\n const hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1\n if (hasMoreStateThanType) {\n this.props.onStateChange(onStateChangeArg, this.getStateAndHelpers())\n }\n\n if (isItemSelected) {\n this.props.onSelect(\n stateToSet.selectedItem,\n this.getStateAndHelpers(),\n )\n }\n\n if (onChangeArg !== undefined) {\n this.props.onChange(onChangeArg, this.getStateAndHelpers())\n }\n // this is currently undocumented and therefore subject to change\n // We'll try to not break it, but just be warned.\n this.props.onUserAction(onStateChangeArg, this.getStateAndHelpers())\n },\n )\n }\n\n getStateAndHelpers() {\n const {highlightedIndex, inputValue, selectedItem, isOpen} = this.getState()\n const {itemToString} = this.props\n const {id} = this\n const {\n getRootProps,\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getItemProps,\n openMenu,\n closeMenu,\n toggleMenu,\n selectItem,\n selectItemAtIndex,\n selectHighlightedItem,\n setHighlightedIndex,\n clearSelection,\n clearItems,\n reset,\n setItemCount,\n unsetItemCount,\n internalSetState: setState,\n } = this\n return {\n // prop getters\n getRootProps,\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getItemProps,\n\n // actions\n reset,\n openMenu,\n closeMenu,\n toggleMenu,\n selectItem,\n selectItemAtIndex,\n selectHighlightedItem,\n setHighlightedIndex,\n clearSelection,\n clearItems,\n setItemCount,\n unsetItemCount,\n setState,\n\n // props\n itemToString,\n\n // derived\n id,\n\n // state\n highlightedIndex,\n inputValue,\n isOpen,\n selectedItem,\n }\n }\n\n //////////////////////////// ROOT\n\n rootRef = node => (this._rootNode = node)\n\n getRootProps = (\n {refKey = 'ref', ref, ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n // this is used in the render to know whether the user has called getRootProps.\n // It uses that to know whether to apply the props automatically\n this.getRootProps.called = true\n this.getRootProps.refKey = refKey\n this.getRootProps.suppressRefError = suppressRefError\n const {isOpen} = this.getState()\n return {\n [refKey]: handleRefs(ref, this.rootRef),\n role: 'combobox',\n 'aria-expanded': isOpen,\n 'aria-haspopup': 'listbox',\n 'aria-owns': isOpen ? this.menuId : null,\n 'aria-labelledby': this.labelId,\n ...rest,\n }\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT\n\n keyDownHandlers = {\n ArrowDown(event) {\n event.preventDefault()\n\n if (this.getState().isOpen) {\n const amount = event.shiftKey ? 5 : 1\n this.moveHighlightedIndex(amount, {\n type: stateChangeTypes.keyDownArrowDown,\n })\n } else {\n this.internalSetState(\n {\n isOpen: true,\n type: stateChangeTypes.keyDownArrowDown,\n },\n () => {\n const itemCount = this.getItemCount()\n if (itemCount > 0) {\n const {highlightedIndex} = this.getState()\n const nextHighlightedIndex = getNextWrappingIndex(\n 1,\n highlightedIndex,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n )\n\n this.setHighlightedIndex(nextHighlightedIndex, {\n type: stateChangeTypes.keyDownArrowDown,\n })\n }\n },\n )\n }\n },\n\n ArrowUp(event) {\n event.preventDefault()\n\n if (this.getState().isOpen) {\n const amount = event.shiftKey ? -5 : -1\n this.moveHighlightedIndex(amount, {\n type: stateChangeTypes.keyDownArrowUp,\n })\n } else {\n this.internalSetState(\n {\n isOpen: true,\n type: stateChangeTypes.keyDownArrowUp,\n },\n () => {\n const itemCount = this.getItemCount()\n if (itemCount > 0) {\n const {highlightedIndex} = this.getState()\n const nextHighlightedIndex = getNextWrappingIndex(\n -1,\n highlightedIndex,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n )\n\n this.setHighlightedIndex(nextHighlightedIndex, {\n type: stateChangeTypes.keyDownArrowUp,\n })\n }\n },\n )\n }\n },\n\n Enter(event) {\n if (event.which === 229) {\n return\n }\n\n const {isOpen, highlightedIndex} = this.getState()\n if (isOpen && highlightedIndex != null) {\n event.preventDefault()\n const item = this.items[highlightedIndex]\n const itemNode = this.getItemNodeFromIndex(highlightedIndex)\n if (item == null || (itemNode && itemNode.hasAttribute('disabled'))) {\n return\n }\n this.selectHighlightedItem({\n type: stateChangeTypes.keyDownEnter,\n })\n }\n },\n\n Escape(event) {\n event.preventDefault()\n this.reset({\n type: stateChangeTypes.keyDownEscape,\n ...(!this.state.isOpen && {selectedItem: null, inputValue: ''}),\n })\n },\n }\n\n //////////////////////////// BUTTON\n\n buttonKeyDownHandlers = {\n ...this.keyDownHandlers,\n\n ' '(event) {\n event.preventDefault()\n this.toggleMenu({type: stateChangeTypes.keyDownSpaceButton})\n },\n }\n\n inputKeyDownHandlers = {\n ...this.keyDownHandlers,\n Home(event) {\n event.preventDefault()\n\n const itemCount = this.getItemCount()\n const {isOpen} = this.getState()\n\n if (itemCount <= 0 || !isOpen) {\n return\n }\n\n // get next non-disabled starting downwards from 0 if that's disabled.\n const newHighlightedIndex = getNextNonDisabledIndex(\n 1,\n 0,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n false,\n )\n\n this.setHighlightedIndex(newHighlightedIndex, {\n type: stateChangeTypes.keyDownHome,\n })\n },\n\n End(event) {\n event.preventDefault()\n\n const itemCount = this.getItemCount()\n const {isOpen} = this.getState()\n\n if (itemCount <= 0 || !isOpen) {\n return\n }\n\n // get next non-disabled starting upwards from last index if that's disabled.\n const newHighlightedIndex = getNextNonDisabledIndex(\n -1,\n itemCount - 1,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n false,\n )\n\n this.setHighlightedIndex(newHighlightedIndex, {\n type: stateChangeTypes.keyDownEnd,\n })\n },\n }\n\n getToggleButtonProps = ({\n onClick,\n onPress,\n onKeyDown,\n onKeyUp,\n onBlur,\n ...rest\n } = {}) => {\n const {isOpen} = this.getState()\n const enabledEventHandlers = isReactNative\n ? /* istanbul ignore next (react-native) */\n {\n onPress: callAllEventHandlers(onPress, this.buttonHandleClick),\n }\n : {\n onClick: callAllEventHandlers(onClick, this.buttonHandleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, this.buttonHandleKeyDown),\n onKeyUp: callAllEventHandlers(onKeyUp, this.buttonHandleKeyUp),\n onBlur: callAllEventHandlers(onBlur, this.buttonHandleBlur),\n }\n const eventHandlers = rest.disabled ? {} : enabledEventHandlers\n return {\n type: 'button',\n role: 'button',\n 'aria-label': isOpen ? 'close menu' : 'open menu',\n 'aria-haspopup': true,\n 'data-toggle': true,\n ...eventHandlers,\n ...rest,\n }\n }\n\n buttonHandleKeyUp = event => {\n // Prevent click event from emitting in Firefox\n event.preventDefault()\n }\n\n buttonHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (this.buttonKeyDownHandlers[key]) {\n this.buttonKeyDownHandlers[key].call(this, event)\n }\n }\n\n buttonHandleClick = event => {\n event.preventDefault()\n // handle odd case for Safari and Firefox which\n // don't give the button the focus properly.\n /* istanbul ignore if (can't reasonably test this) */\n if (\n !isReactNative &&\n this.props.environment.document.activeElement ===\n this.props.environment.document.body\n ) {\n event.target.focus()\n }\n // to simplify testing components that use downshift, we'll not wrap this in a setTimeout\n // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated\n // when building for production and should therefore have no impact on production code.\n if (process.env.NODE_ENV === 'test') {\n this.toggleMenu({type: stateChangeTypes.clickButton})\n } else {\n // Ensure that toggle of menu occurs after the potential blur event in iOS\n this.internalSetTimeout(() =>\n this.toggleMenu({type: stateChangeTypes.clickButton}),\n )\n }\n }\n\n buttonHandleBlur = event => {\n const blurTarget = event.target // Save blur target for comparison with activeElement later\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element\n this.internalSetTimeout(() => {\n if (\n !this.isMouseDown &&\n (this.props.environment.document.activeElement == null ||\n this.props.environment.document.activeElement.id !== this.inputId) &&\n this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)\n ) {\n this.reset({type: stateChangeTypes.blurButton})\n }\n })\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON\n\n /////////////////////////////// LABEL\n\n getLabelProps = props => {\n return {htmlFor: this.inputId, id: this.labelId, ...props}\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL\n\n /////////////////////////////// INPUT\n\n getInputProps = ({\n onKeyDown,\n onBlur,\n onChange,\n onInput,\n onChangeText,\n ...rest\n } = {}) => {\n let onChangeKey\n let eventHandlers = {}\n\n /* istanbul ignore next (preact) */\n if (isPreact) {\n onChangeKey = 'onInput'\n } else {\n onChangeKey = 'onChange'\n }\n const {inputValue, isOpen, highlightedIndex} = this.getState()\n\n if (!rest.disabled) {\n eventHandlers = {\n [onChangeKey]: callAllEventHandlers(\n onChange,\n onInput,\n this.inputHandleChange,\n ),\n onKeyDown: callAllEventHandlers(onKeyDown, this.inputHandleKeyDown),\n onBlur: callAllEventHandlers(onBlur, this.inputHandleBlur),\n }\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n eventHandlers = {\n onChange: callAllEventHandlers(\n onChange,\n onInput,\n this.inputHandleChange,\n ),\n onChangeText: callAllEventHandlers(onChangeText, onInput, text =>\n this.inputHandleChange({nativeEvent: {text}}),\n ),\n onBlur: callAllEventHandlers(onBlur, this.inputHandleBlur),\n }\n }\n\n return {\n 'aria-autocomplete': 'list',\n 'aria-activedescendant':\n isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0\n ? this.getItemId(highlightedIndex)\n : null,\n 'aria-controls': isOpen ? this.menuId : null,\n 'aria-labelledby': this.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: inputValue,\n id: this.inputId,\n ...eventHandlers,\n ...rest,\n }\n }\n\n inputHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && this.inputKeyDownHandlers[key]) {\n this.inputKeyDownHandlers[key].call(this, event)\n }\n }\n\n inputHandleChange = event => {\n this.internalSetState({\n type: stateChangeTypes.changeInput,\n isOpen: true,\n inputValue: isReactNative\n ? /* istanbul ignore next (react-native) */ event.nativeEvent.text\n : event.target.value,\n highlightedIndex: this.props.defaultHighlightedIndex,\n })\n }\n\n inputHandleBlur = () => {\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element\n this.internalSetTimeout(() => {\n const downshiftButtonIsActive =\n this.props.environment.document &&\n !!this.props.environment.document.activeElement &&\n !!this.props.environment.document.activeElement.dataset &&\n this.props.environment.document.activeElement.dataset.toggle &&\n this._rootNode &&\n this._rootNode.contains(this.props.environment.document.activeElement)\n if (!this.isMouseDown && !downshiftButtonIsActive) {\n this.reset({type: stateChangeTypes.blurInput})\n }\n })\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT\n\n /////////////////////////////// MENU\n\n menuRef = node => {\n this._menuNode = node\n }\n\n getMenuProps = (\n {refKey = 'ref', ref, ...props} = {},\n {suppressRefError = false} = {},\n ) => {\n this.getMenuProps.called = true\n this.getMenuProps.refKey = refKey\n this.getMenuProps.suppressRefError = suppressRefError\n\n return {\n [refKey]: handleRefs(ref, this.menuRef),\n role: 'listbox',\n 'aria-labelledby': props && props['aria-label'] ? null : this.labelId,\n id: this.menuId,\n ...props,\n }\n }\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU\n\n /////////////////////////////// ITEM\n getItemProps = ({\n onMouseMove,\n onMouseDown,\n onClick,\n onPress,\n index,\n item = process.env.NODE_ENV === 'production'\n ? /* istanbul ignore next */ undefined\n : requiredProp('getItemProps', 'item'),\n ...rest\n } = {}) => {\n if (index === undefined) {\n this.items.push(item)\n index = this.items.indexOf(item)\n } else {\n this.items[index] = item\n }\n\n const onSelectKey = isReactNative\n ? /* istanbul ignore next (react-native) */ 'onPress'\n : 'onClick'\n const customClickHandler = isReactNative\n ? /* istanbul ignore next (react-native) */ onPress\n : onClick\n\n const enabledEventHandlers = {\n // onMouseMove is used over onMouseEnter here. onMouseMove\n // is only triggered on actual mouse movement while onMouseEnter\n // can fire on DOM changes, interrupting keyboard navigation\n onMouseMove: callAllEventHandlers(onMouseMove, () => {\n if (index === this.getState().highlightedIndex) {\n return\n }\n this.setHighlightedIndex(index, {\n type: stateChangeTypes.itemMouseEnter,\n })\n\n // We never want to manually scroll when changing state based\n // on `onMouseMove` because we will be moving the element out\n // from under the user which is currently scrolling/moving the\n // cursor\n this.avoidScrolling = true\n this.internalSetTimeout(() => (this.avoidScrolling = false), 250)\n }),\n onMouseDown: callAllEventHandlers(onMouseDown, event => {\n // This prevents the activeElement from being changed\n // to the item so it can remain with the current activeElement\n // which is a more common use case.\n event.preventDefault()\n }),\n [onSelectKey]: callAllEventHandlers(customClickHandler, () => {\n this.selectItemAtIndex(index, {\n type: stateChangeTypes.clickItem,\n })\n }),\n }\n\n // Passing down the onMouseDown handler to prevent redirect\n // of the activeElement if clicking on disabled items\n const eventHandlers = rest.disabled\n ? {onMouseDown: enabledEventHandlers.onMouseDown}\n : enabledEventHandlers\n\n return {\n id: this.getItemId(index),\n role: 'option',\n 'aria-selected': this.getState().highlightedIndex === index,\n ...eventHandlers,\n ...rest,\n }\n }\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM\n\n clearItems = () => {\n this.items = []\n }\n\n reset = (otherStateToSet = {}, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n ({selectedItem}) => ({\n isOpen: this.props.defaultIsOpen,\n highlightedIndex: this.props.defaultHighlightedIndex,\n inputValue: this.props.itemToString(selectedItem),\n ...otherStateToSet,\n }),\n cb,\n )\n }\n\n toggleMenu = (otherStateToSet = {}, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n ({isOpen}) => {\n return {\n isOpen: !isOpen,\n ...(isOpen && {\n highlightedIndex: this.props.defaultHighlightedIndex,\n }),\n ...otherStateToSet,\n }\n },\n () => {\n const {isOpen, highlightedIndex} = this.getState()\n if (isOpen) {\n if (this.getItemCount() > 0 && typeof highlightedIndex === 'number') {\n this.setHighlightedIndex(highlightedIndex, otherStateToSet)\n }\n }\n cbToCb(cb)()\n },\n )\n }\n\n openMenu = cb => {\n this.internalSetState({isOpen: true}, cb)\n }\n\n closeMenu = cb => {\n this.internalSetState({isOpen: false}, cb)\n }\n\n updateStatus = debounce(() => {\n const state = this.getState()\n const item = this.items[state.highlightedIndex]\n const resultCount = this.getItemCount()\n const status = this.props.getA11yStatusMessage({\n itemToString: this.props.itemToString,\n previousResultCount: this.previousResultCount,\n resultCount,\n highlightedItem: item,\n ...state,\n })\n this.previousResultCount = resultCount\n\n setA11yStatus(status, this.props.environment.document)\n }, 200)\n\n componentDidMount() {\n /* istanbul ignore if (react-native) */\n if (\n process.env.NODE_ENV !== 'production' &&\n !isReactNative &&\n this.getMenuProps.called &&\n !this.getMenuProps.suppressRefError\n ) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps)\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n this.cleanup = () => {\n this.internalClearTimeouts()\n }\n } else {\n // this.isMouseDown helps us track whether the mouse is currently held down.\n // This is useful when the user clicks on an item in the list, but holds the mouse\n // down long enough for the list to disappear (because the blur event fires on the input)\n // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should\n // trigger hiding the menu.\n const onMouseDown = () => {\n this.isMouseDown = true\n }\n const onMouseUp = event => {\n this.isMouseDown = false\n // if the target element or the activeElement is within a downshift node\n // then we don't want to reset downshift\n const contextWithinDownshift = targetWithinDownshift(\n event.target,\n [this._rootNode, this._menuNode],\n this.props.environment.document,\n )\n if (!contextWithinDownshift && this.getState().isOpen) {\n this.reset({type: stateChangeTypes.mouseUp}, () =>\n this.props.onOuterClick(this.getStateAndHelpers()),\n )\n }\n }\n // Touching an element in iOS gives focus and hover states, but touching out of\n // the element will remove hover, and persist the focus state, resulting in the\n // blur event not being triggered.\n // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.\n // If the user taps outside of Downshift, the component should be reset,\n // but not if the user is swiping\n const onTouchStart = () => {\n this.isTouchMove = false\n }\n\n const onTouchMove = () => {\n this.isTouchMove = true\n }\n\n const onTouchEnd = event => {\n const contextWithinDownshift = targetWithinDownshift(\n event.target,\n [this._rootNode, this._menuNode],\n this.props.environment.document,\n false,\n )\n if (\n !this.isTouchMove &&\n !contextWithinDownshift &&\n this.getState().isOpen\n ) {\n this.reset({type: stateChangeTypes.touchEnd}, () =>\n this.props.onOuterClick(this.getStateAndHelpers()),\n )\n }\n }\n const {environment} = this.props\n\n environment.addEventListener('mousedown', onMouseDown)\n environment.addEventListener('mouseup', onMouseUp)\n environment.addEventListener('touchstart', onTouchStart)\n environment.addEventListener('touchmove', onTouchMove)\n environment.addEventListener('touchend', onTouchEnd)\n\n this.cleanup = () => {\n this.internalClearTimeouts()\n this.updateStatus.cancel()\n environment.removeEventListener('mousedown', onMouseDown)\n environment.removeEventListener('mouseup', onMouseUp)\n environment.removeEventListener('touchstart', onTouchStart)\n environment.removeEventListener('touchmove', onTouchMove)\n environment.removeEventListener('touchend', onTouchEnd)\n }\n }\n }\n\n shouldScroll(prevState, prevProps) {\n const {highlightedIndex: currentHighlightedIndex} =\n this.props.highlightedIndex === undefined ? this.getState() : this.props\n const {highlightedIndex: prevHighlightedIndex} =\n prevProps.highlightedIndex === undefined ? prevState : prevProps\n const scrollWhenOpen =\n currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen\n const scrollWhenNavigating =\n currentHighlightedIndex !== prevHighlightedIndex\n\n return scrollWhenOpen || scrollWhenNavigating\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged(this.state, prevProps, this.props)\n /* istanbul ignore if (react-native) */\n if (\n !isReactNative &&\n this.getMenuProps.called &&\n !this.getMenuProps.suppressRefError\n ) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps)\n }\n }\n\n if (\n isControlledProp(this.props, 'selectedItem') &&\n this.props.selectedItemChanged(\n prevProps.selectedItem,\n this.props.selectedItem,\n )\n ) {\n this.internalSetState({\n type: stateChangeTypes.controlledPropUpdatedSelectedItem,\n inputValue: this.props.itemToString(this.props.selectedItem),\n })\n }\n\n if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {\n this.scrollHighlightedItemIntoView()\n }\n\n /* istanbul ignore else (react-native) */\n if (!isReactNative) {\n this.updateStatus()\n }\n }\n\n componentWillUnmount() {\n this.cleanup() // avoids memory leak\n }\n\n render() {\n const children = unwrapArray(this.props.children, noop)\n // because the items are rerendered every time we call the children\n // we clear this out each render and it will be populated again as\n // getItemProps is called.\n this.clearItems()\n // we reset this so we know whether the user calls getRootProps during\n // this render. If they do then we don't need to do anything,\n // if they don't then we need to clone the element they return and\n // apply the props for them.\n this.getRootProps.called = false\n this.getRootProps.refKey = undefined\n this.getRootProps.suppressRefError = undefined\n // we do something similar for getMenuProps\n this.getMenuProps.called = false\n this.getMenuProps.refKey = undefined\n this.getMenuProps.suppressRefError = undefined\n // we do something similar for getLabelProps\n this.getLabelProps.called = false\n // and something similar for getInputProps\n this.getInputProps.called = false\n const element = unwrapArray(children(this.getStateAndHelpers()))\n if (!element) {\n return null\n }\n\n if (this.getRootProps.called || this.props.suppressRefError) {\n if (\n process.env.NODE_ENV !== 'production' &&\n !this.getRootProps.suppressRefError &&\n !this.props.suppressRefError\n ) {\n validateGetRootPropsCalledCorrectly(element, this.getRootProps)\n }\n return element\n } else if (isDOMElement(element)) {\n // they didn't apply the root props, but we can clone\n // this and apply the props ourselves\n return cloneElement(element, this.getRootProps(getElementProps(element)))\n }\n\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n // they didn't apply the root props, but they need to\n // otherwise we can't query around the autocomplete\n\n throw new Error(\n 'downshift: If you return a non-DOM element, you must apply the getRootProps function',\n )\n }\n\n /* istanbul ignore next */\n return undefined\n }\n}\n\nexport default Downshift\n\nfunction validateGetMenuPropsCalledCorrectly(node, {refKey}) {\n if (!node) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: The ref prop \"${refKey}\" from getMenuProps was not applied correctly on your menu element.`,\n )\n }\n}\n\nfunction validateGetRootPropsCalledCorrectly(element, {refKey}) {\n const refKeySpecified = refKey !== 'ref'\n const isComposite = !isDOMElement(element)\n if (isComposite && !refKeySpecified && !isForwardRef(element)) {\n // eslint-disable-next-line no-console\n console.error(\n 'downshift: You returned a non-DOM element. You must specify a refKey in getRootProps',\n )\n } else if (!isComposite && refKeySpecified) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"${refKey}\"`,\n )\n }\n if (!isForwardRef(element) && !getElementProps(element)[refKey]) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You must apply the ref prop \"${refKey}\" from getRootProps onto your root element.`,\n )\n }\n}\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import PropTypes from 'prop-types'\nimport {\n useRef,\n useCallback,\n useReducer,\n useEffect,\n useLayoutEffect,\n} from 'react'\nimport {\n scrollIntoView,\n getNextWrappingIndex,\n getState,\n generateId,\n debounce,\n targetWithinDownshift,\n validateControlledUnchanged,\n} from '../utils'\nimport setStatus from '../set-a11y-status'\n\nconst dropdownDefaultStateValues = {\n highlightedIndex: -1,\n isOpen: false,\n selectedItem: null,\n inputValue: '',\n}\n\nfunction callOnChangeProps(action, state, newState) {\n const {props, type} = action\n const changes = {}\n\n Object.keys(state).forEach(key => {\n invokeOnChangeHandler(key, action, state, newState)\n\n if (newState[key] !== state[key]) {\n changes[key] = newState[key]\n }\n })\n\n if (props.onStateChange && Object.keys(changes).length) {\n props.onStateChange({type, ...changes})\n }\n}\n\nfunction invokeOnChangeHandler(key, action, state, newState) {\n const {props, type} = action\n const handler = `on${capitalizeString(key)}Change`\n if (\n props[handler] &&\n newState[key] !== undefined &&\n newState[key] !== state[key]\n ) {\n props[handler]({type, ...newState})\n }\n}\n\n/**\n * Default state reducer that returns the changes.\n *\n * @param {Object} s state.\n * @param {Object} a action with changes.\n * @returns {Object} changes.\n */\nfunction stateReducer(s, a) {\n return a.changes\n}\n\n/**\n * Returns a message to be added to aria-live region when item is selected.\n *\n * @param {Object} selectionParameters Parameters required to build the message.\n * @returns {string} The a11y message.\n */\nfunction getA11ySelectionMessage(selectionParameters) {\n const {selectedItem, itemToString: itemToStringLocal} = selectionParameters\n\n return selectedItem\n ? `${itemToStringLocal(selectedItem)} has been selected.`\n : ''\n}\n\n/**\n * Debounced call for updating the a11y message.\n */\nconst updateA11yStatus = debounce((getA11yMessage, document) => {\n setStatus(getA11yMessage(), document)\n}, 200)\n\n\n// istanbul ignore next\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' &&\n typeof window.document !== 'undefined' &&\n typeof window.document.createElement !== 'undefined'\n ? useLayoutEffect\n : useEffect\n\nexport function getElementIds({\n id,\n labelId,\n menuId,\n getItemId,\n toggleButtonId,\n}) {\n const uniqueId = id === undefined ? `downshift-${generateId()}` : id\n\n return {\n labelId: labelId || `${uniqueId}-label`,\n menuId: menuId || `${uniqueId}-menu`,\n getItemId: getItemId || (index => `${uniqueId}-item-${index}`),\n toggleButtonId: toggleButtonId || `${uniqueId}-toggle-button`,\n }\n}\n\nexport function getItemIndex(index, item, items) {\n if (index !== undefined) {\n return index\n }\n if (items.length === 0) {\n return -1\n }\n return items.indexOf(item)\n}\n\nfunction itemToString(item) {\n return item ? String(item) : ''\n}\n\nexport function getPropTypesValidator(caller, propTypes) {\n // istanbul ignore next\n return function validate(options = {}) {\n Object.keys(propTypes).forEach(key => {\n PropTypes.checkPropTypes(propTypes, options, key, caller.name)\n })\n }\n}\n\nexport function isAcceptedCharacterKey(key) {\n return /^\\S{1}$/.test(key)\n}\n\nexport function capitalizeString(string) {\n return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`\n}\n\nexport function useLatestRef(val) {\n const ref = useRef(val)\n // technically this is not \"concurrent mode safe\" because we're manipulating\n // the value during render (so it's not idempotent). However, the places this\n // hook is used is to support memoizing callbacks which will be called\n // *during* render, so we need the latest values *during* render.\n // If not for this, then we'd probably want to use useLayoutEffect instead.\n ref.current = val\n return ref\n}\n\n/**\n * Computes the controlled state using a the previous state, props,\n * two reducers, one from downshift and an optional one from the user.\n * Also calls the onChange handlers for state values that have changed.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nexport function useEnhancedReducer(reducer, initialState, props) {\n const prevStateRef = useRef()\n const actionRef = useRef()\n const enhancedReducer = useCallback(\n (state, action) => {\n actionRef.current = action\n state = getState(state, action.props)\n\n const changes = reducer(state, action)\n const newState = action.props.stateReducer(state, {...action, changes})\n\n return newState\n },\n [reducer],\n )\n const [state, dispatch] = useReducer(enhancedReducer, initialState)\n const propsRef = useLatestRef(props)\n const dispatchWithProps = useCallback(\n action => dispatch({props: propsRef.current, ...action}),\n [propsRef],\n )\n const action = actionRef.current\n\n useEffect(() => {\n if (action && prevStateRef.current && prevStateRef.current !== state) {\n callOnChangeProps(\n action,\n getState(prevStateRef.current, action.props),\n state,\n )\n }\n\n prevStateRef.current = state\n }, [state, props, action])\n\n return [state, dispatchWithProps]\n}\n\n/**\n * Wraps the useEnhancedReducer and applies the controlled prop values before\n * returning the new state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nexport function useControlledReducer(reducer, initialState, props) {\n const [state, dispatch] = useEnhancedReducer(reducer, initialState, props)\n\n return [getState(state, props), dispatch]\n}\n\nexport const defaultProps = {\n itemToString,\n stateReducer,\n getA11ySelectionMessage,\n scrollIntoView,\n circularNavigation: false,\n environment:\n typeof window === 'undefined' /* istanbul ignore next (ssr) */\n ? {}\n : window,\n}\n\nexport function getDefaultValue(\n props,\n propKey,\n defaultStateValues = dropdownDefaultStateValues,\n) {\n const defaultPropKey = `default${capitalizeString(propKey)}`\n\n if (defaultPropKey in props) {\n return props[defaultPropKey]\n }\n\n return defaultStateValues[propKey]\n}\n\nexport function getInitialValue(\n props,\n propKey,\n defaultStateValues = dropdownDefaultStateValues,\n) {\n if (propKey in props) {\n return props[propKey]\n }\n\n const initialPropKey = `initial${capitalizeString(propKey)}`\n\n if (initialPropKey in props) {\n return props[initialPropKey]\n }\n return getDefaultValue(props, propKey, defaultStateValues)\n}\n\nexport function getInitialState(props) {\n const selectedItem = getInitialValue(props, 'selectedItem')\n const isOpen = getInitialValue(props, 'isOpen')\n const highlightedIndex = getInitialValue(props, 'highlightedIndex')\n const inputValue = getInitialValue(props, 'inputValue')\n\n return {\n highlightedIndex:\n highlightedIndex < 0 && selectedItem && isOpen\n ? props.items.indexOf(selectedItem)\n : highlightedIndex,\n isOpen,\n selectedItem,\n inputValue,\n }\n}\n\nexport function getHighlightedIndexOnOpen(\n props,\n state,\n offset,\n getItemNodeFromIndex,\n) {\n const {items, initialHighlightedIndex, defaultHighlightedIndex} = props\n const {selectedItem, highlightedIndex} = state\n\n if (items.length === 0) {\n return -1\n }\n\n // initialHighlightedIndex will give value to highlightedIndex on initial state only.\n if (\n initialHighlightedIndex !== undefined &&\n highlightedIndex === initialHighlightedIndex\n ) {\n return initialHighlightedIndex\n }\n if (defaultHighlightedIndex !== undefined) {\n return defaultHighlightedIndex\n }\n if (selectedItem) {\n if (offset === 0) {\n return items.indexOf(selectedItem)\n }\n return getNextWrappingIndex(\n offset,\n items.indexOf(selectedItem),\n items.length,\n getItemNodeFromIndex,\n false,\n )\n }\n if (offset === 0) {\n return -1\n }\n return offset < 0 ? items.length - 1 : 0\n}\n\n/**\n * Reuse the movement tracking of mouse and touch events.\n *\n * @param {boolean} isOpen Whether the dropdown is open or not.\n * @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)\n * @param {Object} environment Environment where component/hook exists.\n * @param {Function} handleBlur Handler on blur from mouse or touch.\n * @returns {Object} Ref containing whether mouseDown or touchMove event is happening\n */\nexport function useMouseAndTouchTracker(\n isOpen,\n downshiftElementRefs,\n environment,\n handleBlur,\n) {\n const mouseAndTouchTrackersRef = useRef({\n isMouseDown: false,\n isTouchMove: false,\n })\n\n useEffect(() => {\n // The same strategy for checking if a click occurred inside or outside downsift\n // as in downshift.js.\n const onMouseDown = () => {\n mouseAndTouchTrackersRef.current.isMouseDown = true\n }\n const onMouseUp = event => {\n mouseAndTouchTrackersRef.current.isMouseDown = false\n if (\n isOpen &&\n !targetWithinDownshift(\n event.target,\n downshiftElementRefs.map(ref => ref.current),\n environment.document,\n )\n ) {\n handleBlur()\n }\n }\n const onTouchStart = () => {\n mouseAndTouchTrackersRef.current.isTouchMove = false\n }\n const onTouchMove = () => {\n mouseAndTouchTrackersRef.current.isTouchMove = true\n }\n const onTouchEnd = event => {\n if (\n isOpen &&\n !mouseAndTouchTrackersRef.current.isTouchMove &&\n !targetWithinDownshift(\n event.target,\n downshiftElementRefs.map(ref => ref.current),\n environment.document,\n false,\n )\n ) {\n handleBlur()\n }\n }\n\n environment.addEventListener('mousedown', onMouseDown)\n environment.addEventListener('mouseup', onMouseUp)\n environment.addEventListener('touchstart', onTouchStart)\n environment.addEventListener('touchmove', onTouchMove)\n environment.addEventListener('touchend', onTouchEnd)\n\n return function cleanup() {\n environment.removeEventListener('mousedown', onMouseDown)\n environment.removeEventListener('mouseup', onMouseUp)\n environment.removeEventListener('touchstart', onTouchStart)\n environment.removeEventListener('touchmove', onTouchMove)\n environment.removeEventListener('touchend', onTouchEnd)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, environment])\n\n return mouseAndTouchTrackersRef\n}\n\n/**\n * Custom hook that checks if getter props are called correctly.\n *\n * @param {...any} propKeys Getter prop names to be handled.\n * @returns {Function} Setter function called inside getter props to set call information.\n */\nexport function useGetterPropsCalledChecker(...propKeys) {\n const isNotProduction = process.env.NODE_ENV !== 'production'\n const isInitialMountRef = useRef(true)\n const getterPropsCalledRef = useRef(\n propKeys.reduce((acc, propKey) => {\n acc[propKey] = {}\n return acc\n }, {}),\n )\n\n useEffect(() => {\n if (!isNotProduction) {\n return\n }\n\n Object.keys(getterPropsCalledRef.current).forEach(propKey => {\n const propCallInfo = getterPropsCalledRef.current[propKey]\n if (isInitialMountRef.current) {\n if (!Object.keys(propCallInfo).length) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You forgot to call the ${propKey} getter function on your component / element.`,\n )\n return\n }\n }\n\n const {suppressRefError, refKey, elementRef} = propCallInfo\n\n if ((!elementRef || !elementRef.current) && !suppressRefError) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: The ref prop \"${refKey}\" from ${propKey} was not applied correctly on your element.`,\n )\n }\n })\n\n isInitialMountRef.current = false\n })\n\n const setGetterPropCallInfo = useCallback(\n (propKey, suppressRefError, refKey, elementRef) => {\n if (process.env.NODE_ENV !== 'production') {\n getterPropsCalledRef.current[propKey] = {\n suppressRefError,\n refKey,\n elementRef,\n }\n }\n },\n [],\n )\n\n return setGetterPropCallInfo\n}\n\nexport function useA11yMessageSetter(\n getA11yMessage,\n dependencyArray,\n {\n isInitialMount,\n previousResultCount,\n highlightedIndex,\n items,\n environment,\n ...rest\n },\n) {\n // Sets a11y status message on changes in state.\n useEffect(() => {\n if (isInitialMount) {\n return\n }\n\n updateA11yStatus(\n () =>\n getA11yMessage({\n highlightedIndex,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n previousResultCount,\n ...rest,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencyArray)\n}\n\nexport function useScrollIntoView({\n highlightedIndex,\n isOpen,\n itemRefs,\n getItemNodeFromIndex,\n menuElement,\n scrollIntoView: scrollIntoViewProp,\n}) {\n // used not to scroll on highlight by mouse.\n const shouldScrollRef = useRef(true)\n // Scroll on highlighted item if change comes from keyboard.\n useIsomorphicLayoutEffect(() => {\n if (\n highlightedIndex < 0 ||\n !isOpen ||\n !Object.keys(itemRefs.current).length\n ) {\n return\n }\n\n if (shouldScrollRef.current === false) {\n shouldScrollRef.current = true\n } else {\n scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex])\n\n return shouldScrollRef\n}\n\nexport function useControlPropsValidator({isInitialMount, props, state}) {\n // used for checking when props are moving from controlled to uncontrolled.\n const prevPropsRef = useRef(props)\n\n useEffect(() => {\n if (isInitialMount) {\n return\n }\n\n validateControlledUnchanged(state, prevPropsRef.current, props)\n prevPropsRef.current = props\n }, [state, props, isInitialMount])\n}\n","import PropTypes from 'prop-types'\nimport {defaultProps as commonDefaultProps} from '../utils'\n\nfunction getItemIndexByCharacterKey(\n keysSoFar,\n highlightedIndex,\n items,\n itemToStringParam,\n getItemNodeFromIndex,\n) {\n const lowerCasedItemStrings = items.map(item =>\n itemToStringParam(item).toLowerCase(),\n )\n const lowerCasedKeysSoFar = keysSoFar.toLowerCase()\n const isValid = (itemString, index) => {\n const element = getItemNodeFromIndex(index)\n\n return (\n itemString.startsWith(lowerCasedKeysSoFar) &&\n !(element && element.hasAttribute('disabled'))\n )\n }\n\n for (\n let index = highlightedIndex + 1;\n index < lowerCasedItemStrings.length;\n index++\n ) {\n const itemString = lowerCasedItemStrings[index]\n\n if (isValid(itemString, index)) {\n return index\n }\n }\n\n for (let index = 0; index < highlightedIndex; index++) {\n const itemString = lowerCasedItemStrings[index]\n\n if (isValid(itemString, index)) {\n return index\n }\n }\n\n return highlightedIndex\n}\n\nconst propTypes = {\n items: PropTypes.array.isRequired,\n itemToString: PropTypes.func,\n getA11yStatusMessage: PropTypes.func,\n getA11ySelectionMessage: PropTypes.func,\n circularNavigation: PropTypes.bool,\n highlightedIndex: PropTypes.number,\n defaultHighlightedIndex: PropTypes.number,\n initialHighlightedIndex: PropTypes.number,\n isOpen: PropTypes.bool,\n defaultIsOpen: PropTypes.bool,\n initialIsOpen: PropTypes.bool,\n selectedItem: PropTypes.any,\n initialSelectedItem: PropTypes.any,\n defaultSelectedItem: PropTypes.any,\n id: PropTypes.string,\n labelId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n toggleButtonId: PropTypes.string,\n stateReducer: PropTypes.func,\n onSelectedItemChange: PropTypes.func,\n onHighlightedIndexChange: PropTypes.func,\n onStateChange: PropTypes.func,\n onIsOpenChange: PropTypes.func,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n}\n\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specift if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage({isOpen, resultCount, previousResultCount}) {\n if (!isOpen) {\n return ''\n }\n\n if (!resultCount) {\n return 'No results are available.'\n }\n\n if (resultCount !== previousResultCount) {\n return `${resultCount} result${\n resultCount === 1 ? ' is' : 's are'\n } available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.`\n }\n \n return ''\n}\n\nconst defaultProps = {\n ...commonDefaultProps,\n getA11yStatusMessage,\n}\n\nexport {propTypes, getItemIndexByCharacterKey, defaultProps}\n","import {getNextWrappingIndex, getNextNonDisabledIndex} from '../../utils'\nimport {getHighlightedIndexOnOpen, getDefaultValue} from '../utils'\nimport {getItemIndexByCharacterKey} from './utils'\nimport * as stateChangeTypes from './stateChangeTypes'\n\n/* eslint-disable complexity */\nexport default function downshiftSelectReducer(state, action) {\n const {type, props, shiftKey} = action\n let changes\n\n switch (type) {\n case stateChangeTypes.ItemMouseMove:\n changes = {\n highlightedIndex: action.index,\n }\n\n break\n case stateChangeTypes.ItemClick:\n changes = {\n isOpen: getDefaultValue(props, 'isOpen'),\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n selectedItem: props.items[action.index],\n }\n\n break\n case stateChangeTypes.ToggleButtonKeyDownCharacter:\n {\n const lowercasedKey = action.key\n const inputValue = `${state.inputValue}${lowercasedKey}`\n const itemIndex = getItemIndexByCharacterKey(\n inputValue,\n state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,\n props.items,\n props.itemToString,\n action.getItemNodeFromIndex,\n )\n\n changes = {\n inputValue,\n ...(itemIndex >= 0 && {\n selectedItem: props.items[itemIndex],\n }),\n }\n }\n\n break\n case stateChangeTypes.ToggleButtonKeyDownArrowDown:\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(\n props,\n state,\n 1,\n action.getItemNodeFromIndex,\n ),\n isOpen: true,\n }\n\n break\n case stateChangeTypes.ToggleButtonKeyDownArrowUp:\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(\n props,\n state,\n -1,\n action.getItemNodeFromIndex,\n ),\n isOpen: true,\n }\n\n break\n case stateChangeTypes.MenuKeyDownEnter:\n case stateChangeTypes.MenuKeyDownSpaceButton:\n changes = {\n isOpen: getDefaultValue(props, 'isOpen'),\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n ...(state.highlightedIndex >= 0 && {\n selectedItem: props.items[state.highlightedIndex],\n }),\n }\n\n break\n case stateChangeTypes.MenuKeyDownHome:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n 1,\n 0,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n\n break\n case stateChangeTypes.MenuKeyDownEnd:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n -1,\n props.items.length - 1,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n\n break\n case stateChangeTypes.MenuKeyDownEscape:\n changes = {\n isOpen: false,\n highlightedIndex: -1,\n }\n\n break\n case stateChangeTypes.MenuBlur:\n changes = {\n isOpen: false,\n highlightedIndex: -1,\n }\n\n break\n case stateChangeTypes.MenuKeyDownCharacter:\n {\n const lowercasedKey = action.key\n const inputValue = `${state.inputValue}${lowercasedKey}`\n const highlightedIndex = getItemIndexByCharacterKey(\n inputValue,\n state.highlightedIndex,\n props.items,\n props.itemToString,\n action.getItemNodeFromIndex,\n )\n\n changes = {\n inputValue,\n ...(highlightedIndex >= 0 && {\n highlightedIndex,\n }),\n }\n }\n break\n case stateChangeTypes.MenuKeyDownArrowDown:\n changes = {\n highlightedIndex: getNextWrappingIndex(\n shiftKey ? 5 : 1,\n state.highlightedIndex,\n props.items.length,\n action.getItemNodeFromIndex,\n props.circularNavigation,\n ),\n }\n\n break\n case stateChangeTypes.MenuKeyDownArrowUp:\n changes = {\n highlightedIndex: getNextWrappingIndex(\n shiftKey ? -5 : -1,\n state.highlightedIndex,\n props.items.length,\n action.getItemNodeFromIndex,\n props.circularNavigation,\n ),\n }\n\n break\n case stateChangeTypes.MenuMouseLeave:\n changes = {\n highlightedIndex: -1,\n }\n\n break\n case stateChangeTypes.ToggleButtonClick:\n case stateChangeTypes.FunctionToggleMenu:\n changes = {\n isOpen: !state.isOpen,\n highlightedIndex: state.isOpen\n ? -1\n : getHighlightedIndexOnOpen(props, state, 0),\n }\n\n break\n case stateChangeTypes.FunctionOpenMenu:\n changes = {\n isOpen: true,\n highlightedIndex: getHighlightedIndexOnOpen(props, state, 0),\n }\n\n break\n case stateChangeTypes.FunctionCloseMenu:\n changes = {\n isOpen: false,\n }\n\n break\n case stateChangeTypes.FunctionSetHighlightedIndex:\n changes = {\n highlightedIndex: action.highlightedIndex,\n }\n\n break\n case stateChangeTypes.FunctionSelectItem:\n changes = {\n selectedItem: action.selectedItem,\n }\n\n break\n case stateChangeTypes.FunctionSetInputValue:\n changes = {\n inputValue: action.inputValue,\n }\n\n break\n case stateChangeTypes.FunctionReset:\n changes = {\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n isOpen: getDefaultValue(props, 'isOpen'),\n selectedItem: getDefaultValue(props, 'selectedItem'),\n inputValue: getDefaultValue(props, 'inputValue'),\n }\n\n break\n default:\n throw new Error('Reducer called without proper action type.')\n }\n\n return {\n ...state,\n ...changes,\n }\n}\n/* eslint-enable complexity */\n","/* eslint-disable max-statements */\nimport {useRef, useEffect, useCallback, useMemo} from 'react'\nimport {\n getElementIds,\n getItemIndex,\n getPropTypesValidator,\n isAcceptedCharacterKey,\n useControlledReducer,\n getInitialState,\n useMouseAndTouchTracker,\n useGetterPropsCalledChecker,\n useLatestRef,\n useA11yMessageSetter,\n useScrollIntoView,\n useControlPropsValidator,\n} from '../utils'\nimport {\n callAllEventHandlers,\n handleRefs,\n debounce,\n normalizeArrowKey,\n} from '../../utils'\nimport downshiftSelectReducer from './reducer'\nimport {propTypes, defaultProps} from './utils'\nimport * as stateChangeTypes from './stateChangeTypes'\n\nconst validatePropTypes =\n process.env.NODE_ENV === 'production'\n ? /* istanbul ignore next */ null\n : getPropTypesValidator(useSelect, propTypes)\n\nuseSelect.stateChangeTypes = stateChangeTypes\n\nfunction useSelect(userProps = {}) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n validatePropTypes(userProps)\n }\n // Props defaults and destructuring.\n const props = {\n ...defaultProps,\n ...userProps,\n }\n const {\n items,\n scrollIntoView,\n environment,\n initialIsOpen,\n defaultIsOpen,\n itemToString,\n getA11ySelectionMessage,\n getA11yStatusMessage,\n } = props\n // Initial state depending on controlled props.\n const initialState = getInitialState(props)\n const [state, dispatch] = useControlledReducer(\n downshiftSelectReducer,\n initialState,\n props,\n )\n const {isOpen, highlightedIndex, selectedItem, inputValue} = state\n\n // Element efs.\n const toggleButtonRef = useRef(null)\n const menuRef = useRef(null)\n const itemRefs = useRef()\n itemRefs.current = {}\n // used not to trigger menu blur action in some scenarios.\n const shouldBlurRef = useRef(true)\n // used to keep the inputValue clearTimeout object between renders.\n const clearTimeoutRef = useRef(null)\n // prevent id re-generation between renders.\n const elementIdsRef = useRef(getElementIds(props))\n // used to keep track of how many items we had on previous cycle.\n const previousResultCountRef = useRef()\n const isInitialMountRef = useRef(true)\n // utility callback to get item element.\n const latest = useLatestRef({\n state,\n props,\n })\n\n // Some utils.\n const getItemNodeFromIndex = index =>\n itemRefs.current[elementIdsRef.current.getItemId(index)]\n\n // Effects.\n // Sets a11y status message on changes in state.\n useA11yMessageSetter(\n getA11yStatusMessage,\n [isOpen, highlightedIndex, inputValue, items],\n {\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items,\n environment,\n itemToString,\n ...state,\n },\n )\n // Sets a11y status message on changes in selectedItem.\n useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], {\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items,\n environment,\n itemToString,\n ...state,\n })\n // Scroll on highlighted item if change comes from keyboard.\n const shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex,\n isOpen,\n itemRefs,\n scrollIntoView,\n getItemNodeFromIndex,\n })\n // Sets cleanup for the keysSoFar after 500ms.\n useEffect(() => {\n // init the clean function here as we need access to dispatch.\n if (isInitialMountRef.current) {\n clearTimeoutRef.current = debounce(outerDispatch => {\n outerDispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: '',\n })\n }, 500)\n }\n\n if (!inputValue) {\n return\n }\n clearTimeoutRef.current(dispatch)\n }, [dispatch, inputValue])\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props,\n state,\n })\n /* Controls the focus on the menu or the toggle button. */\n useEffect(() => {\n // Don't focus menu on first render.\n if (isInitialMountRef.current) {\n // Unless it was initialised as open.\n if ((initialIsOpen || defaultIsOpen || isOpen) && menuRef.current) {\n menuRef.current.focus()\n }\n return\n }\n // Focus menu on open.\n if (isOpen) {\n // istanbul ignore else\n if (menuRef.current) {\n menuRef.current.focus()\n }\n return\n }\n // Focus toggleButton on close, but not if it was closed with (Shift+)Tab.\n if (environment.document.activeElement === menuRef.current) {\n // istanbul ignore else\n if (toggleButtonRef.current) {\n shouldBlurRef.current = false\n toggleButtonRef.current.focus()\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen])\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n previousResultCountRef.current = items.length\n })\n // Add mouse/touch events to document.\n const mouseAndTouchTrackersRef = useMouseAndTouchTracker(\n isOpen,\n [menuRef, toggleButtonRef],\n environment,\n () => {\n dispatch({\n type: stateChangeTypes.MenuBlur,\n })\n },\n )\n const setGetterPropCallInfo = useGetterPropsCalledChecker(\n 'getMenuProps',\n 'getToggleButtonProps',\n )\n // Make initial ref false.\n useEffect(() => {\n isInitialMountRef.current = false\n }, [])\n\n // Event handler functions.\n const toggleButtonKeyDownHandlers = useMemo(\n () => ({\n ArrowDown(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.ToggleButtonKeyDownArrowDown,\n getItemNodeFromIndex,\n shiftKey: event.shiftKey,\n })\n },\n ArrowUp(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.ToggleButtonKeyDownArrowUp,\n getItemNodeFromIndex,\n shiftKey: event.shiftKey,\n })\n },\n }),\n [dispatch],\n )\n const menuKeyDownHandlers = useMemo(\n () => ({\n ArrowDown(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownArrowDown,\n getItemNodeFromIndex,\n shiftKey: event.shiftKey,\n })\n },\n ArrowUp(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownArrowUp,\n getItemNodeFromIndex,\n shiftKey: event.shiftKey,\n })\n },\n Home(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownHome,\n getItemNodeFromIndex,\n })\n },\n End(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownEnd,\n getItemNodeFromIndex,\n })\n },\n Escape() {\n dispatch({\n type: stateChangeTypes.MenuKeyDownEscape,\n })\n },\n Enter(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownEnter,\n })\n },\n ' '(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownSpaceButton,\n })\n },\n }),\n [dispatch],\n )\n\n // Action functions.\n const toggleMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionToggleMenu,\n })\n }, [dispatch])\n const closeMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionCloseMenu,\n })\n }, [dispatch])\n const openMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionOpenMenu,\n })\n }, [dispatch])\n const setHighlightedIndex = useCallback(\n newHighlightedIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex,\n })\n },\n [dispatch],\n )\n const selectItem = useCallback(\n newSelectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionSelectItem,\n selectedItem: newSelectedItem,\n })\n },\n [dispatch],\n )\n const reset = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }, [dispatch])\n const setInputValue = useCallback(\n newInputValue => {\n dispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: newInputValue,\n })\n },\n [dispatch],\n )\n // Getter functions.\n const getLabelProps = useCallback(\n labelProps => ({\n id: elementIdsRef.current.labelId,\n htmlFor: elementIdsRef.current.toggleButtonId,\n ...labelProps,\n }),\n [],\n )\n const getMenuProps = useCallback(\n (\n {onMouseLeave, refKey = 'ref', onKeyDown, onBlur, ref, ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n const latestState = latest.current.state\n const menuHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && menuKeyDownHandlers[key]) {\n menuKeyDownHandlers[key](event)\n } else if (isAcceptedCharacterKey(key)) {\n dispatch({\n type: stateChangeTypes.MenuKeyDownCharacter,\n key,\n getItemNodeFromIndex,\n })\n }\n }\n const menuHandleBlur = () => {\n // if the blur was a result of selection, we don't trigger this action.\n if (shouldBlurRef.current === false) {\n shouldBlurRef.current = true\n return\n }\n\n const shouldBlur = !mouseAndTouchTrackersRef.current.isMouseDown\n /* istanbul ignore else */\n if (shouldBlur) {\n dispatch({type: stateChangeTypes.MenuBlur})\n }\n }\n const menuHandleMouseLeave = () => {\n dispatch({\n type: stateChangeTypes.MenuMouseLeave,\n })\n }\n\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef)\n\n return {\n [refKey]: handleRefs(ref, menuNode => {\n menuRef.current = menuNode\n }),\n id: elementIdsRef.current.menuId,\n role: 'listbox',\n 'aria-labelledby': elementIdsRef.current.labelId,\n tabIndex: -1,\n ...(latestState.isOpen &&\n latestState.highlightedIndex > -1 && {\n 'aria-activedescendant': elementIdsRef.current.getItemId(\n latestState.highlightedIndex,\n ),\n }),\n onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),\n onKeyDown: callAllEventHandlers(onKeyDown, menuHandleKeyDown),\n onBlur: callAllEventHandlers(onBlur, menuHandleBlur),\n ...rest,\n }\n },\n [\n dispatch,\n latest,\n menuKeyDownHandlers,\n mouseAndTouchTrackersRef,\n setGetterPropCallInfo,\n ],\n )\n const getToggleButtonProps = useCallback(\n (\n {onClick, onKeyDown, refKey = 'ref', ref, ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n const toggleButtonHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ToggleButtonClick,\n })\n }\n const toggleButtonHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && toggleButtonKeyDownHandlers[key]) {\n toggleButtonKeyDownHandlers[key](event)\n } else if (isAcceptedCharacterKey(key)) {\n dispatch({\n type: stateChangeTypes.ToggleButtonKeyDownCharacter,\n key,\n getItemNodeFromIndex,\n })\n }\n }\n const toggleProps = {\n [refKey]: handleRefs(ref, toggleButtonNode => {\n toggleButtonRef.current = toggleButtonNode\n }),\n id: elementIdsRef.current.toggleButtonId,\n 'aria-haspopup': 'listbox',\n 'aria-expanded': latest.current.state.isOpen,\n 'aria-labelledby': `${elementIdsRef.current.labelId} ${elementIdsRef.current.toggleButtonId}`,\n ...rest,\n }\n\n if (!rest.disabled) {\n toggleProps.onClick = callAllEventHandlers(\n onClick,\n toggleButtonHandleClick,\n )\n toggleProps.onKeyDown = callAllEventHandlers(\n onKeyDown,\n toggleButtonHandleKeyDown,\n )\n }\n\n setGetterPropCallInfo(\n 'getToggleButtonProps',\n suppressRefError,\n refKey,\n toggleButtonRef,\n )\n\n return toggleProps\n },\n [dispatch, latest, toggleButtonKeyDownHandlers, setGetterPropCallInfo],\n )\n const getItemProps = useCallback(\n ({\n item,\n index,\n onMouseMove,\n onClick,\n refKey = 'ref',\n ref,\n ...rest\n } = {}) => {\n const {state: latestState, props: latestProps} = latest.current\n const itemHandleMouseMove = () => {\n if (index === latestState.highlightedIndex) {\n return\n }\n shouldScrollRef.current = false\n dispatch({\n type: stateChangeTypes.ItemMouseMove,\n index,\n })\n }\n const itemHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ItemClick,\n index,\n })\n }\n\n const itemIndex = getItemIndex(index, item, latestProps.items)\n if (itemIndex < 0) {\n throw new Error('Pass either item or item index in getItemProps!')\n }\n const itemProps = {\n role: 'option',\n 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,\n id: elementIdsRef.current.getItemId(itemIndex),\n [refKey]: handleRefs(ref, itemNode => {\n if (itemNode) {\n itemRefs.current[\n elementIdsRef.current.getItemId(itemIndex)\n ] = itemNode\n }\n }),\n ...rest,\n }\n\n if (!rest.disabled) {\n itemProps.onMouseMove = callAllEventHandlers(\n onMouseMove,\n itemHandleMouseMove,\n )\n itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick)\n }\n\n return itemProps\n },\n [dispatch, latest, shouldScrollRef],\n )\n\n return {\n // prop getters.\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getItemProps,\n // actions.\n toggleMenu,\n openMenu,\n closeMenu,\n setHighlightedIndex,\n selectItem,\n reset,\n setInputValue,\n // state.\n highlightedIndex,\n isOpen,\n selectedItem,\n inputValue,\n }\n}\n\nexport default useSelect\n","import productionEnum from '../../productionEnum.macro'\n\nexport const InputKeyDownArrowDown = productionEnum(\n '__input_keydown_arrow_down__',\n)\nexport const InputKeyDownArrowUp = productionEnum('__input_keydown_arrow_up__')\nexport const InputKeyDownEscape = productionEnum('__input_keydown_escape__')\nexport const InputKeyDownHome = productionEnum('__input_keydown_home__')\nexport const InputKeyDownEnd = productionEnum('__input_keydown_end__')\nexport const InputKeyDownEnter = productionEnum('__input_keydown_enter__')\nexport const InputChange = productionEnum('__input_change__')\nexport const InputBlur = productionEnum('__input_blur__')\n\nexport const MenuMouseLeave = productionEnum('__menu_mouse_leave__')\n\nexport const ItemMouseMove = productionEnum('__item_mouse_move__')\nexport const ItemClick = productionEnum('__item_click__')\n\nexport const ToggleButtonClick = productionEnum('__togglebutton_click__')\n\nexport const FunctionToggleMenu = productionEnum('__function_toggle_menu__')\nexport const FunctionOpenMenu = productionEnum('__function_open_menu__')\nexport const FunctionCloseMenu = productionEnum('__function_close_menu__')\nexport const FunctionSetHighlightedIndex = productionEnum(\n '__function_set_highlighted_index__',\n)\nexport const FunctionSelectItem = productionEnum('__function_select_item__')\nexport const FunctionSetInputValue = productionEnum(\n '__function_set_input_value__',\n)\nexport const FunctionReset = productionEnum('__function_reset__')\nexport const ControlledPropUpdatedSelectedItem = productionEnum(\n '__controlled_prop_updated_selected_item__',\n)\n","import {useRef, useEffect} from 'react'\nimport PropTypes from 'prop-types'\nimport {\n generateId,\n getA11yStatusMessage,\n isControlledProp,\n getState,\n} from '../../utils'\nimport {\n getElementIds as getElementIdsCommon,\n defaultProps as defaultPropsCommon,\n getInitialState as getInitialStateCommon,\n useEnhancedReducer,\n} from '../utils'\nimport {ControlledPropUpdatedSelectedItem} from './stateChangeTypes'\n\nexport function getElementIds({id, inputId, ...rest}) {\n const uniqueId = id === undefined ? `downshift-${generateId()}` : id\n\n return {\n inputId: inputId || `${uniqueId}-input`,\n ...getElementIdsCommon({id, ...rest}),\n }\n}\n\nexport function getInitialState(props) {\n const initialState = getInitialStateCommon(props)\n const {selectedItem} = initialState\n let {inputValue} = initialState\n\n if (\n inputValue === '' &&\n selectedItem &&\n props.defaultInputValue === undefined &&\n props.initialInputValue === undefined &&\n props.inputValue === undefined\n ) {\n inputValue = props.itemToString(selectedItem)\n }\n\n return {\n ...initialState,\n inputValue,\n }\n}\n\nexport const propTypes = {\n items: PropTypes.array.isRequired,\n itemToString: PropTypes.func,\n getA11yStatusMessage: PropTypes.func,\n getA11ySelectionMessage: PropTypes.func,\n circularNavigation: PropTypes.bool,\n highlightedIndex: PropTypes.number,\n defaultHighlightedIndex: PropTypes.number,\n initialHighlightedIndex: PropTypes.number,\n isOpen: PropTypes.bool,\n defaultIsOpen: PropTypes.bool,\n initialIsOpen: PropTypes.bool,\n selectedItem: PropTypes.any,\n initialSelectedItem: PropTypes.any,\n defaultSelectedItem: PropTypes.any,\n inputValue: PropTypes.string,\n defaultInputValue: PropTypes.string,\n initialInputValue: PropTypes.string,\n id: PropTypes.string,\n labelId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n inputId: PropTypes.string,\n toggleButtonId: PropTypes.string,\n stateReducer: PropTypes.func,\n onSelectedItemChange: PropTypes.func,\n onHighlightedIndexChange: PropTypes.func,\n onStateChange: PropTypes.func,\n onIsOpenChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n}\n\n/**\n * The useCombobox version of useControlledReducer, which also\n * checks if the controlled prop selectedItem changed between\n * renders. If so, it will also update inputValue with its\n * string equivalent. It uses the common useEnhancedReducer to\n * compute the rest of the state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nexport function useControlledReducer(reducer, initialState, props) {\n const previousSelectedItemRef = useRef()\n const [state, dispatch] = useEnhancedReducer(reducer, initialState, props)\n\n // ToDo: if needed, make same approach as selectedItemChanged from Downshift.\n useEffect(() => {\n if (isControlledProp(props, 'selectedItem')) {\n if (previousSelectedItemRef.current !== props.selectedItem) {\n dispatch({\n type: ControlledPropUpdatedSelectedItem,\n inputValue: props.itemToString(props.selectedItem),\n })\n }\n\n previousSelectedItemRef.current =\n state.selectedItem === previousSelectedItemRef.current\n ? props.selectedItem\n : state.selectedItem\n }\n })\n\n return [getState(state, props), dispatch]\n}\n\nexport const defaultProps = {\n ...defaultPropsCommon,\n getA11yStatusMessage,\n circularNavigation: true,\n}\n","import {getHighlightedIndexOnOpen, getDefaultValue} from '../utils'\nimport {getNextWrappingIndex, getNextNonDisabledIndex} from '../../utils'\nimport * as stateChangeTypes from './stateChangeTypes'\n\n/* eslint-disable complexity */\nexport default function downshiftUseComboboxReducer(state, action) {\n const {type, props, shiftKey} = action\n let changes\n\n switch (type) {\n case stateChangeTypes.ItemMouseMove:\n changes = {\n highlightedIndex: action.index,\n }\n break\n case stateChangeTypes.ItemClick:\n changes = {\n isOpen: getDefaultValue(props, 'isOpen'),\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n selectedItem: props.items[action.index],\n inputValue: props.itemToString(props.items[action.index]),\n }\n break\n case stateChangeTypes.InputKeyDownArrowDown:\n if (state.isOpen) {\n changes = {\n highlightedIndex: getNextWrappingIndex(\n shiftKey ? 5 : 1,\n state.highlightedIndex,\n props.items.length,\n action.getItemNodeFromIndex,\n props.circularNavigation,\n ),\n }\n } else {\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(\n props,\n state,\n 1,\n action.getItemNodeFromIndex,\n ),\n isOpen: true,\n }\n }\n break\n case stateChangeTypes.InputKeyDownArrowUp:\n if (state.isOpen) {\n changes = {\n highlightedIndex: getNextWrappingIndex(\n shiftKey ? -5 : -1,\n state.highlightedIndex,\n props.items.length,\n action.getItemNodeFromIndex,\n props.circularNavigation,\n ),\n }\n } else {\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(\n props,\n state,\n -1,\n action.getItemNodeFromIndex,\n ),\n isOpen: true,\n }\n }\n break\n case stateChangeTypes.InputKeyDownEnter:\n changes = {\n ...(state.isOpen &&\n state.highlightedIndex >= 0 && {\n selectedItem: props.items[state.highlightedIndex],\n isOpen: getDefaultValue(props, 'isOpen'),\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n inputValue: props.itemToString(props.items[state.highlightedIndex]),\n }),\n }\n break\n case stateChangeTypes.InputKeyDownEscape:\n changes = {\n isOpen: false,\n highlightedIndex: -1,\n ...(!state.isOpen && {\n selectedItem: null,\n inputValue: '',\n }),\n }\n break\n case stateChangeTypes.InputKeyDownHome:\n changes = {\n ...(state.isOpen && {\n highlightedIndex: getNextNonDisabledIndex(\n 1,\n 0,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }),\n }\n break\n case stateChangeTypes.InputKeyDownEnd:\n changes = {\n ...(state.isOpen && {\n highlightedIndex: getNextNonDisabledIndex(\n -1,\n props.items.length - 1,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }),\n }\n break\n case stateChangeTypes.InputBlur:\n if (state.isOpen) {\n changes = {\n isOpen: false,\n highlightedIndex: -1,\n ...(state.highlightedIndex >= 0 &&\n action.selectItem && {\n selectedItem: props.items[state.highlightedIndex],\n inputValue: props.itemToString(\n props.items[state.highlightedIndex],\n ),\n }),\n }\n }\n break\n case stateChangeTypes.InputChange:\n changes = {\n isOpen: true,\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n inputValue: action.inputValue,\n }\n break\n case stateChangeTypes.MenuMouseLeave:\n changes = {\n highlightedIndex: -1,\n }\n break\n case stateChangeTypes.ToggleButtonClick:\n case stateChangeTypes.FunctionToggleMenu:\n changes = {\n isOpen: !state.isOpen,\n highlightedIndex: state.isOpen\n ? -1\n : getHighlightedIndexOnOpen(props, state, 0),\n }\n break\n case stateChangeTypes.FunctionOpenMenu:\n changes = {\n isOpen: true,\n highlightedIndex: getHighlightedIndexOnOpen(props, state, 0),\n }\n break\n case stateChangeTypes.FunctionCloseMenu:\n changes = {\n isOpen: false,\n }\n break\n case stateChangeTypes.FunctionSetHighlightedIndex:\n changes = {\n highlightedIndex: action.highlightedIndex,\n }\n break\n case stateChangeTypes.FunctionSelectItem:\n changes = {\n selectedItem: action.selectedItem,\n inputValue: props.itemToString(action.selectedItem),\n }\n break\n case stateChangeTypes.ControlledPropUpdatedSelectedItem:\n case stateChangeTypes.FunctionSetInputValue:\n changes = {\n inputValue: action.inputValue,\n }\n break\n case stateChangeTypes.FunctionReset:\n changes = {\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n isOpen: getDefaultValue(props, 'isOpen'),\n selectedItem: getDefaultValue(props, 'selectedItem'),\n inputValue: getDefaultValue(props, 'inputValue'),\n }\n break\n default:\n throw new Error('Reducer called without proper action type.')\n }\n\n return {\n ...state,\n ...changes,\n }\n}\n/* eslint-enable complexity */\n","/* eslint-disable max-statements */\nimport {useRef, useEffect, useCallback, useMemo} from 'react'\nimport {isPreact, isReactNative} from '../../is.macro'\nimport {handleRefs, normalizeArrowKey, callAllEventHandlers} from '../../utils'\nimport {\n getItemIndex,\n getPropTypesValidator,\n useA11yMessageSetter,\n useMouseAndTouchTracker,\n useGetterPropsCalledChecker,\n useLatestRef,\n useScrollIntoView,\n useControlPropsValidator,\n} from '../utils'\nimport {\n getInitialState,\n propTypes,\n defaultProps,\n getElementIds,\n useControlledReducer,\n} from './utils'\nimport downshiftUseComboboxReducer from './reducer'\nimport * as stateChangeTypes from './stateChangeTypes'\n\nconst validatePropTypes =\n process.env.NODE_ENV === 'production'\n ? /* istanbul ignore next */ null\n : getPropTypesValidator(useCombobox, propTypes)\n\nuseCombobox.stateChangeTypes = stateChangeTypes\n\nfunction useCombobox(userProps = {}) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n validatePropTypes(userProps)\n }\n // Props defaults and destructuring.\n const props = {\n ...defaultProps,\n ...userProps,\n }\n const {\n initialIsOpen,\n defaultIsOpen,\n items,\n scrollIntoView,\n environment,\n getA11yStatusMessage,\n getA11ySelectionMessage,\n itemToString,\n } = props\n // Initial state depending on controlled props.\n const initialState = getInitialState(props)\n const [state, dispatch] = useControlledReducer(\n downshiftUseComboboxReducer,\n initialState,\n props,\n )\n const {isOpen, highlightedIndex, selectedItem, inputValue} = state\n\n // Element refs.\n const menuRef = useRef(null)\n const itemRefs = useRef()\n const inputRef = useRef(null)\n const toggleButtonRef = useRef(null)\n const comboboxRef = useRef(null)\n itemRefs.current = {}\n const isInitialMountRef = useRef(true)\n // prevent id re-generation between renders.\n const elementIdsRef = useRef(getElementIds(props))\n // used to keep track of how many items we had on previous cycle.\n const previousResultCountRef = useRef()\n // utility callback to get item element.\n const latest = useLatestRef({state, props})\n\n const getItemNodeFromIndex = index =>\n itemRefs.current[elementIdsRef.current.getItemId(index)]\n\n // Effects.\n // Sets a11y status message on changes in state.\n useA11yMessageSetter(\n getA11yStatusMessage,\n [isOpen, highlightedIndex, inputValue, items],\n {\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items,\n environment,\n itemToString,\n ...state,\n },\n )\n // Sets a11y status message on changes in selectedItem.\n useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], {\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items,\n environment,\n itemToString,\n ...state,\n })\n // Scroll on highlighted item if change comes from keyboard.\n const shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex,\n isOpen,\n itemRefs,\n scrollIntoView,\n getItemNodeFromIndex,\n })\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props,\n state,\n })\n // Controls the focus on the input on open.\n useEffect(() => {\n // Don't focus menu on first render.\n if (isInitialMountRef.current) {\n // Unless it was initialised as open.\n if (initialIsOpen || defaultIsOpen || isOpen) {\n if (inputRef.current) {\n inputRef.current.focus()\n }\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen])\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n previousResultCountRef.current = items.length\n })\n // Add mouse/touch events to document.\n const mouseAndTouchTrackersRef = useMouseAndTouchTracker(\n isOpen,\n [comboboxRef, menuRef, toggleButtonRef],\n environment,\n () => {\n dispatch({\n type: stateChangeTypes.InputBlur,\n selectItem: false,\n })\n },\n )\n const setGetterPropCallInfo = useGetterPropsCalledChecker(\n 'getInputProps',\n 'getComboboxProps',\n 'getMenuProps',\n )\n // Make initial ref false.\n useEffect(() => {\n isInitialMountRef.current = false\n }, [])\n\n /* Event handler functions */\n const inputKeyDownHandlers = useMemo(\n () => ({\n ArrowDown(event) {\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownArrowDown,\n shiftKey: event.shiftKey,\n getItemNodeFromIndex,\n })\n },\n ArrowUp(event) {\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownArrowUp,\n shiftKey: event.shiftKey,\n getItemNodeFromIndex,\n })\n },\n Home(event) {\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownHome,\n getItemNodeFromIndex,\n })\n },\n End(event) {\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownEnd,\n getItemNodeFromIndex,\n })\n },\n Escape() {\n dispatch({\n type: stateChangeTypes.InputKeyDownEscape,\n })\n },\n Enter(event) {\n // if IME composing, wait for next Enter keydown event.\n if (event.which === 229) {\n return\n }\n const latestState = latest.current.state\n\n if (latestState.isOpen) {\n event.preventDefault()\n }\n\n dispatch({\n type: stateChangeTypes.InputKeyDownEnter,\n getItemNodeFromIndex,\n })\n },\n }),\n [dispatch, latest],\n )\n\n // Getter props.\n const getLabelProps = useCallback(\n labelProps => ({\n id: elementIdsRef.current.labelId,\n htmlFor: elementIdsRef.current.inputId,\n ...labelProps,\n }),\n [],\n )\n const getMenuProps = useCallback(\n (\n {onMouseLeave, refKey = 'ref', ref, ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef)\n return {\n [refKey]: handleRefs(ref, menuNode => {\n menuRef.current = menuNode\n }),\n id: elementIdsRef.current.menuId,\n role: 'listbox',\n 'aria-labelledby': elementIdsRef.current.labelId,\n onMouseLeave: callAllEventHandlers(onMouseLeave, () => {\n dispatch({\n type: stateChangeTypes.MenuMouseLeave,\n })\n }),\n ...rest,\n }\n },\n [dispatch, setGetterPropCallInfo],\n )\n\n const getItemProps = useCallback(\n ({\n item,\n index,\n refKey = 'ref',\n ref,\n onMouseMove,\n onClick,\n onPress,\n ...rest\n } = {}) => {\n const {props: latestProps, state: latestState} = latest.current\n const itemIndex = getItemIndex(index, item, latestProps.items)\n if (itemIndex < 0) {\n throw new Error('Pass either item or item index in getItemProps!')\n }\n\n const onSelectKey = isReactNative\n ? /* istanbul ignore next (react-native) */ 'onPress'\n : 'onClick'\n const customClickHandler = isReactNative\n ? /* istanbul ignore next (react-native) */ onPress\n : onClick\n\n const itemHandleMouseMove = () => {\n if (index === latestState.highlightedIndex) {\n return\n }\n shouldScrollRef.current = false\n dispatch({\n type: stateChangeTypes.ItemMouseMove,\n index,\n })\n }\n const itemHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ItemClick,\n index,\n })\n\n if (inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n return {\n [refKey]: handleRefs(ref, itemNode => {\n if (itemNode) {\n itemRefs.current[\n elementIdsRef.current.getItemId(itemIndex)\n ] = itemNode\n }\n }),\n role: 'option',\n 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,\n id: elementIdsRef.current.getItemId(itemIndex),\n ...(!rest.disabled && {\n onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),\n [onSelectKey]: callAllEventHandlers(\n customClickHandler,\n itemHandleClick,\n ),\n }),\n ...rest,\n }\n },\n [dispatch, latest, shouldScrollRef],\n )\n\n const getToggleButtonProps = useCallback(\n ({onClick, onPress, refKey = 'ref', ref, ...rest} = {}) => {\n const toggleButtonHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ToggleButtonClick,\n })\n\n if (!latest.current.state.isOpen && inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n return {\n [refKey]: handleRefs(ref, toggleButtonNode => {\n toggleButtonRef.current = toggleButtonNode\n }),\n id: elementIdsRef.current.toggleButtonId,\n tabIndex: -1,\n ...(!rest.disabled && {\n ...(isReactNative\n ? /* istanbul ignore next (react-native) */ {\n onPress: callAllEventHandlers(onPress, toggleButtonHandleClick),\n }\n : {\n onClick: callAllEventHandlers(onClick, toggleButtonHandleClick),\n }),\n }),\n ...rest,\n }\n },\n [dispatch, latest],\n )\n const getInputProps = useCallback(\n (\n {\n onKeyDown,\n onChange,\n onInput,\n onBlur,\n onChangeText,\n refKey = 'ref',\n ref,\n ...rest\n } = {},\n {suppressRefError = false} = {},\n ) => {\n setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef)\n\n const latestState = latest.current.state\n const inputHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && inputKeyDownHandlers[key]) {\n inputKeyDownHandlers[key](event)\n }\n }\n const inputHandleChange = event => {\n dispatch({\n type: stateChangeTypes.InputChange,\n inputValue: isReactNative\n ? /* istanbul ignore next (react-native) */ event.nativeEvent.text\n : event.target.value,\n })\n }\n const inputHandleBlur = () => {\n /* istanbul ignore else */\n if (!mouseAndTouchTrackersRef.current.isMouseDown) {\n dispatch({\n type: stateChangeTypes.InputBlur,\n selectItem: true,\n })\n }\n }\n\n /* istanbul ignore next (preact) */\n const onChangeKey = isPreact ? 'onInput' : 'onChange'\n let eventHandlers = {}\n\n if (!rest.disabled) {\n eventHandlers = {\n [onChangeKey]: callAllEventHandlers(\n onChange,\n onInput,\n inputHandleChange,\n ),\n onKeyDown: callAllEventHandlers(onKeyDown, inputHandleKeyDown),\n onBlur: callAllEventHandlers(onBlur, inputHandleBlur),\n }\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n eventHandlers.onChange = callAllEventHandlers(\n onChange,\n onInput,\n inputHandleChange,\n )\n eventHandlers.onChangeText = callAllEventHandlers(\n onChangeText,\n onInput,\n text => {\n inputHandleChange({nativeEvent: {text}})\n },\n )\n }\n\n return {\n [refKey]: handleRefs(ref, inputNode => {\n inputRef.current = inputNode\n }),\n id: elementIdsRef.current.inputId,\n 'aria-autocomplete': 'list',\n 'aria-controls': elementIdsRef.current.menuId,\n ...(latestState.isOpen &&\n latestState.highlightedIndex > -1 && {\n 'aria-activedescendant': elementIdsRef.current.getItemId(\n latestState.highlightedIndex,\n ),\n }),\n 'aria-labelledby': elementIdsRef.current.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: latestState.inputValue,\n ...eventHandlers,\n ...rest,\n }\n },\n [\n dispatch,\n inputKeyDownHandlers,\n latest,\n mouseAndTouchTrackersRef,\n setGetterPropCallInfo,\n ],\n )\n const getComboboxProps = useCallback(\n ({refKey = 'ref', ref, ...rest} = {}, {suppressRefError = false} = {}) => {\n setGetterPropCallInfo(\n 'getComboboxProps',\n suppressRefError,\n refKey,\n comboboxRef,\n )\n\n return {\n [refKey]: handleRefs(ref, comboboxNode => {\n comboboxRef.current = comboboxNode\n }),\n role: 'combobox',\n 'aria-haspopup': 'listbox',\n 'aria-owns': elementIdsRef.current.menuId,\n 'aria-expanded': latest.current.state.isOpen,\n ...rest,\n }\n },\n [latest, setGetterPropCallInfo],\n )\n\n // returns\n const toggleMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionToggleMenu,\n })\n }, [dispatch])\n const closeMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionCloseMenu,\n })\n }, [dispatch])\n const openMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionOpenMenu,\n })\n }, [dispatch])\n const setHighlightedIndex = useCallback(\n newHighlightedIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex,\n })\n },\n [dispatch],\n )\n const selectItem = useCallback(\n newSelectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionSelectItem,\n selectedItem: newSelectedItem,\n })\n },\n [dispatch],\n )\n const setInputValue = useCallback(\n newInputValue => {\n dispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: newInputValue,\n })\n },\n [dispatch],\n )\n const reset = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }, [dispatch])\n\n return {\n // prop getters.\n getItemProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getComboboxProps,\n getToggleButtonProps,\n // actions.\n toggleMenu,\n openMenu,\n closeMenu,\n setHighlightedIndex,\n setInputValue,\n selectItem,\n reset,\n // state.\n highlightedIndex,\n isOpen,\n selectedItem,\n inputValue,\n }\n}\n\nexport default useCombobox\n","import PropTypes from 'prop-types'\nimport {\n getInitialValue as getInitialValueCommon,\n getDefaultValue as getDefaultValueCommon,\n defaultProps as defaultPropsCommon,\n} from '../utils'\n\nconst defaultStateValues = {\n activeIndex: -1,\n selectedItems: [],\n}\n\n/**\n * Returns the initial value for a state key in the following order:\n * 1. controlled prop, 2. initial prop, 3. default prop, 4. default\n * value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getInitialValue(props, propKey) {\n return getInitialValueCommon(props, propKey, defaultStateValues)\n}\n\n/**\n * Returns the default value for a state key in the following order:\n * 1. controlled prop, 2. default prop, 3. default value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nexport function getDefaultValue(props, propKey) {\n return getDefaultValueCommon(props, propKey, defaultStateValues)\n}\n\n/**\n * Gets the initial state based on the provided props. It uses initial, default\n * and controlled props related to state in order to compute the initial value.\n *\n * @param {Object} props Props passed to the hook.\n * @returns {Object} The initial state.\n */\nexport function getInitialState(props) {\n const activeIndex = getInitialValue(props, 'activeIndex')\n const selectedItems = getInitialValue(props, 'selectedItems')\n\n return {\n activeIndex,\n selectedItems,\n }\n}\n\n/**\n * Returns true if dropdown keydown operation is permitted. Should not be\n * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on\n * input element with text content that is either highlighted or selection\n * cursor is not at the starting position.\n *\n * @param {KeyboardEvent} event The event from keydown.\n * @returns {boolean} Whether the operation is allowed.\n */\nexport function isKeyDownOperationPermitted(event) {\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false\n }\n\n const element = event.target\n\n if (\n element instanceof HTMLInputElement && // if element is a text input\n element.value !== '' && // and we have text in it\n // and cursor is either not at the start or is currently highlighting text.\n (element.selectionStart !== 0 || element.selectionEnd !== 0)\n ) {\n return false\n }\n\n return true\n}\n\n/**\n * Returns a message to be added to aria-live region when item is removed.\n *\n * @param {Object} selectionParameters Parameters required to build the message.\n * @returns {string} The a11y message.\n */\nfunction getA11yRemovalMessage(selectionParameters) {\n const {\n removedSelectedItem,\n itemToString: itemToStringLocal,\n } = selectionParameters\n\n return `${itemToStringLocal(removedSelectedItem)} has been removed.`\n}\n\nexport const propTypes = {\n selectedItems: PropTypes.array,\n initialSelectedItems: PropTypes.array,\n defaultSelectedItems: PropTypes.array,\n itemToString: PropTypes.func,\n getA11yRemovalMessage: PropTypes.func,\n stateReducer: PropTypes.func,\n activeIndex: PropTypes.number,\n initialActiveIndex: PropTypes.number,\n defaultActiveIndex: PropTypes.number,\n onActiveIndexChange: PropTypes.func,\n onSelectedItemsChange: PropTypes.func,\n keyNavigationNext: PropTypes.string,\n keyNavigationPrevious: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n}\n\nexport const defaultProps = {\n itemToString: defaultPropsCommon.itemToString,\n stateReducer: defaultPropsCommon.stateReducer,\n environment: defaultPropsCommon.environment,\n getA11yRemovalMessage,\n keyNavigationNext: 'ArrowRight',\n keyNavigationPrevious: 'ArrowLeft',\n}\n","import {getDefaultValue} from './utils'\nimport * as stateChangeTypes from './stateChangeTypes'\n\n/* eslint-disable complexity */\nexport default function downshiftMultipleSelectionReducer(state, action) {\n const {type, index, props, selectedItem} = action\n const {activeIndex, selectedItems} = state\n let changes\n\n switch (type) {\n case stateChangeTypes.SelectedItemClick:\n changes = {\n activeIndex: index,\n }\n\n break\n case stateChangeTypes.SelectedItemKeyDownNavigationPrevious:\n changes = {\n activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1,\n }\n\n break\n case stateChangeTypes.SelectedItemKeyDownNavigationNext:\n changes = {\n activeIndex:\n activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1,\n }\n\n break\n case stateChangeTypes.SelectedItemKeyDownBackspace:\n case stateChangeTypes.SelectedItemKeyDownDelete: {\n let newActiveIndex = activeIndex\n\n if (selectedItems.length === 1) {\n newActiveIndex = -1\n } else if (activeIndex === selectedItems.length - 1) {\n newActiveIndex = selectedItems.length - 2\n }\n\n changes = {\n selectedItems: [\n ...selectedItems.slice(0, activeIndex),\n ...selectedItems.slice(activeIndex + 1),\n ],\n ...{activeIndex: newActiveIndex},\n }\n\n break\n }\n case stateChangeTypes.DropdownKeyDownNavigationPrevious:\n changes = {\n activeIndex: selectedItems.length - 1,\n }\n break\n case stateChangeTypes.DropdownKeyDownBackspace:\n changes = {\n selectedItems: selectedItems.slice(0, selectedItems.length - 1),\n }\n break\n case stateChangeTypes.FunctionAddSelectedItem:\n changes = {\n selectedItems: [...selectedItems, selectedItem],\n }\n break\n case stateChangeTypes.DropdownClick:\n changes = {\n activeIndex: -1,\n }\n break\n case stateChangeTypes.FunctionRemoveSelectedItem: {\n let newActiveIndex = activeIndex\n const selectedItemIndex = selectedItems.indexOf(selectedItem)\n\n if (selectedItems.length === 1) {\n newActiveIndex = -1\n } else if (selectedItemIndex === selectedItems.length - 1) {\n newActiveIndex = selectedItems.length - 2\n }\n\n changes = {\n selectedItems: [\n ...selectedItems.slice(0, selectedItemIndex),\n ...selectedItems.slice(selectedItemIndex + 1),\n ],\n ...{activeIndex: newActiveIndex},\n }\n break\n }\n case stateChangeTypes.FunctionSetSelectedItems: {\n const {selectedItems: newSelectedItems} = action\n changes = {\n selectedItems: newSelectedItems,\n }\n break\n }\n case stateChangeTypes.FunctionSetActiveIndex: {\n const {activeIndex: newActiveIndex} = action\n changes = {\n activeIndex: newActiveIndex,\n }\n break\n }\n case stateChangeTypes.FunctionReset:\n changes = {\n activeIndex: getDefaultValue(props, 'activeIndex'),\n selectedItems: getDefaultValue(props, 'selectedItems'),\n }\n break\n default:\n throw new Error('Reducer called without proper action type.')\n }\n\n return {\n ...state,\n ...changes,\n }\n}\n","import {useRef, useEffect, useCallback, useMemo} from 'react'\nimport setStatus from '../../set-a11y-status'\nimport {\n handleRefs,\n callAllEventHandlers,\n normalizeArrowKey,\n} from '../../utils'\nimport {\n useControlledReducer,\n getItemIndex,\n useGetterPropsCalledChecker,\n useLatestRef,\n useControlPropsValidator,\n} from '../utils'\nimport {\n getInitialState,\n defaultProps,\n isKeyDownOperationPermitted,\n} from './utils'\nimport downshiftMultipleSelectionReducer from './reducer'\nimport * as stateChangeTypes from './stateChangeTypes'\n\nuseMultipleSelection.stateChangeTypes = stateChangeTypes\n\nfunction useMultipleSelection(userProps = {}) {\n // Props defaults and destructuring.\n const props = {\n ...defaultProps,\n ...userProps,\n }\n const {\n getA11yRemovalMessage,\n itemToString,\n environment,\n keyNavigationNext,\n keyNavigationPrevious,\n } = props\n\n // Reducer init.\n const [state, dispatch] = useControlledReducer(\n downshiftMultipleSelectionReducer,\n getInitialState(props),\n props,\n )\n const {activeIndex, selectedItems} = state\n\n // Refs.\n const isInitialMountRef = useRef(true)\n const dropdownRef = useRef(null)\n const previousSelectedItemsRef = useRef(selectedItems)\n const selectedItemRefs = useRef()\n selectedItemRefs.current = []\n const latest = useLatestRef({state, props})\n\n // Effects.\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n if (selectedItems.length < previousSelectedItemsRef.current.length) {\n const removedSelectedItem = previousSelectedItemsRef.current.find(\n item => selectedItems.indexOf(item) < 0,\n )\n\n setStatus(\n getA11yRemovalMessage({\n itemToString,\n resultCount: selectedItems.length,\n removedSelectedItem,\n activeIndex,\n activeSelectedItem: selectedItems[activeIndex],\n }),\n environment.document,\n )\n }\n\n previousSelectedItemsRef.current = selectedItems\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedItems.length])\n // Sets focus on active item.\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n if (activeIndex === -1 && dropdownRef.current) {\n dropdownRef.current.focus()\n } else if (selectedItemRefs.current[activeIndex]) {\n selectedItemRefs.current[activeIndex].focus()\n }\n }, [activeIndex])\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props,\n state,\n })\n const setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps')\n // Make initial ref false.\n useEffect(() => {\n isInitialMountRef.current = false\n }, [])\n\n // Event handler functions.\n const selectedItemKeyDownHandlers = useMemo(\n () => ({\n [keyNavigationPrevious]() {\n dispatch({\n type: stateChangeTypes.SelectedItemKeyDownNavigationPrevious,\n })\n },\n [keyNavigationNext]() {\n dispatch({\n type: stateChangeTypes.SelectedItemKeyDownNavigationNext,\n })\n },\n Delete() {\n dispatch({\n type: stateChangeTypes.SelectedItemKeyDownDelete,\n })\n },\n Backspace() {\n dispatch({\n type: stateChangeTypes.SelectedItemKeyDownBackspace,\n })\n },\n }),\n [dispatch, keyNavigationNext, keyNavigationPrevious],\n )\n const dropdownKeyDownHandlers = useMemo(\n () => ({\n [keyNavigationPrevious](event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: stateChangeTypes.DropdownKeyDownNavigationPrevious,\n })\n }\n },\n Backspace(event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: stateChangeTypes.DropdownKeyDownBackspace,\n })\n }\n },\n }),\n [dispatch, keyNavigationPrevious],\n )\n\n // Getter props.\n const getSelectedItemProps = useCallback(\n ({\n refKey = 'ref',\n ref,\n onClick,\n onKeyDown,\n selectedItem,\n index,\n ...rest\n } = {}) => {\n const {state: latestState} = latest.current\n const itemIndex = getItemIndex(\n index,\n selectedItem,\n latestState.selectedItems,\n )\n if (itemIndex < 0) {\n throw new Error(\n 'Pass either selectedItem or index in getSelectedItemProps!',\n )\n }\n\n const selectedItemHandleClick = () => {\n dispatch({\n type: stateChangeTypes.SelectedItemClick,\n index,\n })\n }\n const selectedItemHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && selectedItemKeyDownHandlers[key]) {\n selectedItemKeyDownHandlers[key](event)\n }\n }\n\n return {\n [refKey]: handleRefs(ref, selectedItemNode => {\n if (selectedItemNode) {\n selectedItemRefs.current.push(selectedItemNode)\n }\n }),\n tabIndex: index === latestState.activeIndex ? 0 : -1,\n onClick: callAllEventHandlers(onClick, selectedItemHandleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown),\n ...rest,\n }\n },\n [dispatch, latest, selectedItemKeyDownHandlers],\n )\n const getDropdownProps = useCallback(\n (\n {\n refKey = 'ref',\n ref,\n onKeyDown,\n onClick,\n preventKeyAction = false,\n ...rest\n } = {},\n {suppressRefError = false} = {},\n ) => {\n setGetterPropCallInfo(\n 'getDropdownProps',\n suppressRefError,\n refKey,\n dropdownRef,\n )\n\n const dropdownHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && dropdownKeyDownHandlers[key]) {\n dropdownKeyDownHandlers[key](event)\n }\n }\n const dropdownHandleClick = () => {\n dispatch({\n type: stateChangeTypes.DropdownClick,\n })\n }\n\n return {\n [refKey]: handleRefs(ref, dropdownNode => {\n if (dropdownNode) {\n dropdownRef.current = dropdownNode\n }\n }),\n ...(!preventKeyAction && {\n onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),\n onClick: callAllEventHandlers(onClick, dropdownHandleClick),\n }),\n ...rest,\n }\n },\n [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo],\n )\n\n // returns\n const addSelectedItem = useCallback(\n selectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionAddSelectedItem,\n selectedItem,\n })\n },\n [dispatch],\n )\n const removeSelectedItem = useCallback(\n selectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionRemoveSelectedItem,\n selectedItem,\n })\n },\n [dispatch],\n )\n const setSelectedItems = useCallback(\n newSelectedItems => {\n dispatch({\n type: stateChangeTypes.FunctionSetSelectedItems,\n selectedItems: newSelectedItems,\n })\n },\n [dispatch],\n )\n const setActiveIndex = useCallback(\n newActiveIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetActiveIndex,\n activeIndex: newActiveIndex,\n })\n },\n [dispatch],\n )\n const reset = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }, [dispatch])\n\n return {\n getSelectedItemProps,\n getDropdownProps,\n addSelectedItem,\n removeSelectedItem,\n setSelectedItems,\n setActiveIndex,\n reset,\n selectedItems,\n activeIndex,\n }\n}\n\nexport default useMultipleSelection\n"],"names":["_objectWithoutPropertiesLoose","source","excluded","key","i","target","sourceKeys","Object","keys","length","indexOf","_extends","assign","arguments","prototype","hasOwnProperty","call","apply","this","_assertThisInitialized","self","ReferenceError","b","Symbol","for","c","d","e","f","g","h","k","l","m","n","p","q","r","t","v","w","x","y","z","a","u","$$typeof","type","A","getOwnPropertySymbols","module","require$$0","propIsEnumerable","propertyIsEnumerable","toObject","val","TypeError","test1","String","getOwnPropertyNames","test2","fromCharCode","map","join","test3","split","forEach","letter","err","shouldUseNative","Function","bind","emptyFunction","emptyFunctionWithReset","resetWarningCache","shim","props","propName","componentName","location","propFullName","secret","Error","name","getShim","isRequired","ReactPropTypes","array","bool","func","number","object","string","symbol","any","arrayOf","element","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","require$$2","isElement","el","nodeType","canOverflow","overflow","skipOverflowHiddenElements","isScrollable","clientHeight","scrollHeight","clientWidth","scrollWidth","style","getComputedStyle","overflowY","overflowX","frame","ownerDocument","defaultView","frameElement","alignNearest","scrollingEdgeStart","scrollingEdgeEnd","scrollingSize","scrollingBorderStart","scrollingBorderEnd","elementEdgeStart","elementEdgeEnd","elementSize","idCounter","cbToCb","cb","noop","scrollIntoView","menuNode","options","windowWithViewport","window","scrollMode","block","inline","boundary","checkBoundary","scrollingElement","document","documentElement","frames","cursor","parentNode","push","body","viewportWidth","visualViewport","width","innerWidth","viewportHeight","height","innerHeight","viewportX","scrollX","pageXOffset","viewportY","scrollY","pageYOffset","getBoundingClientRect","targetHeight","targetWidth","targetTop","top","targetRight","right","targetBottom","bottom","targetLeft","left","targetBlock","targetInline","computations","index","frameStyle","borderLeft","parseInt","borderLeftWidth","borderTop","borderTopWidth","borderRight","borderRightWidth","borderBottom","borderBottomWidth","blockScroll","inlineScroll","scrollbarWidth","offsetWidth","scrollbarHeight","offsetHeight","Math","max","scrollLeft","scrollTop","min","computeScrollIntoView","isOrContainsNode","parent","child","Node","contains","debounce","fn","time","timeoutId","cancel","clearTimeout","wrapper","args","setTimeout","callAllEventHandlers","fns","event","some","preventDownshiftDefault","nativeEvent","handleRefs","refs","ref","current","generateId","getA11yStatusMessage","isOpen","resultCount","previousResultCount","unwrapArray","arg","defaultValue","Array","isArray","stateKeys","pickState","state","result","getState","reduce","prevState","isControlledProp","undefined","normalizeArrowKey","keyCode","getNextWrappingIndex","moveAmount","baseIndex","itemCount","getItemNodeFromIndex","circular","itemsLastIndex","newIndex","nonDisabledNewIndex","getNextNonDisabledIndex","currentElementNode","hasAttribute","targetWithinDownshift","downshiftElements","checkActiveElement","contextNode","activeElement","cleanupStatus","documentProp","getStatusDiv","textContent","setStatus","status","div","statusDiv","getElementById","createElement","setAttribute","border","clip","margin","padding","position","appendChild","Downshift","subClass","superClass","_Component","id","_this","menuId","labelId","inputId","getItemId","input","items","timeoutIds","internalSetTimeout","filter","setItemCount","count","unsetItemCount","setHighlightedIndex","highlightedIndex","otherStateToSet","defaultHighlightedIndex","internalSetState","clearSelection","selectedItem","inputValue","defaultIsOpen","selectItem","item","itemToString","selectItemAtIndex","itemIndex","selectHighlightedItem","stateToSet","isItemSelected","onChangeArg","onStateChangeArg","isStateToSetFunction","onInputValueChange","getStateAndHelpers","setState","newStateToSet","stateReducer","nextState","onStateChange","onSelect","onChange","onUserAction","rootRef","_rootNode","getRootProps","refKey","rest","suppressRefError","called","role","keyDownHandlers","ArrowDown","preventDefault","amount","shiftKey","moveHighlightedIndex","_this2","getItemCount","nextHighlightedIndex","ArrowUp","_this3","Enter","which","itemNode","Escape","reset","buttonKeyDownHandlers","toggleMenu","inputKeyDownHandlers","Home","newHighlightedIndex","_this4","End","_this5","getToggleButtonProps","onClick","onKeyDown","onPress","onKeyUp","onBlur","enabledEventHandlers","buttonHandleClick","buttonHandleKeyDown","buttonHandleKeyUp","buttonHandleBlur","disabled","environment","focus","blurTarget","isMouseDown","getLabelProps","htmlFor","getInputProps","onInput","onChangeText","eventHandlers","inputHandleChange","inputHandleKeyDown","inputHandleBlur","autoComplete","value","downshiftButtonIsActive","dataset","toggle","menuRef","_menuNode","getMenuProps","getItemProps","onMouseMove","onMouseDown","customClickHandler","avoidScrolling","clearItems","openMenu","closeMenu","updateStatus","highlightedItem","setA11yStatus","initialHighlightedIndex","initialIsOpen","initialInputValue","initialSelectedItem","create","constructor","__proto__","internalClearTimeouts","stateToMerge","scrollHighlightedItemIntoView","_this6","componentDidMount","_this7","onMouseUp","onOuterClick","onTouchStart","isTouchMove","onTouchMove","onTouchEnd","contextWithinDownshift","addEventListener","cleanup","removeEventListener","shouldScroll","prevProps","currentHighlightedIndex","prevHighlightedIndex","componentDidUpdate","selectedItemChanged","componentWillUnmount","render","children","isDOMElement","cloneElement","getElementProps","Component","defaultProps","prevItem","stateChangeTypes","dropdownDefaultStateValues","callOnChangeProps","action","newState","changes","handler","capitalizeString","invokeOnChangeHandler","updateA11yStatus","getA11yMessage","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","getElementIds","toggleButtonId","uniqueId","getItemIndex","isAcceptedCharacterKey","test","slice","toUpperCase","useLatestRef","useRef","useEnhancedReducer","reducer","initialState","prevStateRef","actionRef","enhancedReducer","useCallback","useReducer","dispatch","propsRef","dispatchWithProps","useControlledReducer","s","getA11ySelectionMessage","selectionParameters","itemToStringLocal","circularNavigation","getDefaultValue","propKey","defaultStateValues","defaultPropKey","getInitialValue","initialPropKey","getInitialState","getHighlightedIndexOnOpen","offset","useMouseAndTouchTracker","downshiftElementRefs","handleBlur","mouseAndTouchTrackersRef","useGetterPropsCalledChecker","propKeys","acc","setGetterPropCallInfo","useA11yMessageSetter","dependencyArray","isInitialMount","useScrollIntoView","itemRefs","menuElement","scrollIntoViewProp","shouldScrollRef","useControlPropsValidator","prevPropsRef","getItemIndexByCharacterKey","keysSoFar","itemToStringParam","lowerCasedItemStrings","toLowerCase","lowerCasedKeysSoFar","isValid","itemString","startsWith","commonDefaultProps","downshiftSelectReducer","lowercasedKey","useSelect","userProps","toggleButtonRef","shouldBlurRef","clearTimeoutRef","elementIdsRef","previousResultCountRef","isInitialMountRef","latest","outerDispatch","toggleButtonKeyDownHandlers","useMemo","menuKeyDownHandlers","newSelectedItem","setInputValue","newInputValue","labelProps","onMouseLeave","latestState","tabIndex","toggleProps","toggleButtonNode","latestProps","itemProps","defaultPropsCommon","downshiftUseComboboxReducer","useCombobox","previousSelectedItemRef","getInitialStateCommon","defaultInputValue","inputRef","comboboxRef","getElementIdsCommon","inputNode","getComboboxProps","comboboxNode","activeIndex","selectedItems","getInitialValueCommon","getDefaultValueCommon","isKeyDownOperationPermitted","metaKey","ctrlKey","altKey","HTMLInputElement","selectionStart","selectionEnd","getA11yRemovalMessage","removedSelectedItem","keyNavigationNext","keyNavigationPrevious","downshiftMultipleSelectionReducer","newActiveIndex","selectedItemIndex","useMultipleSelection","dropdownRef","previousSelectedItemsRef","selectedItemRefs","find","activeSelectedItem","selectedItemKeyDownHandlers","Delete","Backspace","dropdownKeyDownHandlers","getSelectedItemProps","selectedItemNode","getDropdownProps","preventKeyAction","dropdownNode","addSelectedItem","removeSelectedItem","setSelectedItems","newSelectedItems","setActiveIndex"],"mappings":"oRAAe,SAASA,EAA8BC,EAAQC,MAC9C,MAAVD,EAAgB,MAAO,OAGvBE,EAAKC,EAFLC,EAAS,GACTC,EAAaC,OAAOC,KAAKP,OAGxBG,EAAI,EAAGA,EAAIE,EAAWG,OAAQL,IACjCD,EAAMG,EAAWF,GACbF,EAASQ,QAAQP,IAAQ,IAC7BE,EAAOF,GAAOF,EAAOE,WAGhBE,ECZM,SAASM,WACtBA,EAAWJ,OAAOK,QAAU,SAAUP,OAC/B,IAAID,EAAI,EAAGA,EAAIS,UAAUJ,OAAQL,IAAK,KACrCH,EAASY,UAAUT,OAElB,IAAID,KAAOF,EACVM,OAAOO,UAAUC,eAAeC,KAAKf,EAAQE,KAC/CE,EAAOF,GAAOF,EAAOE,WAKpBE,IAGOY,MAAMC,KAAML,WCff,SAASM,EAAuBC,WAChC,IAATA,QACI,IAAIC,eAAe,oEAGpBD;;;;;;;;MCII,IAAIE,EAAE,mBAAoBC,QAAQA,OAAOC,IAAIC,EAAEH,EAAEC,OAAOC,IAAI,iBAAiB,MAAME,EAAEJ,EAAEC,OAAOC,IAAI,gBAAgB,MAAMG,EAAEL,EAAEC,OAAOC,IAAI,kBAAkB,MAAMI,EAAEN,EAAEC,OAAOC,IAAI,qBAAqB,MAAMK,EAAEP,EAAEC,OAAOC,IAAI,kBAAkB,MAAMM,EAAER,EAAEC,OAAOC,IAAI,kBAAkB,MAAMO,EAAET,EAAEC,OAAOC,IAAI,iBAAiB,MAAMQ,EAAEV,EAAEC,OAAOC,IAAI,oBAAoB,MAAMS,EAAEX,EAAEC,OAAOC,IAAI,yBAAyB,MAAMU,EAAEZ,EAAEC,OAAOC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