'use client';

import { cn } from '@djangocfg/ui-core/lib';

export interface StreamingIndicatorProps {
  variant?: 'dots' | 'pulse';
  label?: string;
  className?: string;
}

export function StreamingIndicator({ variant = 'dots', label, className }: StreamingIndicatorProps) {
  return (
    <span
      className={cn('inline-flex items-center gap-1.5 text-xs text-muted-foreground', className)}
      aria-live="off"
    >
      {variant === 'dots' ? (
        <span className="inline-flex gap-0.5" aria-hidden>
          <span className="size-1 animate-bounce rounded-full bg-current [animation-delay:-0.2s]" />
          <span className="size-1 animate-bounce rounded-full bg-current [animation-delay:-0.1s]" />
          <span className="size-1 animate-bounce rounded-full bg-current" />
        </span>
      ) : (
        <span className="inline-block size-1.5 animate-pulse rounded-full bg-current" aria-hidden />
      )}
      {label ? <span className="italic">{label}</span> : null}
    </span>
  );
}
