@availity/mui-menu 0.1.1 → 0.1.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/CHANGELOG.md CHANGED
@@ -2,12 +2,15 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.1.3](https://github.com/Availity/element/compare/@availity/mui-menu@0.1.2...@availity/mui-menu@0.1.3) (2023-10-12)
6
+
7
+ ## [0.1.2](https://github.com/Availity/element/compare/@availity/mui-menu@0.1.1...@availity/mui-menu@0.1.2) (2023-10-06)
8
+
5
9
  ## [0.1.1](https://github.com/Availity/element/compare/@availity/mui-menu@0.1.0...@availity/mui-menu@0.1.1) (2023-08-23)
6
10
 
7
11
  ## 0.1.0 (2023-06-06)
8
12
 
9
-
10
13
  ### Features
11
14
 
12
- * **mui-menu:** add menu component ([5cc8b1f](https://github.com/Availity/element/commit/5cc8b1f15e0aa987135e0bbac99943f2f46f6287))
13
- * **mui-menu:** omit menu props ([b81152a](https://github.com/Availity/element/commit/b81152a0f7804d34055962617f32194b02f2557f))
15
+ - **mui-menu:** add menu component ([5cc8b1f](https://github.com/Availity/element/commit/5cc8b1f15e0aa987135e0bbac99943f2f46f6287))
16
+ - **mui-menu:** omit menu props ([b81152a](https://github.com/Availity/element/commit/b81152a0f7804d34055962617f32194b02f2557f))
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { MenuProps as MenuProps$1, MenuItemProps as MenuItemProps$1, MenuListProps as MenuListProps$1 } from '@mui/material';
2
2
 
3
- type MenuProps = Omit<MenuProps$1, 'BackdropComponent' | 'BackdropProps' | 'classes' | 'disableAutoFocusItem' | 'disableEnforceFocus' | 'disableEscapeKeyDown' | 'onBackdropClick' | 'PopoverClasses' | 'ref' | 'sx' | 'TransitionComponent' | 'TransitionProps'>;
3
+ type MenuProps = Omit<MenuProps$1, 'BackdropComponent' | 'BackdropProps' | 'classes' | 'disableAutoFocusItem' | 'disableEnforceFocus' | 'disableEscapeKeyDown' | 'elevation' | 'onBackdropClick' | 'PopoverClasses' | 'ref' | 'sx' | 'TransitionComponent' | 'TransitionProps'>;
4
4
  declare const Menu: (props: MenuProps) => JSX.Element;
5
- type MenuItemProps = MenuItemProps$1;
5
+ type MenuItemProps = Omit<MenuItemProps$1, 'centerRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'TouchRippleProps' | 'touchRippleRef'>;
6
6
  declare const MenuItem: (props: MenuItemProps) => JSX.Element;
7
7
  type MenuListProps = MenuListProps$1;
8
8
  declare const MenuList: (props: MenuListProps) => JSX.Element;
package/dist/index.js CHANGED
@@ -31,12 +31,15 @@ var import_material = require("@mui/material");
31
31
  var import_jsx_runtime = require("react/jsx-runtime");
32
32
  var Menu = (props) => {
33
33
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Menu, {
34
- ...props
34
+ ...props,
35
+ slotProps: { paper: { variant: "elevation" } }
35
36
  });
36
37
  };
37
38
  var MenuItem = (props) => {
38
39
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.MenuItem, {
39
- ...props
40
+ ...props,
41
+ disableRipple: true,
42
+ disableTouchRipple: true
40
43
  });
41
44
  };
42
45
  var MenuList = (props) => {
package/dist/index.mjs CHANGED
@@ -7,12 +7,15 @@ import {
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  var Menu = (props) => {
9
9
  return /* @__PURE__ */ jsx(MuiMenu, {
10
- ...props
10
+ ...props,
11
+ slotProps: { paper: { variant: "elevation" } }
11
12
  });
12
13
  };
13
14
  var MenuItem = (props) => {
14
15
  return /* @__PURE__ */ jsx(MuiMenuItem, {
15
- ...props
16
+ ...props,
17
+ disableRipple: true,
18
+ disableTouchRipple: true
16
19
  });
17
20
  };
18
21
  var MenuList = (props) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-menu",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Availity MUI Menu Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -33,7 +33,8 @@
33
33
  "publish:canary": "yarn npm publish --access public --tag canary"
34
34
  },
35
35
  "devDependencies": {
36
- "@mui/material": "^5.11.9",
36
+ "@availity/mui-icon": "^0.6.1",
37
+ "@mui/material": "^5.14.12",
37
38
  "react": "18.2.0",
38
39
  "react-dom": "18.2.0",
39
40
  "tsup": "^5.12.7",
@@ -2,6 +2,7 @@
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import type { Meta, StoryObj } from '@storybook/react';
4
4
  import { Button } from '@availity/mui-button';
5
+ import { UserIcon, SettingsIcon, ArrowCircleLeftIcon, HelpCircleIcon } from '@availity/mui-icon';
5
6
  import { Menu, MenuItem } from './Menu';
6
7
 
7
8
  const meta: Meta<typeof Menu> = {
@@ -30,7 +31,7 @@ export const _Menu: StoryObj<typeof Menu> = {
30
31
  };
31
32
 
32
33
  return (
33
- <>
34
+ <div>
34
35
  <Button
35
36
  id="basic-button"
36
37
  aria-controls={open ? 'basic-menu' : undefined}
@@ -52,10 +53,76 @@ export const _Menu: StoryObj<typeof Menu> = {
52
53
  {...args}
53
54
  >
54
55
  <MenuItem onClick={handleClose}>Profile</MenuItem>
55
- <MenuItem onClick={handleClose}>My account</MenuItem>
56
+ <MenuItem onClick={handleClose} selected>
57
+ My account
58
+ </MenuItem>
59
+ <MenuItem onClick={handleClose} disabled>
60
+ Help
61
+ </MenuItem>
56
62
  <MenuItem onClick={handleClose}>Logout</MenuItem>
57
63
  </Menu>
58
- </>
64
+ </div>
65
+ );
66
+ },
67
+ };
68
+
69
+ export const _MenuWithIcons: StoryObj<typeof Menu> = {
70
+ render: ({ open, ...args }) => {
71
+ const anchorEl = useRef<HTMLButtonElement>(null);
72
+ const [controlledOpen, setControlledOpen] = useState(false);
73
+
74
+ useEffect(() => {
75
+ setControlledOpen(open);
76
+ }, [open]);
77
+
78
+ const handleClick = () => {
79
+ setControlledOpen((prev) => !prev);
80
+ };
81
+
82
+ const handleClose = () => {
83
+ setControlledOpen(false);
84
+ };
85
+
86
+ return (
87
+ <div>
88
+ <Button
89
+ id="basic-button"
90
+ aria-controls={open ? 'basic-menu' : undefined}
91
+ aria-haspopup="true"
92
+ aria-expanded={open ? 'true' : undefined}
93
+ onClick={handleClick}
94
+ ref={anchorEl}
95
+ >
96
+ Dashboard
97
+ </Button>
98
+ <Menu
99
+ id="basic-menu"
100
+ anchorEl={anchorEl.current}
101
+ open={controlledOpen}
102
+ onClose={handleClose}
103
+ MenuListProps={{
104
+ 'aria-labelledby': 'basic-button',
105
+ }}
106
+ {...args}
107
+ >
108
+ <MenuItem onClick={handleClose}>
109
+ <UserIcon />
110
+ Profile
111
+ </MenuItem>
112
+ <MenuItem onClick={handleClose} selected>
113
+ <SettingsIcon />
114
+ My account
115
+ </MenuItem>
116
+ <MenuItem onClick={handleClose} disabled>
117
+ <HelpCircleIcon />
118
+ Help
119
+ </MenuItem>
120
+ <MenuItem onClick={handleClose}>
121
+ <ArrowCircleLeftIcon />
122
+ Logout
123
+ </MenuItem>
124
+ </Menu>
125
+ </div>
59
126
  );
60
127
  },
61
128
  };
package/src/lib/Menu.tsx CHANGED
@@ -15,6 +15,7 @@ export type MenuProps = Omit<
15
15
  | 'disableAutoFocusItem'
16
16
  | 'disableEnforceFocus'
17
17
  | 'disableEscapeKeyDown'
18
+ | 'elevation'
18
19
  | 'onBackdropClick'
19
20
  | 'PopoverClasses'
20
21
  | 'ref'
@@ -24,13 +25,16 @@ export type MenuProps = Omit<
24
25
  >;
25
26
 
26
27
  export const Menu = (props: MenuProps): JSX.Element => {
27
- return <MuiMenu {...props} />;
28
+ return <MuiMenu {...props} slotProps={{ paper: { variant: 'elevation' } }} />;
28
29
  };
29
30
 
30
- export type MenuItemProps = MuiMenuItemProps;
31
+ export type MenuItemProps = Omit<
32
+ MuiMenuItemProps,
33
+ 'centerRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'TouchRippleProps' | 'touchRippleRef'
34
+ >;
31
35
 
32
36
  export const MenuItem = (props: MenuItemProps) => {
33
- return <MuiMenuItem {...props} />;
37
+ return <MuiMenuItem {...props} disableRipple disableTouchRipple />;
34
38
  };
35
39
 
36
40
  export type MenuListProps = MuiMenuListProps;