labsense-ui-kit 1.4.47 → 1.4.48

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.
@@ -10344,6 +10344,24 @@ var SearchBar$1 = styled.input(_templateObject10$2 || (_templateObject10$2 = _ta
10344
10344
  theme = _ref37.theme;
10345
10345
  return $placeholderColor || theme.vms.text.light;
10346
10346
  });
10347
+ var getClippingBoundary = function getClippingBoundary(element) {
10348
+ var top = 0;
10349
+ var bottom = window.innerHeight;
10350
+ var node = element.parentElement;
10351
+ while (node && node !== document.body) {
10352
+ var style = window.getComputedStyle(node);
10353
+ if (/(auto|hidden|scroll|clip)/.test(style.overflow) || /(auto|hidden|scroll|clip)/.test(style.overflowY)) {
10354
+ var rect = node.getBoundingClientRect();
10355
+ top = Math.max(top, rect.top);
10356
+ bottom = Math.min(bottom, rect.bottom);
10357
+ }
10358
+ node = node.parentElement;
10359
+ }
10360
+ return {
10361
+ top: top,
10362
+ bottom: bottom
10363
+ };
10364
+ };
10347
10365
  var SelectOption = function SelectOption(_ref38) {
10348
10366
  var title = _ref38.title,
10349
10367
  titlecolor = _ref38.titlecolor,
@@ -10425,9 +10443,13 @@ var SelectOption = function SelectOption(_ref38) {
10425
10443
  useEffect(function () {
10426
10444
  if (isOpen) {
10427
10445
  if (showSearchBox && searchInputRef.current) {
10428
- searchInputRef.current.focus();
10446
+ searchInputRef.current.focus({
10447
+ preventScroll: true
10448
+ });
10429
10449
  } else if (dropdownMenuRef.current) {
10430
- dropdownMenuRef.current.focus();
10450
+ dropdownMenuRef.current.focus({
10451
+ preventScroll: true
10452
+ });
10431
10453
  }
10432
10454
  }
10433
10455
  }, [isOpen, showSearchBox]);
@@ -10435,10 +10457,14 @@ var SelectOption = function SelectOption(_ref38) {
10435
10457
  var refToUse = (positionRef === null || positionRef === void 0 ? void 0 : positionRef.current) || dropdownRef.current;
10436
10458
  if (refToUse) {
10437
10459
  var rect = refToUse.getBoundingClientRect();
10438
- var windowHeight = window.innerHeight;
10439
- var spaceBelow = windowHeight - rect.bottom;
10440
- var spaceAbove = rect.top;
10441
- var dropdownHeight = 95;
10460
+ var _getClippingBoundary = getClippingBoundary(refToUse),
10461
+ clipTop = _getClippingBoundary.top,
10462
+ clipBottom = _getClippingBoundary.bottom;
10463
+ var spaceBelow = clipBottom - rect.bottom;
10464
+ var spaceAbove = rect.top - clipTop;
10465
+ var optionRowHeight = 30;
10466
+ var visibleOptionRows = Math.min(options.length || 1, 5);
10467
+ var dropdownHeight = (showSearchBox ? 44 : 0) + visibleOptionRows * optionRowHeight + 2;
10442
10468
  if (spaceBelow < dropdownHeight && spaceAbove > dropdownHeight) {
10443
10469
  setDropUp(true);
10444
10470
  } else {