import { __assign } from "tslib";
/* eslint-disable @typescript-eslint/no-var-requires */
import * as React from 'react';
import { Text, View, Switch } from 'react-native';
import { ButtonV1 as Button, ContextualMenu, ContextualMenuItem, Separator } from '@fluentui/react-native';
import { CONTEXTUALMENUITEM_TEST_COMPONENT, CONTEXTUALMENU_TEST_COMPONENT } from '../../../../E2E/src/ContextualMenu/consts';
import { testProps } from '../Common/TestProps';
export var E2EContextualMenuTest = function () {
    var stdBtnRef = React.useRef(null);
    var _a = React.useState(false), showContextualMenu = _a[0], setShowContextualMenu = _a[1];
    var _b = React.useState(false), isContextualMenuVisible = _b[0], setIsContextualMenuVisible = _b[1];
    var _c = React.useState(null), lastMenuItemClicked = _c[0], setLastMenuItemClicked = _c[1];
    var _d = React.useState(false), isBeakVisible = _d[0], setIsBeakVisible = _d[1];
    var onIsBeakVisibleChange = React.useCallback(function (value) { return setIsBeakVisible(value); }, []);
    var _e = React.useState(true), focusOnMount = _e[0], setShouldFocusOnMount = _e[1];
    var toggleFocusOnMount = React.useCallback(function (value) { return setShouldFocusOnMount(value); }, [setShouldFocusOnMount]);
    var _f = React.useState(false), focusOnContainer = _f[0], setShouldFocusOnContainer = _f[1];
    var toggleFocusOnContainer = React.useCallback(function (value) { return setShouldFocusOnContainer(value); }, [setShouldFocusOnContainer]);
    var toggleShowContextualMenu = React.useCallback(function () {
        setShowContextualMenu(!showContextualMenu);
        setIsContextualMenuVisible(false);
    }, [showContextualMenu, setShowContextualMenu, setIsContextualMenuVisible]);
    var onShowContextualMenu = React.useCallback(function () {
        setIsContextualMenuVisible(true);
    }, [setIsContextualMenuVisible]);
    var onDismissContextualMenu = React.useCallback(function () {
        setShowContextualMenu(false);
        setIsContextualMenuVisible(false);
    }, [setShowContextualMenu]);
    var onItemClick = React.useCallback(function (key) {
        setLastMenuItemClicked(key);
    }, [setLastMenuItemClicked]);
    return (React.createElement(View, null,
        React.createElement(View, { style: { flexDirection: 'row', paddingVertical: 5 } },
            React.createElement(View, { style: { flexDirection: 'column', paddingHorizontal: 5 } },
                React.createElement(View, { style: { flexDirection: 'row' } },
                    React.createElement(Text, null, "Should Focus on Mount"),
                    React.createElement(Switch, { value: focusOnMount, onValueChange: toggleFocusOnMount })),
                React.createElement(View, { style: { flexDirection: 'row' } },
                    React.createElement(Text, null, "Should Focus on Container"),
                    React.createElement(Switch, { value: focusOnContainer, onValueChange: toggleFocusOnContainer })),
                React.createElement(View, { style: { flexDirection: 'row' } },
                    React.createElement(Text, null, "Beak Visible"),
                    React.createElement(Switch, { value: isBeakVisible, onValueChange: onIsBeakVisibleChange }))),
            React.createElement(Separator, { vertical: true }),
            React.createElement(View, { style: { flexDirection: 'column', paddingHorizontal: 5 } },
                React.createElement(Text, null,
                    React.createElement(Text, null, "Menu Visibility: "),
                    isContextualMenuVisible ? React.createElement(Text, { style: { color: 'green' } }, "Visible") : React.createElement(Text, { style: { color: 'red' } }, "Not Visible")),
                React.createElement(Text, null,
                    React.createElement(Text, null, "Last Menu Item Clicked: "),
                    lastMenuItemClicked > 0 ? (React.createElement(Text, { style: { color: 'blue' } }, lastMenuItemClicked)) : (React.createElement(Text, { style: { color: 'blue' } }, "none"))),
                React.createElement(Button, __assign({ onClick: toggleShowContextualMenu, componentRef: stdBtnRef }, testProps(CONTEXTUALMENU_TEST_COMPONENT)), "Press for ContextualMenu"))),
        showContextualMenu && (React.createElement(ContextualMenu, { target: stdBtnRef, onDismiss: onDismissContextualMenu, onShow: onShowContextualMenu, onItemClick: onItemClick, setShowMenu: toggleShowContextualMenu, shouldFocusOnMount: focusOnMount, shouldFocusOnContainer: focusOnContainer, isBeakVisible: isBeakVisible },
            React.createElement(ContextualMenuItem, __assign({ text: "MenuItem 1", itemKey: "1" }, testProps(CONTEXTUALMENUITEM_TEST_COMPONENT))),
            React.createElement(ContextualMenuItem, { text: "MenuItem 2", itemKey: "2" }),
            React.createElement(ContextualMenuItem, { text: "Disabled Menu Item", itemKey: "3", disabled: true }),
            React.createElement(ContextualMenuItem, { text: "MenuItem 4", itemKey: "4" }),
            React.createElement(ContextualMenuItem, { text: "MenuItem 5", itemKey: "5" })))));
};
//# sourceMappingURL=E2EContextualMenuTest.js.map