import { usePopover } from '../../../components/usePopover';
const NOTE_TEXT = 'Редактировать';
export const useLogic = ({ isLoading, iconPosition, }) => {
    const { isOpen, anchor, actions } = usePopover();
    const isIconOnLeft = iconPosition === 'left';
    const tooltipTitle = isLoading ? undefined : NOTE_TEXT;
    const handleOpen = (event) => {
        if (isLoading) {
            return;
        }
        actions.open(event);
    };
    return {
        isIconOnLeft,
        onClose: actions.close,
        tooltipProps: {
            title: tooltipTitle,
        },
        displayValueProps: {
            $isEdited: isOpen,
            onClick: handleOpen,
        },
        popoverProps: {
            open: isOpen,
            onClose: actions.close,
            anchorEl: anchor,
            title: 'Изменение данных',
        },
    };
};
