import { forwardRef, useMemo } from 'react'; import ConfirmDialog from './ConfirmDialog'; import IconButton from './IconButton'; import { HeaderText } from './Text'; const FormDialog = forwardRef< ConfirmDialogForwardedRefContent, ConfirmDialogProps & { showClose?: boolean } >((props, ref) => { const { scrollContent, showClose, titleText, ...restProps } = props; const scrollBoxPaddingRight = useMemo( () => (scrollContent ? '.5em' : undefined), [scrollContent], ); const titleElement = useMemo(() => { const title = typeof titleText === 'string' ? ( {titleText} ) : ( titleText ); return showClose ? ( <> {title} { if (ref && 'current' in ref) { ref.current?.setOpen?.call(null, false); } }} variant="redcontained" /> ) : ( title ); }, [ref, showClose, titleText]); return ( ); }); FormDialog.defaultProps = { showClose: false, }; FormDialog.displayName = 'FormDialog'; export default FormDialog;