"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandardMenuButton = void 0;
const tslib_1 = require("tslib");
/**
 * Copyright (c) Microsoft Corporation.
 * Licensed under the MIT License.
 * @format
 */
const React = tslib_1.__importStar(require("react"));
const react_native_1 = require("react-native");
const react_native_2 = require("@fluentui/react-native");
const experimental_menu_button_1 = require("@fluentui-react-native/experimental-menu-button");
const MenuButtonV1TestStyles_1 = require("./MenuButtonV1TestStyles");
const testData_1 = require("./testData");
const iconExamples_1 = require("../Common/iconExamples");
const StandardMenuButton = () => {
    const [lastMenuItemClicked, setLastMenuItemClicked] = React.useState(null);
    const [focusOnMount, setShouldFocusOnMount] = React.useState(true);
    const toggleFocusOnMount = React.useCallback((value) => setShouldFocusOnMount(value), [setShouldFocusOnMount]);
    const [focusOnContainer, setShouldFocusOnContainer] = React.useState(false);
    const toggleFocusOnContainer = React.useCallback((value) => setShouldFocusOnContainer(value), [setShouldFocusOnContainer]);
    const onItemClick = React.useCallback((key) => {
        setLastMenuItemClicked(key);
    }, [setLastMenuItemClicked]);
    const contextualMenuProps = {
        accessibilityLabel: 'MenuButton',
        shouldFocusOnMount: focusOnMount,
        shouldFocusOnContainer: focusOnContainer,
    };
    const 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: { ...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