import { jsx as _jsx } from "react/jsx-runtime";
import { createElement as _createElement } from "react";
import { Fragment } from 'react';
import { cn } from "../classname.js";
import { ToolbarButton } from "./ToolbarButton.js";
import { ToolbarButtonPopup } from "./ToolbarButtonPopup.js";
import { ToolbarListButton } from "./ToolbarListButton.js";
import { ToolbarDataType } from "./types.js";
import "./ToolbarGroup.css";
const b = cn('toolbar-group');
export function ToolbarButtonGroup({ className, editor, data, focus, onClick, disableTooltip, disablePreview, disableHotkey, }) {
    return (_jsx("div", { className: b(null, [className]), children: data.map((item) => {
            if (item.type === ToolbarDataType.SingleButton) {
                return (_createElement(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 === ToolbarDataType.ButtonPopup) {
                return (_createElement(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 === ToolbarDataType.ListButton) {
                return (_createElement(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 === ToolbarDataType.ReactComponent) {
                const Component = item.component;
                return (_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 === ToolbarDataType.ReactNode) {
                return _jsx(Fragment, { children: item.content }, item.id);
            }
            if (item.type === ToolbarDataType.ReactNodeFn) {
                return _jsx(Fragment, { children: item.content(editor) }, item.id);
            }
            return null;
        }) }));
}
//# sourceMappingURL=ToolbarGroup.js.map
