import React from 'react'; import PropTypes from 'prop-types'; import { Enterprise, Interpolation, OptionalThemedProps, Prisma } from '@splunk/themes'; import getInitials from './getInitials'; import { ComponentProps } from '../utils/types'; /** @public */ type AvatarClickHandler = (event: React.MouseEvent, data: { value?: string; }) => void; interface AvatarPropsBase { /** * All CSS color definitions are supported, such as `#223344` or `red`. * Using `theme` enables the theme default. */ backgroundColor?: string | Interpolation> | Interpolation>; /** A React ref which is set to the DOM element when the component mounts and `null` when it unmounts. */ elementRef?: React.Ref; /** The image to be displayed inside this `Avatar`, for example an `` or ``. */ image?: React.ReactNode; /** The contents of this `Avatar` if the `image` prop is not set or the provided image is not valid. Must not exceed three characters in length. */ initials: string; /** Text to describe what this Avatar represents. */ label: string; /** Enables interactive mode. */ onClick?: AvatarClickHandler; /** Adjusts the size of the `Avatar`. */ size?: 'small' | 'medium' | 'large' | string; /** If set, the component will be rendered as an `` tag with `href` equal to this prop rather than a `