{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "message", "dependencies": [ "class-variance-authority" ], "registryDependencies": [ "avatar" ], "files": [ { "path": "components/ui/message.tsx", "content": "import type { ComponentProps, HTMLAttributes } from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n Avatar,\n AvatarFallback,\n AvatarImage,\n} from \"@/components/ui/avatar\"\n\nexport type MessageProps = HTMLAttributes & {\n from: \"user\" | \"assistant\"\n}\n\nexport const Message = ({ className, from, ...props }: MessageProps) => (\n \n)\n\nconst messageContentVariants = cva(\n \"is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm\",\n {\n variants: {\n variant: {\n contained: [\n \"max-w-[80%] px-4 py-3\",\n \"group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground\",\n \"group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground\",\n ],\n flat: [\n \"group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground\",\n \"group-[.is-assistant]:text-foreground\",\n ],\n },\n },\n defaultVariants: {\n variant: \"contained\",\n },\n }\n)\n\nexport type MessageContentProps = HTMLAttributes &\n VariantProps\n\nexport const MessageContent = ({\n children,\n className,\n variant,\n ...props\n}: MessageContentProps) => (\n \n {children}\n \n)\n\nexport type MessageAvatarProps = ComponentProps & {\n src: string\n name?: string\n}\n\nexport const MessageAvatar = ({\n src,\n name,\n className,\n ...props\n}: MessageAvatarProps) => (\n \n \n {name?.slice(0, 2) || \"ME\"}\n \n)\n", "type": "registry:ui" } ], "type": "registry:ui" }