{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "floating-chat-widget-shadcnui", "type": "registry:component", "title": "Floating Chat Widget", "description": "Floating chat widget with AI agent selection dropdown and animations", "registryDependencies": [ "button" ], "dependencies": [ "framer-motion", "react" ], "files": [ { "path": "@uitripled/react-shadcn/src/components/components/chat/floating-chat-widget.tsx", "content": "\"use client\";\n\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { cn } from \"@/lib/utils\";\nimport { AnimatePresence, motion, type Variants } from \"framer-motion\";\nimport {\n Brain,\n Code,\n MessageSquare,\n Send,\n Sparkles,\n X,\n Zap,\n} from \"lucide-react\";\nimport { useCallback, useId, useState } from \"react\";\n\ninterface Agent {\n id: string;\n name: string;\n role: string;\n avatar: string;\n status: \"online\" | \"busy\" | \"offline\";\n icon: React.ElementType;\n gradient: string;\n}\n\nconst AI_AGENTS: Agent[] = [\n {\n id: \"gpt4\",\n name: \"GPT-4\",\n role: \"Advanced Reasoning\",\n avatar: \"https://github.com/shadcn.png\",\n status: \"online\",\n icon: Sparkles,\n gradient: \"from-green-500/20 to-emerald-500/20\",\n },\n {\n id: \"claude\",\n name: \"Claude 3.5\",\n role: \"Creative Writing\",\n avatar: \"https://github.com/shadcn.png\",\n status: \"online\",\n icon: Brain,\n gradient: \"from-orange-500/20 to-amber-500/20\",\n },\n {\n id: \"gemini\",\n name: \"Gemini Pro\",\n role: \"Multimodal Analysis\",\n avatar: \"https://github.com/shadcn.png\",\n status: \"busy\",\n icon: Zap,\n gradient: \"from-blue-500/20 to-cyan-500/20\",\n },\n {\n id: \"copilot\",\n name: \"Copilot\",\n role: \"Code Assistant\",\n avatar: \"https://github.com/shadcn.png\",\n status: \"online\",\n icon: Code,\n gradient: \"from-purple-500/20 to-violet-500/20\",\n },\n];\n\nconst containerVariants: Variants = {\n hidden: {\n opacity: 0,\n y: 20,\n scale: 0.95,\n transformOrigin: \"bottom right\",\n },\n visible: {\n opacity: 1,\n y: 0,\n scale: 1,\n transition: {\n type: \"spring\",\n damping: 25,\n stiffness: 300,\n staggerChildren: 0.05,\n },\n },\n exit: {\n opacity: 0,\n y: 20,\n scale: 0.95,\n transition: {\n duration: 0.2,\n },\n },\n};\n\nconst messageVariants: Variants = {\n hidden: { opacity: 0, y: 10, x: -10 },\n visible: {\n opacity: 1,\n y: 0,\n x: 0,\n transition: { type: \"spring\", stiffness: 500, damping: 30 },\n },\n};\n\nexport function FloatingChatWidget() {\n const [isOpen, setIsOpen] = useState(false);\n const [selectedAgent, setSelectedAgent] = useState(AI_AGENTS[0].id);\n const [message, setMessage] = useState(\"\");\n const widgetId = useId();\n\n const toggleOpen = useCallback(() => setIsOpen((prev) => !prev), []);\n\n const currentAgent =\n AI_AGENTS.find((a) => a.id === selectedAgent) || AI_AGENTS[0];\n const AgentIcon = currentAgent.icon;\n\n return (\n
\n \n {isOpen && (\n \n {/* Header */}\n
\n \n
\n
\n
\n \n \n AI\n \n \n
\n
\n

\n {currentAgent.name}\n

\n
\n \n {currentAgent.role}\n \n
\n
\n
\n setIsOpen(false)}\n >\n \n \n
\n
\n\n {/* Agent Selector */}\n
\n \n
\n\n {/* Chat Area */}\n
\n \n \n \n \n AI\n \n \n
\n \n {currentAgent.name}\n \n
\n

\n Hello! I'm {currentAgent.name}. How can I assist you with\n your project today?\n

\n
\n
\n
\n\n {/* User Message Mock */}\n \n \n \n \n ME\n \n \n
\n
\n

I need help optimizing my dashboard performance.

\n
\n
\n \n\n {/* Typing Indicator Mock */}\n \n \n \n \n AI\n \n \n
\n
\n \n \n \n
\n
\n \n
\n\n {/* Input Area */}\n
\n {\n e.preventDefault();\n setMessage(\"\");\n }}\n >\n setMessage(e.target.value)}\n placeholder={`Message ${currentAgent.name}...`}\n className=\"flex-1 rounded-full border border-border/40 bg-background/50 px-4 py-2.5 text-sm outline-none transition-all placeholder:text-muted-foreground focus:border-primary/50 focus:bg-background focus:ring-2 focus:ring-primary/10\"\n />\n \n \n \n \n
\n \n )}\n
\n\n \n \n {isOpen ? (\n \n ) : (\n \n )}\n \n
\n );\n}\n", "type": "registry:component", "target": "components/uitripled/floating-chat-widget-shadcnui.tsx" } ] }