Updated the react-menu library from v2 to v4. #8061

This commit is contained in:
Pravesh Sharma
2024-10-30 17:08:24 +05:30
committed by GitHub
parent a9bfa8a71d
commit 2f4cae35bd
4 changed files with 21 additions and 18 deletions

View File

@@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
import {
MenuItem,
ControlledMenu,
applyStatics,
Menu,
SubMenu,
} from '@szhsin/react-menu';
@@ -48,13 +47,17 @@ PgMenu.propTypes = {
menuButton: PropTypes.element,
};
export const PgSubMenu = applyStatics(SubMenu)(({label, ...props})=>{
export const PgSubMenu = (({label, ...props})=>{
return (
<SubMenu label={label} itemProps={{'data-label': label}} {...props} />
);
});
export const PgMenuItem = applyStatics(MenuItem)(({hasCheck=false, checked=false, accesskey, shortcut, children, closeOnCheck=false, ...props})=>{
PgSubMenu.propTypes = {
label: PropTypes.string
};
export const PgMenuItem = (({hasCheck=false, checked=false, accesskey, shortcut, children, closeOnCheck=false, ...props})=>{
let onClick = props.onClick;
if(hasCheck) {
@@ -83,7 +86,7 @@ PgMenuItem.propTypes = {
children: CustomPropTypes.children,
closeOnCheck: PropTypes.bool,
onClick: PropTypes.func,
dataLabel: PropTypes.string,
datalabel: PropTypes.string,
};
export function usePgMenuGroup() {