// @flow strict import * as React from 'react'; import type {ColorTypes} from '../../types/typography'; import classify from '../../utils/classify'; import {UnstyledButton} from '../Button'; import {TEXT_COLORS} from '../Text'; import type {IconProps, IconSize, IconType} from './'; import {Icon} from './'; import css from './ClickableIcon.module.css'; type ClassNames = $ReadOnly<{ icon?: string, button?: string, }>; export type ClickableIconProps = { ...IconProps, disabled?: boolean, classNames?: ClassNames, }; export const ClickableIcon: React$AbstractComponent< ClickableIconProps, HTMLButtonElement, > = React.forwardRef( ( { size = 'medium', ariaLabel, onClick, className, // Deprecated for Clickable Icon classNames, disabled = false, ...props }: ClickableIconProps, ref, ) => { const onKeyDownHandler = (e) => { if (e.key === 'Enter') { e.preventDefault(); onClick && onClick(e); } }; return ( ); }, ); export type CloseIconProps = { size?: IconSize, type?: IconType, color?: ColorTypes, onClick?: ?(SyntheticEvent) => mixed, className?: string, // Deprecated for Clickable Icon ariaLabel?: string, disabled?: boolean, classNames?: ClassNames, }; export const CloseIcon: React$AbstractComponent< CloseIconProps, HTMLButtonElement, > = React.forwardRef( ( { size = 'medium', type = 'regular', color = TEXT_COLORS.primary, ...props }: CloseIconProps, ref, ) => ( ), );