UNPKG

@atlaskit/avatar-group

Version:

An avatar group displays a number of avatars grouped together in a stack or grid.

41 lines (40 loc) 2.02 kB
import type { ElementType, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react'; import type AnalyticsEvent from '@atlaskit/analytics-next/AnalyticsEvent'; import type { default as Avatar, AvatarPropTypes } from '@atlaskit/avatar/avatar'; import type { SizeType } from '@atlaskit/avatar/types'; import type { MenuGroupProps } from '@atlaskit/menu/types'; import type { ContentProps } from '@atlaskit/popup/types'; import type { AvatarGroupItemProps } from './avatar-group-item'; import { type MoreIndicatorProps } from './more-indicator'; export type DeepRequired<T> = { [P in keyof T]-?: Required<T[P]>; }; export type AvatarProps = AvatarPropTypes & { name: string; key?: string | number; }; export interface AvatarGroupOverrides { AvatarGroupItem?: { render?: (Component: ForwardRefExoticComponent<AvatarGroupItemProps & RefAttributes<HTMLElement>>, props: AvatarGroupItemProps, index: number) => ReactNode; }; Avatar?: { render?: (Component: typeof Avatar | ElementType<AvatarProps>, props: AvatarProps, index: number) => ReactNode; }; MoreIndicator?: { render?: (Component: ForwardRefExoticComponent<MoreIndicatorProps & RefAttributes<HTMLButtonElement>>, props: MoreIndicatorProps) => ReactNode; }; } export type onAvatarClickHandler = (event: React.MouseEvent, analyticsEvent: AnalyticsEvent | undefined, index: number) => void; export type FocusableElement = HTMLAnchorElement | HTMLButtonElement; export type Action = 'next' | 'prev' | 'first' | 'last'; export interface PopupAvatarGroupProps extends MenuGroupProps { setInitialFocusRef?: ContentProps['setInitialFocusRef']; } /** * The set of avatar sizes supported by `AvatarGroup` and its `MoreIndicator`. * * Excludes `xxsmall` (16px), legacy `xsmall`, and `UNSAFE_xsmall` (20px): the * more indicator and grouped avatars cannot be displayed in an accessible manner * at those sizes. */ export type AvatarGroupSize = Exclude<SizeType, 'xxsmall' | 'xsmall' | 'UNSAFE_xsmall'>;