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.
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 {
@@ -12421,7 +12447,7 @@ var Overlay = styled__default.div(_templateObject$n || (_templateObject$n = _tag
12421
12447
  return $isOpen ? 'visible' : 'hidden';
12422
12448
  });
12423
12449
  var HamburgerButton = styled__default.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);
12424
- var SidebarContainer = styled__default.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) {
12450
+ var SidebarContainer = styled__default.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) {
12425
12451
  var $background = _ref3.$background,
12426
12452
  theme = _ref3.theme;
12427
12453
  return $background || theme.vms.accent.softBlue;