"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StageControlButton = exports.MakeMenu = void 0;
const react_1 = __importStar(require("react"));
const components_1 = require("../themes/components");
const styled_components_1 = require("styled-components");
const borderRadius_1 = __importDefault(require("../themes/foundations/borderRadius"));
const OrientationContext_1 = require("../services/OrientationContext");
const toolkit_1 = require("@reduxjs/toolkit");
function MakeMenu(props) {
    const { menu } = props;
    const { colors } = react_1.useContext(styled_components_1.ThemeContext);
    return (react_1.default.createElement(components_1.Flex, null, menu.map(({ title, defaultValue, onChange, options, }, index) => (react_1.default.createElement(react_1.default.Fragment, { key: toolkit_1.nanoid() },
        index !== 0 && react_1.default.createElement(components_1.Box, null),
        react_1.default.createElement(components_1.Flex, null,
            react_1.default.createElement(components_1.Text, { fontSize: "md", mb: 10, fontWeight: "bold", color: "textPrimary.100" }, title),
            options.map(({ key, value, children, }, optionsIndex) => (react_1.default.createElement(components_1.Button, { key: `${key + optionsIndex}`, onClick: () => onChange(value) },
                react_1.default.createElement(components_1.HStack, { justify: "space-between", p: 16, mb: 4, bg: "secondary.800", borderRadius: borderRadius_1.default.small },
                    react_1.default.createElement(components_1.Text, { fontSize: "sm" }, children),
                    defaultValue === value ? react_1.default.createElement(components_1.Icon, { name: "check", fill: "success.500" }) : null))))))))));
}
exports.MakeMenu = MakeMenu;
function StageControlButton(props) {
    const { variant, label, icon, disabled, onClick, isActive, menu, badge, ariaLabel, } = props;
    const { orientation } = react_1.default.useContext(OrientationContext_1.OrientationContext);
    const isLandscape = orientation === 'LANDSCAPE';
    return (react_1.default.createElement(components_1.Flex, null,
        badge !== '' && (react_1.default.createElement(components_1.Box, { className: "dyte-client-notificationBadge", bg: "primary.500", textColor: "textPrimary.100", height: 4, position: "absolute", right: "2", top: "1", fontSize: "xs" },
            react_1.default.createElement("span", null, badge))),
        react_1.default.createElement(components_1.Button, { variant: variant || 'controls', onClick: onClick, disabled: disabled },
            react_1.default.createElement(components_1.VStack, { py: 10, "aria-label": ariaLabel, minWidth: 64, align: "center", justify: "center" },
                react_1.default.createElement(components_1.Box, { fontSize: "xl", transform: [{ rotate: isLandscape ? '90deg' : '0deg' }] }, icon)))));
}
exports.StageControlButton = StageControlButton;
StageControlButton.defaultProps = {
    disabled: false,
    variant: null,
    menu: [],
    isActive: false,
    badge: '',
    ariaLabel: '',
};
//# sourceMappingURL=StageControlButton.js.map