import { makeStyles } from '@material-ui/styles';
import React, { useRef } from 'react';
import CheckIcon from '@material-ui/icons/Check';
import PropTypes from 'prop-types';
import {
MenuItem,
ControlledMenu,
applyStatics,
Menu,
SubMenu,
} from '@szhsin/react-menu';
export {MenuDivider as PgMenuDivider} from '@szhsin/react-menu';
import { shortcutToString } from './ShortcutTitle';
import clsx from 'clsx';
import CustomPropTypes from '../custom_prop_types';
const useStyles = makeStyles((theme)=>({
menu: {
'& .szh-menu': {
padding: '4px 0px',
zIndex: 1005,
backgroundColor: theme.palette.background.default,
color: theme.palette.text.primary,
border: `1px solid ${theme.otherVars.borderColor}`
},
'& .szh-menu__divider': {
margin: 0,
background: theme.otherVars.borderColor,
},
'& .szh-menu__item': {
display: 'flex',
padding: '3px 12px',
'&:after': {
right: '0.75rem',
},
'&.szh-menu__item--active, &.szh-menu__item--hover': {
backgroundColor: theme.palette.primary.main,
color: theme.palette.primary.contrastText,
}
}
},
checkIcon: {
width: '1.3rem',
},
hideCheck: {
visibility: 'hidden',
},
shortcut: {
marginLeft: 'auto',
fontSize: '0.8em',
paddingLeft: '12px',
}
}));
export function PgMenu({open, className='', label, menuButton=null, ...props}) {
const classes = useStyles();
const state = open ? 'open' : 'closed';
props.anchorRef?.current?.setAttribute('data-state', state);
if(menuButton) {
return