muffin-admin 9.5.0 → 9.5.2
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/MuffinMenu.js +15 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/themes.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/MuffinMenu.tsx +19 -9
- package/src/index.tsx +1 -1
- package/src/themes.ts +2 -2
package/dist/MuffinMenu.js
CHANGED
|
@@ -6,7 +6,7 @@ import ListItemButton from "@mui/material/ListItemButton";
|
|
|
6
6
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
7
7
|
import ListItemText from "@mui/material/ListItemText";
|
|
8
8
|
import { matchPath, useLocation } from "react-router-dom";
|
|
9
|
-
import { Menu, useBasename, useTranslate } from "react-admin";
|
|
9
|
+
import { Menu, useBasename, useTheme, useTranslate } from "react-admin";
|
|
10
10
|
import find from "lodash/find";
|
|
11
11
|
import groupBy from "lodash/groupBy";
|
|
12
12
|
import { useContext, useState } from "react";
|
|
@@ -33,9 +33,19 @@ function MenuGroup({ name, resources }) {
|
|
|
33
33
|
const translate = useTranslate();
|
|
34
34
|
const basename = useBasename();
|
|
35
35
|
const { pathname } = useLocation();
|
|
36
|
-
const match = resources.some((resource) => !!matchPath({
|
|
37
|
-
path: `${basename}/${resource.name}/*`,
|
|
38
|
-
}, pathname));
|
|
36
|
+
const match = resources.some((resource) => !!matchPath({ path: `${basename}/${resource.name}/*` }, pathname));
|
|
39
37
|
const [groupOpen, setGroupOpen] = useState(match);
|
|
40
|
-
|
|
38
|
+
const theme = useTheme()[0];
|
|
39
|
+
const colors = theme == "dark"
|
|
40
|
+
? {
|
|
41
|
+
text: "rgba(255, 255, 255, 0.87)",
|
|
42
|
+
textSecondary: "rgba(255, 255, 255, 0.6)",
|
|
43
|
+
}
|
|
44
|
+
: {
|
|
45
|
+
text: "rgba(0, 0, 0, 0.87)",
|
|
46
|
+
textSecondary: "rgba(0, 0, 0, 0.6)",
|
|
47
|
+
};
|
|
48
|
+
return (_jsxs("div", { children: [_jsxs(ListItemButton, { onClick: () => setGroupOpen(!groupOpen), sx: {
|
|
49
|
+
color: match ? colors.text : colors.textSecondary,
|
|
50
|
+
}, children: [Icon && (_jsx(ListItemIcon, { sx: { minWidth: 40 }, children: _jsx(Icon, {}) })), _jsx(ListItemText, { primary: translate(`groups.${name}`) }), groupOpen ? _jsx(ExpandLess, {}) : _jsx(ExpandMore, {})] }), _jsx(Collapse, { in: groupOpen, timeout: "auto", unmountOnExit: true, children: resources.map(({ name }) => (_jsx(Menu.ResourceItem, { name: name }, name))) })] }));
|
|
41
51
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/themes.js
CHANGED
|
@@ -3,8 +3,8 @@ export const muffinLightTheme = Object.assign(Object.assign({}, defaultLightThem
|
|
|
3
3
|
styleOverrides: {
|
|
4
4
|
root: {
|
|
5
5
|
"&.RaMenuItemLink-active": {
|
|
6
|
-
backgroundColor: "#f0f0f0",
|
|
7
6
|
borderRadius: "4px",
|
|
7
|
+
backgroundColor: "#f0f0f0",
|
|
8
8
|
},
|
|
9
9
|
},
|
|
10
10
|
},
|
|
@@ -13,8 +13,8 @@ export const muffinDarkTheme = Object.assign(Object.assign({}, defaultDarkTheme)
|
|
|
13
13
|
styleOverrides: {
|
|
14
14
|
root: {
|
|
15
15
|
"&.RaMenuItemLink-active": {
|
|
16
|
-
backgroundColor: "#424242",
|
|
17
16
|
borderRadius: "4px",
|
|
17
|
+
backgroundColor: "#424242",
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
},
|