better-mui-menu 1.5.2 → 1.5.3

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/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ # **Notice**: MUI v9 has brought nested menu support to the core `Menu` component. You don't need this package if your are on MUI v9. _Unless_, you need a data-driven solution like this package provides
2
+
1
3
  # better-mui-menu
2
4
 
3
5
  [![CI](https://github.com/eggei/better-mui-menu/actions/workflows/ci.yml/badge.svg)](https://github.com/eggei/better-mui-menu/actions/workflows/ci.yml) [![Security](https://github.com/eggei/better-mui-menu/actions/workflows/security.yml/badge.svg)](https://github.com/eggei/better-mui-menu/actions/workflows/security.yml) [![coverage](https://codecov.io/gh/eggei/better-mui-menu/branch/main/graph/badge.svg)](https://codecov.io/gh/eggei/better-mui-menu) [![npm version](https://img.shields.io/npm/v/better-mui-menu.svg?color=brightgreen)](https://www.npmjs.com/package/better-mui-menu) [![npm downloads](https://img.shields.io/npm/dt/better-mui-menu.svg?color=informational)](https://www.npmjs.com/package/better-mui-menu) [![License: MIT](https://img.shields.io/npm/l/better-mui-menu.svg)](https://opensource.org/licenses/MIT)
package/dist/index.cjs CHANGED
@@ -68,17 +68,17 @@ var MenuItemContent = (0, import_material.styled)(import_material.Stack)({
68
68
 
69
69
  // src/Menu/MenuEntry.tsx
70
70
  var import_jsx_runtime2 = require("react/jsx-runtime");
71
- var renderMenuIcon = (icon) => {
71
+ var renderMenuIcon = (icon, alignSelf) => {
72
72
  if (!icon) return null;
73
73
  if ((0, import_react.isValidElement)(icon)) return icon;
74
74
  const IconComponent = icon;
75
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconComponent, {});
75
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { alignSelf, height: "100%", alignItems: "center", display: "flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconComponent, {}) });
76
76
  };
77
77
  var MenuEntry = (0, import_react.forwardRef)(function MenuEntry2({ label, startIcon, endIcon, onClick, ...muiMenuItemProps }, ref) {
78
78
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.MenuItem, { ref, ...muiMenuItemProps, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(MenuItemContent, { children: [
79
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { alignSelf: "flex-start", height: "100%", alignItems: "center", display: "flex" }, children: renderMenuIcon(startIcon) }),
79
+ renderMenuIcon(startIcon, "flex-start"),
80
80
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { component: "span", sx: { flex: 1, fontFamily: "inherit" }, children: label }),
81
- renderMenuIcon(endIcon)
81
+ renderMenuIcon(endIcon, "center")
82
82
  ] }) });
83
83
  });
84
84
 
package/dist/index.js CHANGED
@@ -42,17 +42,17 @@ var MenuItemContent = styled(Stack)({
42
42
 
43
43
  // src/Menu/MenuEntry.tsx
44
44
  import { jsx, jsxs } from "react/jsx-runtime";
45
- var renderMenuIcon = (icon) => {
45
+ var renderMenuIcon = (icon, alignSelf) => {
46
46
  if (!icon) return null;
47
47
  if (isValidElement(icon)) return icon;
48
48
  const IconComponent = icon;
49
- return /* @__PURE__ */ jsx(IconComponent, {});
49
+ return /* @__PURE__ */ jsx("span", { style: { alignSelf, height: "100%", alignItems: "center", display: "flex" }, children: /* @__PURE__ */ jsx(IconComponent, {}) });
50
50
  };
51
51
  var MenuEntry = forwardRef(function MenuEntry2({ label, startIcon, endIcon, onClick, ...muiMenuItemProps }, ref) {
52
52
  return /* @__PURE__ */ jsx(MuiMenuItem, { ref, ...muiMenuItemProps, onClick, children: /* @__PURE__ */ jsxs(MenuItemContent, { children: [
53
- /* @__PURE__ */ jsx("span", { style: { alignSelf: "flex-start", height: "100%", alignItems: "center", display: "flex" }, children: renderMenuIcon(startIcon) }),
53
+ renderMenuIcon(startIcon, "flex-start"),
54
54
  /* @__PURE__ */ jsx(Typography, { component: "span", sx: { flex: 1, fontFamily: "inherit" }, children: label }),
55
- renderMenuIcon(endIcon)
55
+ renderMenuIcon(endIcon, "center")
56
56
  ] }) });
57
57
  });
58
58
 
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/eggei/better-mui-menu/issues"
11
11
  },
12
- "version": "1.5.2",
12
+ "version": "1.5.3",
13
13
  "type": "module",
14
14
  "sideEffects": false,
15
15
  "files": [