import { APPEARANCE, Button, VIEW } from '@cloud-ru/ds-button'; import { ModalCustom, WIDTH } from '@cloud-ru/ds-modal'; import { QuestionTooltip } from '@cloud-ru/ds-tooltip'; import { useRef } from 'react'; import { TEST_IDS } from '../../constants'; import { InputConfirm } from '../../helperComponents'; import { useTextFieldValidation } from '../../hooks'; import { modalPredefinedLocale } from '../../locale'; import { RecallModalProps } from '../../types'; import styles from './styles.module.scss'; export function RecallModal({ open, onClose, mode, closeOnPopstate, titleTooltip, onRecall, loading, content, confirmText, hideConfirmCopyButton, subtitle, ...rest }: RecallModalProps) { const { t } = modalPredefinedLocale.useTranslations(); const inputRef = useRef(null); const { value, error, handleChange, reset, validate } = useTextFieldValidation({ target: confirmText, errorText: t('confirm.error'), }); const shouldShowConfirm = Boolean(confirmText); const handleClose = () => { reset(); onClose(); }; const handleApproveClick = () => { if (!validate()) { inputRef.current?.focus(); return; } onRecall(handleClose); }; return ( : undefined} /> {content ?? t('recallModal.content')} {shouldShowConfirm && ( )} } />
); }