labsense-ui-kit 1.2.39 → 1.2.41

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.
@@ -7,6 +7,7 @@ export interface SidebarItems {
7
7
  iconWeight?: string;
8
8
  url?: string;
9
9
  activeUrl?: string;
10
+ notificationCount?: number;
10
11
  children?: SidebarItems[];
11
12
  }
12
13
  export interface ImageDetails {
package/dist/index.js CHANGED
@@ -5990,8 +5990,8 @@ var StyledButton = styled__default.button(_templateObject5$1 || (_templateObject
5990
5990
  return '';
5991
5991
  }
5992
5992
  }, function (_ref16) {
5993
- var color = _ref16.color;
5994
- return color;
5993
+ var $color = _ref16.$color;
5994
+ return $color;
5995
5995
  });
5996
5996
  var ButtonText = styled__default.span(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n white-space: nowrap;\n"])), function (_ref17) {
5997
5997
  var $fontFamily = _ref17.$fontFamily;
@@ -8838,7 +8838,7 @@ var ProgressBar = function ProgressBar(_ref3) {
8838
8838
  }));
8839
8839
  };
8840
8840
 
8841
- var _templateObject$n, _templateObject2$j, _templateObject3$c, _templateObject4$9, _templateObject5$8;
8841
+ var _templateObject$n, _templateObject2$j, _templateObject3$c, _templateObject4$9, _templateObject5$8, _templateObject6$7;
8842
8842
  var SidebarContainer = styled__default.div(_templateObject$n || (_templateObject$n = _taggedTemplateLiteralLoose(["\n width: ", ";\n max-width: ", ";\n height: 100vh;\n background: ", ";\n transition: all 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: 10;\n justify-content: space-between;\n"])), function (_ref) {
8843
8843
  var $isExpanded = _ref.$isExpanded;
8844
8844
  return $isExpanded ? 'max-content' : '68px';
@@ -8850,7 +8850,7 @@ var SidebarContainer = styled__default.div(_templateObject$n || (_templateObject
8850
8850
  theme = _ref3.theme;
8851
8851
  return $background || theme.accent.softBlue;
8852
8852
  });
8853
- var SidebarLink = styled__default(reactRouterDom.NavLink)(_templateObject2$j || (_templateObject2$j = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n height: 28px;\n width: 100%;\n gap: 10px;\n cursor: pointer;\n border-radius: 4px;\n text-decoration: none;\n // transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);\n padding: ", ";\n color: ", ";\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n"])), function (_ref4) {
8853
+ var SidebarLink = styled__default(reactRouterDom.NavLink)(_templateObject2$j || (_templateObject2$j = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n height: 28px;\n width: 100%;\n gap: 10px;\n cursor: pointer;\n border-radius: 4px;\n text-decoration: none;\n transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);\n padding: ", ";\n color: ", ";\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n"])), function (_ref4) {
8854
8854
  var $padding = _ref4.$padding;
8855
8855
  return $padding;
8856
8856
  }, function (_ref5) {
@@ -8888,14 +8888,18 @@ var TextContainer = styled__default.span(_templateObject5$8 || (_templateObject5
8888
8888
  var $isExpanded = _ref14.$isExpanded;
8889
8889
  return $isExpanded ? 'translateX(0)' : 'translateX(-10px)';
8890
8890
  });
8891
- var Sidebar = function Sidebar(_ref15) {
8892
- var logo = _ref15.logo,
8893
- content = _ref15.content,
8894
- background = _ref15.background,
8895
- ProfileContent = _ref15.ProfileContent,
8896
- _ref15$isExpanded = _ref15.isExpanded,
8897
- isExpanded = _ref15$isExpanded === void 0 ? false : _ref15$isExpanded,
8898
- setIsExpanded = _ref15.setIsExpanded;
8891
+ var NotificationBadge = styled__default.div(_templateObject6$7 || (_templateObject6$7 = _taggedTemplateLiteralLoose(["\n position: ", ";\n top: -4px;\n right: -4px;\n background: red;\n color: white;\n font-size: 10px;\n font-weight: bold;\n border-radius: 50%;\n padding: 2px 5px;\n min-width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n"])), function (_ref15) {
8892
+ var $position = _ref15.$position;
8893
+ return $position || 'absolute';
8894
+ });
8895
+ var Sidebar = function Sidebar(_ref16) {
8896
+ var logo = _ref16.logo,
8897
+ content = _ref16.content,
8898
+ background = _ref16.background,
8899
+ ProfileContent = _ref16.ProfileContent,
8900
+ _ref16$isExpanded = _ref16.isExpanded,
8901
+ isExpanded = _ref16$isExpanded === void 0 ? false : _ref16$isExpanded,
8902
+ setIsExpanded = _ref16.setIsExpanded;
8899
8903
  var location = reactRouterDom.useLocation();
8900
8904
  var _useState = React.useState({}),
8901
8905
  openMenus = _useState[0],
@@ -8909,22 +8913,31 @@ var Sidebar = function Sidebar(_ref15) {
8909
8913
  return _extends({}, prev, (_extends2 = {}, _extends2[id] = !prev[id], _extends2));
8910
8914
  });
8911
8915
  };
8916
+ var _getTotalNotifications = function getTotalNotifications(item) {
8917
+ var _item$children;
8918
+ if ((_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
8919
+ return (item.notificationCount || 0) + item.children.reduce(function (sum, child) {
8920
+ return sum + _getTotalNotifications(child);
8921
+ }, 0);
8922
+ }
8923
+ return item.notificationCount || 0;
8924
+ };
8912
8925
  var getBasePath = function getBasePath(path) {
8913
8926
  if (!path) return '';
8914
8927
  var parts = path.split('/').filter(Boolean);
8915
8928
  return parts.length > 0 ? "/" + parts[0] : '';
8916
8929
  };
8917
8930
  var isRouteActive = function isRouteActive(item) {
8918
- var _item$children;
8931
+ var _item$children2;
8919
8932
  var currentBase = getBasePath(location.pathname);
8920
8933
  var itemBase = item.activeUrl ? getBasePath(item.activeUrl) : getBasePath(item.url);
8921
- return currentBase === itemBase || ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.some(function (child) {
8934
+ return currentBase === itemBase || ((_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.some(function (child) {
8922
8935
  return currentBase === getBasePath(child.activeUrl) || currentBase === getBasePath(child.url);
8923
8936
  }));
8924
8937
  };
8925
- var ChildLink = React__default.memo(function (_ref16) {
8926
- var child = _ref16.child,
8927
- isExpanded = _ref16.isExpanded;
8938
+ var ChildLink = React__default.memo(function (_ref17) {
8939
+ var child = _ref17.child,
8940
+ isExpanded = _ref17.isExpanded;
8928
8941
  var themeColors = styled.useTheme();
8929
8942
  var location = reactRouterDom.useLocation();
8930
8943
  var active = getBasePath(location.pathname) === getBasePath(child.activeUrl) || getBasePath(location.pathname) === getBasePath(child.url);
@@ -8939,7 +8952,8 @@ var Sidebar = function Sidebar(_ref15) {
8939
8952
  },
8940
8953
  onMouseLeave: function onMouseLeave() {
8941
8954
  return setIsHovered(false);
8942
- }
8955
+ },
8956
+ "$padding": '0px 10px 0px 0px'
8943
8957
  }, React__default.createElement(IconWrapper$2, {
8944
8958
  "$selected": active
8945
8959
  }, React__default.createElement(Icon, {
@@ -8947,12 +8961,17 @@ var Sidebar = function Sidebar(_ref15) {
8947
8961
  size: 18,
8948
8962
  weight: child.iconWeight,
8949
8963
  color: isHovered || active ? themeColors.text.white : themeColors.text.medium
8950
- })), React__default.createElement(TextContainer, {
8964
+ })), React__default.createElement(Container, {
8965
+ "$width": '100%',
8966
+ "$justifyContent": 'space-between',
8967
+ "$gap": '5px'
8968
+ }, React__default.createElement(TextContainer, {
8951
8969
  "$isExpanded": isExpanded,
8952
8970
  "$fontSize": '12px',
8953
- "$color": themeColors.text.medium,
8954
- "$padding": '0px 10px 0px 0px'
8955
- }, child.label));
8971
+ "$color": themeColors.text.medium
8972
+ }, child.label), _getTotalNotifications(child) > 0 && React__default.createElement(NotificationBadge, {
8973
+ "$position": 'unset'
8974
+ }, _getTotalNotifications(child) > 99 ? '99+' : _getTotalNotifications(child))));
8956
8975
  });
8957
8976
  var renderChildLinks = function renderChildLinks(children) {
8958
8977
  return React__default.createElement(Container, {
@@ -8967,14 +8986,14 @@ var Sidebar = function Sidebar(_ref15) {
8967
8986
  });
8968
8987
  }));
8969
8988
  };
8970
- var SidebarItem = React__default.memo(function (_ref17) {
8971
- var item = _ref17.item,
8972
- isActive = _ref17.isActive,
8973
- isOpen = _ref17.isOpen,
8974
- hasChildren = _ref17.hasChildren,
8975
- isExpanded = _ref17.isExpanded,
8976
- onToggle = _ref17.onToggle,
8977
- renderChildLinks = _ref17.renderChildLinks;
8989
+ var SidebarItem = React__default.memo(function (_ref18) {
8990
+ var item = _ref18.item,
8991
+ isActive = _ref18.isActive,
8992
+ isOpen = _ref18.isOpen,
8993
+ hasChildren = _ref18.hasChildren,
8994
+ isExpanded = _ref18.isExpanded,
8995
+ onToggle = _ref18.onToggle,
8996
+ renderChildLinks = _ref18.renderChildLinks;
8978
8997
  var themeColors = styled.useTheme();
8979
8998
  var _useState3 = React.useState(false),
8980
8999
  isHovered = _useState3[0],
@@ -8991,10 +9010,19 @@ var Sidebar = function Sidebar(_ref15) {
8991
9010
  "$width": '100%',
8992
9011
  "$cursor": 'pointer',
8993
9012
  "$borderRadius": '4px',
9013
+ "$justifyContent": 'space-between',
8994
9014
  "$hoverBackground": themeColors["default"].primary,
8995
9015
  onClick: function onClick() {
8996
9016
  return hasChildren && onToggle();
8997
9017
  }
9018
+ }, React__default.createElement(Container, {
9019
+ "$alignItems": 'center',
9020
+ "$gap": '8px',
9021
+ "$width": '100%',
9022
+ "$cursor": 'pointer',
9023
+ "$borderRadius": '4px'
9024
+ }, React__default.createElement(Container, {
9025
+ "$position": 'relative'
8998
9026
  }, React__default.createElement(IconWrapper$2, {
8999
9027
  "$selected": !!isActive
9000
9028
  }, React__default.createElement(Icon, {
@@ -9002,11 +9030,12 @@ var Sidebar = function Sidebar(_ref15) {
9002
9030
  size: 20,
9003
9031
  weight: item.iconWeight,
9004
9032
  color: isHovered || isActive ? themeColors.text.white : themeColors.text.medium
9005
- })), React__default.createElement(TextContainer, {
9033
+ })), _getTotalNotifications(item) > 0 && React__default.createElement(NotificationBadge, null, _getTotalNotifications(item) > 99 ? '99+' : _getTotalNotifications(item))), React__default.createElement(TextContainer, {
9006
9034
  "$isExpanded": isExpanded,
9007
9035
  "$fontSize": '14px'
9008
- }, item.label), hasChildren && React__default.createElement(Container, {
9009
- "$padding": '9px'
9036
+ }, item.label)), hasChildren && React__default.createElement(Container, {
9037
+ "$padding": '9px',
9038
+ "$opacity": isExpanded ? 1 : 0
9010
9039
  }, React__default.createElement(Icon, {
9011
9040
  icon: isOpen ? 'UpArrow' : 'DownArrow',
9012
9041
  size: 10,
@@ -9018,10 +9047,12 @@ var Sidebar = function Sidebar(_ref15) {
9018
9047
  }, ContentLayout) : React__default.createElement(Container, {
9019
9048
  "$flexDirection": 'column',
9020
9049
  "$alignItems": 'start',
9021
- "$gap": '8px'
9050
+ "$gap": '8px',
9051
+ "$width": '100%'
9022
9052
  }, React__default.createElement(Container, {
9023
9053
  "$color": themeColors.text.medium,
9024
- "$hoverColor": themeColors.text.white
9054
+ "$hoverColor": themeColors.text.white,
9055
+ "$width": '100%'
9025
9056
  }, ContentLayout), hasChildren && isExpanded && isOpen && renderChildLinks && React__default.createElement(Container, null, renderChildLinks(item.children)));
9026
9057
  });
9027
9058
  return React__default.createElement(SidebarContainer, {
@@ -9053,9 +9084,9 @@ var Sidebar = function Sidebar(_ref15) {
9053
9084
  "$gap": '16px',
9054
9085
  "$width": '100%'
9055
9086
  }, content.map(function (item) {
9056
- var _item$children2;
9087
+ var _item$children3;
9057
9088
  var active = isRouteActive(item) || false;
9058
- var hasChildren = !!((_item$children2 = item.children) !== null && _item$children2 !== void 0 && _item$children2.length);
9089
+ var hasChildren = !!((_item$children3 = item.children) !== null && _item$children3 !== void 0 && _item$children3.length);
9059
9090
  var isOpen = openMenus[item.id];
9060
9091
  return React__default.createElement(SidebarItem, {
9061
9092
  key: item.id,
@@ -9200,7 +9231,7 @@ var TableRow = function TableRow(_ref) {
9200
9231
  }));
9201
9232
  };
9202
9233
 
9203
- var _templateObject$q, _templateObject2$l, _templateObject3$e, _templateObject4$b, _templateObject5$9, _templateObject6$7;
9234
+ var _templateObject$q, _templateObject2$l, _templateObject3$e, _templateObject4$b, _templateObject5$9, _templateObject6$8;
9204
9235
  var TableContainer = styled__default.div(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n background: ", ";\n width: 100%;\n display: flex;\n overflow: hidden;\n border-radius: 8px;\n"])), function (_ref) {
9205
9236
  var theme = _ref.theme;
9206
9237
  return theme.brand.light;
@@ -9226,7 +9257,7 @@ var LegendDivider = styled__default.div(_templateObject5$9 || (_templateObject5$
9226
9257
  var $marginRight = _ref6.$marginRight;
9227
9258
  return $marginRight != null ? $marginRight : '0px';
9228
9259
  });
9229
- var Divider = styled__default.div(_templateObject6$7 || (_templateObject6$7 = _taggedTemplateLiteralLoose(["\n height: 2px;\n background: ", ";\n"])), function (_ref7) {
9260
+ var Divider = styled__default.div(_templateObject6$8 || (_templateObject6$8 = _taggedTemplateLiteralLoose(["\n height: 2px;\n background: ", ";\n"])), function (_ref7) {
9230
9261
  var theme = _ref7.theme;
9231
9262
  return theme.border.extraLight;
9232
9263
  });
@@ -9397,7 +9428,7 @@ var Table = function Table(_ref8) {
9397
9428
  }))));
9398
9429
  };
9399
9430
 
9400
- var _templateObject$r, _templateObject2$m, _templateObject3$f, _templateObject4$c, _templateObject5$a, _templateObject6$8;
9431
+ var _templateObject$r, _templateObject2$m, _templateObject3$f, _templateObject4$c, _templateObject5$a, _templateObject6$9;
9401
9432
  var Container$4 = styled__default.div(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%; \n display: flex;\n flex-direction: column;\n overflow: ", ";\n gap: ", ";\n border: ", ";\n border-radius: 8px;\n"])), function (_ref) {
9402
9433
  var $overflow = _ref.$overflow;
9403
9434
  return $overflow || 'visible';
@@ -9446,7 +9477,7 @@ var DetailsFirstContainer = styled__default.div(_templateObject5$a || (_template
9446
9477
  theme = _ref13.theme;
9447
9478
  return $active ? theme["default"].primary : theme.text.medium;
9448
9479
  });
9449
- var TabItemsWrapper = styled__default.div(_templateObject6$8 || (_templateObject6$8 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 24px;\n // overflow-x: auto;\n scrollbar-width: thin;\n"])));
9480
+ var TabItemsWrapper = styled__default.div(_templateObject6$9 || (_templateObject6$9 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 24px;\n // overflow-x: auto;\n scrollbar-width: thin;\n"])));
9450
9481
  var Tabs = function Tabs(_ref14) {
9451
9482
  var tabItems = _ref14.tabItems,
9452
9483
  _ref14$disabled = _ref14.disabled,