"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolbarButtonGroup = ToolbarButtonGroup;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const react_2 = require("react");
const classname_1 = require("../classname.js");
const ToolbarButton_1 = require("./ToolbarButton.js");
const ToolbarButtonPopup_1 = require("./ToolbarButtonPopup.js");
const ToolbarListButton_1 = require("./ToolbarListButton.js");
const types_1 = require("./types.js");
require("./ToolbarGroup.css");
const b = (0, classname_1.cn)('toolbar-group');
function ToolbarButtonGroup({ className, editor, data, focus, onClick, disableTooltip, disablePreview, disableHotkey, }) {
    return ((0, jsx_runtime_1.jsx)("div", { className: b(null, [className]), children: data.map((item) => {
            if (item.type === types_1.ToolbarDataType.SingleButton) {
                return ((0, react_1.createElement)(ToolbarButton_1.ToolbarButton, { ...item, key: item.id, editor: editor, focus: focus, onClick: onClick, className: b(item.type, { id: item.id }, [item.className]), disableTooltip: disableTooltip }));
            }
            if (item.type === types_1.ToolbarDataType.ButtonPopup) {
                return ((0, react_1.createElement)(ToolbarButtonPopup_1.ToolbarButtonPopup, { ...item, key: item.id, editor: editor, focus: focus, onClick: onClick, className: b(item.type, { id: item.id }, item.className), disableTooltip: disableTooltip }));
            }
            if (item.type === types_1.ToolbarDataType.ListButton) {
                return ((0, react_1.createElement)(ToolbarListButton_1.ToolbarListButton, { ...item, qaMenu: "g-md-toolbar-menu", key: item.id, editor: editor, focus: focus, onClick: onClick, className: b(item.type, { id: item.id }, [item.className]), disablePreview: disablePreview, disableHotkey: disableHotkey, disableTooltip: disableTooltip }));
            }
            if (item.type === types_1.ToolbarDataType.ReactComponent) {
                const Component = item.component;
                return ((0, react_1.createElement)(Component, { ...item.props, key: item.id, editor: editor, focus: focus, onClick: onClick, className: b(item.type, { id: item.id }, [item.className]) }));
            }
            if (item.type === types_1.ToolbarDataType.ReactNode) {
                return (0, jsx_runtime_1.jsx)(react_2.Fragment, { children: item.content }, item.id);
            }
            if (item.type === types_1.ToolbarDataType.ReactNodeFn) {
                return (0, jsx_runtime_1.jsx)(react_2.Fragment, { children: item.content(editor) }, item.id);
            }
            return null;
        }) }));
}
//# sourceMappingURL=ToolbarGroup.js.map
