@entur/dropdown 5.0.23 → 5.0.24

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.
@@ -1737,7 +1737,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1737
1737
  });
1738
1738
  }
1739
1739
  case Downshift.useCombobox.stateChangeTypes.ControlledPropUpdatedSelectedItem:
1740
- if (!inputHasFocus) setShowSelectedItem(true);
1740
+ if (changes.selectedItem !== null && !inputHasFocus) setShowSelectedItem(true);
1741
1741
  updateListItems({
1742
1742
  inputValue: EMPTY_INPUT
1743
1743
  });
@@ -1762,6 +1762,8 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1762
1762
  updateListItems({
1763
1763
  inputValue: changes.inputValue
1764
1764
  });
1765
+ setHighlightedIndex(0);
1766
+ setLastHighlightedIndex(0);
1765
1767
  }
1766
1768
  return changes;
1767
1769
  }
@@ -1802,6 +1804,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1802
1804
  getMenuProps = _useCombobox.getMenuProps,
1803
1805
  getInputProps = _useCombobox.getInputProps,
1804
1806
  highlightedIndex = _useCombobox.highlightedIndex,
1807
+ setHighlightedIndex = _useCombobox.setHighlightedIndex,
1805
1808
  getItemProps = _useCombobox.getItemProps,
1806
1809
  selectedItem = _useCombobox.selectedItem,
1807
1810
  inputValue = _useCombobox.inputValue,
@@ -1828,6 +1831,10 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1828
1831
  label: label,
1829
1832
  labelId: getLabelProps().id,
1830
1833
  labelProps: getLabelProps(),
1834
+ onClick: function onClick(e) {
1835
+ var _inputRef$current2;
1836
+ if (e.target === e.currentTarget) (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.focus();
1837
+ },
1831
1838
  prepend: prepend,
1832
1839
  readOnly: readOnly,
1833
1840
  variant: variant
@@ -1852,8 +1859,8 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1852
1859
  }),
1853
1860
  "aria-hidden": "true",
1854
1861
  onClick: function onClick() {
1855
- var _inputRef$current2;
1856
- return (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.focus();
1862
+ var _inputRef$current3;
1863
+ return (_inputRef$current3 = inputRef.current) == null ? void 0 : _inputRef$current3.focus();
1857
1864
  }
1858
1865
  }, showSelectedItem ? selectedItem == null ? void 0 : selectedItem.label : ''), React.createElement("input", _extends({
1859
1866
  className: classNames('eds-dropdown__input eds-form-control', {