labsense-ui-kit 1.3.73 → 1.3.75

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.
@@ -5,6 +5,28 @@ import { toast } from 'react-hot-toast';
5
5
  import { useNavigate, NavLink, useLocation } from 'react-router-dom';
6
6
  import { useTranslation } from 'react-i18next';
7
7
 
8
+ function _arrayLikeToArray(r, a) {
9
+ (null == a || a > r.length) && (a = r.length);
10
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
11
+ return n;
12
+ }
13
+ function _createForOfIteratorHelperLoose(r, e) {
14
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
15
+ if (t) return (t = t.call(r)).next.bind(t);
16
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
17
+ t && (r = t);
18
+ var o = 0;
19
+ return function () {
20
+ return o >= r.length ? {
21
+ done: !0
22
+ } : {
23
+ done: !1,
24
+ value: r[o++]
25
+ };
26
+ };
27
+ }
28
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29
+ }
8
30
  function _extends() {
9
31
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
10
32
  for (var e = 1; e < arguments.length; e++) {
@@ -17,6 +39,13 @@ function _extends() {
17
39
  function _taggedTemplateLiteralLoose(e, t) {
18
40
  return t || (t = e.slice(0)), e.raw = t, e;
19
41
  }
42
+ function _unsupportedIterableToArray(r, a) {
43
+ if (r) {
44
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
45
+ var t = {}.toString.call(r).slice(8, -1);
46
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
47
+ }
48
+ }
20
49
 
21
50
  var Action = function Action(_ref) {
22
51
  var size = _ref.size,
@@ -10582,7 +10611,7 @@ var Pagination = function Pagination(_ref4) {
10582
10611
  "$fontWeight": '400',
10583
10612
  "$fontSize": '14px'
10584
10613
  }, t('Items_Per_Page')), React.createElement(Container, null, React.createElement(SelectOption, {
10585
- width: '54px',
10614
+ width: 'max-content',
10586
10615
  size: 'small',
10587
10616
  value: itemsPerPage.toString(),
10588
10617
  onChange: function onChange(e) {
@@ -10736,7 +10765,7 @@ var ProgressBar = function ProgressBar(_ref3) {
10736
10765
  };
10737
10766
 
10738
10767
  var _templateObject$n, _templateObject2$j, _templateObject3$c, _templateObject4$9, _templateObject5$8, _templateObject6$8, _templateObject7$6;
10739
- var SidebarContainer = styled.div(_templateObject$n || (_templateObject$n = _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\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"])), function (_ref) {
10768
+ var SidebarContainer = styled.div(_templateObject$n || (_templateObject$n = _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"])), function (_ref) {
10740
10769
  var $background = _ref.$background,
10741
10770
  theme = _ref.theme;
10742
10771
  return $background || theme.vms.accent.softBlue;
@@ -10815,6 +10844,7 @@ var Sidebar = function Sidebar(_ref20) {
10815
10844
  openMenus = _useState[0],
10816
10845
  setOpenMenus = _useState[1];
10817
10846
  var isExpandedRef = useRef(isExpanded);
10847
+ var sidebarRef = useRef(null);
10818
10848
  var _useState2 = useState(function () {
10819
10849
  var container = document.getElementById('badge-portal-container');
10820
10850
  if (!container) {
@@ -10861,7 +10891,7 @@ var Sidebar = function Sidebar(_ref20) {
10861
10891
  return currentBase === getBasePath(child.activeUrl) || currentBase === getBasePath(child.url);
10862
10892
  }));
10863
10893
  };
10864
- var ChildLink = React.memo(function (_ref22) {
10894
+ var ChildLink = function ChildLink(_ref22) {
10865
10895
  var child = _ref22.child;
10866
10896
  var themeColors = useTheme$1();
10867
10897
  var location = useLocation();
@@ -10894,7 +10924,7 @@ var Sidebar = function Sidebar(_ref20) {
10894
10924
  }, child.label), getTotalNotifications(child) > 0 && React.createElement(NotificationBadge, {
10895
10925
  "$position": 'unset'
10896
10926
  }, getTotalNotifications(child) > 99 ? '99+' : getTotalNotifications(child))));
10897
- });
10927
+ };
10898
10928
  var renderChildLinks = function renderChildLinks(children) {
10899
10929
  return React.createElement(Container, {
10900
10930
  "$padding": '0px 0px 0px 16px',
@@ -10908,7 +10938,7 @@ var Sidebar = function Sidebar(_ref20) {
10908
10938
  });
10909
10939
  }));
10910
10940
  };
10911
- var SidebarItem = React.memo(function (_ref23) {
10941
+ var SidebarItem = function SidebarItem(_ref23) {
10912
10942
  var item = _ref23.item,
10913
10943
  isActive = _ref23.isActive,
10914
10944
  isOpen = _ref23.isOpen,
@@ -11001,12 +11031,33 @@ var Sidebar = function Sidebar(_ref20) {
11001
11031
  "$hoverColor": themeColors.vms.text.white,
11002
11032
  "$width": '100%'
11003
11033
  }, ContentLayout), hasChildren && isExpanded && isOpen && renderChildLinks && React.createElement(Container, null, renderChildLinks(item.children)));
11004
- });
11034
+ };
11005
11035
  var handleSidebarExpansion = useCallback(function (expanded) {
11006
11036
  if (isExpandedRef.current !== expanded) {
11007
11037
  setIsExpanded(expanded);
11038
+ isExpandedRef.current = expanded;
11008
11039
  }
11009
11040
  }, [setIsExpanded]);
11041
+ useEffect(function () {
11042
+ var sidebar = sidebarRef.current;
11043
+ if (!sidebar) return;
11044
+ if (typeof ResizeObserver === 'undefined') return;
11045
+ var resizeObserver = new ResizeObserver(function (entries) {
11046
+ for (var _iterator = _createForOfIteratorHelperLoose(entries), _step; !(_step = _iterator()).done;) {
11047
+ var entry = _step.value;
11048
+ var width = entry.contentRect.width;
11049
+ if (width > 70) {
11050
+ handleSidebarExpansion(true);
11051
+ } else {
11052
+ handleSidebarExpansion(false);
11053
+ }
11054
+ }
11055
+ });
11056
+ resizeObserver.observe(sidebar);
11057
+ return function () {
11058
+ resizeObserver.disconnect();
11059
+ };
11060
+ }, [handleSidebarExpansion]);
11010
11061
  useEffect(function () {
11011
11062
  var updateBadgePositions = function updateBadgePositions() {
11012
11063
  content.forEach(function (item) {
@@ -11028,13 +11079,8 @@ var Sidebar = function Sidebar(_ref20) {
11028
11079
  };
11029
11080
  }, [content, isExpanded, getTotalNotifications]);
11030
11081
  return React.createElement(SidebarContainer, {
11031
- "$background": background,
11032
- onMouseEnter: function onMouseEnter() {
11033
- return handleSidebarExpansion(true);
11034
- },
11035
- onMouseLeave: function onMouseLeave() {
11036
- return handleSidebarExpansion(false);
11037
- }
11082
+ ref: sidebarRef,
11083
+ "$background": background
11038
11084
  }, React.createElement(Container, {
11039
11085
  "$flexDirection": 'column',
11040
11086
  "$gap": '28px',
@@ -11051,7 +11097,9 @@ var Sidebar = function Sidebar(_ref20) {
11051
11097
  }))), React.createElement(Container, {
11052
11098
  "$flexDirection": 'column',
11053
11099
  "$gap": '16px',
11054
- "$width": '100%'
11100
+ "$width": '100%',
11101
+ "$overflow": 'auto',
11102
+ "$scrollbarWidth": 'none'
11055
11103
  }, content.map(function (item) {
11056
11104
  var _item$children3;
11057
11105
  var active = isRouteActive(item) || false;