@cullsin/lnc-menu 3.0.13 → 3.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cullsin/lnc-menu",
3
- "version": "3.0.13",
3
+ "version": "3.0.15",
4
4
  "description": "Reusable SideMenu component for MedGenome LNC platform using MUI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,5 +27,5 @@
27
27
  "type": "git",
28
28
  "url": "https://github.com/cullsin/lnc-menu"
29
29
  },
30
- "author": "Your Name <you@example.com>"
30
+ "author": "Raja Kulasekaran <cullsin@gmail.com>"
31
31
  }
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { default as SideMenu } from './src/SideMenu';
2
- import './src/sidemenu.scss';
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { default as SideMenu } from './src/SideMenu';
2
- import './src/sidemenu.scss'; // consumer must support SCSS
@@ -1,12 +0,0 @@
1
- import * as React from "react";
2
- import { NavigateFunction } from "react-router-dom";
3
- interface SideMenuProps {
4
- useDrawer: () => {
5
- isDrawerOpen: boolean;
6
- toggleDrawer: () => void;
7
- };
8
- SampleMgmtIcon: React.ElementType;
9
- navigate: NavigateFunction;
10
- }
11
- declare function SideMenu({ useDrawer, SampleMgmtIcon, navigate }: SideMenuProps): import("react/jsx-runtime").JSX.Element;
12
- export default SideMenu;
@@ -1,97 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import AppBar from "@mui/material/AppBar";
4
- import Box from "@mui/material/Box";
5
- import Drawer from "@mui/material/Drawer";
6
- import List from "@mui/material/List";
7
- import ListItem from "@mui/material/ListItem";
8
- import ListItemIcon from "@mui/material/ListItemIcon";
9
- import ListItemText from "@mui/material/ListItemText";
10
- import Menu from "@mui/material/Menu";
11
- import MenuItem from "@mui/material/MenuItem";
12
- import DashboardOutlinedIcon from "@mui/icons-material/DashboardOutlined";
13
- import RecentActorsOutlinedIcon from "@mui/icons-material/RecentActorsOutlined";
14
- import ArticleOutlinedIcon from "@mui/icons-material/ArticleOutlined";
15
- function SideMenu({ useDrawer, SampleMgmtIcon, navigate }) {
16
- const [selectedMainMenu, setSelectedMainMenu] = React.useState(null); // Track selected main menu
17
- const [selectedSubMenuPath, setSelectedSubMenuPath] = React.useState(null);
18
- const [openMenuIndex, setOpenMenuIndex] = React.useState(null);
19
- const { isDrawerOpen, toggleDrawer } = useDrawer();
20
- const [anchorEl, setAnchorEl] = React.useState(null);
21
- const handleMenuOpen = (event, index) => {
22
- setAnchorEl(event.currentTarget);
23
- setOpenMenuIndex(index); // Keep track of which menu to open
24
- };
25
- const handleMenuClose = () => {
26
- setAnchorEl(null);
27
- setOpenMenuIndex(null);
28
- };
29
- const handleSubMenuItemClick = (path, parentText) => {
30
- setSelectedMainMenu(parentText);
31
- setSelectedSubMenuPath(path); // Set based on path for unique identification
32
- handleMenuClose();
33
- if (isDrawerOpen) {
34
- toggleDrawer();
35
- }
36
- window.location.href = path;
37
- };
38
- const menuItems = [
39
- {
40
- text: "Home",
41
- icon: _jsx(DashboardOutlinedIcon, {}),
42
- subMenu: [{ text: "Dashboard", path: "/super-site/dashboard" }],
43
- },
44
- {
45
- text: "Patient Management",
46
- icon: _jsx(RecentActorsOutlinedIcon, {}),
47
- subMenu: [
48
- { text: "Patient", path: "/patient/patient-listing" },
49
- { text: "Family", path: "/patient/family-listing" },
50
- ],
51
- },
52
- {
53
- text: "Sample Management",
54
- icon: _jsx(SampleMgmtIcon, {}),
55
- subMenu: [
56
- { text: "Dashboard", path: "/sample/sample-dashboard" },
57
- { text: "Sample Listing", path: "/sample/sample-listing" },
58
- {
59
- text: "Single Sample Analysis",
60
- path: "/sample/single-sample-analysis",
61
- },
62
- ],
63
- },
64
- { text: "Reports", icon: _jsx(ArticleOutlinedIcon, {}) },
65
- ];
66
- return (_jsxs(Box, { sx: { flexGrow: 1 }, children: [_jsx(AppBar, { sx: { position: "fixed", top: 0 } }), _jsx(Drawer, { open: isDrawerOpen, variant: "permanent", className: "parent-container", sx: {
67
- width: isDrawerOpen ? 230 : 64,
68
- flexShrink: 0,
69
- "& .MuiDrawer-paper": {
70
- width: isDrawerOpen ? 230 : 64,
71
- transition: "width 0.3s ease",
72
- top: "64px",
73
- bottom: "0",
74
- borderRight: "1px solid #B1BECB",
75
- },
76
- }, children: _jsx(List, { children: menuItems.map((item, index) => (_jsxs(React.Fragment, { children: [_jsxs(ListItem, { button: true, selected: selectedMainMenu === item.text, className: selectedMainMenu === item.text ? "selected" : "", onClick: (event) => {
77
- if (item.subMenu) {
78
- handleMenuOpen(event, index);
79
- setSelectedMainMenu(item.text); // Set selected when main menu is clicked
80
- }
81
- else if (item.onClick) {
82
- item.onClick();
83
- setSelectedMainMenu(item.text); // Set selected when a menu is clicked
84
- }
85
- }, children: [_jsx(ListItemIcon, { children: item.icon }), isDrawerOpen && _jsx(ListItemText, { primary: item.text })] }), item.subMenu && anchorEl && openMenuIndex === index && (_jsxs(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleMenuClose, anchorOrigin: {
86
- vertical: "top",
87
- horizontal: "left",
88
- }, transformOrigin: {
89
- vertical: "top",
90
- horizontal: "left",
91
- }, PaperProps: {
92
- style: {
93
- marginLeft: isDrawerOpen ? 230 : 65,
94
- },
95
- }, children: [_jsx("span", { className: "submenu-title", children: !isDrawerOpen ? item.text : "" }), item.subMenu.map((subItem) => (_jsx(MenuItem, { selected: selectedSubMenuPath === subItem.path, onClick: () => handleSubMenuItemClick(subItem.path, item.text), children: subItem.text }, subItem.text)))] }))] }, index))) }) })] }));
96
- }
97
- export default SideMenu;
@@ -1,118 +0,0 @@
1
- //overwritten the default MUI css
2
-
3
- .MuiBox-root .MuiList-root {
4
- background: linear-gradient(to bottom, #1e2f97, #0b1659) !important;
5
- color: #fff;
6
- height: 100%;
7
- bottom: 0; // Ensure drawer stretches till bottom
8
- padding: 20px 0;
9
- }
10
-
11
- .MuiList-root {
12
- &.MuiMenu-list {
13
- background: linear-gradient(to bottom, #586d81, #3e4f60) !important;
14
- color: #fff;
15
- width: 200px;
16
- padding: 10px;
17
- position: relative;
18
- overflow: visible;
19
-
20
- .submenu-title {
21
- text-transform: uppercase;
22
- font: 12px / 18px "OpenSans-Regular";
23
- color: #efffff;
24
- padding: 0 0 5px 10px;
25
- display: block;
26
- }
27
-
28
- .MuiMenuItem-root {
29
- &.Mui-focusVisible {
30
- background-color: transparent;
31
- }
32
-
33
- &:hover {
34
- font: 16px/24px "OpenSans-SemiBold";
35
- background: #374451;
36
- border-radius: 6px;
37
- }
38
- }
39
- }
40
-
41
- .MuiListItem-root {
42
- padding: 15px;
43
- &.selected {
44
- padding: 7px;
45
-
46
- .MuiListItemIcon-root {
47
- background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
48
- color: #1e2f97;
49
- padding: 10px;
50
- min-width: 25px;
51
- border-top-left-radius: 5px;
52
- border-bottom-left-radius: 5px;
53
-
54
- &:only-of-type {
55
- border-top-right-radius: 5px;
56
- border-bottom-right-radius: 5px;
57
- }
58
- }
59
-
60
- .MuiListItemText-root {
61
- span {
62
- background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
63
- color: #1e2f97;
64
- padding: 10px 0;
65
- min-width: 25px;
66
- border-top-right-radius: 5px;
67
- border-bottom-right-radius: 5px;
68
- }
69
- }
70
- }
71
-
72
- .MuiListItemIcon-root {
73
- color: #fff;
74
- min-width: 30px;
75
- cursor: pointer;
76
- }
77
-
78
- .MuiListItemText-root {
79
- margin-top: 0;
80
- margin-bottom: 0;
81
- .MuiTypography-root {
82
- font: 14px/24px "OpenSans-SemiBold";
83
- color: #fff;
84
- cursor: pointer;
85
- white-space: nowrap;
86
- }
87
- }
88
- }
89
- }
90
-
91
- ul.MuiList-root {
92
- &:has(.submenu-title) {
93
- &::before {
94
- content: "";
95
- position: absolute;
96
- top: 15px;
97
- left: -8px;
98
- width: 0;
99
- height: 0;
100
- border-top: 8px solid transparent;
101
- border-bottom: 8px solid transparent;
102
- border-right: 8px solid #516578;
103
- z-index: 2;
104
- }
105
- }
106
- }
107
-
108
- .MuiPopover-root {
109
- .MuiPaper-root {
110
- overflow: visible;
111
- position: relative;
112
- width: max-content;
113
- }
114
- }
115
-
116
- .MuiList-root.MuiMenu-list {
117
- border-radius: 5px;
118
- }