"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ButtonContextualMenuExample = void 0;
var tslib_1 = require("tslib");
var React = require("react");
var react_1 = require("@fluentui/react");
var Button_1 = require("@fluentui/react/lib-commonjs/Button");
var menuProps = {
    // For example: disable dismiss if shift key is held down while dismissing
    onDismiss: function (ev) {
        if (ev && 'shiftKey' in ev) {
            ev.preventDefault();
        }
    },
    items: [
        {
            key: 'emailMessage',
            text: 'Email message',
            iconProps: { iconName: 'Mail' },
        },
        {
            key: 'calendarEvent',
            text: 'Calendar event',
            iconProps: { iconName: 'Calendar' },
        },
    ],
    directionalHintFixed: true,
};
var addIcon = { iconName: 'Add' };
var ButtonContextualMenuExample = function (props) {
    var disabled = props.disabled, checked = props.checked;
    var buttonProps = {
        text: 'New item',
        iconProps: addIcon,
        menuProps: menuProps,
        // Optional callback to customize menu rendering
        menuAs: _getMenu,
        // Optional callback to do other actions (besides opening the menu) on click
        // onMenuClick={_onMenuClick}
        // By default, the ContextualMenu is re-created each time it's shown and destroyed when closed.
        // Uncomment the next line to hide the ContextualMenu but persist it in the DOM instead.
        // persistMenu={true}
        allowDisabledFocus: true,
        disabled: disabled,
        checked: checked,
    };
    return (React.createElement(React.Fragment, null,
        React.createElement(Button_1.DefaultButton, tslib_1.__assign({}, buttonProps)),
        React.createElement(Button_1.PrimaryButton, tslib_1.__assign({}, buttonProps))));
};
exports.ButtonContextualMenuExample = ButtonContextualMenuExample;
function _getMenu(props) {
    // Customize contextual menu with menuAs
    return React.createElement(react_1.ContextualMenu, tslib_1.__assign({}, props));
}
// function _onMenuClick(ev?: React.SyntheticEvent<string>) {
//   console.log(ev);
// }
//# sourceMappingURL=contextualMenu.stories.js.map