@cullsin/lnc-menu 3.0.22 → 3.0.90

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 CHANGED
@@ -1,2 +1,4 @@
1
1
  export { default as SideMenu } from './src/SideMenu';
2
+ export { getTranslations, en, es } from './src/translations';
3
+ export type { Language, Translations } from './src/translations';
2
4
  import './src/sidemenu.scss';
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default as SideMenu } from './src/SideMenu';
2
+ export { getTranslations, en, es } from './src/translations';
2
3
  import './src/sidemenu.scss'; // consumer must support SCSS
@@ -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;
@@ -14,44 +14,46 @@ import Menu from "@mui/material/Menu";
14
14
  import MenuItem from "@mui/material/MenuItem";
15
15
  import Tooltip from "@mui/material/Tooltip";
16
16
  import * as React from "react";
17
- function SideMenu({ useDrawer, SampleMgmtIcon, location }) {
17
+ import { getTranslations } from "./translations";
18
+ function SideMenu({ useDrawer, SampleMgmtIcon, location, language = 'en' }) {
18
19
  const [selectedMainMenu, setSelectedMainMenu] = React.useState(null);
19
20
  const [selectedSubMenuPath, setSelectedSubMenuPath] = React.useState(null);
20
21
  const [openMenuIndex, setOpenMenuIndex] = React.useState(null);
21
22
  const { isDrawerOpen, toggleDrawer } = useDrawer();
22
23
  const [anchorEl, setAnchorEl] = React.useState(null);
24
+ const t = React.useMemo(() => getTranslations(language), [language]);
23
25
  const menuItems = React.useMemo(() => [
24
26
  {
25
- text: "Home",
27
+ text: t.menu.home,
26
28
  icon: _jsx(DashboardOutlinedIcon, {}),
27
- subMenu: [{ text: "Dashboard", path: "/super-site/dashboard" }],
29
+ subMenu: [{ text: t.menu.dashboard, path: "/super-site/dashboard" }],
28
30
  },
29
31
  {
30
- text: "Patient Management",
32
+ text: t.menu.patientManagement,
31
33
  icon: _jsx(RecentActorsOutlinedIcon, {}),
32
34
  subMenu: [
33
- { text: "Patient", path: "/patient/patient-listing" },
34
- { text: "Family", path: "/patient/family-listing" },
35
+ { text: t.menu.patient, path: "/patient/patient-listing" },
36
+ { text: t.menu.family, path: "/family/family-listing" },
35
37
  ],
36
38
  },
37
39
  {
38
- text: "Sample Management",
40
+ text: t.menu.sampleManagement,
39
41
  icon: _jsx(SampleMgmtIcon, {}),
40
42
  subMenu: [
41
- { text: "Sample Listing", path: "/sample/sample-listing" }
43
+ { text: t.menu.sampleListing, path: "/sample/sample-listing" }
42
44
  ],
43
45
  },
44
46
  {
45
- text: "Reports",
47
+ text: t.menu.reports,
46
48
  icon: _jsx(ArticleOutlinedIcon, {}),
47
- path: "/variant/",
49
+ path: "/reports/",
48
50
  },
49
51
  {
50
- text: "Carrier Duo/Trio",
52
+ text: t.menu.carrierDuoTrio,
51
53
  icon: _jsx(GroupAddOutlinedIcon, {}),
52
54
  path: "/carrier-duo-trio/",
53
55
  },
54
- ], [SampleMgmtIcon]);
56
+ ], [SampleMgmtIcon, t]);
55
57
  // 🔁 Sync selection with current path
56
58
  React.useEffect(() => {
57
59
  const currentPath = location.pathname;
@@ -97,9 +99,9 @@ function SideMenu({ useDrawer, SampleMgmtIcon, location }) {
97
99
  "& .MuiDrawer-paper": {
98
100
  width: isDrawerOpen ? 230 : 64,
99
101
  transition: "width 0.3s ease",
100
- top: "64px",
101
- bottom: "0",
102
+ height: "100vh",
102
103
  borderRight: "1px solid #B1BECB",
104
+ overflowY: "auto",
103
105
  },
104
106
  }, 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
107
  if (item.subMenu) {
@@ -0,0 +1,161 @@
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
+ }
108
+ .MuiMenuItem-root {
109
+ &.Mui-focusVisible {
110
+ background-color: transparent;
111
+ }
112
+
113
+ &:hover {
114
+ font: 16px/24px "OpenSans-SemiBold";
115
+ background: #374451;
116
+ border-radius: 6px;
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ ul.MuiList-root {
124
+ &:has(.submenu-title) {
125
+ &::before {
126
+ content: "";
127
+ position: absolute;
128
+ top: 15px;
129
+ left: -8px;
130
+ width: 0;
131
+ height: 0;
132
+ border-top: 8px solid transparent;
133
+ border-bottom: 8px solid transparent;
134
+ border-right: 8px solid #516578;
135
+ z-index: 2;
136
+ }
137
+ }
138
+ }
139
+
140
+ .MuiPopover-root {
141
+ .MuiPaper-root {
142
+ overflow: visible;
143
+ position: relative;
144
+ width: max-content;
145
+ }
146
+ }
147
+
148
+ .MuiList-root.MuiMenu-list {
149
+ border-radius: 5px;
150
+ }
151
+
152
+ #more-menu {
153
+ .MuiPaper-root {
154
+ .MuiMenu-list {
155
+ color: #1e2f97;
156
+ .MuiMenuItem-root {
157
+ font-size: 14px;
158
+ }
159
+ }
160
+ }
161
+ }
@@ -0,0 +1,13 @@
1
+ export declare const en: {
2
+ menu: {
3
+ home: string;
4
+ patientManagement: string;
5
+ sampleManagement: string;
6
+ reports: string;
7
+ carrierDuoTrio: string;
8
+ dashboard: string;
9
+ patient: string;
10
+ family: string;
11
+ sampleListing: string;
12
+ };
13
+ };
@@ -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 declare const es: {
2
+ menu: {
3
+ home: string;
4
+ patientManagement: string;
5
+ sampleManagement: string;
6
+ reports: string;
7
+ carrierDuoTrio: string;
8
+ dashboard: string;
9
+ patient: string;
10
+ family: string;
11
+ sampleListing: string;
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
+ };
@@ -0,0 +1,6 @@
1
+ import { en } from './en';
2
+ import { es } from './es';
3
+ export type Language = 'en' | 'es';
4
+ export type Translations = typeof en;
5
+ export declare const getTranslations: (language?: Language) => Translations;
6
+ export { en, es };
@@ -0,0 +1,10 @@
1
+ import { en } from './en';
2
+ import { es } from './es';
3
+ const translations = {
4
+ en,
5
+ es,
6
+ };
7
+ export const getTranslations = (language = 'en') => {
8
+ return translations[language] || translations.en;
9
+ };
10
+ export { en, es };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cullsin/lnc-menu",
3
- "version": "3.0.22",
3
+ "version": "3.0.90",
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": {