labsense-ui-kit 1.3.63 → 1.3.65
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 +26 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +26 -4
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -8003,6 +8003,14 @@ var OptionComponent = function OptionComponent(_ref11) {
|
|
|
8003
8003
|
setHighlightedIndex = _useState2[1];
|
|
8004
8004
|
var optionContainerRef = useRef(null);
|
|
8005
8005
|
var searchInputRef = useRef(null);
|
|
8006
|
+
useEffect(function () {
|
|
8007
|
+
if (searchBox && searchInputRef.current) {
|
|
8008
|
+
setTimeout(function () {
|
|
8009
|
+
var _searchInputRef$curre;
|
|
8010
|
+
(_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
|
|
8011
|
+
}, 50);
|
|
8012
|
+
}
|
|
8013
|
+
}, [searchBox]);
|
|
8006
8014
|
var handleSearchChange = function handleSearchChange(e) {
|
|
8007
8015
|
setSearchQuery(e.target.value.trimStart());
|
|
8008
8016
|
setHighlightedIndex(-1);
|
|
@@ -8723,7 +8731,7 @@ var LabelText$1 = styled.div(_templateObject5$5 || (_templateObject5$5 = _tagged
|
|
|
8723
8731
|
return $disabled ? theme.vms.text.medium : $color || theme.vms.text.medium;
|
|
8724
8732
|
});
|
|
8725
8733
|
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) {
|
|
8734
|
+
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
8735
|
var theme = _ref24.theme;
|
|
8728
8736
|
return "1px solid " + theme.vms.border.light;
|
|
8729
8737
|
}, function (_ref25) {
|
|
@@ -8846,6 +8854,8 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8846
8854
|
highlightedIndex = _useState4[0],
|
|
8847
8855
|
setHighlightedIndex = _useState4[1];
|
|
8848
8856
|
var optionsWrapperRef = useRef(null);
|
|
8857
|
+
var dropdownMenuRef = useRef(null);
|
|
8858
|
+
var showSearchBox = searchBox && (options.length > 5 || allowCustomValue);
|
|
8849
8859
|
useEffect(function () {
|
|
8850
8860
|
if (loading) {
|
|
8851
8861
|
setIsOpen(false);
|
|
@@ -8853,7 +8863,15 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8853
8863
|
setHighlightedIndex(-1);
|
|
8854
8864
|
}
|
|
8855
8865
|
}, [loading]);
|
|
8856
|
-
|
|
8866
|
+
useEffect(function () {
|
|
8867
|
+
if (isOpen) {
|
|
8868
|
+
if (showSearchBox && searchInputRef.current) {
|
|
8869
|
+
searchInputRef.current.focus();
|
|
8870
|
+
} else if (dropdownMenuRef.current) {
|
|
8871
|
+
dropdownMenuRef.current.focus();
|
|
8872
|
+
}
|
|
8873
|
+
}
|
|
8874
|
+
}, [isOpen, showSearchBox]);
|
|
8857
8875
|
var toggleDropdown = function toggleDropdown() {
|
|
8858
8876
|
var refToUse = (positionRef === null || positionRef === void 0 ? void 0 : positionRef.current) || dropdownRef.current;
|
|
8859
8877
|
if (refToUse) {
|
|
@@ -8959,13 +8977,14 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8959
8977
|
case 'ArrowDown':
|
|
8960
8978
|
e.preventDefault();
|
|
8961
8979
|
setHighlightedIndex(function (prev) {
|
|
8962
|
-
|
|
8980
|
+
var newIndex = prev < totalOptions - 1 ? prev + 1 : prev;
|
|
8981
|
+
return prev === -1 ? 0 : newIndex;
|
|
8963
8982
|
});
|
|
8964
8983
|
break;
|
|
8965
8984
|
case 'ArrowUp':
|
|
8966
8985
|
e.preventDefault();
|
|
8967
8986
|
setHighlightedIndex(function (prev) {
|
|
8968
|
-
return prev > 0 ? prev - 1 :
|
|
8987
|
+
return prev > 0 ? prev - 1 : 0;
|
|
8969
8988
|
});
|
|
8970
8989
|
break;
|
|
8971
8990
|
case 'Enter':
|
|
@@ -9039,6 +9058,9 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
9039
9058
|
size: 7,
|
|
9040
9059
|
color: color || themeColors.vms.text.medium
|
|
9041
9060
|
})), isOpen && React.createElement(DropdownMenu$1, {
|
|
9061
|
+
ref: dropdownMenuRef,
|
|
9062
|
+
tabIndex: -1,
|
|
9063
|
+
onKeyDown: !showSearchBox ? handleKeyDown : undefined,
|
|
9042
9064
|
"$width": width,
|
|
9043
9065
|
"$menuBackground": menuBackground,
|
|
9044
9066
|
"$optionsBorderRadius": optionsBorderRadius,
|