// @flow strict import * as React from 'react'; import type {AlertSemanticType} from '../../types/common'; import {ALERT_SEMANTIC} from '../../types/common'; import classify from '../../utils/classify'; import {ClickableCard} from '../Card'; import {Chip} from '../Chip'; import type {IconSize, IconType} from '../Icon'; import {ICON_SIZE, ICON_TYPE, SemanticIcon} from '../Icon'; import {RadioButton} from '../RadioButton'; import {BodyMedium, SubTitleMedium} from '../Text'; import css from './RadioTile.module.css'; type ClassNames = $ReadOnly<{ wrapper?: string, }>; export type RadioTileProps = { id: string, classNames?: ClassNames, semantic?: AlertSemanticType, header?: string, description?: string, chipItems?: Array, onTileClick?: (e: SyntheticEvent, id: string) => void, iconName?: string, iconSize?: IconSize, iconType?: IconType, isSelected?: boolean, }; export const RadioTile: React$AbstractComponent< RadioTileProps, HTMLDivElement, > = React.forwardRef( ( { classNames, id, semantic = ALERT_SEMANTIC.neutral, header, description, chipItems, iconName, iconSize = ICON_SIZE.medium, iconType = ICON_TYPE.solid, onTileClick, isSelected = false, ...props }: RadioTileProps, ref, ) => { const handleTileClick = (e: SyntheticEvent) => { onTileClick && onTileClick(e, id); }; return (
{!!iconName && ( )}
{!!header && {header}} {!!description && ( {description} )}
{!!chipItems?.length && (
{chipItems.map((item, index) => ( // eslint-disable-next-line react/no-array-index-key {item} ))}
)}
); }, );