import { IconAlertTriangle } from '@tabler/icons-react'; /** * ConfirmModal - модальное окно подтверждения действия * Простой подход со встроенным backdrop (как в HistoryModal) */ function ConfirmModal({ show, onClose, onConfirm, title = 'Подтверждение', message, confirmLabel = 'Подтвердить', cancelLabel = 'Отмена', variant = 'danger', icon: Icon = IconAlertTriangle, loading = false, showIcon = true }) { if (!show) return null; const handleConfirm = () => { onConfirm?.(); }; const handleBackdropClick = (e) => { if (e.target === e.currentTarget) { onClose?.(); } }; return ( <> {/* Modal Backdrop */}
{/* Modal */}
{ if (e.key === 'Escape') onClose?.(); }} >
{ if (e.key === 'Tab') { const c = e.currentTarget; const focusable = c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'); if (!focusable || focusable.length === 0) return; const first = focusable[0]; const last = focusable[focusable.length - 1]; if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); } else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); } } }} >
{title}
{showIcon && Icon && (
)}
{typeof message === 'string' ?

{message}

: message}
); } export default ConfirmModal;