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.js
CHANGED
|
@@ -8007,6 +8007,14 @@ var OptionComponent = function OptionComponent(_ref11) {
|
|
|
8007
8007
|
setHighlightedIndex = _useState2[1];
|
|
8008
8008
|
var optionContainerRef = React.useRef(null);
|
|
8009
8009
|
var searchInputRef = React.useRef(null);
|
|
8010
|
+
React.useEffect(function () {
|
|
8011
|
+
if (searchBox && searchInputRef.current) {
|
|
8012
|
+
setTimeout(function () {
|
|
8013
|
+
var _searchInputRef$curre;
|
|
8014
|
+
(_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
|
|
8015
|
+
}, 50);
|
|
8016
|
+
}
|
|
8017
|
+
}, [searchBox]);
|
|
8010
8018
|
var handleSearchChange = function handleSearchChange(e) {
|
|
8011
8019
|
setSearchQuery(e.target.value.trimStart());
|
|
8012
8020
|
setHighlightedIndex(-1);
|
|
@@ -8727,7 +8735,7 @@ var LabelText$1 = styled__default.div(_templateObject5$5 || (_templateObject5$5
|
|
|
8727
8735
|
return $disabled ? theme.vms.text.medium : $color || theme.vms.text.medium;
|
|
8728
8736
|
});
|
|
8729
8737
|
var NoOptions = styled__default(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"])));
|
|
8730
|
-
var DropdownMenu$1 = styled__default.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) {
|
|
8738
|
+
var DropdownMenu$1 = styled__default.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) {
|
|
8731
8739
|
var theme = _ref24.theme;
|
|
8732
8740
|
return "1px solid " + theme.vms.border.light;
|
|
8733
8741
|
}, function (_ref25) {
|
|
@@ -8850,6 +8858,8 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8850
8858
|
highlightedIndex = _useState4[0],
|
|
8851
8859
|
setHighlightedIndex = _useState4[1];
|
|
8852
8860
|
var optionsWrapperRef = React.useRef(null);
|
|
8861
|
+
var dropdownMenuRef = React.useRef(null);
|
|
8862
|
+
var showSearchBox = searchBox && (options.length > 5 || allowCustomValue);
|
|
8853
8863
|
React.useEffect(function () {
|
|
8854
8864
|
if (loading) {
|
|
8855
8865
|
setIsOpen(false);
|
|
@@ -8857,7 +8867,15 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8857
8867
|
setHighlightedIndex(-1);
|
|
8858
8868
|
}
|
|
8859
8869
|
}, [loading]);
|
|
8860
|
-
|
|
8870
|
+
React.useEffect(function () {
|
|
8871
|
+
if (isOpen) {
|
|
8872
|
+
if (showSearchBox && searchInputRef.current) {
|
|
8873
|
+
searchInputRef.current.focus();
|
|
8874
|
+
} else if (dropdownMenuRef.current) {
|
|
8875
|
+
dropdownMenuRef.current.focus();
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8878
|
+
}, [isOpen, showSearchBox]);
|
|
8861
8879
|
var toggleDropdown = function toggleDropdown() {
|
|
8862
8880
|
var refToUse = (positionRef === null || positionRef === void 0 ? void 0 : positionRef.current) || dropdownRef.current;
|
|
8863
8881
|
if (refToUse) {
|
|
@@ -8963,13 +8981,14 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
8963
8981
|
case 'ArrowDown':
|
|
8964
8982
|
e.preventDefault();
|
|
8965
8983
|
setHighlightedIndex(function (prev) {
|
|
8966
|
-
|
|
8984
|
+
var newIndex = prev < totalOptions - 1 ? prev + 1 : prev;
|
|
8985
|
+
return prev === -1 ? 0 : newIndex;
|
|
8967
8986
|
});
|
|
8968
8987
|
break;
|
|
8969
8988
|
case 'ArrowUp':
|
|
8970
8989
|
e.preventDefault();
|
|
8971
8990
|
setHighlightedIndex(function (prev) {
|
|
8972
|
-
return prev > 0 ? prev - 1 :
|
|
8991
|
+
return prev > 0 ? prev - 1 : 0;
|
|
8973
8992
|
});
|
|
8974
8993
|
break;
|
|
8975
8994
|
case 'Enter':
|
|
@@ -9043,6 +9062,9 @@ var SelectOption = function SelectOption(_ref37) {
|
|
|
9043
9062
|
size: 7,
|
|
9044
9063
|
color: color || themeColors.vms.text.medium
|
|
9045
9064
|
})), isOpen && React__default.createElement(DropdownMenu$1, {
|
|
9065
|
+
ref: dropdownMenuRef,
|
|
9066
|
+
tabIndex: -1,
|
|
9067
|
+
onKeyDown: !showSearchBox ? handleKeyDown : undefined,
|
|
9046
9068
|
"$width": width,
|
|
9047
9069
|
"$menuBackground": menuBackground,
|
|
9048
9070
|
"$optionsBorderRadius": optionsBorderRadius,
|