import { create, tsx } from '@dojo/framework/core/vdom';
import theme from '../middleware/theme';
import List from '../list/index';
import * as menuCss from '../theme/default/list.m.css';
import * as css from '../theme/default/context-menu.m.css';
import ContextPopup from '../context-popup';
import { createResourceMiddleware } from '@dojo/framework/core/middleware/resources';
const factory = create({ theme, resource: createResourceMiddleware() }).properties();
export const ContextMenu = factory(function ({ properties, children, middleware: { theme } }) {
    const { resource, onSelect, classes, variant } = properties();
    return (tsx(ContextPopup, null, {
        trigger: children(),
        content: ({ close, shouldFocus }) => (tsx(List, { key: "menu", focus: shouldFocus, theme: theme.compose(menuCss, css, 'menu'), classes: classes, variant: variant, menu: true, resource: resource, onBlur: close, onRequestClose: close, onValue: (value) => {
                close();
                onSelect(value);
            } }))
    }));
});
export default ContextMenu;

/*# sourceMappingURL=index.mjs.map*/