labsense-ui-kit 1.3.63 → 1.3.64
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.
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +18 -4
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -8723,7 +8723,7 @@ var LabelText$1 = styled.div(_templateObject5$5 || (_templateObject5$5 = _tagged
|
|
|
8723
8723
|
return $disabled ? theme.vms.text.medium : $color || theme.vms.text.medium;
|
|
8724
8724
|
});
|
|
8725
8725
|
var NoOptions = styled(Span)(_templateObject6$5 || (_templateObject6$5 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n height: 100%;\n padding: 12px;\n font-size: 14px;\n font-weight: 400;\n"])));
|
|
8726
|
-
var DropdownMenu$1 = styled.div(_templateObject7$3 || (_templateObject7$3 = _taggedTemplateLiteralLoose(["\n height: auto;\n max-height: 170px;\n border: ", ";\n border-radius: ", ";\n min-width: 100%;\n width: ", ";\n background: ", ";\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n overflow: hidden;\n position: absolute;\n z-index: 2;\n ", "\n ", "\n\n ", "\n"])), function (_ref24) {
|
|
8726
|
+
var DropdownMenu$1 = styled.div(_templateObject7$3 || (_templateObject7$3 = _taggedTemplateLiteralLoose(["\n height: auto;\n max-height: 170px;\n border: ", ";\n border-radius: ", ";\n min-width: 100%;\n width: ", ";\n background: ", ";\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n overflow: hidden;\n position: absolute;\n z-index: 2;\n outline: none;\n ", "\n ", "\n\n ", "\n"])), function (_ref24) {
|
|
8727
8727
|
var theme = _ref24.theme;
|
|
8728
8728
|
return "1px solid " + theme.vms.border.light;
|
|
8729
8729
|
}, function (_ref25) {
|
|
@@ -8846,6 +8846,8 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8846
8846
|
highlightedIndex = _useState4[0],
|
|
8847
8847
|
setHighlightedIndex = _useState4[1];
|
|
8848
8848
|
var optionsWrapperRef = useRef(null);
|
|
8849
|
+
var dropdownMenuRef = useRef(null);
|
|
8850
|
+
var showSearchBox = searchBox && (options.length > 5 || allowCustomValue);
|
|
8849
8851
|
useEffect(function () {
|
|
8850
8852
|
if (loading) {
|
|
8851
8853
|
setIsOpen(false);
|
|
@@ -8853,7 +8855,15 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8853
8855
|
setHighlightedIndex(-1);
|
|
8854
8856
|
}
|
|
8855
8857
|
}, [loading]);
|
|
8856
|
-
|
|
8858
|
+
useEffect(function () {
|
|
8859
|
+
if (isOpen) {
|
|
8860
|
+
if (showSearchBox && searchInputRef.current) {
|
|
8861
|
+
searchInputRef.current.focus();
|
|
8862
|
+
} else if (dropdownMenuRef.current) {
|
|
8863
|
+
dropdownMenuRef.current.focus();
|
|
8864
|
+
}
|
|
8865
|
+
}
|
|
8866
|
+
}, [isOpen, showSearchBox]);
|
|
8857
8867
|
var toggleDropdown = function toggleDropdown() {
|
|
8858
8868
|
var refToUse = (positionRef === null || positionRef === void 0 ? void 0 : positionRef.current) || dropdownRef.current;
|
|
8859
8869
|
if (refToUse) {
|
|
@@ -8959,13 +8969,14 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8959
8969
|
case 'ArrowDown':
|
|
8960
8970
|
e.preventDefault();
|
|
8961
8971
|
setHighlightedIndex(function (prev) {
|
|
8962
|
-
|
|
8972
|
+
var newIndex = prev < totalOptions - 1 ? prev + 1 : prev;
|
|
8973
|
+
return prev === -1 ? 0 : newIndex;
|
|
8963
8974
|
});
|
|
8964
8975
|
break;
|
|
8965
8976
|
case 'ArrowUp':
|
|
8966
8977
|
e.preventDefault();
|
|
8967
8978
|
setHighlightedIndex(function (prev) {
|
|
8968
|
-
return prev > 0 ? prev - 1 :
|
|
8979
|
+
return prev > 0 ? prev - 1 : 0;
|
|
8969
8980
|
});
|
|
8970
8981
|
break;
|
|
8971
8982
|
case 'Enter':
|
|
@@ -9039,6 +9050,9 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
9039
9050
|
size: 7,
|
|
9040
9051
|
color: color || themeColors.vms.text.medium
|
|
9041
9052
|
})), isOpen && React.createElement(DropdownMenu$1, {
|
|
9053
|
+
ref: dropdownMenuRef,
|
|
9054
|
+
tabIndex: -1,
|
|
9055
|
+
onKeyDown: !showSearchBox ? handleKeyDown : undefined,
|
|
9042
9056
|
"$width": width,
|
|
9043
9057
|
"$menuBackground": menuBackground,
|
|
9044
9058
|
"$optionsBorderRadius": optionsBorderRadius,
|