import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import { createElement as _createElement } from "react";
import { MenuItem } from '../../MenuItem';
import { Tooltip } from '../../Tooltip';
import { useMainActions } from './hooks';
import { StyledButton, StyledDropdownButton } from './styles';
export const MainActions = ({ actions, isDisabled, size, }) => {
    const processedActions = useMainActions({ actions, size, isDisabled });
    return (_jsx(_Fragment, { children: processedActions.map(({ tooltipProps, isNested, buttonProps, nestedActions }) => {
            const { key: tooltipKey, ...restTooltipProps } = tooltipProps;
            if (isNested) {
                return (_createElement(Tooltip, { ...restTooltipProps, key: tooltipKey },
                    _jsx(StyledDropdownButton, { ...buttonProps, children: nestedActions.map(({ key, text, ...nestedProps }) => (_jsx(MenuItem, { ...nestedProps, children: text }, key))) })));
            }
            return (_createElement(Tooltip, { ...restTooltipProps, key: tooltipKey },
                _jsx(StyledButton, { ...buttonProps })));
        }) }));
};
