labsense-ui-kit 1.4.47 → 1.4.49

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 {
@@ -12416,7 +12442,7 @@ var Overlay = styled.div(_templateObject$n || (_templateObject$n = _taggedTempla
12416
12442
  return $isOpen ? 'visible' : 'hidden';
12417
12443
  });
12418
12444
  var HamburgerButton = styled.button(_templateObject2$j || (_templateObject2$j = _taggedTemplateLiteralLoose(["\n display: none;\n \n @media (max-width: ", ") {\n display: flex;\n width: max-content;\n border: none;\n padding: 8px;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n // box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n transition: transform 0.2s ease;\n\n &:active {\n transform: scale(0.95);\n }\n }\n"])), MOBILE_BREAKPOINT);
12419
- var SidebarContainer = styled.div(_templateObject3$c || (_templateObject3$c = _taggedTemplateLiteralLoose(["\n width: 68px;\n max-width: 68px;\n height: 100vh;\n background: ", ";\n transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1);\n display: flex;\n flex-direction: column;\n align-items: start;\n padding: 20px;\n position: fixed;\n left: 0;\n top: 0;\n overflow: hidden;\n z-index: 998;\n justify-content: space-between;\n gap: 24px;\n\n /* Expand on hover */\n &:hover {\n width: max-content;\n max-width: 400px;\n\n /* You can also add a class for children */\n span, .expandable {\n opacity: 1;\n visibility: visible;\n transform: translateX(0);\n }\n }\n\n /* Mobile styles */\n @media (max-width: ", ") {\n transform: translateX(", ");\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n width: 280px;\n max-width: 280px;\n box-shadow: ", ";\n\n /* Always show text on mobile when open */\n span, .expandable {\n opacity: ", ";\n visibility: ", ";\n transform: translateX(0);\n }\n\n /* Disable hover expansion on mobile */\n &:hover {\n width: 280px;\n max-width: 280px;\n }\n }\n"])), function (_ref3) {
12445
+ var SidebarContainer = styled.div(_templateObject3$c || (_templateObject3$c = _taggedTemplateLiteralLoose(["\n width: 68px;\n max-width: 68px;\n height: 100vh;\n background: ", ";\n transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1);\n display: flex;\n flex-direction: column;\n align-items: start;\n padding: 20px;\n position: fixed;\n left: 0;\n top: 0;\n overflow: hidden;\n z-index: 998;\n justify-content: space-between;\n gap: 24px;\n\n /* Expand on hover to a fixed width - not max-content, which would resize\n the sidebar itself depending on which submenu happens to be open (a\n longer/deeper-indented child label, e.g. \"API Key Management\" under\n Administration, made the box wider than with it collapsed or another\n menu open). Sized to comfortably fit the longest current label already\n used with room to spare; matches the fixed width already used for the\n mobile-open state below. */\n &:hover {\n width: 230px;\n max-width: 230px;\n\n /* You can also add a class for children */\n span, .expandable {\n opacity: 1;\n visibility: visible;\n transform: translateX(0);\n }\n }\n\n /* Mobile styles */\n @media (max-width: ", ") {\n transform: translateX(", ");\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n width: 280px;\n max-width: 280px;\n box-shadow: ", ";\n\n /* Always show text on mobile when open */\n span, .expandable {\n opacity: ", ";\n visibility: ", ";\n transform: translateX(0);\n }\n\n /* Disable hover expansion on mobile */\n &:hover {\n width: 280px;\n max-width: 280px;\n }\n }\n"])), function (_ref3) {
12420
12446
  var $background = _ref3.$background,
12421
12447
  theme = _ref3.theme;
12422
12448
  return $background || theme.vms.accent.softBlue;