import { ErrorInfo } from '@ably/chat';
/**
* Props for the RoomReaction component
*/
export interface RoomReactionProps {
/**
* Duration for the emoji burst animation in milliseconds.
* Controls how long the emoji animation is visible before automatically hiding.
* Longer durations provide more noticeable feedback but may feel slower.
* @default 500
*/
emojiBurstDuration?: number;
/**
* Fixed position for the burst animation when receiving reactions from others.
* When provided, all incoming reactions will animate at this position.
* When not provided, incoming reactions animate at screen center.
* Own reactions always animate from the button position
*
* @example
* // Fixed position in top-right corner
* emojiBurstPosition={{ x: window.innerWidth - 100, y: 100 }}
*
* @example
* // Center of a specific element
* const rect = element.getBoundingClientRect();
* emojiBurstPosition={{
* x: rect.left + rect.width / 2,
* y: rect.top + rect.height / 2
* }}
*/
emojiBurstPosition?: {
x: number;
y: number;
};
/**
* Additional CSS classes to apply to the reaction button container.
* Allows customization of spacing, alignment, and styling.
* Merged with default padding and container classes using clsx.
*
* @example
* // Custom spacing and positioning
* className="px-6 py-2 fixed bottom-4 right-4"
*
* @example
* // Integration with flex layouts
* className="flex-shrink-0 ml-auto"
*/
className?: string;
/**
* Custom error handling configuration for room reaction operations.
* Provides hooks for handling specific error scenarios instead of default console logging.
* All handlers are optional and will fall back to console.error if not provided.
*
* @example
* ```tsx
* const onError = {
* onSendRoomReactionError: (error, emoji) => {
* toast.error(`Failed to send ${emoji} reaction: ${error.message}`);
* console.error('Room reaction error:', error);
* }
* };
*
*
* ```
*/
onError?: {
/**
* Called when sending a room reaction fails.
* Provides the error object and the emoji that failed to send.
*
* @param error - The error that occurred while sending the reaction
* @param emoji - The emoji that failed to send
*/
onSendRoomReactionError?: (error: ErrorInfo, emoji: string) => void;
};
}
/**
* RoomReaction component provides ephemeral room reaction functionality for chat rooms
*
* Core Features:
* - Quick reaction button with customizable default emoji (starts with 👍)
* - Long press (500ms) to open circular emoji selection wheel
* - Selected emoji becomes new default for subsequent quick reactions
* - Immediate visual feedback with emoji burst animations
* - Throttled sending (max 1 reaction per 200ms)
* - Handles both outgoing and incoming room reactions
* - Mobile-friendly with touch event support and haptic feedback
* - Accessible with proper ARIA labels and keyboard interaction
*
* Interaction:
* • Short click/tap: Sends current default emoji immediately
* • Long press/hold: Opens emoji wheel for selection
* • Emoji wheel selection: Updates default and sends chosen emoji
* • Click outside wheel: Closes wheel without sending
*
*
* Room Reactions vs Message Reactions:
* Room reactions are ephemeral like typing indicators - they provide momentary
* feedback without being stored in chat history. They're useful for quick
* acknowledgments, applause, or ambient reactions during conversations.
*
* @example
* // With custom animation settings
*
*
* @example
* // Custom positioning and styling
*
*
* @example
* // With custom error handling
* {
* toast.error(`Failed to send ${emoji} reaction: ${error.message}`);
* console.error('Room reaction error:', error);
* }
* }}
* />
*
*/
export declare const RoomReaction: ({ emojiBurstDuration, emojiBurstPosition: initialEmojiBurstPosition, className, onError, }: RoomReactionProps) => import("react/jsx-runtime").JSX.Element;