import { useState } from 'react';
import { useActionsState } from '../../../ActionGroup';
export const useLogic = ({ main, secondary, secondaryVisible, isLoading, }) => {
    const [isActive, setIsActive] = useState(false);
    const { disabledAction } = useActionsState({ main, secondary });
    const handleToggle = () => {
        setIsActive(!isActive);
    };
    const visibleMainActions = main?.slice(0, 2);
    const hiddenMainActions = main?.slice(2);
    return {
        disabledAction,
        isActive,
        handleToggle,
        visibleMainActions,
        hiddenMainActions,
        isVisibleShowMoreButton: Boolean(secondary || secondaryVisible || hiddenMainActions?.length),
        isLoading,
    };
};
