import { clsx } from 'clsx';
import AvatarView, { AvatarViewProps } from '../avatarView';
import { useDirection } from '../common/hooks';
type SingleAvatarType = { asset?: AvatarViewProps['children'] } & Omit<
AvatarViewProps,
'selected' | 'size' | 'badge' | 'children' | 'interactive'
>;
export type Props = {
/** @default [] */
avatars: SingleAvatarType[];
/** @default 'horizontal' */
orientation?: 'horizontal' | 'diagonal';
/** @default 48 */
size?: AvatarViewProps['size'];
} & Pick<
AvatarViewProps,
'interactive' | 'className' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'
>;
export default function AvatarLayout({
avatars = [],
orientation: orientationProp = 'horizontal',
size = 48,
className,
interactive,
...restProps
}: Props) {
const orientation =
size === 16 && orientationProp === 'diagonal' ? 'horizontal' : orientationProp;
const { isRTL } = useDirection();
const isDiagonal = orientation === 'diagonal';
const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;
return avatars.length < 1 ? null : avatars.length === 1 ? (