"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandardMenuButton = void 0;
var tslib_1 = require("tslib");
/**
 * Copyright (c) Microsoft Corporation.
 * Licensed under the MIT License.
 * @format
 */
var React = tslib_1.__importStar(require("react"));
var react_native_1 = require("react-native");
var react_native_2 = require("@fluentui/react-native");
var experimental_menu_button_1 = require("@fluentui-react-native/experimental-menu-button");
var MenuButtonV1TestStyles_1 = require("./MenuButtonV1TestStyles");
var testData_1 = require("./testData");
var iconExamples_1 = require("../Common/iconExamples");
var StandardMenuButton = function () {
    var _a = React.useState(null), lastMenuItemClicked = _a[0], setLastMenuItemClicked = _a[1];
    var _b = React.useState(true), focusOnMount = _b[0], setShouldFocusOnMount = _b[1];
    var toggleFocusOnMount = React.useCallback(function (value) { return setShouldFocusOnMount(value); }, [setShouldFocusOnMount]);
    var _c = React.useState(false), focusOnContainer = _c[0], setShouldFocusOnContainer = _c[1];
    var toggleFocusOnContainer = React.useCallback(function (value) { return setShouldFocusOnContainer(value); }, [setShouldFocusOnContainer]);
    var onItemClick = React.useCallback(function (key) {
        setLastMenuItemClicked(key);
    }, [setLastMenuItemClicked]);
    var contextualMenuProps = {
        accessibilityLabel: 'MenuButton',
        shouldFocusOnMount: focusOnMount,
        shouldFocusOnContainer: focusOnContainer,
    };
    var iconToShow = react_native_1.Platform.select({
        macos: iconExamples_1.testImage,
        default: testData_1.iconProps,
    });
    return (React.createElement(react_native_1.View, null,
        React.createElement(react_native_1.View, { style: MenuButtonV1TestStyles_1.viewWrapperStyle },
            React.createElement(react_native_1.View, { style: MenuButtonV1TestStyles_1.columnStyle },
                React.createElement(react_native_1.View, { style: MenuButtonV1TestStyles_1.rowStyle },
                    React.createElement(react_native_1.Text, null, "Should Focus on Mount"),
                    React.createElement(react_native_1.Switch, { value: focusOnMount, onValueChange: toggleFocusOnMount })),
                React.createElement(react_native_1.View, { style: MenuButtonV1TestStyles_1.rowStyle },
                    React.createElement(react_native_1.Text, null, "Should Focus on Container"),
                    React.createElement(react_native_1.Switch, { value: focusOnContainer, onValueChange: toggleFocusOnContainer }))),
            React.createElement(react_native_2.Separator, { vertical: true }),
            React.createElement(react_native_1.View, { style: MenuButtonV1TestStyles_1.columnStyle },
                React.createElement(react_native_1.Text, null,
                    React.createElement(react_native_1.Text, null, "Last Menu Item Clicked: "),
                    lastMenuItemClicked > 0 ? React.createElement(react_native_1.Text, { style: MenuButtonV1TestStyles_1.textColor }, lastMenuItemClicked) : React.createElement(react_native_1.Text, { style: MenuButtonV1TestStyles_1.textColor }, "none")),
                React.createElement(react_native_1.View, { style: tslib_1.__assign(tslib_1.__assign({}, MenuButtonV1TestStyles_1.rowStyle), { paddingHorizontal: 5 }) },
                    React.createElement(react_native_1.View, { style: MenuButtonV1TestStyles_1.columnStyle },
                        React.createElement(experimental_menu_button_1.MenuButton, { content: "Standard MenuButton", tooltip: "Standard MenuButton tooltip", menuItems: testData_1.menuItems, onItemClick: onItemClick, contextualMenu: contextualMenuProps }),
                        React.createElement(react_native_1.Text, null, "MenuButton with icon"),
                        React.createElement(experimental_menu_button_1.MenuButton, { icon: iconToShow, content: "MenuButton", menuItems: testData_1.menuItems, onItemClick: onItemClick, contextualMenu: contextualMenuProps }),
                        React.createElement(react_native_1.Text, null, "MenuButton with only icon"),
                        React.createElement(experimental_menu_button_1.MenuButton, { icon: iconToShow, menuItems: testData_1.menuItems, onItemClick: onItemClick, contextualMenu: contextualMenuProps }),
                        React.createElement(react_native_1.Text, null, "Disabled MenuButton"),
                        React.createElement(experimental_menu_button_1.MenuButton, { disabled: true, content: "Disabled MenuButton", menuItems: testData_1.menuItems })),
                    React.createElement(react_native_2.Separator, { vertical: true }),
                    React.createElement(react_native_1.View, { style: MenuButtonV1TestStyles_1.columnStyle },
                        React.createElement(experimental_menu_button_1.MenuButton, { appearance: "primary", content: "Primary MenuButton", menuItems: testData_1.menuItems, onItemClick: onItemClick, contextualMenu: contextualMenuProps }),
                        React.createElement(react_native_1.Text, null, "Primary MenuButton with icon"),
                        React.createElement(experimental_menu_button_1.MenuButton, { appearance: "primary", icon: iconToShow, content: "Primary MenuButton", menuItems: testData_1.menuItems, onItemClick: onItemClick, contextualMenu: contextualMenuProps }),
                        React.createElement(react_native_1.Text, null, "Primary MenuButton with only icon"),
                        React.createElement(experimental_menu_button_1.MenuButton, { appearance: "primary", icon: iconToShow, menuItems: testData_1.menuItems, onItemClick: onItemClick, contextualMenu: contextualMenuProps }),
                        React.createElement(react_native_1.Text, null, "Primary Disabled MenuButton"),
                        React.createElement(experimental_menu_button_1.MenuButton, { appearance: "primary", disabled: true, content: "Disabled Primary MenuButton", menuItems: testData_1.menuItems })))))));
};
exports.StandardMenuButton = StandardMenuButton;
//# sourceMappingURL=StandardMenuButtonTest.js.map