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