downshift 6.1.9 → 6.1.10

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.
@@ -1,5 +1,5 @@
1
1
  export let useControlPropsValidator: typeof noop;
2
- export function useScrollIntoView({ highlightedIndex, isOpen, itemRefs, getItemNodeFromIndex, menuElement, scrollIntoView: scrollIntoViewProp, }: {
2
+ export function useScrollIntoView({ highlightedIndex, isOpen, itemRefs, getItemNodeFromIndex, menuElement, scrollIntoView, }: {
3
3
  highlightedIndex: any;
4
4
  isOpen: any;
5
5
  itemRefs: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "downshift",
3
- "version": "6.1.9",
3
+ "version": "6.1.10",
4
4
  "description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.",
5
5
  "main": "dist/downshift.cjs.js",
6
6
  "react-native": "dist/downshift.native.cjs.js",
@@ -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 '';
@@ -250,7 +250,7 @@ function getElementProps(element) {
250
250
 
251
251
  function requiredProp(fnName, propName) {
252
252
  // eslint-disable-next-line no-console
253
- console.error("The property \"" + propName + "\" is required in \"" + fnName + "\"");
253
+ console.error(`The property "${propName}" is required in "${fnName}"`);
254
254
  }
255
255
 
256
256
  const stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
@@ -320,7 +320,7 @@ function normalizeArrowKey(event) {
320
320
  /* istanbul ignore next (ie) */
321
321
 
322
322
  if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
323
- return "Arrow" + key;
323
+ return `Arrow${key}`;
324
324
  }
325
325
 
326
326
  return key;
@@ -444,14 +444,14 @@ let validateControlledUnchanged = noop;
444
444
 
445
445
  if (process.env.NODE_ENV !== 'production') {
446
446
  validateControlledUnchanged = (state, prevProps, nextProps) => {
447
- 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";
447
+ 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`;
448
448
  Object.keys(state).forEach(propKey => {
449
449
  if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {
450
450
  // eslint-disable-next-line no-console
451
- console.error("downshift: A component has changed the controlled prop \"" + propKey + "\" to be uncontrolled. " + warningDescription);
451
+ console.error(`downshift: A component has changed the controlled prop "${propKey}" to be uncontrolled. ${warningDescription}`);
452
452
  } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {
453
453
  // eslint-disable-next-line no-console
454
- console.error("downshift: A component has changed the uncontrolled prop \"" + propKey + "\" to be controlled. " + warningDescription);
454
+ console.error(`downshift: A component has changed the uncontrolled prop "${propKey}" to be controlled. ${warningDescription}`);
455
455
  }
456
456
  });
457
457
  };
@@ -560,12 +560,12 @@ const Downshift = /*#__PURE__*/(() => {
560
560
 
561
561
  super(_props);
562
562
  _this = this;
563
- this.id = this.props.id || "downshift-" + generateId();
564
- this.menuId = this.props.menuId || this.id + "-menu";
565
- this.labelId = this.props.labelId || this.id + "-label";
566
- this.inputId = this.props.inputId || this.id + "-input";
563
+ this.id = this.props.id || `downshift-${generateId()}`;
564
+ this.menuId = this.props.menuId || `${this.id}-menu`;
565
+ this.labelId = this.props.labelId || `${this.id}-label`;
566
+ this.inputId = this.props.inputId || `${this.id}-input`;
567
567
 
568
- this.getItemId = this.props.getItemId || (index => this.id + "-item-" + index);
568
+ this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
569
569
 
570
570
  this.input = null;
571
571
  this.items = [];
@@ -1644,7 +1644,7 @@ function validateGetMenuPropsCalledCorrectly(node, _ref3) {
1644
1644
 
1645
1645
  if (!node) {
1646
1646
  // eslint-disable-next-line no-console
1647
- console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
1647
+ console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
1648
1648
  }
1649
1649
  }
1650
1650
 
@@ -1660,12 +1660,12 @@ function validateGetRootPropsCalledCorrectly(element, _ref4) {
1660
1660
  console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
1661
1661
  } else if (!isComposite && refKeySpecified) {
1662
1662
  // eslint-disable-next-line no-console
1663
- console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"" + refKey + "\"");
1663
+ console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
1664
1664
  }
1665
1665
 
1666
1666
  if (!reactIs.isForwardRef(element) && !getElementProps(element)[refKey]) {
1667
1667
  // eslint-disable-next-line no-console
1668
- console.error("downshift: You must apply the ref prop \"" + refKey + "\" from getRootProps onto your root element.");
1668
+ console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
1669
1669
  }
1670
1670
  }
1671
1671
 
@@ -1703,7 +1703,7 @@ function invokeOnChangeHandler(key, action, state, newState) {
1703
1703
  props,
1704
1704
  type
1705
1705
  } = action;
1706
- const handler = "on" + capitalizeString(key) + "Change";
1706
+ const handler = `on${capitalizeString(key)}Change`;
1707
1707
 
1708
1708
  if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
1709
1709
  props[handler]({
@@ -1737,7 +1737,7 @@ function getA11ySelectionMessage(selectionParameters) {
1737
1737
  selectedItem,
1738
1738
  itemToString: itemToStringLocal
1739
1739
  } = selectionParameters;
1740
- return selectedItem ? itemToStringLocal(selectedItem) + " has been selected." : '';
1740
+ return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
1741
1741
  }
1742
1742
  /**
1743
1743
  * Debounced call for updating the a11y message.
@@ -1752,7 +1752,7 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window
1752
1752
 
1753
1753
  function useElementIds(_ref) {
1754
1754
  let {
1755
- id = "downshift-" + generateId(),
1755
+ id = `downshift-${generateId()}`,
1756
1756
  labelId,
1757
1757
  menuId,
1758
1758
  getItemId,
@@ -1760,11 +1760,11 @@ function useElementIds(_ref) {
1760
1760
  inputId
1761
1761
  } = _ref;
1762
1762
  const elementIdsRef = preact.useRef({
1763
- labelId: labelId || id + "-label",
1764
- menuId: menuId || id + "-menu",
1765
- getItemId: getItemId || (index => id + "-item-" + index),
1766
- toggleButtonId: toggleButtonId || id + "-toggle-button",
1767
- inputId: inputId || id + "-input"
1763
+ labelId: labelId || `${id}-label`,
1764
+ menuId: menuId || `${id}-menu`,
1765
+ getItemId: getItemId || (index => `${id}-item-${index}`),
1766
+ toggleButtonId: toggleButtonId || `${id}-toggle-button`,
1767
+ inputId: inputId || `${id}-input`
1768
1768
  });
1769
1769
  return elementIdsRef.current;
1770
1770
  }
@@ -1790,7 +1790,7 @@ function isAcceptedCharacterKey(key) {
1790
1790
  }
1791
1791
 
1792
1792
  function capitalizeString(string) {
1793
- return "" + string.slice(0, 1).toUpperCase() + string.slice(1);
1793
+ return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`;
1794
1794
  }
1795
1795
 
1796
1796
  function useLatestRef(val) {
@@ -1875,7 +1875,7 @@ function getDefaultValue$1(props, propKey, defaultStateValues) {
1875
1875
  defaultStateValues = dropdownDefaultStateValues;
1876
1876
  }
1877
1877
 
1878
- const defaultValue = props["default" + capitalizeString(propKey)];
1878
+ const defaultValue = props[`default${capitalizeString(propKey)}`];
1879
1879
 
1880
1880
  if (defaultValue !== undefined) {
1881
1881
  return defaultValue;
@@ -1895,7 +1895,7 @@ function getInitialValue$1(props, propKey, defaultStateValues) {
1895
1895
  return value;
1896
1896
  }
1897
1897
 
1898
- const initialValue = props["initial" + capitalizeString(propKey)];
1898
+ const initialValue = props[`initial${capitalizeString(propKey)}`];
1899
1899
 
1900
1900
  if (initialValue !== undefined) {
1901
1901
  return initialValue;
@@ -2049,7 +2049,7 @@ if (process.env.NODE_ENV !== 'production') {
2049
2049
  if (isInitialMountRef.current) {
2050
2050
  if (!Object.keys(propCallInfo).length) {
2051
2051
  // eslint-disable-next-line no-console
2052
- console.error("downshift: You forgot to call the " + propKey + " getter function on your component / element.");
2052
+ console.error(`downshift: You forgot to call the ${propKey} getter function on your component / element.`);
2053
2053
  return;
2054
2054
  }
2055
2055
  }
@@ -2062,7 +2062,7 @@ if (process.env.NODE_ENV !== 'production') {
2062
2062
 
2063
2063
  if ((!elementRef || !elementRef.current) && !suppressRefError) {
2064
2064
  // eslint-disable-next-line no-console
2065
- console.error("downshift: The ref prop \"" + refKey + "\" from " + propKey + " was not applied correctly on your element.");
2065
+ console.error(`downshift: The ref prop "${refKey}" from ${propKey} was not applied correctly on your element.`);
2066
2066
  }
2067
2067
  });
2068
2068
  isInitialMountRef.current = false;
@@ -2383,7 +2383,7 @@ function downshiftSelectReducer(state, action) {
2383
2383
  case ToggleButtonKeyDownCharacter:
2384
2384
  {
2385
2385
  const lowercasedKey = action.key;
2386
- const inputValue = "" + state.inputValue + lowercasedKey;
2386
+ const inputValue = `${state.inputValue}${lowercasedKey}`;
2387
2387
  const itemIndex = getItemIndexByCharacterKey({
2388
2388
  keysSoFar: inputValue,
2389
2389
  highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
@@ -2454,7 +2454,7 @@ function downshiftSelectReducer(state, action) {
2454
2454
  case MenuKeyDownCharacter:
2455
2455
  {
2456
2456
  const lowercasedKey = action.key;
2457
- const inputValue = "" + state.inputValue + lowercasedKey;
2457
+ const inputValue = `${state.inputValue}${lowercasedKey}`;
2458
2458
  const highlightedIndex = getItemIndexByCharacterKey({
2459
2459
  keysSoFar: inputValue,
2460
2460
  highlightedIndex: state.highlightedIndex,
@@ -2893,7 +2893,7 @@ function useSelect(userProps) {
2893
2893
  id: elementIds.toggleButtonId,
2894
2894
  'aria-haspopup': 'listbox',
2895
2895
  'aria-expanded': latest.current.state.isOpen,
2896
- 'aria-labelledby': elementIds.labelId + " " + elementIds.toggleButtonId,
2896
+ 'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,
2897
2897
  ...rest
2898
2898
  };
2899
2899
 
@@ -2947,7 +2947,7 @@ function useSelect(userProps) {
2947
2947
 
2948
2948
  const itemProps = {
2949
2949
  role: 'option',
2950
- 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
2950
+ 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
2951
2951
  id: elementIds.getItemId(itemIndex),
2952
2952
  [refKey]: handleRefs(ref, itemNode => {
2953
2953
  if (itemNode) {
@@ -3420,10 +3420,11 @@ function useCombobox(userProps) {
3420
3420
  });
3421
3421
  },
3422
3422
 
3423
- Escape() {
3423
+ Escape(event) {
3424
3424
  const latestState = latest.current.state;
3425
3425
 
3426
3426
  if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
3427
+ event.preventDefault();
3427
3428
  dispatch({
3428
3429
  type: InputKeyDownEscape
3429
3430
  });
@@ -3532,7 +3533,7 @@ function useCombobox(userProps) {
3532
3533
  }
3533
3534
  }),
3534
3535
  role: 'option',
3535
- 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
3536
+ 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
3536
3537
  id: elementIds.getItemId(itemIndex),
3537
3538
  ...(!rest.disabled && {
3538
3539
  onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
@@ -3818,7 +3819,7 @@ function getA11yRemovalMessage(selectionParameters) {
3818
3819
  removedSelectedItem,
3819
3820
  itemToString: itemToStringLocal
3820
3821
  } = selectionParameters;
3821
- return itemToStringLocal(removedSelectedItem) + " has been removed.";
3822
+ return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
3822
3823
  }
3823
3824
 
3824
3825
  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 '';
@@ -241,7 +241,7 @@ function getElementProps(element) {
241
241
 
242
242
  function requiredProp(fnName, propName) {
243
243
  // eslint-disable-next-line no-console
244
- console.error("The property \"" + propName + "\" is required in \"" + fnName + "\"");
244
+ console.error(`The property "${propName}" is required in "${fnName}"`);
245
245
  }
246
246
 
247
247
  const stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
@@ -311,7 +311,7 @@ function normalizeArrowKey(event) {
311
311
  /* istanbul ignore next (ie) */
312
312
 
313
313
  if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
314
- return "Arrow" + key;
314
+ return `Arrow${key}`;
315
315
  }
316
316
 
317
317
  return key;
@@ -435,14 +435,14 @@ let validateControlledUnchanged = noop;
435
435
 
436
436
  if (process.env.NODE_ENV !== 'production') {
437
437
  validateControlledUnchanged = (state, prevProps, nextProps) => {
438
- 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";
438
+ 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`;
439
439
  Object.keys(state).forEach(propKey => {
440
440
  if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {
441
441
  // eslint-disable-next-line no-console
442
- console.error("downshift: A component has changed the controlled prop \"" + propKey + "\" to be uncontrolled. " + warningDescription);
442
+ console.error(`downshift: A component has changed the controlled prop "${propKey}" to be uncontrolled. ${warningDescription}`);
443
443
  } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {
444
444
  // eslint-disable-next-line no-console
445
- console.error("downshift: A component has changed the uncontrolled prop \"" + propKey + "\" to be controlled. " + warningDescription);
445
+ console.error(`downshift: A component has changed the uncontrolled prop "${propKey}" to be controlled. ${warningDescription}`);
446
446
  }
447
447
  });
448
448
  };
@@ -551,12 +551,12 @@ const Downshift = /*#__PURE__*/(() => {
551
551
 
552
552
  super(_props);
553
553
  _this = this;
554
- this.id = this.props.id || "downshift-" + generateId();
555
- this.menuId = this.props.menuId || this.id + "-menu";
556
- this.labelId = this.props.labelId || this.id + "-label";
557
- this.inputId = this.props.inputId || this.id + "-input";
554
+ this.id = this.props.id || `downshift-${generateId()}`;
555
+ this.menuId = this.props.menuId || `${this.id}-menu`;
556
+ this.labelId = this.props.labelId || `${this.id}-label`;
557
+ this.inputId = this.props.inputId || `${this.id}-input`;
558
558
 
559
- this.getItemId = this.props.getItemId || (index => this.id + "-item-" + index);
559
+ this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
560
560
 
561
561
  this.input = null;
562
562
  this.items = [];
@@ -1635,7 +1635,7 @@ function validateGetMenuPropsCalledCorrectly(node, _ref3) {
1635
1635
 
1636
1636
  if (!node) {
1637
1637
  // eslint-disable-next-line no-console
1638
- console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
1638
+ console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
1639
1639
  }
1640
1640
  }
1641
1641
 
@@ -1651,12 +1651,12 @@ function validateGetRootPropsCalledCorrectly(element, _ref4) {
1651
1651
  console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
1652
1652
  } else if (!isComposite && refKeySpecified) {
1653
1653
  // eslint-disable-next-line no-console
1654
- console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"" + refKey + "\"");
1654
+ console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
1655
1655
  }
1656
1656
 
1657
1657
  if (!isForwardRef(element) && !getElementProps(element)[refKey]) {
1658
1658
  // eslint-disable-next-line no-console
1659
- console.error("downshift: You must apply the ref prop \"" + refKey + "\" from getRootProps onto your root element.");
1659
+ console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
1660
1660
  }
1661
1661
  }
1662
1662
 
@@ -1694,7 +1694,7 @@ function invokeOnChangeHandler(key, action, state, newState) {
1694
1694
  props,
1695
1695
  type
1696
1696
  } = action;
1697
- const handler = "on" + capitalizeString(key) + "Change";
1697
+ const handler = `on${capitalizeString(key)}Change`;
1698
1698
 
1699
1699
  if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
1700
1700
  props[handler]({
@@ -1728,7 +1728,7 @@ function getA11ySelectionMessage(selectionParameters) {
1728
1728
  selectedItem,
1729
1729
  itemToString: itemToStringLocal
1730
1730
  } = selectionParameters;
1731
- return selectedItem ? itemToStringLocal(selectedItem) + " has been selected." : '';
1731
+ return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
1732
1732
  }
1733
1733
  /**
1734
1734
  * Debounced call for updating the a11y message.
@@ -1743,7 +1743,7 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window
1743
1743
 
1744
1744
  function useElementIds(_ref) {
1745
1745
  let {
1746
- id = "downshift-" + generateId(),
1746
+ id = `downshift-${generateId()}`,
1747
1747
  labelId,
1748
1748
  menuId,
1749
1749
  getItemId,
@@ -1751,11 +1751,11 @@ function useElementIds(_ref) {
1751
1751
  inputId
1752
1752
  } = _ref;
1753
1753
  const elementIdsRef = useRef({
1754
- labelId: labelId || id + "-label",
1755
- menuId: menuId || id + "-menu",
1756
- getItemId: getItemId || (index => id + "-item-" + index),
1757
- toggleButtonId: toggleButtonId || id + "-toggle-button",
1758
- inputId: inputId || id + "-input"
1754
+ labelId: labelId || `${id}-label`,
1755
+ menuId: menuId || `${id}-menu`,
1756
+ getItemId: getItemId || (index => `${id}-item-${index}`),
1757
+ toggleButtonId: toggleButtonId || `${id}-toggle-button`,
1758
+ inputId: inputId || `${id}-input`
1759
1759
  });
1760
1760
  return elementIdsRef.current;
1761
1761
  }
@@ -1781,7 +1781,7 @@ function isAcceptedCharacterKey(key) {
1781
1781
  }
1782
1782
 
1783
1783
  function capitalizeString(string) {
1784
- return "" + string.slice(0, 1).toUpperCase() + string.slice(1);
1784
+ return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`;
1785
1785
  }
1786
1786
 
1787
1787
  function useLatestRef(val) {
@@ -1866,7 +1866,7 @@ function getDefaultValue$1(props, propKey, defaultStateValues) {
1866
1866
  defaultStateValues = dropdownDefaultStateValues;
1867
1867
  }
1868
1868
 
1869
- const defaultValue = props["default" + capitalizeString(propKey)];
1869
+ const defaultValue = props[`default${capitalizeString(propKey)}`];
1870
1870
 
1871
1871
  if (defaultValue !== undefined) {
1872
1872
  return defaultValue;
@@ -1886,7 +1886,7 @@ function getInitialValue$1(props, propKey, defaultStateValues) {
1886
1886
  return value;
1887
1887
  }
1888
1888
 
1889
- const initialValue = props["initial" + capitalizeString(propKey)];
1889
+ const initialValue = props[`initial${capitalizeString(propKey)}`];
1890
1890
 
1891
1891
  if (initialValue !== undefined) {
1892
1892
  return initialValue;
@@ -2040,7 +2040,7 @@ if (process.env.NODE_ENV !== 'production') {
2040
2040
  if (isInitialMountRef.current) {
2041
2041
  if (!Object.keys(propCallInfo).length) {
2042
2042
  // eslint-disable-next-line no-console
2043
- console.error("downshift: You forgot to call the " + propKey + " getter function on your component / element.");
2043
+ console.error(`downshift: You forgot to call the ${propKey} getter function on your component / element.`);
2044
2044
  return;
2045
2045
  }
2046
2046
  }
@@ -2053,7 +2053,7 @@ if (process.env.NODE_ENV !== 'production') {
2053
2053
 
2054
2054
  if ((!elementRef || !elementRef.current) && !suppressRefError) {
2055
2055
  // eslint-disable-next-line no-console
2056
- console.error("downshift: The ref prop \"" + refKey + "\" from " + propKey + " was not applied correctly on your element.");
2056
+ console.error(`downshift: The ref prop "${refKey}" from ${propKey} was not applied correctly on your element.`);
2057
2057
  }
2058
2058
  });
2059
2059
  isInitialMountRef.current = false;
@@ -2374,7 +2374,7 @@ function downshiftSelectReducer(state, action) {
2374
2374
  case ToggleButtonKeyDownCharacter:
2375
2375
  {
2376
2376
  const lowercasedKey = action.key;
2377
- const inputValue = "" + state.inputValue + lowercasedKey;
2377
+ const inputValue = `${state.inputValue}${lowercasedKey}`;
2378
2378
  const itemIndex = getItemIndexByCharacterKey({
2379
2379
  keysSoFar: inputValue,
2380
2380
  highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
@@ -2445,7 +2445,7 @@ function downshiftSelectReducer(state, action) {
2445
2445
  case MenuKeyDownCharacter:
2446
2446
  {
2447
2447
  const lowercasedKey = action.key;
2448
- const inputValue = "" + state.inputValue + lowercasedKey;
2448
+ const inputValue = `${state.inputValue}${lowercasedKey}`;
2449
2449
  const highlightedIndex = getItemIndexByCharacterKey({
2450
2450
  keysSoFar: inputValue,
2451
2451
  highlightedIndex: state.highlightedIndex,
@@ -2884,7 +2884,7 @@ function useSelect(userProps) {
2884
2884
  id: elementIds.toggleButtonId,
2885
2885
  'aria-haspopup': 'listbox',
2886
2886
  'aria-expanded': latest.current.state.isOpen,
2887
- 'aria-labelledby': elementIds.labelId + " " + elementIds.toggleButtonId,
2887
+ 'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,
2888
2888
  ...rest
2889
2889
  };
2890
2890
 
@@ -2938,7 +2938,7 @@ function useSelect(userProps) {
2938
2938
 
2939
2939
  const itemProps = {
2940
2940
  role: 'option',
2941
- 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
2941
+ 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
2942
2942
  id: elementIds.getItemId(itemIndex),
2943
2943
  [refKey]: handleRefs(ref, itemNode => {
2944
2944
  if (itemNode) {
@@ -3411,10 +3411,11 @@ function useCombobox(userProps) {
3411
3411
  });
3412
3412
  },
3413
3413
 
3414
- Escape() {
3414
+ Escape(event) {
3415
3415
  const latestState = latest.current.state;
3416
3416
 
3417
3417
  if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
3418
+ event.preventDefault();
3418
3419
  dispatch({
3419
3420
  type: InputKeyDownEscape
3420
3421
  });
@@ -3523,7 +3524,7 @@ function useCombobox(userProps) {
3523
3524
  }
3524
3525
  }),
3525
3526
  role: 'option',
3526
- 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
3527
+ 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
3527
3528
  id: elementIds.getItemId(itemIndex),
3528
3529
  ...(!rest.disabled && {
3529
3530
  onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
@@ -3809,7 +3810,7 @@ function getA11yRemovalMessage(selectionParameters) {
3809
3810
  removedSelectedItem,
3810
3811
  itemToString: itemToStringLocal
3811
3812
  } = selectionParameters;
3812
- return itemToStringLocal(removedSelectedItem) + " has been removed.";
3813
+ return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
3813
3814
  }
3814
3815
 
3815
3816
  const propTypes = {