downshift 5.2.1 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/downshift.cjs.js +51 -34
- package/dist/downshift.esm.js +51 -34
- package/dist/downshift.native.cjs.js +51 -34
- package/dist/downshift.umd.js +51 -34
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +1 -1
- package/dist/downshift.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/preact/dist/downshift.cjs.js +51 -34
- package/preact/dist/downshift.esm.js +51 -34
- package/preact/dist/downshift.umd.js +51 -34
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +1 -1
- package/preact/dist/downshift.umd.min.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
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/react-is/cjs/react-is.production.min.js","../node_modules/object-assign/index.js","../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/compute-scroll-into-view/es/index.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","function isElement(el) {\n return el != null && typeof el === 'object' && el.nodeType === 1;\n}\n\nfunction canOverflow(overflow, skipOverflowHiddenElements) {\n if (skipOverflowHiddenElements && overflow === 'hidden') {\n return false;\n }\n\n return overflow !== 'visible' && overflow !== 'clip';\n}\n\nfunction getFrameElement(el) {\n if (!el.ownerDocument || !el.ownerDocument.defaultView) {\n return null;\n }\n\n return el.ownerDocument.defaultView.frameElement;\n}\n\nfunction isHiddenByFrame(el) {\n var frame = getFrameElement(el);\n\n if (!frame) {\n return false;\n }\n\n return frame.clientHeight < el.scrollHeight || frame.clientWidth < el.scrollWidth;\n}\n\nfunction isScrollable(el, skipOverflowHiddenElements) {\n if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {\n var style = getComputedStyle(el, null);\n return canOverflow(style.overflowY, skipOverflowHiddenElements) || canOverflow(style.overflowX, skipOverflowHiddenElements) || isHiddenByFrame(el);\n }\n\n return false;\n}\n\nfunction alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) {\n if (elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd || elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd) {\n return 0;\n }\n\n if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {\n return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;\n }\n\n if (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize || elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize) {\n return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd;\n }\n\n return 0;\n}\n\nexport default (function (target, options) {\n var scrollMode = options.scrollMode,\n block = options.block,\n inline = options.inline,\n boundary = options.boundary,\n skipOverflowHiddenElements = options.skipOverflowHiddenElements;\n var checkBoundary = typeof boundary === 'function' ? boundary : function (node) {\n return node !== boundary;\n };\n\n if (!isElement(target)) {\n throw new TypeError('Invalid target');\n }\n\n var scrollingElement = document.scrollingElement || document.documentElement;\n var frames = [];\n var cursor = target;\n\n while (isElement(cursor) && checkBoundary(cursor)) {\n cursor = cursor.parentNode;\n\n if (cursor === scrollingElement) {\n frames.push(cursor);\n break;\n }\n\n if (cursor === document.body && isScrollable(cursor) && !isScrollable(document.documentElement)) {\n continue;\n }\n\n if (isScrollable(cursor, skipOverflowHiddenElements)) {\n frames.push(cursor);\n }\n }\n\n var viewportWidth = window.visualViewport ? visualViewport.width : innerWidth;\n var viewportHeight = window.visualViewport ? visualViewport.height : innerHeight;\n var viewportX = window.scrollX || pageXOffset;\n var viewportY = window.scrollY || pageYOffset;\n\n var _target$getBoundingCl = target.getBoundingClientRect(),\n targetHeight = _target$getBoundingCl.height,\n targetWidth = _target$getBoundingCl.width,\n targetTop = _target$getBoundingCl.top,\n targetRight = _target$getBoundingCl.right,\n targetBottom = _target$getBoundingCl.bottom,\n targetLeft = _target$getBoundingCl.left;\n\n var targetBlock = block === 'start' || block === 'nearest' ? targetTop : block === 'end' ? targetBottom : targetTop + targetHeight / 2;\n var targetInline = inline === 'center' ? targetLeft + targetWidth / 2 : inline === 'end' ? targetRight : targetLeft;\n var computations = [];\n\n for (var index = 0; index < frames.length; index++) {\n var frame = frames[index];\n\n var _frame$getBoundingCli = frame.getBoundingClientRect(),\n height = _frame$getBoundingCli.height,\n width = _frame$getBoundingCli.width,\n top = _frame$getBoundingCli.top,\n right = _frame$getBoundingCli.right,\n bottom = _frame$getBoundingCli.bottom,\n left = _frame$getBoundingCli.left;\n\n if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) {\n return computations;\n }\n\n var frameStyle = getComputedStyle(frame);\n var borderLeft = parseInt(frameStyle.borderLeftWidth, 10);\n var borderTop = parseInt(frameStyle.borderTopWidth, 10);\n var borderRight = parseInt(frameStyle.borderRightWidth, 10);\n var borderBottom = parseInt(frameStyle.borderBottomWidth, 10);\n var blockScroll = 0;\n var inlineScroll = 0;\n var scrollbarWidth = 'offsetWidth' in frame ? frame.offsetWidth - frame.clientWidth - borderLeft - borderRight : 0;\n var scrollbarHeight = 'offsetHeight' in frame ? frame.offsetHeight - frame.clientHeight - borderTop - borderBottom : 0;\n\n if (scrollingElement === frame) {\n if (block === 'start') {\n blockScroll = targetBlock;\n } else if (block === 'end') {\n blockScroll = targetBlock - viewportHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - viewportHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline;\n } else if (inline === 'center') {\n inlineScroll = targetInline - viewportWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - viewportWidth;\n } else {\n inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth);\n }\n\n blockScroll = Math.max(0, blockScroll + viewportY);\n inlineScroll = Math.max(0, inlineScroll + viewportX);\n } else {\n if (block === 'start') {\n blockScroll = targetBlock - top - borderTop;\n } else if (block === 'end') {\n blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(top, bottom, height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - (top + height / 2) + scrollbarHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline - left - borderLeft;\n } else if (inline === 'center') {\n inlineScroll = targetInline - (left + width / 2) + scrollbarWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - right + borderRight + scrollbarWidth;\n } else {\n inlineScroll = alignNearest(left, right, width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);\n }\n\n var scrollLeft = frame.scrollLeft,\n scrollTop = frame.scrollTop;\n blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, frame.scrollHeight - height + scrollbarHeight));\n inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, frame.scrollWidth - width + scrollbarWidth));\n targetBlock += scrollTop - blockScroll;\n targetInline += scrollLeft - inlineScroll;\n }\n\n computations.push({\n el: frame,\n top: blockScroll,\n left: inlineScroll\n });\n }\n\n return computations;\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 === null) {\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 || (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.nodeName === 'string' || typeof element.type === '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.attributes || element.props\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 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 return nonDisabledNewIndex === -1 ? baseIndex : 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 {\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(() => {\n getStatusDiv().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()\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} 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 selectedItem: null,\n 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(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\nfunction validateControlledUnchanged(prevProps, nextProps) {\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 ;['selectedItem', 'isOpen', 'inputValue', 'highlightedIndex'].forEach(\n propKey => {\n 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 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}\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 {useState} from 'react'\nimport {\n scrollIntoView,\n getNextWrappingIndex,\n getState,\n generateId,\n debounce,\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, props, 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, props, state, newState) {\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](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 */\nexport const updateA11yStatus = debounce((getA11yMessage, document) => {\n setStatus(getA11yMessage(), document)\n}, 200)\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\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 useControlledState(reducer, initialState, props) {\n const [uncontrolledState, setState] = useState(initialState)\n const state = getState(uncontrolledState, props)\n\n const dispatch = action => {\n const {stateReducer: stateReducerFromProps} = action.props\n const changes = reducer(state, action)\n const newState = stateReducerFromProps(state, {...action, changes})\n\n callOnChangeProps(action, state, newState)\n\n setState(newState)\n }\n\n const dispatchWithProps = action => dispatch({props, ...action})\n\n return [getState(state, props), dispatchWithProps]\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\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 // 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","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} from 'react'\nimport {\n getElementIds,\n getItemIndex,\n getPropTypesValidator,\n isAcceptedCharacterKey,\n useControlledState,\n getInitialState,\n updateA11yStatus,\n} from '../utils'\nimport {\n callAllEventHandlers,\n handleRefs,\n debounce,\n normalizeArrowKey,\n targetWithinDownshift,\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\n // Reducer init.\n const [\n {isOpen, highlightedIndex, selectedItem, inputValue},\n dispatch,\n ] = useControlledState(downshiftSelectReducer, initialState, props)\n\n // Refs\n const toggleButtonRef = useRef(null)\n const menuRef = useRef(null)\n const isInitialMount = useRef(true)\n const shouldScroll = useRef(true)\n const clearTimeout = useRef(null)\n const mouseAndTouchTrackers = useRef({\n isMouseDown: false,\n isTouchMove: false,\n })\n const elementIds = useRef(getElementIds(props))\n const previousResultCountRef = useRef()\n\n // Some utils.\n const getItemNodeFromIndex = index =>\n environment.document.getElementById(elementIds.current.getItemId(index))\n\n // Effects.\n /* Sets a11y status message on changes in state. */\n useEffect(() => {\n if (isInitialMount.current) {\n return\n }\n\n const previousResultCount = previousResultCountRef.current\n\n updateA11yStatus(\n () =>\n getA11yStatusMessage({\n isOpen,\n highlightedIndex,\n selectedItem,\n inputValue,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n itemToString,\n previousResultCount,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, highlightedIndex, selectedItem, inputValue])\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(() => {\n if (isInitialMount.current) {\n return\n }\n\n const previousResultCount = previousResultCountRef.current\n\n updateA11yStatus(\n () =>\n getA11ySelectionMessage({\n isOpen,\n highlightedIndex,\n selectedItem,\n inputValue,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n itemToString,\n previousResultCount,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedItem])\n /* Sets cleanup for the keysSoFar after 500ms. */\n useEffect(() => {\n // init the clean function here as we need access to dispatch.\n if (isInitialMount.current) {\n clearTimeout.current = debounce(outerDispatch => {\n outerDispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: '',\n })\n }, 500)\n }\n\n if (!inputValue) {\n return\n }\n clearTimeout.current(dispatch)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inputValue])\n /* Controls the focus on the menu or the toggle button. */\n useEffect(() => {\n // Don't focus menu on first render.\n if (isInitialMount.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 // istanbul ignore next\n if (isOpen && menuRef.current) {\n menuRef.current.focus()\n // Focus toggleButton on close.\n } else if (\n environment.document.activeElement === menuRef.current &&\n toggleButtonRef.current\n ) {\n toggleButtonRef.current.focus()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen])\n /* Scroll on highlighted item if change comes from keyboard. */\n useEffect(() => {\n if (highlightedIndex < 0 || !isOpen || !items.length) {\n return\n }\n if (shouldScroll.current === false) {\n shouldScroll.current = true\n } else {\n scrollIntoView(getItemNodeFromIndex(highlightedIndex), menuRef.current)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex])\n useEffect(() => {\n if (isInitialMount.current) {\n return\n }\n\n previousResultCountRef.current = items.length\n })\n /* Make initial ref false. */\n useEffect(() => {\n isInitialMount.current = false\n }, [])\n /* Add mouse/touch events to document. */\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 mouseAndTouchTrackers.current.isMouseDown = true\n }\n const onMouseUp = event => {\n mouseAndTouchTrackers.current.isMouseDown = false\n if (\n isOpen &&\n !targetWithinDownshift(\n event.target,\n [toggleButtonRef.current, menuRef.current],\n environment.document,\n )\n ) {\n dispatch({\n type: stateChangeTypes.MenuBlur,\n })\n }\n }\n const onTouchStart = () => {\n mouseAndTouchTrackers.current.isTouchMove = false\n }\n const onTouchMove = () => {\n mouseAndTouchTrackers.current.isTouchMove = true\n }\n const onTouchEnd = event => {\n if (\n isOpen &&\n !mouseAndTouchTrackers.current.isTouchMove &&\n !targetWithinDownshift(\n event.target,\n [toggleButtonRef.current, menuRef.current],\n environment.document,\n false,\n )\n ) {\n dispatch({\n type: stateChangeTypes.MenuBlur,\n })\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 })\n\n // Event handler functions.\n const toggleButtonKeyDownHandlers = {\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 const menuKeyDownHandlers = {\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\n // Event handlers.\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 const shouldBlur = !mouseAndTouchTrackers.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 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 itemHandleMouseMove = index => {\n if (index === highlightedIndex) {\n return\n }\n shouldScroll.current = false\n dispatch({\n type: stateChangeTypes.ItemMouseMove,\n index,\n })\n }\n const itemHandleClick = index => {\n dispatch({\n type: stateChangeTypes.ItemClick,\n index,\n })\n }\n\n // Action functions.\n const toggleMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionToggleMenu,\n })\n }\n const closeMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionCloseMenu,\n })\n }\n const openMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionOpenMenu,\n })\n }\n const setHighlightedIndex = newHighlightedIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex,\n })\n }\n const selectItem = newSelectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionSelectItem,\n selectedItem: newSelectedItem,\n })\n }\n const reset = () => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }\n const setInputValue = newInputValue => {\n dispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: newInputValue,\n })\n }\n // Getter functions.\n const getLabelProps = labelProps => ({\n id: elementIds.current.labelId,\n htmlFor: elementIds.current.toggleButtonId,\n ...labelProps,\n })\n const getMenuProps = ({\n onMouseLeave,\n refKey = 'ref',\n onKeyDown,\n onBlur,\n ref,\n ...rest\n } = {}) => ({\n [refKey]: handleRefs(ref, menuNode => {\n menuRef.current = menuNode\n }),\n id: elementIds.current.menuId,\n role: 'listbox',\n 'aria-labelledby': elementIds.current.labelId,\n tabIndex: -1,\n ...(isOpen &&\n highlightedIndex > -1 && {\n 'aria-activedescendant': elementIds.current.getItemId(highlightedIndex),\n }),\n onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),\n onKeyDown: callAllEventHandlers(onKeyDown, menuHandleKeyDown),\n onBlur: callAllEventHandlers(onBlur, menuHandleBlur),\n ...rest,\n })\n const getToggleButtonProps = ({\n onClick,\n onKeyDown,\n refKey = 'ref',\n ref,\n ...rest\n } = {}) => {\n const toggleProps = {\n [refKey]: handleRefs(ref, toggleButtonNode => {\n toggleButtonRef.current = toggleButtonNode\n }),\n id: elementIds.current.toggleButtonId,\n 'aria-haspopup': 'listbox',\n 'aria-expanded': isOpen,\n 'aria-labelledby': `${elementIds.current.labelId} ${elementIds.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 return toggleProps\n }\n const getItemProps = ({item, index, onMouseMove, onClick, ...rest} = {}) => {\n const itemIndex = getItemIndex(index, item, 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 === highlightedIndex}`,\n id: elementIds.current.getItemId(itemIndex),\n ...rest,\n }\n\n if (!rest.disabled) {\n itemProps.onMouseMove = callAllEventHandlers(onMouseMove, () =>\n itemHandleMouseMove(itemIndex),\n )\n itemProps.onClick = callAllEventHandlers(onClick, () =>\n itemHandleClick(itemIndex),\n )\n }\n\n return itemProps\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} from 'react'\nimport PropTypes from 'prop-types'\nimport {generateId, getA11yStatusMessage, isControlledProp} from '../../utils'\nimport {\n getElementIds as getElementIdsCommon,\n defaultProps as defaultPropsCommon,\n getInitialState as getInitialStateCommon,\n useControlledState as useControlledStateCommon,\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 useControlledState, 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 useControlledState 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 useControlledState(reducer, initialState, props) {\n const [newState, dispatch] = useControlledStateCommon(\n reducer,\n initialState,\n props,\n )\n const previousSelectedItemRef = useRef(null)\n const {selectedItem, itemToString} = props\n\n // ToDo: if needed, make same approach as selectedItemChanged from Downshift.\n if (\n isControlledProp(props, 'selectedItem') &&\n previousSelectedItemRef.current !== selectedItem\n ) {\n dispatch({\n type: ControlledPropUpdatedSelectedItem,\n inputValue: itemToString(selectedItem),\n })\n }\n\n previousSelectedItemRef.current = selectedItem\n\n return [newState, 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.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 selectedItem: null,\n highlightedIndex: -1,\n inputValue: '',\n }\n break\n case stateChangeTypes.InputKeyDownHome:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n 1,\n 0,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n break\n case stateChangeTypes.InputKeyDownEnd:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n -1,\n props.items.length - 1,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n break\n case stateChangeTypes.InputBlur:\n changes = {\n isOpen: false,\n ...(state.highlightedIndex >= 0 && {\n selectedItem: props.items[state.highlightedIndex],\n inputValue: props.itemToString(props.items[state.highlightedIndex]),\n highlightedIndex: -1,\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 }\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} from 'react'\nimport {isPreact, isReactNative} from '../../is.macro'\nimport {\n handleRefs,\n normalizeArrowKey,\n callAllEventHandlers,\n targetWithinDownshift,\n} from '../../utils'\nimport {getItemIndex, getPropTypesValidator, updateA11yStatus} from '../utils'\nimport {\n getInitialState,\n propTypes,\n defaultProps,\n getElementIds,\n useControlledState,\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\n // Reducer init.\n const [\n {isOpen, highlightedIndex, selectedItem, inputValue},\n dispatch,\n ] = useControlledState(downshiftUseComboboxReducer, initialState, props)\n\n /* 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 shouldScroll = useRef(true)\n const isInitialMount = useRef(true)\n const mouseAndTouchTrackers = useRef({\n isMouseDown: false,\n isTouchMove: false,\n })\n const elementIds = useRef(getElementIds(props))\n const previousResultCountRef = useRef()\n\n /* Effects */\n /* Sets a11y status message on changes in state. */\n useEffect(() => {\n if (isInitialMount.current) {\n return\n }\n\n const previousResultCount = previousResultCountRef.current\n\n updateA11yStatus(\n () =>\n getA11yStatusMessage({\n isOpen,\n highlightedIndex,\n selectedItem,\n inputValue,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n itemToString,\n previousResultCount,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, highlightedIndex, selectedItem, inputValue])\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(() => {\n if (isInitialMount.current) {\n return\n }\n\n const previousResultCount = previousResultCountRef.current\n\n updateA11yStatus(\n () =>\n getA11ySelectionMessage({\n isOpen,\n highlightedIndex,\n selectedItem,\n inputValue,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n itemToString,\n previousResultCount,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedItem])\n /* Scroll on highlighted item if change comes from keyboard. */\n useEffect(() => {\n if (highlightedIndex < 0 || !isOpen || !itemRefs.current.length) {\n return\n }\n\n if (shouldScroll.current === false) {\n shouldScroll.current = true\n } else {\n scrollIntoView(itemRefs.current[highlightedIndex], menuRef.current)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex])\n /* Controls the focus on the menu or the toggle button. */\n useEffect(() => {\n // Don't focus menu on first render.\n if (isInitialMount.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 (isInitialMount.current) {\n return\n }\n\n previousResultCountRef.current = items.length\n })\n useEffect(() => {\n isInitialMount.current = false\n }, [])\n /* Add mouse/touch events to document. */\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 mouseAndTouchTrackers.current.isMouseDown = true\n }\n const onMouseUp = event => {\n mouseAndTouchTrackers.current.isMouseDown = false\n if (\n isOpen &&\n !targetWithinDownshift(\n event.target,\n [comboboxRef.current, menuRef.current, toggleButtonRef.current],\n environment.document,\n )\n ) {\n dispatch({\n type: stateChangeTypes.InputBlur,\n })\n }\n }\n const onTouchStart = () => {\n mouseAndTouchTrackers.current.isTouchMove = false\n }\n const onTouchMove = () => {\n mouseAndTouchTrackers.current.isTouchMove = true\n }\n const onTouchEnd = event => {\n if (\n isOpen &&\n !mouseAndTouchTrackers.current.isTouchMove &&\n !targetWithinDownshift(\n event.target,\n [comboboxRef.current, menuRef.current, toggleButtonRef.current],\n environment.document,\n false,\n )\n ) {\n dispatch({\n type: stateChangeTypes.InputBlur,\n })\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 })\n\n const getItemNodeFromIndex = index => itemRefs.current[index]\n\n /* Event handler functions */\n const inputKeyDownHandlers = {\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\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownEnter,\n getItemNodeFromIndex,\n })\n },\n }\n\n // Event handlers.\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 (!mouseAndTouchTrackers.current.isMouseDown) {\n dispatch({\n type: stateChangeTypes.InputBlur,\n })\n }\n }\n const menuHandleMouseLeave = () => {\n dispatch({\n type: stateChangeTypes.MenuMouseLeave,\n })\n }\n const itemHandleMouseMove = index => {\n if (index === highlightedIndex) {\n return\n }\n shouldScroll.current = false\n dispatch({\n type: stateChangeTypes.ItemMouseMove,\n index,\n })\n }\n const itemHandleClick = index => {\n dispatch({\n type: stateChangeTypes.ItemClick,\n index,\n })\n }\n const toggleButtonHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ToggleButtonClick,\n })\n\n if (!isOpen && inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n // Getter props.\n const getLabelProps = labelProps => ({\n id: elementIds.current.labelId,\n htmlFor: elementIds.current.inputId,\n ...labelProps,\n })\n const getMenuProps = ({onMouseLeave, refKey = 'ref', ref, ...rest} = {}) => ({\n [refKey]: handleRefs(ref, menuNode => {\n menuRef.current = menuNode\n }),\n id: elementIds.current.menuId,\n role: 'listbox',\n 'aria-labelledby': elementIds.current.labelId,\n onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),\n ...rest,\n })\n const getItemProps = ({\n item,\n index,\n refKey = 'ref',\n ref,\n onMouseMove,\n onClick,\n onPress,\n ...rest\n } = {}) => {\n const itemIndex = getItemIndex(index, item, 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 return {\n [refKey]: handleRefs(ref, itemNode => {\n if (itemNode) {\n itemRefs.current.push(itemNode)\n }\n }),\n role: 'option',\n 'aria-selected': `${itemIndex === highlightedIndex}`,\n id: elementIds.current.getItemId(itemIndex),\n ...(!rest.disabled && {\n onMouseMove: callAllEventHandlers(onMouseMove, () => {\n itemHandleMouseMove(itemIndex)\n }),\n [onSelectKey]: callAllEventHandlers(customClickHandler, () => {\n itemHandleClick(itemIndex)\n }),\n }),\n ...rest,\n }\n }\n const getToggleButtonProps = ({\n onClick,\n onPress,\n refKey = 'ref',\n ref,\n ...rest\n } = {}) => {\n return {\n [refKey]: handleRefs(ref, toggleButtonNode => {\n toggleButtonRef.current = toggleButtonNode\n }),\n id: elementIds.current.toggleButtonId,\n tabIndex: -1,\n ...(!rest.disabled && {\n ...(isReactNative\n ? /* istanbul ignore next (react-native) */ {\n onPress: callAllEventHandlers(onPress, toggleButtonHandleClick),\n }\n : {onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)}),\n }),\n ...rest,\n }\n }\n const getInputProps = ({\n onKeyDown,\n onChange,\n onInput,\n onBlur,\n onChangeText,\n refKey = 'ref',\n ref,\n ...rest\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: elementIds.current.inputId,\n 'aria-autocomplete': 'list',\n 'aria-controls': elementIds.current.menuId,\n ...(isOpen &&\n highlightedIndex > -1 && {\n 'aria-activedescendant': elementIds.current.getItemId(\n highlightedIndex,\n ),\n }),\n 'aria-labelledby': elementIds.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: inputValue,\n ...eventHandlers,\n ...rest,\n }\n }\n const getComboboxProps = ({refKey = 'ref', ref, ...rest} = {}) => ({\n [refKey]: handleRefs(ref, comboboxNode => {\n comboboxRef.current = comboboxNode\n }),\n role: 'combobox',\n 'aria-haspopup': 'listbox',\n 'aria-owns': elementIds.current.menuId,\n 'aria-expanded': isOpen,\n ...rest,\n })\n\n // returns\n const toggleMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionToggleMenu,\n })\n }\n const closeMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionCloseMenu,\n })\n }\n const openMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionOpenMenu,\n })\n }\n const setHighlightedIndex = newHighlightedIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex,\n })\n }\n const selectItem = newSelectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionSelectItem,\n selectedItem: newSelectedItem,\n })\n }\n const setInputValue = newInputValue => {\n dispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: newInputValue,\n })\n }\n const reset = () => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }\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} from 'react'\nimport setStatus from '../../set-a11y-status'\nimport {handleRefs, callAllEventHandlers, normalizeArrowKey} from '../../utils'\nimport {useControlledState, getItemIndex} 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 [{activeIndex, selectedItems}, dispatch] = useControlledState(\n downshiftMultipleSelectionReducer,\n getInitialState(props),\n props,\n )\n\n // Refs.\n const isInitialMount = useRef(true)\n const dropdownRef = useRef(null)\n const previousSelectedItemsRef = useRef(selectedItems)\n const selectedItemRefs = useRef()\n selectedItemRefs.current = []\n\n // Effects.\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(() => {\n if (isInitialMount.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 (isInitialMount.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 // Make initial ref false.\n useEffect(() => {\n isInitialMount.current = false\n }, [])\n\n // Event handler functions.\n const selectedItemKeyDownHandlers = {\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 const dropdownKeyDownHandlers = {\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\n // Event handlers.\n const selectedItemHandleClick = index => {\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 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 // Getter props.\n const getSelectedItemProps = ({\n refKey = 'ref',\n ref,\n onClick,\n onKeyDown,\n selectedItem,\n index,\n ...rest\n } = {}) => {\n const itemIndex = getItemIndex(index, selectedItem, selectedItems)\n if (itemIndex < 0) {\n throw new Error(\n 'Pass either selectedItem or index in getSelectedItemProps!',\n )\n }\n\n return {\n [refKey]: handleRefs(ref, selectedItemNode => {\n if (selectedItemNode) {\n selectedItemRefs.current.push(selectedItemNode)\n }\n }),\n tabIndex: index === activeIndex ? 0 : -1,\n onClick: callAllEventHandlers(onClick, () => {\n selectedItemHandleClick(index)\n }),\n onKeyDown: callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown),\n ...rest,\n }\n }\n const getDropdownProps = ({\n refKey = 'ref',\n ref,\n onKeyDown,\n onClick,\n preventKeyAction = false,\n ...rest\n } = {}) => ({\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 // returns\n const addSelectedItem = selectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionAddSelectedItem,\n selectedItem,\n })\n }\n const removeSelectedItem = selectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionRemoveSelectedItem,\n selectedItem,\n })\n }\n const setSelectedItems = newSelectedItems => {\n dispatch({\n type: stateChangeTypes.FunctionSetSelectedItems,\n selectedItems: newSelectedItems,\n })\n }\n const setActiveIndex = newActiveIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetActiveIndex,\n activeIndex: newActiveIndex,\n })\n }\n const reset = () => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }\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","getFrameElement","isHiddenByFrame","alignNearest","scrollingEdgeStart","scrollingEdgeEnd","scrollingSize","scrollingBorderStart","scrollingBorderEnd","elementEdgeStart","elementEdgeEnd","elementSize","idCounter","cbToCb","cb","noop","scrollIntoView","menuNode","options","scrollMode","block","inline","boundary","checkBoundary","scrollingElement","document","documentElement","frames","cursor","parentNode","push","body","viewportWidth","window","visualViewport","width","innerWidth","viewportHeight","height","innerHeight","viewportX","scrollX","pageXOffset","viewportY","scrollY","pageYOffset","_target$getBoundingCl","getBoundingClientRect","targetHeight","targetWidth","targetTop","top","targetRight","right","targetBottom","bottom","targetLeft","left","targetBlock","targetInline","computations","index","_frame$getBoundingCli","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","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","getStatusDiv","textContent","setStatus","status","documentProp","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","nextFullState","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","getElementIds","toggleButtonId","uniqueId","getItemIndex","isAcceptedCharacterKey","test","slice","toUpperCase","useControlledState","reducer","initialState","useState","uncontrolledState","stateReducerFromProps","dispatch","s","getA11ySelectionMessage","selectionParameters","itemToStringLocal","circularNavigation","getDefaultValue","propKey","defaultStateValues","defaultPropKey","getInitialValue","initialPropKey","getInitialState","getHighlightedIndexOnOpen","offset","getItemIndexByCharacterKey","keysSoFar","itemToStringParam","lowerCasedItemStrings","toLowerCase","lowerCasedKeysSoFar","isValid","itemString","startsWith","commonDefaultProps","downshiftSelectReducer","lowercasedKey","useSelect","userProps","toggleButtonRef","useRef","isInitialMount","mouseAndTouchTrackers","elementIds","previousResultCountRef","useEffect","outerDispatch","toggleButtonKeyDownHandlers","menuKeyDownHandlers","menuHandleKeyDown","menuHandleBlur","menuHandleMouseLeave","toggleButtonHandleClick","toggleButtonHandleKeyDown","toggleProps","toggleButtonNode","labelProps","onMouseLeave","tabIndex","itemProps","itemHandleMouseMove","itemHandleClick","newSelectedItem","setInputValue","newInputValue","defaultPropsCommon","downshiftUseComboboxReducer","useCombobox","useControlledStateCommon","previousSelectedItemRef","getInitialStateCommon","defaultInputValue","itemRefs","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","selectedItemHandleKeyDown","dropdownHandleKeyDown","dropdownHandleClick","getSelectedItemProps","selectedItemNode","selectedItemHandleClick","getDropdownProps","preventKeyAction","dropdownNode","addSelectedItem","removeSelectedItem","setSelectedItems","newSelectedItems","setActiveIndex"],"mappings":"0OAAe,SAASA,EAA8BC,EAAQC,MAC9C,MAAVD,EAAgB,MAAO,OAGvBE,EAAKC,EAFLC,EAAS,GACTC,EAAaC,OAAOC,KAAKP,OAGxBG,EA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Q7E,KAAKsa,QAGlCrD,SAAUlV,IAAUuW,EAAc,GAAK,IACvC/K,QAASnJ,EAAqBmJ,GAAS,YAhDX,SAAAxL,GAC9BkS,EAAS,CACP9a,OACA4I,MAAAA,IA8CEwY,CAAwBxY,QAE1ByL,UAAWpJ,EAAqBoJ,EAAW0M,MACxCxO,IAwDL8O,iBArDuB,+BAOrB,SANF/O,OAAAA,aAAS,QACT7G,IAAAA,IACA4I,IAAAA,UACAD,IAAAA,YACAkN,iBAAAA,gBACG/O,kFAEFD,GAAS/G,EAAWE,GAAK,SAAA8V,GACpBA,IACFjB,EAAY5U,QAAU6V,UAGrBD,GAAoB,CACvBjN,UAAWpJ,EAAqBoJ,EAAW2M,GAC3C5M,QAASnJ,EAAqBmJ,EAAS6M,OAEtC1O,IAqCHiP,gBAjCsB,SAAA9Q,GACtBoK,EAAS,CACP9a,OACA0Q,aAAAA,KA+BF+Q,mBA5ByB,SAAA/Q,GACzBoK,EAAS,CACP9a,OACA0Q,aAAAA,KA0BFgR,iBAvBuB,SAAAC,GACvB7G,EAAS,CACP9a,QACAof,cAAeuC,KAqBjBC,eAlBqB,SAAAzB,GACrBrF,EAAS,CACP9a,QACAmf,YAAagB,KAgBfzM,MAbY,WACZoH,EAAS,CACP9a,WAYFof,cAAAA,EACAD,YAAAA,GAvOJkB,GAAqBhH,iBAAmBA,iCfuHxC,WACE1T,EAAY"}
|
|
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/react-is/cjs/react-is.production.min.js","../node_modules/object-assign/index.js","../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/compute-scroll-into-view/es/index.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","function isElement(el) {\n return el != null && typeof el === 'object' && el.nodeType === 1;\n}\n\nfunction canOverflow(overflow, skipOverflowHiddenElements) {\n if (skipOverflowHiddenElements && overflow === 'hidden') {\n return false;\n }\n\n return overflow !== 'visible' && overflow !== 'clip';\n}\n\nfunction getFrameElement(el) {\n if (!el.ownerDocument || !el.ownerDocument.defaultView) {\n return null;\n }\n\n return el.ownerDocument.defaultView.frameElement;\n}\n\nfunction isHiddenByFrame(el) {\n var frame = getFrameElement(el);\n\n if (!frame) {\n return false;\n }\n\n return frame.clientHeight < el.scrollHeight || frame.clientWidth < el.scrollWidth;\n}\n\nfunction isScrollable(el, skipOverflowHiddenElements) {\n if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {\n var style = getComputedStyle(el, null);\n return canOverflow(style.overflowY, skipOverflowHiddenElements) || canOverflow(style.overflowX, skipOverflowHiddenElements) || isHiddenByFrame(el);\n }\n\n return false;\n}\n\nfunction alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) {\n if (elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd || elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd) {\n return 0;\n }\n\n if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {\n return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;\n }\n\n if (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize || elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize) {\n return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd;\n }\n\n return 0;\n}\n\nexport default (function (target, options) {\n var scrollMode = options.scrollMode,\n block = options.block,\n inline = options.inline,\n boundary = options.boundary,\n skipOverflowHiddenElements = options.skipOverflowHiddenElements;\n var checkBoundary = typeof boundary === 'function' ? boundary : function (node) {\n return node !== boundary;\n };\n\n if (!isElement(target)) {\n throw new TypeError('Invalid target');\n }\n\n var scrollingElement = document.scrollingElement || document.documentElement;\n var frames = [];\n var cursor = target;\n\n while (isElement(cursor) && checkBoundary(cursor)) {\n cursor = cursor.parentNode;\n\n if (cursor === scrollingElement) {\n frames.push(cursor);\n break;\n }\n\n if (cursor === document.body && isScrollable(cursor) && !isScrollable(document.documentElement)) {\n continue;\n }\n\n if (isScrollable(cursor, skipOverflowHiddenElements)) {\n frames.push(cursor);\n }\n }\n\n var viewportWidth = window.visualViewport ? visualViewport.width : innerWidth;\n var viewportHeight = window.visualViewport ? visualViewport.height : innerHeight;\n var viewportX = window.scrollX || pageXOffset;\n var viewportY = window.scrollY || pageYOffset;\n\n var _target$getBoundingCl = target.getBoundingClientRect(),\n targetHeight = _target$getBoundingCl.height,\n targetWidth = _target$getBoundingCl.width,\n targetTop = _target$getBoundingCl.top,\n targetRight = _target$getBoundingCl.right,\n targetBottom = _target$getBoundingCl.bottom,\n targetLeft = _target$getBoundingCl.left;\n\n var targetBlock = block === 'start' || block === 'nearest' ? targetTop : block === 'end' ? targetBottom : targetTop + targetHeight / 2;\n var targetInline = inline === 'center' ? targetLeft + targetWidth / 2 : inline === 'end' ? targetRight : targetLeft;\n var computations = [];\n\n for (var index = 0; index < frames.length; index++) {\n var frame = frames[index];\n\n var _frame$getBoundingCli = frame.getBoundingClientRect(),\n height = _frame$getBoundingCli.height,\n width = _frame$getBoundingCli.width,\n top = _frame$getBoundingCli.top,\n right = _frame$getBoundingCli.right,\n bottom = _frame$getBoundingCli.bottom,\n left = _frame$getBoundingCli.left;\n\n if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) {\n return computations;\n }\n\n var frameStyle = getComputedStyle(frame);\n var borderLeft = parseInt(frameStyle.borderLeftWidth, 10);\n var borderTop = parseInt(frameStyle.borderTopWidth, 10);\n var borderRight = parseInt(frameStyle.borderRightWidth, 10);\n var borderBottom = parseInt(frameStyle.borderBottomWidth, 10);\n var blockScroll = 0;\n var inlineScroll = 0;\n var scrollbarWidth = 'offsetWidth' in frame ? frame.offsetWidth - frame.clientWidth - borderLeft - borderRight : 0;\n var scrollbarHeight = 'offsetHeight' in frame ? frame.offsetHeight - frame.clientHeight - borderTop - borderBottom : 0;\n\n if (scrollingElement === frame) {\n if (block === 'start') {\n blockScroll = targetBlock;\n } else if (block === 'end') {\n blockScroll = targetBlock - viewportHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - viewportHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline;\n } else if (inline === 'center') {\n inlineScroll = targetInline - viewportWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - viewportWidth;\n } else {\n inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth);\n }\n\n blockScroll = Math.max(0, blockScroll + viewportY);\n inlineScroll = Math.max(0, inlineScroll + viewportX);\n } else {\n if (block === 'start') {\n blockScroll = targetBlock - top - borderTop;\n } else if (block === 'end') {\n blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(top, bottom, height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - (top + height / 2) + scrollbarHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline - left - borderLeft;\n } else if (inline === 'center') {\n inlineScroll = targetInline - (left + width / 2) + scrollbarWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - right + borderRight + scrollbarWidth;\n } else {\n inlineScroll = alignNearest(left, right, width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);\n }\n\n var scrollLeft = frame.scrollLeft,\n scrollTop = frame.scrollTop;\n blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, frame.scrollHeight - height + scrollbarHeight));\n inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, frame.scrollWidth - width + scrollbarWidth));\n targetBlock += scrollTop - blockScroll;\n targetInline += scrollLeft - inlineScroll;\n }\n\n computations.push({\n el: frame,\n top: blockScroll,\n left: inlineScroll\n });\n }\n\n return computations;\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 === null) {\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 || (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.nodeName === 'string' || typeof element.type === '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.attributes || element.props\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 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 return nonDisabledNewIndex === -1 ? baseIndex : 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 {\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(() => {\n getStatusDiv().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()\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} 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 selectedItem: null,\n 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(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\nfunction validateControlledUnchanged(prevProps, nextProps) {\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 ;['selectedItem', 'isOpen', 'inputValue', 'highlightedIndex'].forEach(\n propKey => {\n 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 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}\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 {useState} from 'react'\nimport {\n scrollIntoView,\n getNextWrappingIndex,\n getState,\n generateId,\n debounce,\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, props, 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, props, state, newState) {\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](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 */\nexport const updateA11yStatus = debounce((getA11yMessage, document) => {\n setStatus(getA11yMessage(), document)\n}, 200)\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\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 useControlledState(reducer, initialState, props) {\n const [uncontrolledState, setState] = useState(initialState)\n const state = getState(uncontrolledState, props)\n\n const dispatch = action => {\n const {stateReducer: stateReducerFromProps} = action.props\n const changes = reducer(state, action)\n const newState = stateReducerFromProps(state, {...action, changes})\n\n callOnChangeProps(action, state, newState)\n\n setState(newState)\n }\n\n const dispatchWithProps = action => dispatch({props, ...action})\n\n return [getState(state, props), dispatchWithProps]\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\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 // 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","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} from 'react'\nimport {\n getElementIds,\n getItemIndex,\n getPropTypesValidator,\n isAcceptedCharacterKey,\n useControlledState,\n getInitialState,\n updateA11yStatus,\n} from '../utils'\nimport {\n callAllEventHandlers,\n handleRefs,\n debounce,\n normalizeArrowKey,\n targetWithinDownshift,\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\n // Reducer init.\n const [\n {isOpen, highlightedIndex, selectedItem, inputValue},\n dispatch,\n ] = useControlledState(downshiftSelectReducer, initialState, props)\n\n // Refs\n const toggleButtonRef = useRef(null)\n const menuRef = useRef(null)\n const isInitialMountRef = useRef(true)\n const shouldScrollRef = useRef(true)\n const shouldBlurRef = useRef(true)\n const clearTimeoutRef = useRef(null)\n const mouseAndTouchTrackersRef = useRef({\n isMouseDown: false,\n isTouchMove: false,\n })\n const elementIdsRef = useRef(getElementIds(props))\n const previousResultCountRef = useRef()\n\n // Some utils.\n const getItemNodeFromIndex = index =>\n environment.document.getElementById(elementIdsRef.current.getItemId(index))\n\n // Effects.\n /* Sets a11y status message on changes in state. */\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n const previousResultCount = previousResultCountRef.current\n\n updateA11yStatus(\n () =>\n getA11yStatusMessage({\n isOpen,\n highlightedIndex,\n selectedItem,\n inputValue,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n itemToString,\n previousResultCount,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, highlightedIndex, selectedItem, inputValue])\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n const previousResultCount = previousResultCountRef.current\n\n updateA11yStatus(\n () =>\n getA11ySelectionMessage({\n isOpen,\n highlightedIndex,\n selectedItem,\n inputValue,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n itemToString,\n previousResultCount,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedItem])\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 // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inputValue])\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 return\n }\n }\n // Focus toggleButton on close, but on if 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 /* Scroll on highlighted item if change comes from keyboard. */\n useEffect(() => {\n if (highlightedIndex < 0 || !isOpen || !items.length) {\n return\n }\n if (shouldScrollRef.current === false) {\n shouldScrollRef.current = true\n } else {\n scrollIntoView(getItemNodeFromIndex(highlightedIndex), menuRef.current)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex])\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n previousResultCountRef.current = items.length\n })\n /* Make initial ref false. */\n useEffect(() => {\n isInitialMountRef.current = false\n }, [])\n /* Add mouse/touch events to document. */\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 [toggleButtonRef.current, menuRef.current],\n environment.document,\n )\n ) {\n dispatch({\n type: stateChangeTypes.MenuBlur,\n })\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 [toggleButtonRef.current, menuRef.current],\n environment.document,\n false,\n )\n ) {\n dispatch({\n type: stateChangeTypes.MenuBlur,\n })\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 })\n\n // Event handler functions.\n const toggleButtonKeyDownHandlers = {\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 const menuKeyDownHandlers = {\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\n // Event handlers.\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 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 itemHandleMouseMove = index => {\n if (index === highlightedIndex) {\n return\n }\n shouldScrollRef.current = false\n dispatch({\n type: stateChangeTypes.ItemMouseMove,\n index,\n })\n }\n const itemHandleClick = index => {\n dispatch({\n type: stateChangeTypes.ItemClick,\n index,\n })\n }\n\n // Action functions.\n const toggleMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionToggleMenu,\n })\n }\n const closeMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionCloseMenu,\n })\n }\n const openMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionOpenMenu,\n })\n }\n const setHighlightedIndex = newHighlightedIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex,\n })\n }\n const selectItem = newSelectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionSelectItem,\n selectedItem: newSelectedItem,\n })\n }\n const reset = () => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }\n const setInputValue = newInputValue => {\n dispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: newInputValue,\n })\n }\n // Getter functions.\n const getLabelProps = labelProps => ({\n id: elementIdsRef.current.labelId,\n htmlFor: elementIdsRef.current.toggleButtonId,\n ...labelProps,\n })\n const getMenuProps = ({\n onMouseLeave,\n refKey = 'ref',\n onKeyDown,\n onBlur,\n ref,\n ...rest\n } = {}) => ({\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 ...(isOpen &&\n highlightedIndex > -1 && {\n 'aria-activedescendant': elementIdsRef.current.getItemId(\n highlightedIndex,\n ),\n }),\n onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),\n onKeyDown: callAllEventHandlers(onKeyDown, menuHandleKeyDown),\n onBlur: callAllEventHandlers(onBlur, menuHandleBlur),\n ...rest,\n })\n const getToggleButtonProps = ({\n onClick,\n onKeyDown,\n refKey = 'ref',\n ref,\n ...rest\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': 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 return toggleProps\n }\n const getItemProps = ({item, index, onMouseMove, onClick, ...rest} = {}) => {\n const itemIndex = getItemIndex(index, item, 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 === highlightedIndex}`,\n id: elementIdsRef.current.getItemId(itemIndex),\n ...rest,\n }\n\n if (!rest.disabled) {\n itemProps.onMouseMove = callAllEventHandlers(onMouseMove, () =>\n itemHandleMouseMove(itemIndex),\n )\n itemProps.onClick = callAllEventHandlers(onClick, () =>\n itemHandleClick(itemIndex),\n )\n }\n\n return itemProps\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} from 'react'\nimport PropTypes from 'prop-types'\nimport {generateId, getA11yStatusMessage, isControlledProp} from '../../utils'\nimport {\n getElementIds as getElementIdsCommon,\n defaultProps as defaultPropsCommon,\n getInitialState as getInitialStateCommon,\n useControlledState as useControlledStateCommon,\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 useControlledState, 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 useControlledState 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 useControlledState(reducer, initialState, props) {\n const [newState, dispatch] = useControlledStateCommon(\n reducer,\n initialState,\n props,\n )\n const previousSelectedItemRef = useRef(null)\n const {selectedItem, itemToString} = props\n\n // ToDo: if needed, make same approach as selectedItemChanged from Downshift.\n if (\n isControlledProp(props, 'selectedItem') &&\n previousSelectedItemRef.current !== selectedItem\n ) {\n dispatch({\n type: ControlledPropUpdatedSelectedItem,\n inputValue: itemToString(selectedItem),\n })\n }\n\n previousSelectedItemRef.current = selectedItem\n\n return [newState, 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.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 selectedItem: null,\n highlightedIndex: -1,\n inputValue: '',\n }\n break\n case stateChangeTypes.InputKeyDownHome:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n 1,\n 0,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n break\n case stateChangeTypes.InputKeyDownEnd:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n -1,\n props.items.length - 1,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n break\n case stateChangeTypes.InputBlur:\n changes = {\n isOpen: false,\n ...(state.highlightedIndex >= 0 && {\n selectedItem: props.items[state.highlightedIndex],\n inputValue: props.itemToString(props.items[state.highlightedIndex]),\n highlightedIndex: -1,\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 }\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} from 'react'\nimport {isPreact, isReactNative} from '../../is.macro'\nimport {\n handleRefs,\n normalizeArrowKey,\n callAllEventHandlers,\n targetWithinDownshift,\n} from '../../utils'\nimport {getItemIndex, getPropTypesValidator, updateA11yStatus} from '../utils'\nimport {\n getInitialState,\n propTypes,\n defaultProps,\n getElementIds,\n useControlledState,\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\n // Reducer init.\n const [\n {isOpen, highlightedIndex, selectedItem, inputValue},\n dispatch,\n ] = useControlledState(downshiftUseComboboxReducer, initialState, props)\n\n /* 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 shouldScroll = useRef(true)\n const isInitialMount = useRef(true)\n const mouseAndTouchTrackers = useRef({\n isMouseDown: false,\n isTouchMove: false,\n })\n const elementIds = useRef(getElementIds(props))\n const previousResultCountRef = useRef()\n\n /* Effects */\n /* Sets a11y status message on changes in state. */\n useEffect(() => {\n if (isInitialMount.current) {\n return\n }\n\n const previousResultCount = previousResultCountRef.current\n\n updateA11yStatus(\n () =>\n getA11yStatusMessage({\n isOpen,\n highlightedIndex,\n selectedItem,\n inputValue,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n itemToString,\n previousResultCount,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, highlightedIndex, selectedItem, inputValue])\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(() => {\n if (isInitialMount.current) {\n return\n }\n\n const previousResultCount = previousResultCountRef.current\n\n updateA11yStatus(\n () =>\n getA11ySelectionMessage({\n isOpen,\n highlightedIndex,\n selectedItem,\n inputValue,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n itemToString,\n previousResultCount,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedItem])\n /* Scroll on highlighted item if change comes from keyboard. */\n useEffect(() => {\n if (highlightedIndex < 0 || !isOpen || !itemRefs.current.length) {\n return\n }\n\n if (shouldScroll.current === false) {\n shouldScroll.current = true\n } else {\n scrollIntoView(itemRefs.current[highlightedIndex], menuRef.current)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex])\n /* Controls the focus on the menu or the toggle button. */\n useEffect(() => {\n // Don't focus menu on first render.\n if (isInitialMount.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 (isInitialMount.current) {\n return\n }\n\n previousResultCountRef.current = items.length\n })\n useEffect(() => {\n isInitialMount.current = false\n }, [])\n /* Add mouse/touch events to document. */\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 mouseAndTouchTrackers.current.isMouseDown = true\n }\n const onMouseUp = event => {\n mouseAndTouchTrackers.current.isMouseDown = false\n if (\n isOpen &&\n !targetWithinDownshift(\n event.target,\n [comboboxRef.current, menuRef.current, toggleButtonRef.current],\n environment.document,\n )\n ) {\n dispatch({\n type: stateChangeTypes.InputBlur,\n })\n }\n }\n const onTouchStart = () => {\n mouseAndTouchTrackers.current.isTouchMove = false\n }\n const onTouchMove = () => {\n mouseAndTouchTrackers.current.isTouchMove = true\n }\n const onTouchEnd = event => {\n if (\n isOpen &&\n !mouseAndTouchTrackers.current.isTouchMove &&\n !targetWithinDownshift(\n event.target,\n [comboboxRef.current, menuRef.current, toggleButtonRef.current],\n environment.document,\n false,\n )\n ) {\n dispatch({\n type: stateChangeTypes.InputBlur,\n })\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 })\n\n const getItemNodeFromIndex = index => itemRefs.current[index]\n\n /* Event handler functions */\n const inputKeyDownHandlers = {\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\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownEnter,\n getItemNodeFromIndex,\n })\n },\n }\n\n // Event handlers.\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 (!mouseAndTouchTrackers.current.isMouseDown) {\n dispatch({\n type: stateChangeTypes.InputBlur,\n })\n }\n }\n const menuHandleMouseLeave = () => {\n dispatch({\n type: stateChangeTypes.MenuMouseLeave,\n })\n }\n const itemHandleMouseMove = index => {\n if (index === highlightedIndex) {\n return\n }\n shouldScroll.current = false\n dispatch({\n type: stateChangeTypes.ItemMouseMove,\n index,\n })\n }\n const itemHandleClick = index => {\n dispatch({\n type: stateChangeTypes.ItemClick,\n index,\n })\n }\n const toggleButtonHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ToggleButtonClick,\n })\n\n if (!isOpen && inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n // Getter props.\n const getLabelProps = labelProps => ({\n id: elementIds.current.labelId,\n htmlFor: elementIds.current.inputId,\n ...labelProps,\n })\n const getMenuProps = ({onMouseLeave, refKey = 'ref', ref, ...rest} = {}) => ({\n [refKey]: handleRefs(ref, menuNode => {\n menuRef.current = menuNode\n }),\n id: elementIds.current.menuId,\n role: 'listbox',\n 'aria-labelledby': elementIds.current.labelId,\n onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),\n ...rest,\n })\n const getItemProps = ({\n item,\n index,\n refKey = 'ref',\n ref,\n onMouseMove,\n onClick,\n onPress,\n ...rest\n } = {}) => {\n const itemIndex = getItemIndex(index, item, 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 return {\n [refKey]: handleRefs(ref, itemNode => {\n if (itemNode) {\n itemRefs.current.push(itemNode)\n }\n }),\n role: 'option',\n 'aria-selected': `${itemIndex === highlightedIndex}`,\n id: elementIds.current.getItemId(itemIndex),\n ...(!rest.disabled && {\n onMouseMove: callAllEventHandlers(onMouseMove, () => {\n itemHandleMouseMove(itemIndex)\n }),\n [onSelectKey]: callAllEventHandlers(customClickHandler, () => {\n itemHandleClick(itemIndex)\n }),\n }),\n ...rest,\n }\n }\n const getToggleButtonProps = ({\n onClick,\n onPress,\n refKey = 'ref',\n ref,\n ...rest\n } = {}) => {\n return {\n [refKey]: handleRefs(ref, toggleButtonNode => {\n toggleButtonRef.current = toggleButtonNode\n }),\n id: elementIds.current.toggleButtonId,\n tabIndex: -1,\n ...(!rest.disabled && {\n ...(isReactNative\n ? /* istanbul ignore next (react-native) */ {\n onPress: callAllEventHandlers(onPress, toggleButtonHandleClick),\n }\n : {onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)}),\n }),\n ...rest,\n }\n }\n const getInputProps = ({\n onKeyDown,\n onChange,\n onInput,\n onBlur,\n onChangeText,\n refKey = 'ref',\n ref,\n ...rest\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: elementIds.current.inputId,\n 'aria-autocomplete': 'list',\n 'aria-controls': elementIds.current.menuId,\n ...(isOpen &&\n highlightedIndex > -1 && {\n 'aria-activedescendant': elementIds.current.getItemId(\n highlightedIndex,\n ),\n }),\n 'aria-labelledby': elementIds.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: inputValue,\n ...eventHandlers,\n ...rest,\n }\n }\n const getComboboxProps = ({refKey = 'ref', ref, ...rest} = {}) => ({\n [refKey]: handleRefs(ref, comboboxNode => {\n comboboxRef.current = comboboxNode\n }),\n role: 'combobox',\n 'aria-haspopup': 'listbox',\n 'aria-owns': elementIds.current.menuId,\n 'aria-expanded': isOpen,\n ...rest,\n })\n\n // returns\n const toggleMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionToggleMenu,\n })\n }\n const closeMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionCloseMenu,\n })\n }\n const openMenu = () => {\n dispatch({\n type: stateChangeTypes.FunctionOpenMenu,\n })\n }\n const setHighlightedIndex = newHighlightedIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex,\n })\n }\n const selectItem = newSelectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionSelectItem,\n selectedItem: newSelectedItem,\n })\n }\n const setInputValue = newInputValue => {\n dispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: newInputValue,\n })\n }\n const reset = () => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }\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} from 'react'\nimport setStatus from '../../set-a11y-status'\nimport {handleRefs, callAllEventHandlers, normalizeArrowKey} from '../../utils'\nimport {useControlledState, getItemIndex} 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 [{activeIndex, selectedItems}, dispatch] = useControlledState(\n downshiftMultipleSelectionReducer,\n getInitialState(props),\n props,\n )\n\n // Refs.\n const isInitialMount = useRef(true)\n const dropdownRef = useRef(null)\n const previousSelectedItemsRef = useRef(selectedItems)\n const selectedItemRefs = useRef()\n selectedItemRefs.current = []\n\n // Effects.\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(() => {\n if (isInitialMount.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 (isInitialMount.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 // Make initial ref false.\n useEffect(() => {\n isInitialMount.current = false\n }, [])\n\n // Event handler functions.\n const selectedItemKeyDownHandlers = {\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 const dropdownKeyDownHandlers = {\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\n // Event handlers.\n const selectedItemHandleClick = index => {\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 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 // Getter props.\n const getSelectedItemProps = ({\n refKey = 'ref',\n ref,\n onClick,\n onKeyDown,\n selectedItem,\n index,\n ...rest\n } = {}) => {\n const itemIndex = getItemIndex(index, selectedItem, selectedItems)\n if (itemIndex < 0) {\n throw new Error(\n 'Pass either selectedItem or index in getSelectedItemProps!',\n )\n }\n\n return {\n [refKey]: handleRefs(ref, selectedItemNode => {\n if (selectedItemNode) {\n selectedItemRefs.current.push(selectedItemNode)\n }\n }),\n tabIndex: index === activeIndex ? 0 : -1,\n onClick: callAllEventHandlers(onClick, () => {\n selectedItemHandleClick(index)\n }),\n onKeyDown: callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown),\n ...rest,\n }\n }\n const getDropdownProps = ({\n refKey = 'ref',\n ref,\n onKeyDown,\n onClick,\n preventKeyAction = false,\n ...rest\n } = {}) => ({\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 // returns\n const addSelectedItem = selectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionAddSelectedItem,\n selectedItem,\n })\n }\n const removeSelectedItem = selectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionRemoveSelectedItem,\n selectedItem,\n })\n }\n const setSelectedItems = newSelectedItems => {\n dispatch({\n type: stateChangeTypes.FunctionSetSelectedItems,\n selectedItems: newSelectedItems,\n })\n }\n const setActiveIndex = newActiveIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetActiveIndex,\n activeIndex: newActiveIndex,\n })\n }\n const reset = () => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }\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","getFrameElement","isHiddenByFrame","alignNearest","scrollingEdgeStart","scrollingEdgeEnd","scrollingSize","scrollingBorderStart","scrollingBorderEnd","elementEdgeStart","elementEdgeEnd","elementSize","idCounter","cbToCb","cb","noop","scrollIntoView","menuNode","options","scrollMode","block","inline","boundary","checkBoundary","scrollingElement","document","documentElement","frames","cursor","parentNode","push","body","viewportWidth","window","visualViewport","width","innerWidth","viewportHeight","height","innerHeight","viewportX","scrollX","pageXOffset","viewportY","scrollY","pageYOffset","_target$getBoundingCl","getBoundingClientRect","targetHeight","targetWidth","targetTop","top","targetRight","right","targetBottom","bottom","targetLeft","left","targetBlock","targetInline","computations","index","_frame$getBoundingCli","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","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","getStatusDiv","textContent","setStatus","status","documentProp","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","nextFullState","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","getElementIds","toggleButtonId","uniqueId","getItemIndex","isAcceptedCharacterKey","test","slice","toUpperCase","useControlledState","reducer","initialState","useState","uncontrolledState","stateReducerFromProps","dispatch","s","getA11ySelectionMessage","selectionParameters","itemToStringLocal","circularNavigation","getDefaultValue","propKey","defaultStateValues","defaultPropKey","getInitialValue","initialPropKey","getInitialState","getHighlightedIndexOnOpen","offset","getItemIndexByCharacterKey","keysSoFar","itemToStringParam","lowerCasedItemStrings","toLowerCase","lowerCasedKeysSoFar","isValid","itemString","startsWith","commonDefaultProps","downshiftSelectReducer","lowercasedKey","useSelect","userProps","toggleButtonRef","useRef","isInitialMountRef","shouldScrollRef","shouldBlurRef","clearTimeoutRef","mouseAndTouchTrackersRef","elementIdsRef","previousResultCountRef","useEffect","outerDispatch","toggleButtonKeyDownHandlers","menuKeyDownHandlers","menuHandleKeyDown","menuHandleBlur","menuHandleMouseLeave","toggleButtonHandleClick","toggleButtonHandleKeyDown","toggleProps","toggleButtonNode","labelProps","onMouseLeave","tabIndex","itemProps","itemHandleMouseMove","itemHandleClick","newSelectedItem","setInputValue","newInputValue","defaultPropsCommon","downshiftUseComboboxReducer","useCombobox","useControlledStateCommon","previousSelectedItemRef","getInitialStateCommon","defaultInputValue","itemRefs","inputRef","comboboxRef","isInitialMount","mouseAndTouchTrackers","elementIds","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","selectedItemHandleKeyDown","dropdownHandleKeyDown","dropdownHandleClick","getSelectedItemProps","selectedItemNode","selectedItemHandleClick","getDropdownProps","preventKeyAction","dropdownNode","addSelectedItem","removeSelectedItem","setSelectedItems","newSelectedItems","setActiveIndex"],"mappings":"0OAAe,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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