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.
@@ -6,6 +6,7 @@ export declare const Options: import("styled-components/dist/types").IStyledComp
6
6
  $optionFontWeight?: string | undefined;
7
7
  $optionBackgroundColor?: string | undefined;
8
8
  $optionSelected?: boolean | undefined;
9
+ $isHighlighted?: boolean | undefined;
9
10
  }>> & string;
10
11
  export declare const DropdownMenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
11
12
  $menuBackground?: string | undefined;
package/dist/index.js CHANGED
@@ -7862,15 +7862,24 @@ var DatePicker = function DatePicker(_ref22) {
7862
7862
 
7863
7863
  var _templateObject$a, _templateObject2$7, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$3;
7864
7864
  var OptionContainer = styled__default.div(_templateObject$a || (_templateObject$a = _taggedTemplateLiteralLoose([""])));
7865
- var OptionItem = styled__default.div(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteralLoose(["\n border-bottom: ", ";\n"])), function (_ref) {
7865
+ var OptionItem = styled__default.div(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteralLoose(["\n border-bottom: ", ";\n background-color: ", ";\n border-radius: ", ";\n"])), function (_ref) {
7866
7866
  var $optionBorder = _ref.$optionBorder,
7867
7867
  $isborder = _ref.$isborder,
7868
7868
  theme = _ref.theme;
7869
7869
  return $isborder ? $optionBorder || "1px solid " + theme.vms.border.extraLight : '';
7870
- });
7871
- var OptionLabel = styled__default.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) {
7872
- var $optionColor = _ref2.$optionColor,
7870
+ }, function (_ref2) {
7871
+ var $isHighlighted = _ref2.$isHighlighted,
7873
7872
  theme = _ref2.theme;
7873
+ return $isHighlighted ? theme.vms.hover.primary : 'transparent';
7874
+ }, function (_ref3) {
7875
+ var $isHighlighted = _ref3.$isHighlighted;
7876
+ return $isHighlighted ? '4px' : '0';
7877
+ });
7878
+ var OptionLabel = styled__default.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) {
7879
+ var $optionColor = _ref4.$optionColor,
7880
+ $isHighlighted = _ref4.$isHighlighted,
7881
+ theme = _ref4.theme;
7882
+ if ($isHighlighted) return theme.vms.text.white;
7874
7883
  switch ($optionColor) {
7875
7884
  case 'dark':
7876
7885
  return theme.vms.text.dark;
@@ -7892,9 +7901,9 @@ var OptionLabel = styled__default.label(_templateObject3$4 || (_templateObject3$
7892
7901
  return $optionColor || theme.vms.text.medium;
7893
7902
  }
7894
7903
  });
7895
- var SearchContainer = styled__default.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) {
7896
- var $background = _ref3.$background,
7897
- theme = _ref3.theme;
7904
+ var SearchContainer = styled__default.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) {
7905
+ var $background = _ref5.$background,
7906
+ theme = _ref5.theme;
7898
7907
  switch ($background) {
7899
7908
  case 'dark':
7900
7909
  return theme.vms.text.dark;
@@ -7915,19 +7924,19 @@ var SearchContainer = styled__default.div(_templateObject4$3 || (_templateObject
7915
7924
  default:
7916
7925
  return $background;
7917
7926
  }
7918
- }, function (_ref4) {
7919
- var $borderBottom = _ref4.$borderBottom;
7927
+ }, function (_ref6) {
7928
+ var $borderBottom = _ref6.$borderBottom;
7920
7929
  return $borderBottom || 'none';
7921
- }, function (_ref5) {
7922
- var $borderRadius = _ref5.$borderRadius;
7930
+ }, function (_ref7) {
7931
+ var $borderRadius = _ref7.$borderRadius;
7923
7932
  return $borderRadius || '8px';
7924
7933
  });
7925
- var SearchBar = styled__default.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) {
7926
- var theme = _ref6.theme;
7934
+ var SearchBar = styled__default.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) {
7935
+ var theme = _ref8.theme;
7927
7936
  return theme.vms["default"].tertiary;
7928
- }, function (_ref7) {
7929
- var $inputColor = _ref7.$inputColor,
7930
- theme = _ref7.theme;
7937
+ }, function (_ref9) {
7938
+ var $inputColor = _ref9.$inputColor,
7939
+ theme = _ref9.theme;
7931
7940
  switch ($inputColor) {
7932
7941
  case 'dark':
7933
7942
  return theme.vms.text.dark;
@@ -7948,9 +7957,9 @@ var SearchBar = styled__default.input(_templateObject5$3 || (_templateObject5$3
7948
7957
  default:
7949
7958
  return $inputColor;
7950
7959
  }
7951
- }, function (_ref8) {
7952
- var $placeholderColor = _ref8.$placeholderColor,
7953
- theme = _ref8.theme;
7960
+ }, function (_ref10) {
7961
+ var $placeholderColor = _ref10.$placeholderColor,
7962
+ theme = _ref10.theme;
7954
7963
  switch ($placeholderColor) {
7955
7964
  case 'dark':
7956
7965
  return theme.vms.text.dark;
@@ -7973,28 +7982,34 @@ var SearchBar = styled__default.input(_templateObject5$3 || (_templateObject5$3
7973
7982
  }
7974
7983
  });
7975
7984
  var Text = styled__default.span(_templateObject6$3 || (_templateObject6$3 = _taggedTemplateLiteralLoose(["\n word-break: break-word;\n"])));
7976
- var OptionComponent = function OptionComponent(_ref9) {
7977
- var options = _ref9.options,
7978
- selectedOptions = _ref9.selectedOptions,
7979
- onChange = _ref9.onChange,
7980
- _ref9$placeholder = _ref9.placeholder,
7981
- placeholder = _ref9$placeholder === void 0 ? 'Search...' : _ref9$placeholder,
7982
- placeholderColor = _ref9.placeholderColor,
7983
- optionBorder = _ref9.optionBorder,
7984
- optionColor = _ref9.optionColor,
7985
- searchIcon = _ref9.searchIcon,
7986
- searchbarTextColor = _ref9.searchbarTextColor,
7987
- searchBoxBorder = _ref9.searchBoxBorder,
7988
- searchBoxBorderRadius = _ref9.searchBoxBorderRadius,
7989
- searchBoxBackground = _ref9.searchBoxBackground,
7990
- _ref9$searchBox = _ref9.searchBox,
7991
- searchBox = _ref9$searchBox === void 0 ? true : _ref9$searchBox,
7992
- NoOptionsText = _ref9.NoOptionsText;
7985
+ var OptionComponent = function OptionComponent(_ref11) {
7986
+ var options = _ref11.options,
7987
+ selectedOptions = _ref11.selectedOptions,
7988
+ onChange = _ref11.onChange,
7989
+ _ref11$placeholder = _ref11.placeholder,
7990
+ placeholder = _ref11$placeholder === void 0 ? 'Search...' : _ref11$placeholder,
7991
+ placeholderColor = _ref11.placeholderColor,
7992
+ optionBorder = _ref11.optionBorder,
7993
+ optionColor = _ref11.optionColor,
7994
+ searchIcon = _ref11.searchIcon,
7995
+ searchbarTextColor = _ref11.searchbarTextColor,
7996
+ searchBoxBorder = _ref11.searchBoxBorder,
7997
+ searchBoxBorderRadius = _ref11.searchBoxBorderRadius,
7998
+ searchBoxBackground = _ref11.searchBoxBackground,
7999
+ _ref11$searchBox = _ref11.searchBox,
8000
+ searchBox = _ref11$searchBox === void 0 ? true : _ref11$searchBox,
8001
+ NoOptionsText = _ref11.NoOptionsText;
7993
8002
  var _useState = React.useState(''),
7994
8003
  searchQuery = _useState[0],
7995
8004
  setSearchQuery = _useState[1];
8005
+ var _useState2 = React.useState(-1),
8006
+ highlightedIndex = _useState2[0],
8007
+ setHighlightedIndex = _useState2[1];
8008
+ var optionContainerRef = React.useRef(null);
8009
+ var searchInputRef = React.useRef(null);
7996
8010
  var handleSearchChange = function handleSearchChange(e) {
7997
8011
  setSearchQuery(e.target.value.trimStart());
8012
+ setHighlightedIndex(-1);
7998
8013
  };
7999
8014
  var handleOptionToggle = function handleOptionToggle(currentOption) {
8000
8015
  var newOption = selectedOptions.includes(currentOption) ? selectedOptions.filter(function (item) {
@@ -8002,6 +8017,36 @@ var OptionComponent = function OptionComponent(_ref9) {
8002
8017
  }) : [].concat(selectedOptions, [currentOption]);
8003
8018
  onChange === null || onChange === void 0 ? void 0 : onChange(newOption);
8004
8019
  };
8020
+ var handleKeyDown = function handleKeyDown(e) {
8021
+ if (finalOptions.length === 0) return;
8022
+ switch (e.key) {
8023
+ case 'ArrowDown':
8024
+ e.preventDefault();
8025
+ setHighlightedIndex(function (prev) {
8026
+ return prev < finalOptions.length - 1 ? prev + 1 : prev;
8027
+ });
8028
+ break;
8029
+ case 'ArrowUp':
8030
+ e.preventDefault();
8031
+ setHighlightedIndex(function (prev) {
8032
+ return prev > 0 ? prev - 1 : -1;
8033
+ });
8034
+ break;
8035
+ case 'Enter':
8036
+ e.preventDefault();
8037
+ if (highlightedIndex >= 0 && highlightedIndex < finalOptions.length) {
8038
+ var selectedOption = finalOptions[highlightedIndex];
8039
+ handleOptionToggle(selectedOption.value);
8040
+ }
8041
+ break;
8042
+ case 'Escape':
8043
+ setHighlightedIndex(-1);
8044
+ if (searchInputRef.current) {
8045
+ searchInputRef.current.blur();
8046
+ }
8047
+ break;
8048
+ }
8049
+ };
8005
8050
  var filteredOptions = options.filter(function (option) {
8006
8051
  return option.labelText.toLowerCase().includes(searchQuery.toLowerCase());
8007
8052
  });
@@ -8012,6 +8057,17 @@ var OptionComponent = function OptionComponent(_ref9) {
8012
8057
  })) : filteredOptions.sort(function (a, b) {
8013
8058
  return a.labelText.localeCompare(b.labelText);
8014
8059
  });
8060
+ React.useEffect(function () {
8061
+ if (highlightedIndex >= 0 && optionContainerRef.current) {
8062
+ var highlightedElement = optionContainerRef.current.children[highlightedIndex];
8063
+ if (highlightedElement) {
8064
+ highlightedElement.scrollIntoView({
8065
+ block: 'nearest',
8066
+ behavior: 'smooth'
8067
+ });
8068
+ }
8069
+ }
8070
+ }, [highlightedIndex]);
8015
8071
  return React__default.createElement(Container, {
8016
8072
  "$flexDirection": 'column',
8017
8073
  "$gap": '8px',
@@ -8026,20 +8082,26 @@ var OptionComponent = function OptionComponent(_ref9) {
8026
8082
  color: searchIcon === null || searchIcon === void 0 ? void 0 : searchIcon.color,
8027
8083
  weight: (searchIcon === null || searchIcon === void 0 ? void 0 : searchIcon.weight) || '0px'
8028
8084
  }), React__default.createElement(SearchBar, {
8085
+ ref: searchInputRef,
8029
8086
  type: 'text',
8030
8087
  placeholder: placeholder,
8031
8088
  value: searchQuery,
8032
8089
  onChange: handleSearchChange,
8090
+ onKeyDown: handleKeyDown,
8033
8091
  "$inputColor": searchbarTextColor,
8034
8092
  "$placeholderColor": placeholderColor
8035
- })), React__default.createElement(OptionContainer, null, finalOptions.length > 0 ? finalOptions.map(function (option, id) {
8093
+ })), React__default.createElement(OptionContainer, {
8094
+ ref: optionContainerRef
8095
+ }, finalOptions.length > 0 ? finalOptions.map(function (option, id) {
8036
8096
  return React__default.createElement(OptionItem, {
8037
8097
  key: option.value,
8038
8098
  "$optionBorder": optionBorder,
8039
- "$isborder": id !== finalOptions.length - 1
8099
+ "$isborder": id !== finalOptions.length - 1,
8100
+ "$isHighlighted": id === highlightedIndex
8040
8101
  }, React__default.createElement(OptionLabel, {
8041
8102
  htmlFor: option.value,
8042
- "$optionColor": optionColor
8103
+ "$optionColor": optionColor,
8104
+ "$isHighlighted": id === highlightedIndex
8043
8105
  }, React__default.createElement("input", {
8044
8106
  id: option.value,
8045
8107
  type: 'checkbox',
@@ -8334,6 +8396,7 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
8334
8396
  isOpen = _useState2[0],
8335
8397
  setIsOpen = _useState2[1];
8336
8398
  var dropdownRef = React.useRef(null);
8399
+ var dropdownButtonRef = React.useRef(null);
8337
8400
  var toggleDropdown = function toggleDropdown() {
8338
8401
  if (disabled) return;
8339
8402
  var refToUse = dropdownRef.current;
@@ -8399,6 +8462,34 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
8399
8462
  return v !== SELECT_ALL_VALUE;
8400
8463
  }));
8401
8464
  };
8465
+ var handleKeyDown = function handleKeyDown(e) {
8466
+ if (disabled) return;
8467
+ switch (e.key) {
8468
+ case 'Enter':
8469
+ case ' ':
8470
+ e.preventDefault();
8471
+ toggleDropdown();
8472
+ break;
8473
+ case 'Escape':
8474
+ if (isOpen) {
8475
+ e.preventDefault();
8476
+ setIsOpen(false);
8477
+ }
8478
+ break;
8479
+ case 'ArrowDown':
8480
+ if (!isOpen) {
8481
+ e.preventDefault();
8482
+ toggleDropdown();
8483
+ }
8484
+ break;
8485
+ case 'ArrowUp':
8486
+ if (!isOpen) {
8487
+ e.preventDefault();
8488
+ toggleDropdown();
8489
+ }
8490
+ break;
8491
+ }
8492
+ };
8402
8493
  return React__default.createElement(Container$2, null, title && React__default.createElement(TitleText, {
8403
8494
  "$titleColor": titleColor || themeColors.vms.text.dark,
8404
8495
  "$titleSize": titleSize,
@@ -8410,7 +8501,10 @@ var MultiSelectDropdown = function MultiSelectDropdown(_ref32) {
8410
8501
  "$height": height,
8411
8502
  "$hasTitle": !!title
8412
8503
  }, React__default.createElement(DropdownButton, {
8504
+ ref: dropdownButtonRef,
8413
8505
  onClick: toggleDropdown,
8506
+ onKeyDown: handleKeyDown,
8507
+ tabIndex: disabled ? -1 : 0,
8414
8508
  "$height": height,
8415
8509
  "$width": width,
8416
8510
  "$border": border,
@@ -8581,8 +8675,9 @@ var DropdownButton$1 = styled__default.div(_templateObject3$6 || (_templateObjec
8581
8675
  var Options = styled__default.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) {
8582
8676
  var $optionColor = _ref14.$optionColor,
8583
8677
  $optionSelected = _ref14.$optionSelected,
8678
+ $isHighlighted = _ref14.$isHighlighted,
8584
8679
  theme = _ref14.theme;
8585
- return $optionSelected ? theme.vms.text.white : $optionColor || theme.vms.text.medium;
8680
+ return $optionSelected || $isHighlighted ? theme.vms.text.white : $optionColor || theme.vms.text.medium;
8586
8681
  }, function (_ref15) {
8587
8682
  var $optionFontSize = _ref15.$optionFontSize;
8588
8683
  return $optionFontSize || '14px';
@@ -8592,8 +8687,9 @@ var Options = styled__default.div(_templateObject4$5 || (_templateObject4$5 = _t
8592
8687
  }, function (_ref17) {
8593
8688
  var $optionBackgroundColor = _ref17.$optionBackgroundColor,
8594
8689
  $optionSelected = _ref17.$optionSelected,
8690
+ $isHighlighted = _ref17.$isHighlighted,
8595
8691
  theme = _ref17.theme;
8596
- return $optionSelected ? theme.vms["default"].primary : $optionBackgroundColor || theme.vms["default"].tertiary;
8692
+ return $optionSelected ? theme.vms["default"].primary : $isHighlighted ? theme.vms.hover.primary : $optionBackgroundColor || theme.vms["default"].tertiary;
8597
8693
  }, function (_ref18) {
8598
8694
  var theme = _ref18.theme;
8599
8695
  return theme.vms.hover.primary;
@@ -8750,10 +8846,15 @@ var SelectOption = function SelectOption(_ref37) {
8750
8846
  var _useState3 = React.useState(''),
8751
8847
  searchTerm = _useState3[0],
8752
8848
  setSearchTerm = _useState3[1];
8849
+ var _useState4 = React.useState(-1),
8850
+ highlightedIndex = _useState4[0],
8851
+ setHighlightedIndex = _useState4[1];
8852
+ var optionsWrapperRef = React.useRef(null);
8753
8853
  React.useEffect(function () {
8754
8854
  if (loading) {
8755
8855
  setIsOpen(false);
8756
8856
  setSearchTerm('');
8857
+ setHighlightedIndex(-1);
8757
8858
  }
8758
8859
  }, [loading]);
8759
8860
  var showSearchBox = searchBox && (options.length > 5 || allowCustomValue);
@@ -8776,6 +8877,7 @@ var SelectOption = function SelectOption(_ref37) {
8776
8877
  });
8777
8878
  if (!isOpen) {
8778
8879
  setSearchTerm('');
8880
+ setHighlightedIndex(-1);
8779
8881
  }
8780
8882
  };
8781
8883
  var dropdownRef = React.useRef(null);
@@ -8800,6 +8902,7 @@ var SelectOption = function SelectOption(_ref37) {
8800
8902
  }
8801
8903
  setIsOpen(false);
8802
8904
  setSearchTerm('');
8905
+ setHighlightedIndex(-1);
8803
8906
  };
8804
8907
  var filteredOptions = searchTerm ? options.filter(function (option) {
8805
8908
  return option.label.toLowerCase().includes(searchTerm.toLowerCase());
@@ -8824,6 +8927,7 @@ var SelectOption = function SelectOption(_ref37) {
8824
8927
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
8825
8928
  setIsOpen(false);
8826
8929
  setSearchTerm('');
8930
+ setHighlightedIndex(-1);
8827
8931
  }
8828
8932
  };
8829
8933
  document.addEventListener('mousedown', handleClickOutside);
@@ -8831,12 +8935,62 @@ var SelectOption = function SelectOption(_ref37) {
8831
8935
  document.removeEventListener('mousedown', handleClickOutside);
8832
8936
  };
8833
8937
  }, []);
8938
+ React.useEffect(function () {
8939
+ if (highlightedIndex >= 0 && optionsWrapperRef.current) {
8940
+ var children = optionsWrapperRef.current.children;
8941
+ var offset = isCustomValue ? 1 : 0;
8942
+ var highlightedElement = children[highlightedIndex + offset];
8943
+ if (highlightedElement) {
8944
+ highlightedElement.scrollIntoView({
8945
+ block: 'nearest',
8946
+ behavior: 'smooth'
8947
+ });
8948
+ }
8949
+ }
8950
+ }, [highlightedIndex, isCustomValue]);
8834
8951
  var selectedOption = options === null || options === void 0 ? void 0 : options.find(function (option) {
8835
8952
  return option.value === value;
8836
8953
  });
8837
8954
  var displayLabel = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || (allowCustomValue && value ? value : '');
8838
8955
  var handleSearchChange = function handleSearchChange(e) {
8839
8956
  setSearchTerm(e.target.value);
8957
+ setHighlightedIndex(-1);
8958
+ };
8959
+ var handleKeyDown = function handleKeyDown(e) {
8960
+ var totalOptions = isCustomValue ? filteredOptions.length + 1 : filteredOptions.length;
8961
+ if (totalOptions === 0) return;
8962
+ switch (e.key) {
8963
+ case 'ArrowDown':
8964
+ e.preventDefault();
8965
+ setHighlightedIndex(function (prev) {
8966
+ return prev < totalOptions - 1 ? prev + 1 : prev;
8967
+ });
8968
+ break;
8969
+ case 'ArrowUp':
8970
+ e.preventDefault();
8971
+ setHighlightedIndex(function (prev) {
8972
+ return prev > 0 ? prev - 1 : -1;
8973
+ });
8974
+ break;
8975
+ case 'Enter':
8976
+ e.preventDefault();
8977
+ if (highlightedIndex >= 0) {
8978
+ if (isCustomValue && highlightedIndex === 0) {
8979
+ handleCustomValueSelect();
8980
+ } else {
8981
+ var adjustedIndex = isCustomValue ? highlightedIndex - 1 : highlightedIndex;
8982
+ if (adjustedIndex >= 0 && adjustedIndex < filteredOptions.length) {
8983
+ handleOptionClick(filteredOptions[adjustedIndex].value);
8984
+ }
8985
+ }
8986
+ }
8987
+ break;
8988
+ case 'Escape':
8989
+ setIsOpen(false);
8990
+ setSearchTerm('');
8991
+ setHighlightedIndex(-1);
8992
+ break;
8993
+ }
8840
8994
  };
8841
8995
  return React__default.createElement(Container, {
8842
8996
  "$padding": padding,
@@ -8910,13 +9064,17 @@ var SelectOption = function SelectOption(_ref37) {
8910
9064
  type: 'text',
8911
9065
  value: searchTerm,
8912
9066
  onChange: handleSearchChange,
9067
+ onKeyDown: handleKeyDown,
8913
9068
  placeholder: placeholderText,
8914
9069
  "$inputColor": inputColor,
8915
9070
  "$placeholderColor": placeholderColor
8916
- })), React__default.createElement(OptionsWrapper, null, isCustomValue && React__default.createElement(Options, {
9071
+ })), React__default.createElement(OptionsWrapper, {
9072
+ ref: optionsWrapperRef
9073
+ }, isCustomValue && React__default.createElement(Options, {
8917
9074
  "$optionSelected": false,
9075
+ "$isHighlighted": highlightedIndex === 0,
8918
9076
  onClick: handleCustomValueSelect
8919
- }, "Add \"", normalizedSearch, "\""), filteredOptions.length ? filteredOptions.map(function (option) {
9077
+ }, "Add \"", normalizedSearch, "\""), filteredOptions.length ? filteredOptions.map(function (option, index) {
8920
9078
  return React__default.createElement(Options, {
8921
9079
  key: option.value,
8922
9080
  "$optionColor": optionColor,
@@ -8926,7 +9084,8 @@ var SelectOption = function SelectOption(_ref37) {
8926
9084
  onClick: function onClick() {
8927
9085
  return handleOptionClick(option.value);
8928
9086
  },
8929
- "$optionSelected": option.value === value || allowCustomValue && option.value === displayLabel
9087
+ "$optionSelected": option.value === value || allowCustomValue && option.value === displayLabel,
9088
+ "$isHighlighted": isCustomValue ? index + 1 === highlightedIndex : index === highlightedIndex
8930
9089
  }, option.label);
8931
9090
  }) : !isCustomValue && React__default.createElement(NoOptions, null, NoOptionsText)))));
8932
9091
  };
@@ -9720,12 +9879,14 @@ var OptionContainer$1 = styled__default.div(_templateObject$h || (_templateObjec
9720
9879
  });
9721
9880
  var OptionItem$1 = styled__default.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) {
9722
9881
  var $optionSelected = _ref2.$optionSelected,
9882
+ $isHighlighted = _ref2.$isHighlighted,
9723
9883
  theme = _ref2.theme;
9724
- return $optionSelected ? theme.vms.text.white : theme.vms.text.medium;
9884
+ return $optionSelected || $isHighlighted ? theme.vms.text.white : theme.vms.text.medium;
9725
9885
  }, function (_ref3) {
9726
9886
  var $optionSelected = _ref3.$optionSelected,
9887
+ $isHighlighted = _ref3.$isHighlighted,
9727
9888
  theme = _ref3.theme;
9728
- return $optionSelected ? theme.vms["default"].primary : theme.vms.text.white;
9889
+ return $optionSelected ? theme.vms["default"].primary : $isHighlighted ? theme.vms.hover.primary : theme.vms.text.white;
9729
9890
  }, function (_ref4) {
9730
9891
  var theme = _ref4.theme;
9731
9892
  return theme.vms.hover.primary;
@@ -9851,19 +10012,57 @@ var TextFieldWithDropdown = function TextFieldWithDropdown(_ref16) {
9851
10012
  var _useTranslation = reactI18next.useTranslation(),
9852
10013
  t = _useTranslation.t;
9853
10014
  var searchBoxRef = React.useRef(null);
10015
+ var optionsWrapperRef = React.useRef(null);
9854
10016
  var _useState = React.useState(false),
9855
10017
  isSearchBarEnabled = _useState[0],
9856
10018
  setIsSearchBarEnabled = _useState[1];
10019
+ var _useState2 = React.useState(-1),
10020
+ highlightedIndex = _useState2[0],
10021
+ setHighlightedIndex = _useState2[1];
9857
10022
  var filteredArray = options.filter(function (item) {
9858
10023
  return item.labelText.toLowerCase().includes(internalSearchQuery.toLowerCase().trim());
9859
10024
  });
9860
10025
  var handleSearchChange = function handleSearchChange(e) {
9861
10026
  var value = e.target.value.trimStart();
9862
10027
  setInternalSearchQuery(value);
10028
+ setHighlightedIndex(-1);
10029
+ };
10030
+ var handleKeyDown = function handleKeyDown(e) {
10031
+ if (!isSearchBarEnabled || filteredArray.length === 0) return;
10032
+ switch (e.key) {
10033
+ case 'ArrowDown':
10034
+ e.preventDefault();
10035
+ setHighlightedIndex(function (prev) {
10036
+ return prev < filteredArray.length - 1 ? prev + 1 : prev;
10037
+ });
10038
+ break;
10039
+ case 'ArrowUp':
10040
+ e.preventDefault();
10041
+ setHighlightedIndex(function (prev) {
10042
+ return prev > 0 ? prev - 1 : -1;
10043
+ });
10044
+ break;
10045
+ case 'Enter':
10046
+ e.preventDefault();
10047
+ if (highlightedIndex >= 0 && highlightedIndex < filteredArray.length) {
10048
+ var _selectedOption = filteredArray[highlightedIndex];
10049
+ setInternalSearchQuery(_selectedOption.labelText);
10050
+ setSearchQuery(_selectedOption.labelText);
10051
+ setIsSearchBarEnabled(false);
10052
+ setHighlightedIndex(-1);
10053
+ if (onSelect) onSelect(_selectedOption);
10054
+ }
10055
+ break;
10056
+ case 'Escape':
10057
+ setIsSearchBarEnabled(false);
10058
+ setHighlightedIndex(-1);
10059
+ break;
10060
+ }
9863
10061
  };
9864
10062
  var handleClickOutside = function handleClickOutside(event) {
9865
10063
  if (searchBoxRef.current && !searchBoxRef.current.contains(event.target)) {
9866
10064
  setIsSearchBarEnabled(false);
10065
+ setHighlightedIndex(-1);
9867
10066
  }
9868
10067
  };
9869
10068
  React.useEffect(function () {
@@ -9872,6 +10071,17 @@ var TextFieldWithDropdown = function TextFieldWithDropdown(_ref16) {
9872
10071
  document.removeEventListener('mousedown', handleClickOutside);
9873
10072
  };
9874
10073
  }, []);
10074
+ React.useEffect(function () {
10075
+ if (highlightedIndex >= 0 && optionsWrapperRef.current) {
10076
+ var highlightedElement = optionsWrapperRef.current.children[highlightedIndex];
10077
+ if (highlightedElement) {
10078
+ highlightedElement.scrollIntoView({
10079
+ block: 'nearest',
10080
+ behavior: 'smooth'
10081
+ });
10082
+ }
10083
+ }
10084
+ }, [highlightedIndex]);
9875
10085
  return React__default.createElement(Container, {
9876
10086
  "$flexDirection": 'column',
9877
10087
  "$gap": '8px',
@@ -9898,6 +10108,7 @@ var TextFieldWithDropdown = function TextFieldWithDropdown(_ref16) {
9898
10108
  placeholder: placeholder,
9899
10109
  value: internalSearchQuery,
9900
10110
  onChange: handleSearchChange,
10111
+ onKeyDown: handleKeyDown,
9901
10112
  "$inputColor": searchbarTextColor,
9902
10113
  "$placeholderColor": isSearchBarEnabled ? themeColors.vms.text.light : themeColors.vms.text.medium,
9903
10114
  disabled: !!searchQuery
@@ -9917,16 +10128,20 @@ var TextFieldWithDropdown = function TextFieldWithDropdown(_ref16) {
9917
10128
  "$fontSize": '12px',
9918
10129
  "$fontWeight": '400',
9919
10130
  "$color": themeColors.vms.text.light
9920
- }, t('Showing_results') + " (" + filteredArray.length + " of " + (options === null || options === void 0 ? void 0 : options.length) + ")")), React__default.createElement(OptionsWrapper$1, null, filteredArray.length > 0 ? filteredArray.map(function (option) {
10131
+ }, t('Showing_results') + " (" + filteredArray.length + " of " + (options === null || options === void 0 ? void 0 : options.length) + ")")), React__default.createElement(OptionsWrapper$1, {
10132
+ ref: optionsWrapperRef
10133
+ }, filteredArray.length > 0 ? filteredArray.map(function (option, index) {
9921
10134
  return React__default.createElement(OptionItem$1, {
9922
10135
  key: option.value,
9923
- "$optionSelected": option.value === selectedOption
10136
+ "$optionSelected": option.value === selectedOption,
10137
+ "$isHighlighted": index === highlightedIndex
9924
10138
  }, React__default.createElement(OptionLabel$1, {
9925
10139
  htmlFor: option.value,
9926
10140
  onClick: function onClick() {
9927
10141
  setInternalSearchQuery(option.labelText);
9928
10142
  setSearchQuery(option.labelText);
9929
10143
  setIsSearchBarEnabled(false);
10144
+ setHighlightedIndex(-1);
9930
10145
  if (onSelect) onSelect(option);
9931
10146
  }
9932
10147
  }, option.labelText));