labsense-ui-kit 1.3.62 → 1.3.63

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.
@@ -7858,15 +7858,24 @@ var DatePicker = function DatePicker(_ref22) {
7858
7858
 
7859
7859
  var _templateObject$a, _templateObject2$7, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$3;
7860
7860
  var OptionContainer = styled.div(_templateObject$a || (_templateObject$a = _taggedTemplateLiteralLoose([""])));
7861
- var OptionItem = styled.div(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteralLoose(["\n border-bottom: ", ";\n"])), function (_ref) {
7861
+ var OptionItem = styled.div(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteralLoose(["\n border-bottom: ", ";\n background-color: ", ";\n border-radius: ", ";\n"])), function (_ref) {
7862
7862
  var $optionBorder = _ref.$optionBorder,
7863
7863
  $isborder = _ref.$isborder,
7864
7864
  theme = _ref.theme;
7865
7865
  return $isborder ? $optionBorder || "1px solid " + theme.vms.border.extraLight : '';
7866
- });
7867
- var OptionLabel = styled.label(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n display: flex;\n gap: 8px;\n padding: 8px 12px;\n word-break: break-word;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n font-weight: 500;\n font-size: 14px;\n line-height: 14px;\n color: ", ";\n"])), function (_ref2) {
7868
- var $optionColor = _ref2.$optionColor,
7866
+ }, function (_ref2) {
7867
+ var $isHighlighted = _ref2.$isHighlighted,
7869
7868
  theme = _ref2.theme;
7869
+ return $isHighlighted ? theme.vms.hover.primary : 'transparent';
7870
+ }, function (_ref3) {
7871
+ var $isHighlighted = _ref3.$isHighlighted;
7872
+ return $isHighlighted ? '4px' : '0';
7873
+ });
7874
+ var OptionLabel = styled.label(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n display: flex;\n gap: 8px;\n padding: 8px 12px;\n word-break: break-word;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n font-weight: 500;\n font-size: 14px;\n line-height: 14px;\n color: ", ";\n"])), function (_ref4) {
7875
+ var $optionColor = _ref4.$optionColor,
7876
+ $isHighlighted = _ref4.$isHighlighted,
7877
+ theme = _ref4.theme;
7878
+ if ($isHighlighted) return theme.vms.text.white;
7870
7879
  switch ($optionColor) {
7871
7880
  case 'dark':
7872
7881
  return theme.vms.text.dark;
@@ -7888,9 +7897,9 @@ var OptionLabel = styled.label(_templateObject3$4 || (_templateObject3$4 = _tagg
7888
7897
  return $optionColor || theme.vms.text.medium;
7889
7898
  }
7890
7899
  });
7891
- var SearchContainer = styled.div(_templateObject4$3 || (_templateObject4$3 = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: auto;\n background: ", ";\n border-bottom: ", ";\n border-radius: ", ";\n padding: 8px 8px;\n display: flex;\n align-items: center;\n gap: 8px;\n"])), function (_ref3) {
7892
- var $background = _ref3.$background,
7893
- theme = _ref3.theme;
7900
+ var SearchContainer = styled.div(_templateObject4$3 || (_templateObject4$3 = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: auto;\n background: ", ";\n border-bottom: ", ";\n border-radius: ", ";\n padding: 8px 8px;\n display: flex;\n align-items: center;\n gap: 8px;\n"])), function (_ref5) {
7901
+ var $background = _ref5.$background,
7902
+ theme = _ref5.theme;
7894
7903
  switch ($background) {
7895
7904
  case 'dark':
7896
7905
  return theme.vms.text.dark;
@@ -7911,19 +7920,19 @@ var SearchContainer = styled.div(_templateObject4$3 || (_templateObject4$3 = _ta
7911
7920
  default:
7912
7921
  return $background;
7913
7922
  }
7914
- }, function (_ref4) {
7915
- var $borderBottom = _ref4.$borderBottom;
7923
+ }, function (_ref6) {
7924
+ var $borderBottom = _ref6.$borderBottom;
7916
7925
  return $borderBottom || 'none';
7917
- }, function (_ref5) {
7918
- var $borderRadius = _ref5.$borderRadius;
7926
+ }, function (_ref7) {
7927
+ var $borderRadius = _ref7.$borderRadius;
7919
7928
  return $borderRadius || '8px';
7920
7929
  });
7921
- var SearchBar = styled.input(_templateObject5$3 || (_templateObject5$3 = _taggedTemplateLiteralLoose(["\n border: none;\n outline: none;\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 14px;\n background: ", ";\n color: ", ";\n &::placeholder {\n color: ", ";\n font-style: italic;\n }\n"])), function (_ref6) {
7922
- var theme = _ref6.theme;
7930
+ var SearchBar = styled.input(_templateObject5$3 || (_templateObject5$3 = _taggedTemplateLiteralLoose(["\n border: none;\n outline: none;\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 14px;\n background: ", ";\n color: ", ";\n &::placeholder {\n color: ", ";\n font-style: italic;\n }\n"])), function (_ref8) {
7931
+ var theme = _ref8.theme;
7923
7932
  return theme.vms["default"].tertiary;
7924
- }, function (_ref7) {
7925
- var $inputColor = _ref7.$inputColor,
7926
- theme = _ref7.theme;
7933
+ }, function (_ref9) {
7934
+ var $inputColor = _ref9.$inputColor,
7935
+ theme = _ref9.theme;
7927
7936
  switch ($inputColor) {
7928
7937
  case 'dark':
7929
7938
  return theme.vms.text.dark;
@@ -7944,9 +7953,9 @@ var SearchBar = styled.input(_templateObject5$3 || (_templateObject5$3 = _tagged
7944
7953
  default:
7945
7954
  return $inputColor;
7946
7955
  }
7947
- }, function (_ref8) {
7948
- var $placeholderColor = _ref8.$placeholderColor,
7949
- theme = _ref8.theme;
7956
+ }, function (_ref10) {
7957
+ var $placeholderColor = _ref10.$placeholderColor,
7958
+ theme = _ref10.theme;
7950
7959
  switch ($placeholderColor) {
7951
7960
  case 'dark':
7952
7961
  return theme.vms.text.dark;
@@ -7969,28 +7978,34 @@ var SearchBar = styled.input(_templateObject5$3 || (_templateObject5$3 = _tagged
7969
7978
  }
7970
7979
  });
7971
7980
  var Text = styled.span(_templateObject6$3 || (_templateObject6$3 = _taggedTemplateLiteralLoose(["\n word-break: break-word;\n"])));
7972
- var OptionComponent = function OptionComponent(_ref9) {
7973
- var options = _ref9.options,
7974
- selectedOptions = _ref9.selectedOptions,
7975
- onChange = _ref9.onChange,
7976
- _ref9$placeholder = _ref9.placeholder,
7977
- placeholder = _ref9$placeholder === void 0 ? 'Search...' : _ref9$placeholder,
7978
- placeholderColor = _ref9.placeholderColor,
7979
- optionBorder = _ref9.optionBorder,
7980
- optionColor = _ref9.optionColor,
7981
- searchIcon = _ref9.searchIcon,
7982
- searchbarTextColor = _ref9.searchbarTextColor,
7983
- searchBoxBorder = _ref9.searchBoxBorder,
7984
- searchBoxBorderRadius = _ref9.searchBoxBorderRadius,
7985
- searchBoxBackground = _ref9.searchBoxBackground,
7986
- _ref9$searchBox = _ref9.searchBox,
7987
- searchBox = _ref9$searchBox === void 0 ? true : _ref9$searchBox,
7988
- NoOptionsText = _ref9.NoOptionsText;
7981
+ var OptionComponent = function OptionComponent(_ref11) {
7982
+ var options = _ref11.options,
7983
+ selectedOptions = _ref11.selectedOptions,
7984
+ onChange = _ref11.onChange,
7985
+ _ref11$placeholder = _ref11.placeholder,
7986
+ placeholder = _ref11$placeholder === void 0 ? 'Search...' : _ref11$placeholder,
7987
+ placeholderColor = _ref11.placeholderColor,
7988
+ optionBorder = _ref11.optionBorder,
7989
+ optionColor = _ref11.optionColor,
7990
+ searchIcon = _ref11.searchIcon,
7991
+ searchbarTextColor = _ref11.searchbarTextColor,
7992
+ searchBoxBorder = _ref11.searchBoxBorder,
7993
+ searchBoxBorderRadius = _ref11.searchBoxBorderRadius,
7994
+ searchBoxBackground = _ref11.searchBoxBackground,
7995
+ _ref11$searchBox = _ref11.searchBox,
7996
+ searchBox = _ref11$searchBox === void 0 ? true : _ref11$searchBox,
7997
+ NoOptionsText = _ref11.NoOptionsText;
7989
7998
  var _useState = useState(''),
7990
7999
  searchQuery = _useState[0],
7991
8000
  setSearchQuery = _useState[1];
8001
+ var _useState2 = useState(-1),
8002
+ highlightedIndex = _useState2[0],
8003
+ setHighlightedIndex = _useState2[1];
8004
+ var optionContainerRef = useRef(null);
8005
+ var searchInputRef = useRef(null);
7992
8006
  var handleSearchChange = function handleSearchChange(e) {
7993
8007
  setSearchQuery(e.target.value.trimStart());
8008
+ setHighlightedIndex(-1);
7994
8009
  };
7995
8010
  var handleOptionToggle = function handleOptionToggle(currentOption) {
7996
8011
  var newOption = selectedOptions.includes(currentOption) ? selectedOptions.filter(function (item) {
@@ -7998,6 +8013,36 @@ var OptionComponent = function OptionComponent(_ref9) {
7998
8013
  }) : [].concat(selectedOptions, [currentOption]);
7999
8014
  onChange === null || onChange === void 0 ? void 0 : onChange(newOption);
8000
8015
  };
8016
+ var handleKeyDown = function handleKeyDown(e) {
8017
+ if (finalOptions.length === 0) return;
8018
+ switch (e.key) {
8019
+ case 'ArrowDown':
8020
+ e.preventDefault();
8021
+ setHighlightedIndex(function (prev) {
8022
+ return prev < finalOptions.length - 1 ? prev + 1 : prev;
8023
+ });
8024
+ break;
8025
+ case 'ArrowUp':
8026
+ e.preventDefault();
8027
+ setHighlightedIndex(function (prev) {
8028
+ return prev > 0 ? prev - 1 : -1;
8029
+ });
8030
+ break;
8031
+ case 'Enter':
8032
+ e.preventDefault();
8033
+ if (highlightedIndex >= 0 && highlightedIndex < finalOptions.length) {
8034
+ var selectedOption = finalOptions[highlightedIndex];
8035
+ handleOptionToggle(selectedOption.value);
8036
+ }
8037
+ break;
8038
+ case 'Escape':
8039
+ setHighlightedIndex(-1);
8040
+ if (searchInputRef.current) {
8041
+ searchInputRef.current.blur();
8042
+ }
8043
+ break;
8044
+ }
8045
+ };
8001
8046
  var filteredOptions = options.filter(function (option) {
8002
8047
  return option.labelText.toLowerCase().includes(searchQuery.toLowerCase());
8003
8048
  });
@@ -8008,6 +8053,17 @@ var OptionComponent = function OptionComponent(_ref9) {
8008
8053
  })) : filteredOptions.sort(function (a, b) {
8009
8054
  return a.labelText.localeCompare(b.labelText);
8010
8055
  });
8056
+ useEffect(function () {
8057
+ if (highlightedIndex >= 0 && optionContainerRef.current) {
8058
+ var highlightedElement = optionContainerRef.current.children[highlightedIndex];
8059
+ if (highlightedElement) {
8060
+ highlightedElement.scrollIntoView({
8061
+ block: 'nearest',
8062
+ behavior: 'smooth'
8063
+ });
8064
+ }
8065
+ }
8066
+ }, [highlightedIndex]);
8011
8067
  return React.createElement(Container, {
8012
8068
  "$flexDirection": 'column',
8013
8069
  "$gap": '8px',
@@ -8022,20 +8078,26 @@ var OptionComponent = function OptionComponent(_ref9) {
8022
8078
  color: searchIcon === null || searchIcon === void 0 ? void 0 : searchIcon.color,
8023
8079
  weight: (searchIcon === null || searchIcon === void 0 ? void 0 : searchIcon.weight) || '0px'
8024
8080
  }), React.createElement(SearchBar, {
8081
+ ref: searchInputRef,
8025
8082
  type: 'text',
8026
8083
  placeholder: placeholder,
8027
8084
  value: searchQuery,
8028
8085
  onChange: handleSearchChange,
8086
+ onKeyDown: handleKeyDown,
8029
8087
  "$inputColor": searchbarTextColor,
8030
8088
  "$placeholderColor": placeholderColor
8031
- })), React.createElement(OptionContainer, null, finalOptions.length > 0 ? finalOptions.map(function (option, id) {
8089
+ })), React.createElement(OptionContainer, {
8090
+ ref: optionContainerRef
8091
+ }, finalOptions.length > 0 ? finalOptions.map(function (option, id) {
8032
8092
  return React.createElement(OptionItem, {
8033
8093
  key: option.value,
8034
8094
  "$optionBorder": optionBorder,
8035
- "$isborder": id !== finalOptions.length - 1
8095
+ "$isborder": id !== finalOptions.length - 1,
8096
+ "$isHighlighted": id === highlightedIndex
8036
8097
  }, React.createElement(OptionLabel, {
8037
8098
  htmlFor: option.value,
8038
- "$optionColor": optionColor
8099
+ "$optionColor": optionColor,
8100
+ "$isHighlighted": id === highlightedIndex
8039
8101
  }, React.createElement("input", {
8040
8102
  id: option.value,
8041
8103
  type: 'checkbox',
@@ -8330,6 +8392,7 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
8330
8392
  isOpen = _useState2[0],
8331
8393
  setIsOpen = _useState2[1];
8332
8394
  var dropdownRef = useRef(null);
8395
+ var dropdownButtonRef = useRef(null);
8333
8396
  var toggleDropdown = function toggleDropdown() {
8334
8397
  if (disabled) return;
8335
8398
  var refToUse = dropdownRef.current;
@@ -8395,6 +8458,34 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
8395
8458
  return v !== SELECT_ALL_VALUE;
8396
8459
  }));
8397
8460
  };
8461
+ var handleKeyDown = function handleKeyDown(e) {
8462
+ if (disabled) return;
8463
+ switch (e.key) {
8464
+ case 'Enter':
8465
+ case ' ':
8466
+ e.preventDefault();
8467
+ toggleDropdown();
8468
+ break;
8469
+ case 'Escape':
8470
+ if (isOpen) {
8471
+ e.preventDefault();
8472
+ setIsOpen(false);
8473
+ }
8474
+ break;
8475
+ case 'ArrowDown':
8476
+ if (!isOpen) {
8477
+ e.preventDefault();
8478
+ toggleDropdown();
8479
+ }
8480
+ break;
8481
+ case 'ArrowUp':
8482
+ if (!isOpen) {
8483
+ e.preventDefault();
8484
+ toggleDropdown();
8485
+ }
8486
+ break;
8487
+ }
8488
+ };
8398
8489
  return React.createElement(Container$2, null, title && React.createElement(TitleText, {
8399
8490
  "$titleColor": titleColor || themeColors.vms.text.dark,
8400
8491
  "$titleSize": titleSize,
@@ -8406,7 +8497,10 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
8406
8497
  "$height": height,
8407
8498
  "$hasTitle": !!title
8408
8499
  }, React.createElement(DropdownButton, {
8500
+ ref: dropdownButtonRef,
8409
8501
  onClick: toggleDropdown,
8502
+ onKeyDown: handleKeyDown,
8503
+ tabIndex: disabled ? -1 : 0,
8410
8504
  "$height": height,
8411
8505
  "$width": width,
8412
8506
  "$border": border,
@@ -8577,8 +8671,9 @@ var DropdownButton$1 = styled.div(_templateObject3$6 || (_templateObject3$6 = _t
8577
8671
  var Options = styled.div(_templateObject4$5 || (_templateObject4$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n padding: 5px 10px;\n width: 100%;\n font-size: ", ";\n font-weight: ", ";\n background-color: ", ";\n\n \n &:hover {\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n }\n\n"])), function (_ref14) {
8578
8672
  var $optionColor = _ref14.$optionColor,
8579
8673
  $optionSelected = _ref14.$optionSelected,
8674
+ $isHighlighted = _ref14.$isHighlighted,
8580
8675
  theme = _ref14.theme;
8581
- return $optionSelected ? theme.vms.text.white : $optionColor || theme.vms.text.medium;
8676
+ return $optionSelected || $isHighlighted ? theme.vms.text.white : $optionColor || theme.vms.text.medium;
8582
8677
  }, function (_ref15) {
8583
8678
  var $optionFontSize = _ref15.$optionFontSize;
8584
8679
  return $optionFontSize || '14px';
@@ -8588,8 +8683,9 @@ var Options = styled.div(_templateObject4$5 || (_templateObject4$5 = _taggedTemp
8588
8683
  }, function (_ref17) {
8589
8684
  var $optionBackgroundColor = _ref17.$optionBackgroundColor,
8590
8685
  $optionSelected = _ref17.$optionSelected,
8686
+ $isHighlighted = _ref17.$isHighlighted,
8591
8687
  theme = _ref17.theme;
8592
- return $optionSelected ? theme.vms["default"].primary : $optionBackgroundColor || theme.vms["default"].tertiary;
8688
+ return $optionSelected ? theme.vms["default"].primary : $isHighlighted ? theme.vms.hover.primary : $optionBackgroundColor || theme.vms["default"].tertiary;
8593
8689
  }, function (_ref18) {
8594
8690
  var theme = _ref18.theme;
8595
8691
  return theme.vms.hover.primary;
@@ -8746,10 +8842,15 @@ var SelectOption = function SelectOption(_ref37) {
8746
8842
  var _useState3 = useState(''),
8747
8843
  searchTerm = _useState3[0],
8748
8844
  setSearchTerm = _useState3[1];
8845
+ var _useState4 = useState(-1),
8846
+ highlightedIndex = _useState4[0],
8847
+ setHighlightedIndex = _useState4[1];
8848
+ var optionsWrapperRef = useRef(null);
8749
8849
  useEffect(function () {
8750
8850
  if (loading) {
8751
8851
  setIsOpen(false);
8752
8852
  setSearchTerm('');
8853
+ setHighlightedIndex(-1);
8753
8854
  }
8754
8855
  }, [loading]);
8755
8856
  var showSearchBox = searchBox && (options.length > 5 || allowCustomValue);
@@ -8772,6 +8873,7 @@ var SelectOption = function SelectOption(_ref37) {
8772
8873
  });
8773
8874
  if (!isOpen) {
8774
8875
  setSearchTerm('');
8876
+ setHighlightedIndex(-1);
8775
8877
  }
8776
8878
  };
8777
8879
  var dropdownRef = useRef(null);
@@ -8796,6 +8898,7 @@ var SelectOption = function SelectOption(_ref37) {
8796
8898
  }
8797
8899
  setIsOpen(false);
8798
8900
  setSearchTerm('');
8901
+ setHighlightedIndex(-1);
8799
8902
  };
8800
8903
  var filteredOptions = searchTerm ? options.filter(function (option) {
8801
8904
  return option.label.toLowerCase().includes(searchTerm.toLowerCase());
@@ -8820,6 +8923,7 @@ var SelectOption = function SelectOption(_ref37) {
8820
8923
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
8821
8924
  setIsOpen(false);
8822
8925
  setSearchTerm('');
8926
+ setHighlightedIndex(-1);
8823
8927
  }
8824
8928
  };
8825
8929
  document.addEventListener('mousedown', handleClickOutside);
@@ -8827,12 +8931,62 @@ var SelectOption = function SelectOption(_ref37) {
8827
8931
  document.removeEventListener('mousedown', handleClickOutside);
8828
8932
  };
8829
8933
  }, []);
8934
+ useEffect(function () {
8935
+ if (highlightedIndex >= 0 && optionsWrapperRef.current) {
8936
+ var children = optionsWrapperRef.current.children;
8937
+ var offset = isCustomValue ? 1 : 0;
8938
+ var highlightedElement = children[highlightedIndex + offset];
8939
+ if (highlightedElement) {
8940
+ highlightedElement.scrollIntoView({
8941
+ block: 'nearest',
8942
+ behavior: 'smooth'
8943
+ });
8944
+ }
8945
+ }
8946
+ }, [highlightedIndex, isCustomValue]);
8830
8947
  var selectedOption = options === null || options === void 0 ? void 0 : options.find(function (option) {
8831
8948
  return option.value === value;
8832
8949
  });
8833
8950
  var displayLabel = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || (allowCustomValue && value ? value : '');
8834
8951
  var handleSearchChange = function handleSearchChange(e) {
8835
8952
  setSearchTerm(e.target.value);
8953
+ setHighlightedIndex(-1);
8954
+ };
8955
+ var handleKeyDown = function handleKeyDown(e) {
8956
+ var totalOptions = isCustomValue ? filteredOptions.length + 1 : filteredOptions.length;
8957
+ if (totalOptions === 0) return;
8958
+ switch (e.key) {
8959
+ case 'ArrowDown':
8960
+ e.preventDefault();
8961
+ setHighlightedIndex(function (prev) {
8962
+ return prev < totalOptions - 1 ? prev + 1 : prev;
8963
+ });
8964
+ break;
8965
+ case 'ArrowUp':
8966
+ e.preventDefault();
8967
+ setHighlightedIndex(function (prev) {
8968
+ return prev > 0 ? prev - 1 : -1;
8969
+ });
8970
+ break;
8971
+ case 'Enter':
8972
+ e.preventDefault();
8973
+ if (highlightedIndex >= 0) {
8974
+ if (isCustomValue && highlightedIndex === 0) {
8975
+ handleCustomValueSelect();
8976
+ } else {
8977
+ var adjustedIndex = isCustomValue ? highlightedIndex - 1 : highlightedIndex;
8978
+ if (adjustedIndex >= 0 && adjustedIndex < filteredOptions.length) {
8979
+ handleOptionClick(filteredOptions[adjustedIndex].value);
8980
+ }
8981
+ }
8982
+ }
8983
+ break;
8984
+ case 'Escape':
8985
+ setIsOpen(false);
8986
+ setSearchTerm('');
8987
+ setHighlightedIndex(-1);
8988
+ break;
8989
+ }
8836
8990
  };
8837
8991
  return React.createElement(Container, {
8838
8992
  "$padding": padding,
@@ -8906,13 +9060,17 @@ var SelectOption = function SelectOption(_ref37) {
8906
9060
  type: 'text',
8907
9061
  value: searchTerm,
8908
9062
  onChange: handleSearchChange,
9063
+ onKeyDown: handleKeyDown,
8909
9064
  placeholder: placeholderText,
8910
9065
  "$inputColor": inputColor,
8911
9066
  "$placeholderColor": placeholderColor
8912
- })), React.createElement(OptionsWrapper, null, isCustomValue && React.createElement(Options, {
9067
+ })), React.createElement(OptionsWrapper, {
9068
+ ref: optionsWrapperRef
9069
+ }, isCustomValue && React.createElement(Options, {
8913
9070
  "$optionSelected": false,
9071
+ "$isHighlighted": highlightedIndex === 0,
8914
9072
  onClick: handleCustomValueSelect
8915
- }, "Add \"", normalizedSearch, "\""), filteredOptions.length ? filteredOptions.map(function (option) {
9073
+ }, "Add \"", normalizedSearch, "\""), filteredOptions.length ? filteredOptions.map(function (option, index) {
8916
9074
  return React.createElement(Options, {
8917
9075
  key: option.value,
8918
9076
  "$optionColor": optionColor,
@@ -8922,7 +9080,8 @@ var SelectOption = function SelectOption(_ref37) {
8922
9080
  onClick: function onClick() {
8923
9081
  return handleOptionClick(option.value);
8924
9082
  },
8925
- "$optionSelected": option.value === value || allowCustomValue && option.value === displayLabel
9083
+ "$optionSelected": option.value === value || allowCustomValue && option.value === displayLabel,
9084
+ "$isHighlighted": isCustomValue ? index + 1 === highlightedIndex : index === highlightedIndex
8926
9085
  }, option.label);
8927
9086
  }) : !isCustomValue && React.createElement(NoOptions, null, NoOptionsText)))));
8928
9087
  };
@@ -9716,12 +9875,14 @@ var OptionContainer$1 = styled.div(_templateObject$h || (_templateObject$h = _ta
9716
9875
  });
9717
9876
  var OptionItem$1 = styled.div(_templateObject2$e || (_templateObject2$e = _taggedTemplateLiteralLoose(["\n color: ", ";\n background-color: ", ";\n border-radius: 8px;\n\n &:hover {\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n }\n"])), function (_ref2) {
9718
9877
  var $optionSelected = _ref2.$optionSelected,
9878
+ $isHighlighted = _ref2.$isHighlighted,
9719
9879
  theme = _ref2.theme;
9720
- return $optionSelected ? theme.vms.text.white : theme.vms.text.medium;
9880
+ return $optionSelected || $isHighlighted ? theme.vms.text.white : theme.vms.text.medium;
9721
9881
  }, function (_ref3) {
9722
9882
  var $optionSelected = _ref3.$optionSelected,
9883
+ $isHighlighted = _ref3.$isHighlighted,
9723
9884
  theme = _ref3.theme;
9724
- return $optionSelected ? theme.vms["default"].primary : theme.vms.text.white;
9885
+ return $optionSelected ? theme.vms["default"].primary : $isHighlighted ? theme.vms.hover.primary : theme.vms.text.white;
9725
9886
  }, function (_ref4) {
9726
9887
  var theme = _ref4.theme;
9727
9888
  return theme.vms.hover.primary;
@@ -9847,19 +10008,57 @@ var TextFieldWithDropdown = function TextFieldWithDropdown(_ref16) {
9847
10008
  var _useTranslation = useTranslation(),
9848
10009
  t = _useTranslation.t;
9849
10010
  var searchBoxRef = useRef(null);
10011
+ var optionsWrapperRef = useRef(null);
9850
10012
  var _useState = useState(false),
9851
10013
  isSearchBarEnabled = _useState[0],
9852
10014
  setIsSearchBarEnabled = _useState[1];
10015
+ var _useState2 = useState(-1),
10016
+ highlightedIndex = _useState2[0],
10017
+ setHighlightedIndex = _useState2[1];
9853
10018
  var filteredArray = options.filter(function (item) {
9854
10019
  return item.labelText.toLowerCase().includes(internalSearchQuery.toLowerCase().trim());
9855
10020
  });
9856
10021
  var handleSearchChange = function handleSearchChange(e) {
9857
10022
  var value = e.target.value.trimStart();
9858
10023
  setInternalSearchQuery(value);
10024
+ setHighlightedIndex(-1);
10025
+ };
10026
+ var handleKeyDown = function handleKeyDown(e) {
10027
+ if (!isSearchBarEnabled || filteredArray.length === 0) return;
10028
+ switch (e.key) {
10029
+ case 'ArrowDown':
10030
+ e.preventDefault();
10031
+ setHighlightedIndex(function (prev) {
10032
+ return prev < filteredArray.length - 1 ? prev + 1 : prev;
10033
+ });
10034
+ break;
10035
+ case 'ArrowUp':
10036
+ e.preventDefault();
10037
+ setHighlightedIndex(function (prev) {
10038
+ return prev > 0 ? prev - 1 : -1;
10039
+ });
10040
+ break;
10041
+ case 'Enter':
10042
+ e.preventDefault();
10043
+ if (highlightedIndex >= 0 && highlightedIndex < filteredArray.length) {
10044
+ var _selectedOption = filteredArray[highlightedIndex];
10045
+ setInternalSearchQuery(_selectedOption.labelText);
10046
+ setSearchQuery(_selectedOption.labelText);
10047
+ setIsSearchBarEnabled(false);
10048
+ setHighlightedIndex(-1);
10049
+ if (onSelect) onSelect(_selectedOption);
10050
+ }
10051
+ break;
10052
+ case 'Escape':
10053
+ setIsSearchBarEnabled(false);
10054
+ setHighlightedIndex(-1);
10055
+ break;
10056
+ }
9859
10057
  };
9860
10058
  var handleClickOutside = function handleClickOutside(event) {
9861
10059
  if (searchBoxRef.current && !searchBoxRef.current.contains(event.target)) {
9862
10060
  setIsSearchBarEnabled(false);
10061
+ setHighlightedIndex(-1);
9863
10062
  }
9864
10063
  };
9865
10064
  useEffect(function () {
@@ -9868,6 +10067,17 @@ var TextFieldWithDropdown = function TextFieldWithDropdown(_ref16) {
9868
10067
  document.removeEventListener('mousedown', handleClickOutside);
9869
10068
  };
9870
10069
  }, []);
10070
+ useEffect(function () {
10071
+ if (highlightedIndex >= 0 && optionsWrapperRef.current) {
10072
+ var highlightedElement = optionsWrapperRef.current.children[highlightedIndex];
10073
+ if (highlightedElement) {
10074
+ highlightedElement.scrollIntoView({
10075
+ block: 'nearest',
10076
+ behavior: 'smooth'
10077
+ });
10078
+ }
10079
+ }
10080
+ }, [highlightedIndex]);
9871
10081
  return React.createElement(Container, {
9872
10082
  "$flexDirection": 'column',
9873
10083
  "$gap": '8px',
@@ -9894,6 +10104,7 @@ var TextFieldWithDropdown = function TextFieldWithDropdown(_ref16) {
9894
10104
  placeholder: placeholder,
9895
10105
  value: internalSearchQuery,
9896
10106
  onChange: handleSearchChange,
10107
+ onKeyDown: handleKeyDown,
9897
10108
  "$inputColor": searchbarTextColor,
9898
10109
  "$placeholderColor": isSearchBarEnabled ? themeColors.vms.text.light : themeColors.vms.text.medium,
9899
10110
  disabled: !!searchQuery
@@ -9913,16 +10124,20 @@ var TextFieldWithDropdown = function TextFieldWithDropdown(_ref16) {
9913
10124
  "$fontSize": '12px',
9914
10125
  "$fontWeight": '400',
9915
10126
  "$color": themeColors.vms.text.light
9916
- }, t('Showing_results') + " (" + filteredArray.length + " of " + (options === null || options === void 0 ? void 0 : options.length) + ")")), React.createElement(OptionsWrapper$1, null, filteredArray.length > 0 ? filteredArray.map(function (option) {
10127
+ }, t('Showing_results') + " (" + filteredArray.length + " of " + (options === null || options === void 0 ? void 0 : options.length) + ")")), React.createElement(OptionsWrapper$1, {
10128
+ ref: optionsWrapperRef
10129
+ }, filteredArray.length > 0 ? filteredArray.map(function (option, index) {
9917
10130
  return React.createElement(OptionItem$1, {
9918
10131
  key: option.value,
9919
- "$optionSelected": option.value === selectedOption
10132
+ "$optionSelected": option.value === selectedOption,
10133
+ "$isHighlighted": index === highlightedIndex
9920
10134
  }, React.createElement(OptionLabel$1, {
9921
10135
  htmlFor: option.value,
9922
10136
  onClick: function onClick() {
9923
10137
  setInternalSearchQuery(option.labelText);
9924
10138
  setSearchQuery(option.labelText);
9925
10139
  setIsSearchBarEnabled(false);
10140
+ setHighlightedIndex(-1);
9926
10141
  if (onSelect) onSelect(option);
9927
10142
  }
9928
10143
  }, option.labelText));