import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cva } from '../utils/cva';
import { ActionCellContextProvider } from './ActionCellContext';
import { dataGridActionCellClassnames } from './constants';
import { DataGridMainActions } from './DataGridMainActions';
import { SecondaryActionsButton } from './SecondaryActionsButton';
import { Wrapper } from './styles';
import { useLogic } from './useLogic';
const actionCellCva = cva(dataGridActionCellClassnames.root, {
    variants: {
        hasMainActions: {
            true: dataGridActionCellClassnames.hasMainActions,
        },
    },
});
export const DataGridActionCell = (props) => {
    const { handleWrapperClick, handleActionClick, actions, mainActions, secondaryActions, hasSecondaryActions, hasMainActions, } = useLogic(props);
    return (_jsx(ActionCellContextProvider, { onActionClick: handleActionClick, children: _jsxs(Wrapper, { onClick: handleWrapperClick, className: actionCellCva({ hasMainActions }), children: [mainActions ? (mainActions()) : (_jsx(DataGridMainActions, { actions: actions?.main })), hasSecondaryActions && (_jsx(SecondaryActionsButton, { actions: actions?.secondary, renderActions: secondaryActions }))] }) }));
};
