downshift 6.1.8 → 6.1.10-alpha.0

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/README.md CHANGED
@@ -1410,6 +1410,7 @@ Thanks goes to these people ([emoji key][emojis]):
1410
1410
  <td align="center"><a href="https://github.com/KaiminHuang"><img src="https://avatars.githubusercontent.com/u/5600404?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaimin Huang</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=KaiminHuang" title="Code">💻</a> <a href="https://github.com/downshift-js/downshift/issues?q=author%3AKaiminHuang" title="Bug reports">🐛</a></td>
1411
1411
  <td align="center"><a href="http://theredcircuit.com"><img src="https://avatars.githubusercontent.com/u/1242456?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Welling</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=davewelling" title="Code">💻</a> <a href="https://github.com/downshift-js/downshift/issues?q=author%3Adavewelling" title="Bug reports">🐛</a></td>
1412
1412
  <td align="center"><a href="https://github.com/chandrasekhar1996"><img src="https://avatars.githubusercontent.com/u/33996892?v=4?s=100" width="100px;" alt=""/><br /><sub><b>chandrasekhar1996</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/issues?q=author%3Achandrasekhar1996" title="Bug reports">🐛</a> <a href="https://github.com/downshift-js/downshift/commits?author=chandrasekhar1996" title="Code">💻</a></td>
1413
+ <td align="center"><a href="https://github.com/drewbrend"><img src="https://avatars.githubusercontent.com/u/5375799?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brendan Drew</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=drewbrend" title="Code">💻</a></td>
1413
1414
  </tr>
1414
1415
  </table>
1415
1416
 
@@ -188,7 +188,7 @@ function getA11yStatusMessage$1(_ref2) {
188
188
  }
189
189
 
190
190
  if (resultCount !== previousResultCount) {
191
- return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter key to select.";
191
+ return `${resultCount} result${resultCount === 1 ? ' is' : 's are'} available, use up and down arrow keys to navigate. Press Enter key to select.`;
192
192
  }
193
193
 
194
194
  return '';
