"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MenuPicker = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var react_native_1 = require("react-native");
var react_native_2 = require("@fluentui/react-native");
var menu_1 = require("@fluentui-react-native/menu");
var react_native_svg_1 = require("react-native-svg");
var chevronXml = "\n<svg width=\"12\" height=\"16\" viewBox=\"0 0 11 6\" color=\"#000\">\n  <path fill='currentColor' d='M0.646447 0.646447C0.841709 0.451184 1.15829 0.451184 1.35355 0.646447L5.5 4.79289L9.64645 0.646447C9.84171 0.451185 10.1583 0.451185 10.3536 0.646447C10.5488 0.841709 10.5488 1.15829 10.3536 1.35355L5.85355 5.85355C5.65829 6.04882 5.34171 6.04882 5.14645 5.85355L0.646447 1.35355C0.451184 1.15829 0.451184 0.841709 0.646447 0.646447Z' />\n</svg>";
var MenuPicker = function (props) {
    var prompt = props.prompt, selected = props.selected, onChange = props.onChange, collection = props.collection;
    var label;
    collection.forEach(function (item) {
        if (item.value == selected) {
            label = item.label;
        }
    });
    return (React.createElement(react_native_1.View, { style: menuPickerStyles.container },
        React.createElement(react_native_2.Text, { style: menuPickerStyles.prompt }, prompt),
        React.createElement(menu_1.Menu, null,
            React.createElement(menu_1.MenuTrigger, null,
                React.createElement(react_native_2.ButtonV1, null,
                    React.createElement(react_native_2.Text, null, label),
                    React.createElement(react_native_1.View, { style: menuPickerStyles.chevronContainer },
                        React.createElement(react_native_svg_1.SvgXml, { xml: chevronXml })))),
            React.createElement(menu_1.MenuPopover, null,
                React.createElement(menu_1.MenuList, null, collection.map(function (collectionItem, index) {
                    var _a;
                    return (React.createElement(menu_1.MenuItem, { onClick: function () { return onChange(collectionItem.value, index); }, key: (_a = collectionItem.value) !== null && _a !== void 0 ? _a : index }, collectionItem.label));
                }))))));
};
exports.MenuPicker = MenuPicker;
var menuPickerStyles = react_native_1.StyleSheet.create({
    container: {
        flexDirection: 'row',
        alignItems: 'center',
        margin: 5,
    },
    prompt: {
        marginRight: 5,
    },
    chevronContainer: {
        padding: 4,
    },
});
//# sourceMappingURL=MenuPicker.desktop.js.map