import { Cross, CrossCircleFill } from '@transferwise/icons';
import { clsx } from 'clsx';
import { forwardRef } from 'react';
import { useIntl } from 'react-intl';
import { Size, SizeLarge, SizeMedium, SizeSmall, SizeExtraSmall } from '../propsValues/size';
import messages from './CloseButton.messages';
export type CloseButtonProps = Pick<
React.ComponentPropsWithoutRef<'button'>,
'aria-label' | 'className' | 'onClick'
> & {
size?: SizeExtraSmall | SizeSmall | SizeMedium | SizeLarge;
filled?: boolean;
isDisabled?: boolean;
testId?: string;
tabIndex?: number;
};
/**
* @deprecated Use `` component instead
*/
export const CloseButton = forwardRef(function CloseButton(
{
'aria-label': ariaLabel,
size = Size.MEDIUM,
filled = false,
className,
onClick,
isDisabled,
testId,
tabIndex,
}: CloseButtonProps,
reference: React.ForwardedRef,
) {
const intl = useIntl();
ariaLabel ??= intl.formatMessage(messages.ariaLabel);
const Icon = filled ? CrossCircleFill : Cross;
return (
);
});