@@ -244,7 +244,7 @@ function getElementProps(element) {
244
244
 
245
245
  function requiredProp(fnName, propName) {
246
246
  // eslint-disable-next-line no-console
247
- console.error("The property \"" + propName + "\" is required in \"" + fnName + "\"");
247
+ console.error(`The property "${propName}" is required in "${fnName}"`);
248
248
  }
249
249
 
250
250
  const stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
@@ -314,7 +314,7 @@ function normalizeArrowKey(event) {
314
314
  /* istanbul ignore next (ie) */
315
315
 
316
316
  if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
317
- return "Arrow" + key;
317
+ return `Arrow${key}`;
318
318
  }
319
319
 
320
320
  return key;
@@ -438,14 +438,14 @@ let validateControlledUnchanged = noop;
438
438
 
439
439
  if (process.env.NODE_ENV !== 'production') {
440
440
  validateControlledUnchanged = (state, prevProps, nextProps) => {
441
- 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";
441
+ 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`;
442
442
  Object.keys(state).forEach(propKey => {
443
443
  if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {
444
444
  // eslint-disable-next-line no-console
445
- console.error("downshift: A component has changed the controlled prop \"" + propKey + "\" to be uncontrolled. " + warningDescription);
445
+ console.error(`downshift: A component has changed the controlled prop "${propKey}" to be uncontrolled. ${warningDescription}`);
446
446
  } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {
447
447
  // eslint-disable-next-line no-console
448
- console.error("downshift: A component has changed the uncontrolled prop \"" + propKey + "\" to be controlled. " + warningDescription);
448
+ console.error(`downshift: A component has changed the uncontrolled prop "${propKey}" to be controlled. ${warningDescription}`);
449
449
  }
450
450
  });
451
451
  };
@@ -554,12 +554,12 @@ const Downshift = /*#__PURE__*/(() => {
554
554
 
555
555
  super(_props);
556
556
  _this = this;
557
- this.id = this.props.id || "downshift-" + generateId();
558
- this.menuId = this.props.menuId || this.id + "-menu";
559
- this.labelId = this.props.labelId || this.id + "-label";
560
- this.inputId = this.props.inputId || this.id + "-input";
557
+ this.id = this.props.id || `downshift-${generateId()}`;
558
+ this.menuId = this.props.menuId || `${this.id}-menu`;
559
+ this.labelId = this.props.labelId || `${this.id}-label`;
560
+ this.inputId = this.props.inputId || `${this.id}-input`;
561
561
 
562
- this.getItemId = this.props.getItemId || (index => this.id + "-item-" + index);
562
+ this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
563
563
 
564
564
  this.input = null;
565
565
  this.items = [];
@@ -1684,7 +1684,7 @@ function validateGetMenuPropsCalledCorrectly(node, _ref3) {
1684
1684
 
1685
1685
  if (!node) {
1686
1686
  // eslint-disable-next-line no-console
1687
- console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
1687
+ console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
1688
1688
  }
1689
1689
  }
1690
1690
 
@@ -1700,12 +1700,12 @@ function validateGetRootPropsCalledCorrectly(element, _ref4) {
1700
1700
  console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
1701
1701
  } else if (!isComposite && refKeySpecified) {
1702
1702
  // eslint-disable-next-line no-console
1703
- console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"" + refKey + "\"");
1703
+ console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
1704
1704
  }
1705
1705
 
1706
1706
  if (!reactIs.isForwardRef(element) && !getElementProps(element)[refKey]) {
1707
1707
  // eslint-disable-next-line no-console
1708
- console.error("downshift: You must apply the ref prop \"" + refKey + "\" from getRootProps onto your root element.");
1708
+ console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
1709
1709
  }
1710
1710
  }
1711
1711
 
@@ -1743,7 +1743,7 @@ function invokeOnChangeHandler(key, action, state, newState) {
1743
1743
  props,
1744
1744
  type
1745
1745
  } = action;
1746
- const handler = "on" + capitalizeString(key) + "Change";
1746
+ const handler = `on${capitalizeString(key)}Change`;
1747
1747
 
1748
1748
  if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
1749
1749
  props[handler]({
@@ -1777,7 +1777,7 @@ function getA11ySelectionMessage(selectionParameters) {
1777
1777
  selectedItem,
1778
1778
  itemToString: itemToStringLocal
1779
1779
  } = selectionParameters;
1780
- return selectedItem ? itemToStringLocal(selectedItem) + " has been selected." : '';
1780
+ return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
1781
1781
  }
1782
1782
  /**
1783
1783
  * Debounced call for updating the a11y message.
@@ -1792,7 +1792,7 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window
1792
1792
 
1793
1793
  function useElementIds(_ref) {
1794
1794
  let {
1795
- id = "downshift-" + generateId(),
1795
+ id = `downshift-${generateId()}`,
1796
1796
  labelId,
1797
1797
  menuId,
1798
1798
  getItemId,
@@ -1800,11 +1800,11 @@ function useElementIds(_ref) {
1800
1800
  inputId
1801
1801
  } = _ref;
1802
1802
  const elementIdsRef = react.useRef({
1803
- labelId: labelId || id + "-label",
1804
- menuId: menuId || id + "-menu",
1805
- getItemId: getItemId || (index => id + "-item-" + index),
1806
- toggleButtonId: toggleButtonId || id + "-toggle-button",
1807
- inputId: inputId || id + "-input"
1803
+ labelId: labelId || `${id}-label`,
1804
+ menuId: menuId || `${id}-menu`,
1805
+ getItemId: getItemId || (index => `${id}-item-${index}`),
1806
+ toggleButtonId: toggleButtonId || `${id}-toggle-button`,
1807
+ inputId: inputId || `${id}-input`
1808
1808
  });
1809
1809
  return elementIdsRef.current;
1810
1810
  }
@@ -1830,7 +1830,7 @@ function isAcceptedCharacterKey(key) {
1830
1830
  }
1831
1831
 
1832
1832
  function capitalizeString(string) {
1833
- return "" + string.slice(0, 1).toUpperCase() + string.slice(1);
1833
+ return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`;
1834
1834
  }
1835
1835
 
1836
1836
  function useLatestRef(val) {
@@ -1915,10 +1915,10 @@ function getDefaultValue$1(props, propKey, defaultStateValues) {
1915
1915
  defaultStateValues = dropdownDefaultStateValues;
1916
1916
  }
1917
1917
 
1918
- const defaultPropKey = "default" + capitalizeString(propKey);
1918
+ const defaultValue = props[`default${capitalizeString(propKey)}`];
1919
1919
 
1920
- if (defaultPropKey in props) {
1921
- return props[defaultPropKey];
1920
+ if (defaultValue !== undefined) {
1921
+ return defaultValue;
1922
1922
  }
1923
1923
 
1924
1924
  return defaultStateValues[propKey];
@@ -1929,14 +1929,16 @@ function getInitialValue$1(props, propKey, defaultStateValues) {
1929
1929
  defaultStateValues = dropdownDefaultStateValues;
1930
1930
  }
1931
1931
 
1932
- if (propKey in props) {
1933
- return props[propKey];
1932
+ const value = props[propKey];
1933
+
1934
+ if (value !== undefined) {
1935
+ return value;
1934
1936
  }
1935
1937
 
1936
- const initialPropKey = "initial" + capitalizeString(propKey);
1938
+ const initialValue = props[`initial${capitalizeString(propKey)}`];
1937
1939
 
1938
- if (initialPropKey in props) {
1939
- return props[initialPropKey];
1940
+ if (initialValue !== undefined) {
1941
+ return initialValue;
1940
1942
  }
1941
1943
 
1942
1944
  return getDefaultValue$1(props, propKey, defaultStateValues);
@@ -2087,7 +2089,7 @@ if (process.env.NODE_ENV !== 'production') {
2087
2089
  if (isInitialMountRef.current) {
2088
2090
  if (!Object.keys(propCallInfo).length) {
2089
2091
  // eslint-disable-next-line no-console
2090
- console.error("downshift: You forgot to call the " + propKey + " getter function on your component / element.");
2092
+ console.error(`downshift: You forgot to call the ${propKey} getter function on your component / element.`);
2091
2093
  return;
2092
2094
  }
2093
2095
  }
@@ -2100,7 +2102,7 @@ if (process.env.NODE_ENV !== 'production') {
2100
2102
 
2101
2103
  if ((!elementRef || !elementRef.current) && !suppressRefError) {
2102
2104
  // eslint-disable-next-line no-console
2103
- console.error("downshift: The ref prop \"" + refKey + "\" from " + propKey + " was not applied correctly on your element.");
2105
+ console.error(`downshift: The ref prop "${refKey}" from ${propKey} was not applied correctly on your element.`);
2104
2106
  }
2105
2107
  });
2106
2108
  isInitialMountRef.current = false;
@@ -2421,7 +2423,7 @@ function downshiftSelectReducer(state, action) {
2421
2423
  case ToggleButtonKeyDownCharacter:
2422
2424
  {
2423
2425
  const lowercasedKey = action.key;
2424
- const inputValue = "" + state.inputValue + lowercasedKey;
2426
+ const inputValue = `${state.inputValue}${lowercasedKey}`;
2425
2427
  const itemIndex = getItemIndexByCharacterKey({
2426
2428
  keysSoFar: inputValue,
2427
2429
  highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
@@ -2492,7 +2494,7 @@ function downshiftSelectReducer(state, action) {
2492
2494
  case MenuKeyDownCharacter:
2493
2495
  {
2494
2496
  const lowercasedKey = action.key;
2495
- const inputValue = "" + state.inputValue + lowercasedKey;
2497
+ const inputValue = `${state.inputValue}${lowercasedKey}`;
2496
2498
  const highlightedIndex = getItemIndexByCharacterKey({
2497
2499
  keysSoFar: inputValue,
2498
2500
  highlightedIndex: state.highlightedIndex,
@@ -2931,7 +2933,7 @@ function useSelect(userProps) {
2931
2933
  id: elementIds.toggleButtonId,
2932
2934
  'aria-haspopup': 'listbox',
2933
2935
  'aria-expanded': latest.current.state.isOpen,
2934
- 'aria-labelledby': elementIds.labelId + " " + elementIds.toggleButtonId,
2936
+ 'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,
2935
2937
  ...rest
2936
2938
  };
2937
2939
 
@@ -2985,7 +2987,7 @@ function useSelect(userProps) {
2985
2987
 
2986
2988
  const itemProps = {
2987
2989
  role: 'option',
2988
- 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
2990
+ 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
2989
2991
  id: elementIds.getItemId(itemIndex),
2990
2992
  [refKey]: handleRefs(ref, itemNode => {
2991
2993
  if (itemNode) {
@@ -3458,10 +3460,11 @@ function useCombobox(userProps) {
3458
3460
  });
3459
3461
  },
3460
3462
 
3461
- Escape() {
3463
+ Escape(event) {
3462
3464
  const latestState = latest.current.state;
3463
3465
 
3464
3466
  if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
3467
+ event.stopPropagation();
3465
3468
  dispatch({
3466
3469
  type: InputKeyDownEscape
3467
3470
  });
@@ -3570,7 +3573,7 @@ function useCombobox(userProps) {
3570
3573
  }
3571
3574
  }),
3572
3575
  role: 'option',
3573
- 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
3576
+ 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
3574
3577
  id: elementIds.getItemId(itemIndex),
3575
3578
  ...(!rest.disabled && {
3576
3579
  onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
@@ -3856,7 +3859,7 @@ function getA11yRemovalMessage(selectionParameters) {
3856
3859
  removedSelectedItem,
3857
3860
  itemToString: itemToStringLocal
3858
3861
  } = selectionParameters;
3859
- return itemToStringLocal(removedSelectedItem) + " has been removed.";
3862
+ return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
3860
3863
  }
3861
3864
 
3862
3865
  const propTypes = {
@@ -179,7 +179,7 @@ function getA11yStatusMessage$1(_ref2) {
179
179
  }
180
180
 
181
181
  if (resultCount !== previousResultCount) {
182
- return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter key to select.";
182
+ return `${resultCount} result${resultCount === 1 ? ' is' : 's are'} available, use up and down arrow keys to navigate. Press Enter key to select.`;
183
183
  }
184
184
 
185
185
  return '';
@@ -235,7 +235,7 @@ function getElementProps(element) {
235
235
 
236
236
  function requiredProp(fnName, propName) {
237
237
  // eslint-disable-next-line no-console
238
- console.error("The property \"" + propName + "\" is required in \"" + fnName + "\"");
238
+ console.error(`The property "${propName}" is required in "${fnName}"`);
239
239
  }
240
240
 
241
241
  const stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
@@ -305,7 +305,7 @@ function normalizeArrowKey(event) {
305
305
  /* istanbul ignore next (ie) */
306
306
 
307
307
  if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
308
- return "Arrow" + key;
308
+ return `Arrow${key}`;
309
309
  }
310
310
 
311
311
  return key;
@@ -429,14 +429,14 @@ let validateControlledUnchanged = noop;
429
429
 
430
430
  if (process.env.NODE_ENV !== 'production') {
431
431
  validateControlledUnchanged = (state, prevProps, nextProps) => {
432
- 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";
432
+ 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`;
433
433
  Object.keys(state).forEach(propKey => {
434
434
  if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {
435
435
  // eslint-disable-next-line no-console
436
- console.error("downshift: A component has changed the controlled prop \"" + propKey + "\" to be uncontrolled. " + warningDescription);
436
+ console.error(`downshift: A component has changed the controlled prop "${propKey}" to be uncontrolled. ${warningDescription}`);
437
437
  } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {
438
438
  // eslint-disable-next-line no-console
439
- console.error("downshift: A component has changed the uncontrolled prop \"" + propKey + "\" to be controlled. " + warningDescription);
439
+ console.error(`downshift: A component has changed the uncontrolled prop "${propKey}" to be controlled. ${warningDescription}`);
440
440
  }
441
441
  });
442
442
  };
@@ -545,12 +545,12 @@ const Downshift = /*#__PURE__*/(() => {
545
545
 
546
546
  super(_props);
547
547
  _this = this;
548
- this.id = this.props.id || "downshift-" + generateId();
549
- this.menuId = this.props.menuId || this.id + "-menu";
550
- this.labelId = this.props.labelId || this.id + "-label";
551
- this.inputId = this.props.inputId || this.id + "-input";
548
+ this.id = this.props.id || `downshift-${generateId()}`;
549
+ this.menuId = this.props.menuId || `${this.id}-menu`;
550
+ this.labelId = this.props.labelId || `${this.id}-label`;
551
+ this.inputId = this.props.inputId || `${this.id}-input`;
552
552
 
553
- this.getItemId = this.props.getItemId || (index => this.id + "-item-" + index);
553
+ this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
554
554
 
555
555
  this.input = null;
556
556
  this.items = [];
@@ -1675,7 +1675,7 @@ function validateGetMenuPropsCalledCorrectly(node, _ref3) {
1675
1675
 
1676
1676
  if (!node) {
1677
1677
  // eslint-disable-next-line no-console
1678
- console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
1678
+ console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
1679
1679
  }
1680
1680
  }
1681
1681
 
@@ -1691,12 +1691,12 @@ function validateGetRootPropsCalledCorrectly(element, _ref4) {
1691
1691
  console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
1692
1692
  } else if (!isComposite && refKeySpecified) {
1693
1693
  // eslint-disable-next-line no-console
1694
- console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"" + refKey + "\"");
1694
+ console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
1695
1695
  }
1696
1696
 
1697
1697
  if (!isForwardRef(element) && !getElementProps(element)[refKey]) {
1698
1698
  // eslint-disable-next-line no-console
1699
- console.error("downshift: You must apply the ref prop \"" + refKey + "\" from getRootProps onto your root element.");
1699
+ console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
1700
1700
  }
1701
1701
  }
1702
1702
 
@@ -1734,7 +1734,7 @@ function invokeOnChangeHandler(key, action, state, newState) {
1734
1734
  props,
1735
1735
  type
1736
1736
  } = action;
1737
- const handler = "on" + capitalizeString(key) + "Change";
1737
+ const handler = `on${capitalizeString(key)}Change`;
1738
1738
 
1739
1739
  if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
1740
1740
  props[handler]({
@@ -1768,7 +1768,7 @@ function getA11ySelectionMessage(selectionParameters) {
1768
1768
  selectedItem,
1769
1769
  itemToString: itemToStringLocal
1770
1770
  } = selectionParameters;
1771
- return selectedItem ? itemToStringLocal(selectedItem) + " has been selected." : '';
1771
+ return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
1772
1772
  }
1773
1773
  /**
1774
1774
  * Debounced call for updating the a11y message.
@@ -1783,7 +1783,7 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window
1783
1783
 
1784
1784
  function useElementIds(_ref) {
1785
1785
  let {
1786
- id = "downshift-" + generateId(),
1786
+ id = `downshift-${generateId()}`,
1787
1787
  labelId,
1788
1788
  menuId,
1789
1789
  getItemId,
@@ -1791,11 +1791,11 @@ function useElementIds(_ref) {
1791
1791
  inputId
1792
1792
  } = _ref;
1793
1793
  const elementIdsRef = useRef({
1794
- labelId: labelId || id + "-label",
1795
- menuId: menuId || id + "-menu",
1796
- getItemId: getItemId || (index => id + "-item-" + index),
1797
- toggleButtonId: toggleButtonId || id + "-toggle-button",
1798
- inputId: inputId || id + "-input"
1794
+ labelId: labelId || `${id}-label`,
1795
+ menuId: menuId || `${id}-menu`,
1796
+ getItemId: getItemId || (index => `${id}-item-${index}`),
1797
+ toggleButtonId: toggleButtonId || `${id}-toggle-button`,
1798
+ inputId: inputId || `${id}-input`
1799
1799
  });
1800
1800
  return elementIdsRef.current;
1801
1801
  }
@@ -1821,7 +1821,7 @@ function isAcceptedCharacterKey(key) {
1821
1821
  }
1822
1822
 
1823
1823
  function capitalizeString(string) {
1824
- return "" + string.slice(0, 1).toUpperCase() + string.slice(1);
1824
+ return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`;
1825
1825
  }
1826
1826
 
1827
1827
  function useLatestRef(val) {
@@ -1906,10 +1906,10 @@ function getDefaultValue$1(props, propKey, defaultStateValues) {
1906
1906
  defaultStateValues = dropdownDefaultStateValues;
1907
1907
  }
1908
1908
 
1909
- const defaultPropKey = "default" + capitalizeString(propKey);
1909
+ const defaultValue = props[`default${capitalizeString(propKey)}`];
1910
1910
 
1911
- if (defaultPropKey in props) {
1912
- return props[defaultPropKey];
1911
+ if (defaultValue !== undefined) {
1912
+ return defaultValue;
1913
1913
  }
1914
1914
 
1915
1915
  return defaultStateValues[propKey];
@@ -1920,14 +1920,16 @@ function getInitialValue$1(props, propKey, defaultStateValues) {
1920
1920
  defaultStateValues = dropdownDefaultStateValues;
1921
1921
  }
1922
1922
 
1923
- if (propKey in props) {
1924
- return props[propKey];
1923
+ const value = props[propKey];
1924
+
1925
+ if (value !== undefined) {
1926
+ return value;
1925
1927
  }
1926
1928
 
1927
- const initialPropKey = "initial" + capitalizeString(propKey);
1929
+ const initialValue = props[`initial${capitalizeString(propKey)}`];
1928
1930
 
1929
- if (initialPropKey in props) {
1930
- return props[initialPropKey];
1931
+ if (initialValue !== undefined) {
1932
+ return initialValue;
1931
1933
  }
1932
1934
 
1933
1935
  return getDefaultValue$1(props, propKey, defaultStateValues);
@@ -2078,7 +2080,7 @@ if (process.env.NODE_ENV !== 'production') {
2078
2080
  if (isInitialMountRef.current) {
2079
2081
  if (!Object.keys(propCallInfo).length) {
2080
2082
  // eslint-disable-next-line no-console
2081
- console.error("downshift: You forgot to call the " + propKey + " getter function on your component / element.");
2083
+ console.error(`downshift: You forgot to call the ${propKey} getter function on your component / element.`);
2082
2084
  return;
2083
2085
  }
2084
2086
  }
@@ -2091,7 +2093,7 @@ if (process.env.NODE_ENV !== 'production') {
2091
2093
 
2092
2094
  if ((!elementRef || !elementRef.current) && !suppressRefError) {
2093
2095
  // eslint-disable-next-line no-console
2094
- console.error("downshift: The ref prop \"" + refKey + "\" from " + propKey + " was not applied correctly on your element.");
2096
+ console.error(`downshift: The ref prop "${refKey}" from ${propKey} was not applied correctly on your element.`);
2095
2097
  }
2096
2098
  });
2097
2099
  isInitialMountRef.current = false;
@@ -2412,7 +2414,7 @@ function downshiftSelectReducer(state, action) {
2412
2414
  case ToggleButtonKeyDownCharacter:
2413
2415
  {
2414
2416
  const lowercasedKey = action.key;
2415
- const inputValue = "" + state.inputValue + lowercasedKey;
2417
+ const inputValue = `${state.inputValue}${lowercasedKey}`;
2416
2418
  const itemIndex = getItemIndexByCharacterKey({
2417
2419
  keysSoFar: inputValue,
2418
2420
  highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
@@ -2483,7 +2485,7 @@ function downshiftSelectReducer(state, action) {
2483
2485
  case MenuKeyDownCharacter:
2484
2486
  {
2485
2487
  const lowercasedKey = action.key;
2486
- const inputValue = "" + state.inputValue + lowercasedKey;
2488
+ const inputValue = `${state.inputValue}${lowercasedKey}`;
2487
2489
  const highlightedIndex = getItemIndexByCharacterKey({
2488
2490
  keysSoFar: inputValue,
2489
2491
  highlightedIndex: state.highlightedIndex,
@@ -2922,7 +2924,7 @@ function useSelect(userProps) {
2922
2924
  id: elementIds.toggleButtonId,
2923
2925
  'aria-haspopup': 'listbox',
2924
2926
  'aria-expanded': latest.current.state.isOpen,
2925
- 'aria-labelledby': elementIds.labelId + " " + elementIds.toggleButtonId,
2927
+ 'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,
2926
2928
  ...rest
2927
2929
  };
2928
2930
 
@@ -2976,7 +2978,7 @@ function useSelect(userProps) {
2976
2978
 
2977
2979
  const itemProps = {
2978
2980
  role: 'option',
2979
- 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
2981
+ 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
2980
2982
  id: elementIds.getItemId(itemIndex),
2981
2983
  [refKey]: handleRefs(ref, itemNode => {
2982
2984
  if (itemNode) {
@@ -3449,10 +3451,11 @@ function useCombobox(userProps) {
3449
3451
  });
3450
3452
  },
3451
3453
 
3452
- Escape() {
3454
+ Escape(event) {
3453
3455
  const latestState = latest.current.state;
3454
3456
 
3455
3457
  if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
3458
+ event.stopPropagation();
3456
3459
  dispatch({
3457
3460
  type: InputKeyDownEscape
3458
3461
  });
@@ -3561,7 +3564,7 @@ function useCombobox(userProps) {
3561
3564
  }
3562
3565
  }),
3563
3566
  role: 'option',
3564
- 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
3567
+ 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
3565
3568
  id: elementIds.getItemId(itemIndex),
3566
3569
  ...(!rest.disabled && {
3567
3570
  onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
@@ -3847,7 +3850,7 @@ function getA11yRemovalMessage(selectionParameters) {
3847
3850
  removedSelectedItem,
3848
3851
  itemToString: itemToStringLocal
3849
3852
  } = selectionParameters;
3850
- return itemToStringLocal(removedSelectedItem) + " has been removed.";
3853
+ return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
3851
3854
  }
3852
3855
 
3853
3856
  const propTypes = {