"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var vdom_1 = require("@dojo/framework/core/vdom");
var theme_1 = require("../middleware/theme");
var index_1 = require("../list/index");
var menuCss = require("../theme/default/list.m.css");
var css = require("../theme/default/context-menu.m.css");
var context_popup_1 = require("../context-popup");
var resources_1 = require("@dojo/framework/core/middleware/resources");
var factory = vdom_1.create({
    theme: theme_1.default,
    resource: resources_1.createResourceMiddleware()
}).properties();
exports.ContextMenu = factory(function ContextMenu(_a) {
    var properties = _a.properties, children = _a.children, theme = _a.middleware.theme;
    var _b = properties(), resource = _b.resource, onSelect = _b.onSelect, classes = _b.classes, variant = _b.variant;
    return (vdom_1.tsx(context_popup_1.default, null, {
        trigger: children(),
        content: function (_a) {
            var close = _a.close, shouldFocus = _a.shouldFocus;
            return (vdom_1.tsx(index_1.default, { key: "menu", height: "auto", focus: shouldFocus, theme: theme.compose(menuCss, css, 'menu'), classes: classes, variant: variant, menu: true, resource: resource, onBlur: close, onRequestClose: close, onValue: function (value) {
                    close();
                    onSelect(value);
                } }));
        }
    }));
});
exports.default = exports.ContextMenu;

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