@entur/dropdown 5.0.23 → 5.0.25

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.
@@ -1733,7 +1733,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1733
1733
  });
1734
1734
  }
1735
1735
  case useCombobox.stateChangeTypes.ControlledPropUpdatedSelectedItem:
1736
- if (!inputHasFocus) setShowSelectedItem(true);
1736
+ if (changes.selectedItem !== null && !inputHasFocus) setShowSelectedItem(true);
1737
1737
  updateListItems({
1738
1738
  inputValue: EMPTY_INPUT
1739
1739
  });
@@ -1758,6 +1758,8 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1758
1758
  updateListItems({
1759
1759
  inputValue: changes.inputValue
1760
1760
  });
1761
+ setHighlightedIndex(0);
1762
+ setLastHighlightedIndex(0);
1761
1763
  }
1762
1764
  return changes;
1763
1765
  }
@@ -1798,6 +1800,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1798
1800
  getMenuProps = _useCombobox.getMenuProps,
1799
1801
  getInputProps = _useCombobox.getInputProps,
1800
1802
  highlightedIndex = _useCombobox.highlightedIndex,
1803
+ setHighlightedIndex = _useCombobox.setHighlightedIndex,
1801
1804
  getItemProps = _useCombobox.getItemProps,
1802
1805
  selectedItem = _useCombobox.selectedItem,
1803
1806
  inputValue = _useCombobox.inputValue,
@@ -1824,6 +1827,10 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1824
1827
  label: label,
1825
1828
  labelId: getLabelProps().id,
1826
1829
  labelProps: getLabelProps(),
1830
+ onClick: function onClick(e) {
1831
+ var _inputRef$current2;
1832
+ if (e.target === e.currentTarget) (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.focus();
1833
+ },
1827
1834
  prepend: prepend,
1828
1835
  readOnly: readOnly,
1829
1836
  variant: variant
@@ -1848,8 +1855,8 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1848
1855
  }),
1849
1856
  "aria-hidden": "true",
1850
1857
  onClick: function onClick() {
1851
- var _inputRef$current2;
1852
- return (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.focus();
1858
+ var _inputRef$current3;
1859
+ return (_inputRef$current3 = inputRef.current) == null ? void 0 : _inputRef$current3.focus();
1853
1860
  }
1854
1861
  }, showSelectedItem ? selectedItem == null ? void 0 : selectedItem.label : ''), React.createElement("input", _extends({
1855
1862
  className: classNames('eds-dropdown__input eds-form-control', {