'use client' import { useState } from 'react' import { Button } from '@/components/ui/button' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover' import { SmilePlus } from 'lucide-react' import data from '@emoji-mart/data' import Picker from '@emoji-mart/react' interface EmojiPickerButtonProps { onEmojiSelect: (emoji: string) => void inputIdToFocus?: string // Optional: ID of the input to focus after selection } export default function EmojiPickerButton({ onEmojiSelect, inputIdToFocus }: EmojiPickerButtonProps) { const [isEmojiPickerOpen, setIsEmojiPickerOpen] = useState(false) return ( { if (inputIdToFocus) { event.preventDefault(); const input = document.getElementById(inputIdToFocus) as HTMLInputElement; input?.focus(); } }} > { onEmojiSelect(emoji.native); setIsEmojiPickerOpen(false); // Focus is handled by onCloseAutoFocus }} /> ) }