import { clsx } from 'clsx'; import React from 'react'; /** * Props for the TypingDots component */ export interface TypingDotsProps extends React.HTMLAttributes { /** * Tailwind size utility classes for each dot * @default 'w-1.5 h-1.5' * @example 'w-2 h-2' for larger dots */ dotSizeClassName?: string; /** * Custom classes for the container div that wraps all dots */ className?: string; /** * Custom classes applied to each individual dot */ dotClassName?: string; /** * Animation duration for the bounce effect * @default '1s' */ animationDuration?: string; /** * Color of the dots - uses CSS currentColor by default * @default 'bg-current' (inherits text color) */ dotColor?: string; } /** * Animation delays for each of the three dots to create a wave effect */ const ANIMATION_DELAYS = ['0ms', '200ms', '400ms']; /** * TypingDots component displays an animated three-dot indicator commonly used to show typing activity * * Features: * - Three dots with staggered bounce animation * - Customizable size, color, and animation timing * - Respects reduced motion preferences * - Basic ARIA support (role, aria-label, aria-live) * * @example * // Basic usage * * * @example * // Custom styling * * * @example * // With custom animation * */ export const TypingDots = ({ dotSizeClassName = 'w-1.5 h-1.5', className, dotClassName, animationDuration = '1s', dotColor = 'bg-current', ...rest }: TypingDotsProps) => (
{ANIMATION_DELAYS.map((delay) => ( );