@cullsin/lnc-menu 3.0.22 → 3.0.91
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.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/src/SideMenu.d.ts +3 -1
- package/dist/src/SideMenu.js +17 -27
- package/dist/src/src/sidemenu.scss +166 -0
- package/dist/src/translations/en.d.ts +13 -0
- package/dist/src/translations/en.js +13 -0
- package/dist/src/translations/es.d.ts +13 -0
- package/dist/src/translations/es.js +13 -0
- package/dist/src/translations/index.d.ts +6 -0
- package/dist/src/translations/index.js +10 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/src/SideMenu.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Location, NavigateFunction } from "react-router-dom";
|
|
3
|
+
import { Language } from "./translations";
|
|
3
4
|
interface SideMenuProps {
|
|
4
5
|
useDrawer: () => {
|
|
5
6
|
isDrawerOpen: boolean;
|
|
@@ -8,6 +9,7 @@ interface SideMenuProps {
|
|
|
8
9
|
SampleMgmtIcon: React.ElementType;
|
|
9
10
|
navigate: NavigateFunction;
|
|
10
11
|
location: Location;
|
|
12
|
+
language?: Language;
|
|
11
13
|
}
|
|
12
|
-
declare function SideMenu({ useDrawer, SampleMgmtIcon, location }: SideMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function SideMenu({ useDrawer, SampleMgmtIcon, location, language }: SideMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
export default SideMenu;
|
package/dist/src/SideMenu.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import ArticleOutlinedIcon from "@mui/icons-material/ArticleOutlined";
|
|
3
|
-
import DashboardOutlinedIcon from "@mui/icons-material/DashboardOutlined";
|
|
4
2
|
import RecentActorsOutlinedIcon from "@mui/icons-material/RecentActorsOutlined";
|
|
5
3
|
import GroupAddOutlinedIcon from "@mui/icons-material/GroupAddOutlined";
|
|
6
4
|
import AppBar from "@mui/material/AppBar";
|
|
@@ -14,44 +12,36 @@ import Menu from "@mui/material/Menu";
|
|
|
14
12
|
import MenuItem from "@mui/material/MenuItem";
|
|
15
13
|
import Tooltip from "@mui/material/Tooltip";
|
|
16
14
|
import * as React from "react";
|
|
17
|
-
|
|
15
|
+
import { getTranslations } from "./translations";
|
|
16
|
+
function SideMenu({ useDrawer, SampleMgmtIcon, location, language = 'en' }) {
|
|
18
17
|
const [selectedMainMenu, setSelectedMainMenu] = React.useState(null);
|
|
19
18
|
const [selectedSubMenuPath, setSelectedSubMenuPath] = React.useState(null);
|
|
20
19
|
const [openMenuIndex, setOpenMenuIndex] = React.useState(null);
|
|
21
20
|
const { isDrawerOpen, toggleDrawer } = useDrawer();
|
|
22
21
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
22
|
+
const t = React.useMemo(() => getTranslations(language), [language]);
|
|
23
23
|
const menuItems = React.useMemo(() => [
|
|
24
24
|
{
|
|
25
|
-
text:
|
|
26
|
-
icon: _jsx(DashboardOutlinedIcon, {}),
|
|
27
|
-
subMenu: [{ text: "Dashboard", path: "/super-site/dashboard" }],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
text: "Patient Management",
|
|
25
|
+
text: t.menu.patientManagement,
|
|
31
26
|
icon: _jsx(RecentActorsOutlinedIcon, {}),
|
|
32
27
|
subMenu: [
|
|
33
|
-
{ text:
|
|
34
|
-
{ text:
|
|
28
|
+
{ text: t.menu.patient, path: `/patient/${language}/patient-listing` },
|
|
29
|
+
{ text: t.menu.family, path: `/family/${language}/family-listing` },
|
|
35
30
|
],
|
|
36
31
|
},
|
|
37
32
|
{
|
|
38
|
-
text:
|
|
33
|
+
text: t.menu.sampleManagement,
|
|
39
34
|
icon: _jsx(SampleMgmtIcon, {}),
|
|
40
35
|
subMenu: [
|
|
41
|
-
{ text:
|
|
36
|
+
{ text: t.menu.sampleListing, path: `/sample/${language}/sample-listing` }
|
|
42
37
|
],
|
|
43
38
|
},
|
|
44
39
|
{
|
|
45
|
-
text:
|
|
46
|
-
icon: _jsx(ArticleOutlinedIcon, {}),
|
|
47
|
-
path: "/variant/",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
text: "Carrier Duo/Trio",
|
|
40
|
+
text: t.menu.carrierDuoTrio,
|
|
51
41
|
icon: _jsx(GroupAddOutlinedIcon, {}),
|
|
52
|
-
path:
|
|
42
|
+
path: `/carrier-duo-trio/${language}/`,
|
|
53
43
|
},
|
|
54
|
-
], [SampleMgmtIcon]);
|
|
44
|
+
], [SampleMgmtIcon, t, language]);
|
|
55
45
|
// 🔁 Sync selection with current path
|
|
56
46
|
React.useEffect(() => {
|
|
57
47
|
const currentPath = location.pathname;
|
|
@@ -97,9 +87,9 @@ function SideMenu({ useDrawer, SampleMgmtIcon, location }) {
|
|
|
97
87
|
"& .MuiDrawer-paper": {
|
|
98
88
|
width: isDrawerOpen ? 230 : 64,
|
|
99
89
|
transition: "width 0.3s ease",
|
|
100
|
-
|
|
101
|
-
bottom: "0",
|
|
90
|
+
height: "100vh",
|
|
102
91
|
borderRight: "1px solid #B1BECB",
|
|
92
|
+
overflowY: "auto",
|
|
103
93
|
},
|
|
104
94
|
}, children: _jsx(List, { children: menuItems.map((item, index) => (_jsxs(React.Fragment, { children: [_jsx(Tooltip, { title: item.text, placement: "right", disableHoverListener: isDrawerOpen, children: _jsxs(ListItem, { button: true, selected: selectedMainMenu === item.text, className: selectedMainMenu === item.text ? "selected" : "", onClick: (event) => {
|
|
105
95
|
if (item.subMenu) {
|
|
@@ -121,16 +111,16 @@ function SideMenu({ useDrawer, SampleMgmtIcon, location }) {
|
|
|
121
111
|
item.onClick();
|
|
122
112
|
setSelectedMainMenu(item.text);
|
|
123
113
|
}
|
|
124
|
-
}, children: [_jsx(ListItemIcon, { children: item.icon }), isDrawerOpen && _jsx(ListItemText, { primary: item.text })] }) }), item.subMenu && anchorEl && openMenuIndex === index && (_jsxs(Menu, { className:
|
|
114
|
+
}, children: [_jsx(ListItemIcon, { children: item.icon }), isDrawerOpen && _jsx(ListItemText, { primary: item.text })] }) }), item.subMenu && anchorEl && openMenuIndex === index && (_jsxs(Menu, { className: `app-menu-item ${!isDrawerOpen ? 'collapsed-menu' : ''}`, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleMenuClose, anchorOrigin: {
|
|
125
115
|
vertical: "top",
|
|
126
|
-
horizontal: "
|
|
116
|
+
horizontal: "right",
|
|
127
117
|
}, transformOrigin: {
|
|
128
118
|
vertical: "top",
|
|
129
119
|
horizontal: "left",
|
|
130
120
|
}, PaperProps: {
|
|
131
121
|
style: {
|
|
132
|
-
marginLeft:
|
|
122
|
+
marginLeft: 8,
|
|
133
123
|
},
|
|
134
|
-
}, children: [_jsx("span", { className: "submenu-title", children:
|
|
124
|
+
}, children: [!isDrawerOpen && (_jsx("span", { className: "submenu-title", children: item.text })), item.subMenu.map((subItem) => (_jsx(MenuItem, { selected: selectedSubMenuPath === subItem.path, onClick: () => handleSubMenuItemClick(subItem.path, item.text), children: subItem.text }, subItem.text)))] }))] }, index))) }) })] }));
|
|
135
125
|
}
|
|
136
126
|
export default SideMenu;
|
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
.MuiListItem-root {
|
|
13
|
+
padding: 15px;
|
|
14
|
+
&.selected {
|
|
15
|
+
padding: 7px;
|
|
16
|
+
|
|
17
|
+
.MuiListItemIcon-root {
|
|
18
|
+
background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
|
|
19
|
+
color: #1e2f97;
|
|
20
|
+
padding: 10px;
|
|
21
|
+
min-width: 25px;
|
|
22
|
+
border-top-left-radius: 5px;
|
|
23
|
+
border-bottom-left-radius: 5px;
|
|
24
|
+
|
|
25
|
+
&:only-of-type {
|
|
26
|
+
border-top-right-radius: 5px;
|
|
27
|
+
border-bottom-right-radius: 5px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.MuiListItemText-root {
|
|
32
|
+
span {
|
|
33
|
+
background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
|
|
34
|
+
padding: 10px 0;
|
|
35
|
+
min-width: 25px;
|
|
36
|
+
border-top-right-radius: 5px;
|
|
37
|
+
border-bottom-right-radius: 5px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:hover:not(.selected) {
|
|
43
|
+
padding: 5px 7px;
|
|
44
|
+
|
|
45
|
+
.MuiListItemIcon-root {
|
|
46
|
+
background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
|
|
47
|
+
color: #1e2f97;
|
|
48
|
+
padding: 10px;
|
|
49
|
+
min-width: 25px;
|
|
50
|
+
border-top-left-radius: 5px;
|
|
51
|
+
border-bottom-left-radius: 5px;
|
|
52
|
+
|
|
53
|
+
&:only-of-type {
|
|
54
|
+
border-top-right-radius: 5px;
|
|
55
|
+
border-bottom-right-radius: 5px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.MuiListItemText-root {
|
|
60
|
+
span {
|
|
61
|
+
background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
|
|
62
|
+
padding: 10px 0;
|
|
63
|
+
min-width: 25px;
|
|
64
|
+
border-top-right-radius: 5px;
|
|
65
|
+
border-bottom-right-radius: 5px;
|
|
66
|
+
}
|
|
67
|
+
.MuiTypography-root {
|
|
68
|
+
color: #1e2f97;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.MuiListItemIcon-root {
|
|
74
|
+
color: #fff;
|
|
75
|
+
min-width: 30px;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.MuiListItemText-root {
|
|
80
|
+
margin-top: 0;
|
|
81
|
+
margin-bottom: 0;
|
|
82
|
+
.MuiTypography-root {
|
|
83
|
+
font: 14px/24px "OpenSans-SemiBold";
|
|
84
|
+
color: #fff;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.app-menu-item {
|
|
93
|
+
.MuiList-root {
|
|
94
|
+
&.MuiMenu-list {
|
|
95
|
+
background: linear-gradient(to bottom, #586d81, #3e4f60) !important;
|
|
96
|
+
color: #fff;
|
|
97
|
+
width: 200px;
|
|
98
|
+
padding: 10px;
|
|
99
|
+
position: relative;
|
|
100
|
+
overflow: visible;
|
|
101
|
+
.submenu-title {
|
|
102
|
+
text-transform: uppercase;
|
|
103
|
+
font: 12px / 18px "OpenSans-Regular";
|
|
104
|
+
color: #efffff;
|
|
105
|
+
padding: 0 0 5px 10px;
|
|
106
|
+
display: block;
|
|
107
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
|
108
|
+
margin-bottom: 5px;
|
|
109
|
+
}
|
|
110
|
+
.MuiMenuItem-root {
|
|
111
|
+
&.Mui-focusVisible {
|
|
112
|
+
background-color: transparent;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:hover {
|
|
116
|
+
font: 16px/24px "OpenSans-SemiBold";
|
|
117
|
+
background: #374451;
|
|
118
|
+
border-radius: 6px;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&.collapsed-menu {
|
|
125
|
+
.MuiList-root {
|
|
126
|
+
&.MuiMenu-list {
|
|
127
|
+
&::before {
|
|
128
|
+
content: "";
|
|
129
|
+
position: absolute;
|
|
130
|
+
top: 15px;
|
|
131
|
+
left: -8px;
|
|
132
|
+
width: 0;
|
|
133
|
+
height: 0;
|
|
134
|
+
border-top: 8px solid transparent;
|
|
135
|
+
border-bottom: 8px solid transparent;
|
|
136
|
+
border-right: 8px solid #516578;
|
|
137
|
+
z-index: 2;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
.MuiPopover-root {
|
|
146
|
+
.MuiPaper-root {
|
|
147
|
+
overflow: visible;
|
|
148
|
+
position: relative;
|
|
149
|
+
width: max-content;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.MuiList-root.MuiMenu-list {
|
|
154
|
+
border-radius: 5px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
#more-menu {
|
|
158
|
+
.MuiPaper-root {
|
|
159
|
+
.MuiMenu-list {
|
|
160
|
+
color: #1e2f97;
|
|
161
|
+
.MuiMenuItem-root {
|
|
162
|
+
font-size: 14px;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const en = {
|
|
2
|
+
menu: {
|
|
3
|
+
home: "Home",
|
|
4
|
+
patientManagement: "Patient Management",
|
|
5
|
+
sampleManagement: "Sample Management",
|
|
6
|
+
reports: "Reports",
|
|
7
|
+
carrierDuoTrio: "Carrier Duo/Trio",
|
|
8
|
+
dashboard: "Dashboard",
|
|
9
|
+
patient: "Patient",
|
|
10
|
+
family: "Family",
|
|
11
|
+
sampleListing: "Sample Listing",
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const es = {
|
|
2
|
+
menu: {
|
|
3
|
+
home: "Inicio",
|
|
4
|
+
patientManagement: "Gestión de Pacientes",
|
|
5
|
+
sampleManagement: "Gestión de Muestras",
|
|
6
|
+
reports: "Informes",
|
|
7
|
+
carrierDuoTrio: "Portador Duo/Trio",
|
|
8
|
+
dashboard: "Panel",
|
|
9
|
+
patient: "Paciente",
|
|
10
|
+
family: "Familia",
|
|
11
|
+
sampleListing: "Listado de Muestras",
|
|
12
|
+
},
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cullsin/lnc-menu",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.91",
|
|
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",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc && npm run copy-scss",
|
|
12
|
-
"copy-scss": "cpy src/sidemenu.scss dist"
|
|
12
|
+
"copy-scss": "cpy src/sidemenu.scss dist/src"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"publishConfig": {
|