// AUTO-GENERATED by scripts/generate-wrappers.mjs — do not edit by hand.
// Source: packages/core/manifest.json (component "avatar-group").
import type { ElementType, ReactNode } from 'react';
import { AvatarGroup as AvatarGroupController, type AvatarGroupOptions } from '@42/core/avatar-group';
import { C42 } from '../C42';

const DEFAULT_HTML: string | null = "<div data-c42-avatar>…</div>\n  <div data-c42-avatar>…</div>\n  <div data-c42-avatar>…</div>\n  <span data-c42-avatar-overflow></span>";

export interface AvatarGroupProps extends Partial<AvatarGroupOptions> {
  /** Element/tag rendered as the controller root. Defaults to `"div"`. */
  as?: ElementType;
  className?: string;
  children?: ReactNode;
  /** Fired on `avatar-group:change` — detail: `(no detail)` */
  onChange?: (detail: unknown, event: CustomEvent) => void;
  /** Extra props are forwarded to the rendered `<div>` element. */
  [key: string]: unknown;
}

export function AvatarGroup(props: AvatarGroupProps) {
  const { as, className, children, onChange, stacked, spacing, max, label, ...rest } = props;
  const options = { stacked, spacing, max, label } as AvatarGroupOptions;

  return (
    <C42
      controller={AvatarGroupController}
      options={options}
      deps={[stacked, spacing, max, label]}
      events={{
        'avatar-group:change': onChange,
      }}
      as={(as as ElementType) ?? 'div'}
      className={className as string | undefined}
      html={DEFAULT_HTML ?? undefined}
      {...{ 'data-c42-avatar-group': '' }}
      {...rest}
    >
      {children as ReactNode}
    </C42>
  );
}
