{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "folder-preview", "type": "registry:ui", "dependencies": [ "framer-motion" ], "files": [ { "path": "components/ui/folder-preview.tsx", "content": "\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { motion, AnimatePresence, useAnimation, Variants } from \"framer-motion\";\r\nimport { cn } from \"@/lib/utils\";\r\n\r\n// ============================================\r\n// SVG Icon Components\r\n// ============================================\r\n\r\nconst FolderBackIcon = ({ className }: { className?: string }) => (\r\n \r\n);\r\n\r\nconst FolderCoverIcon = ({ className }: { className?: string }) => (\r\n \r\n);\r\n\r\nconst UsersIcon = ({ className }: { className?: string }) => (\r\n \r\n);\r\n\r\nconst GlobeIcon = ({ className }: { className?: string }) => (\r\n \r\n);\r\n\r\nconst PadlockIcon = ({ className }: { className?: string }) => (\r\n \r\n);\r\n\r\nconst CloudIcon = ({ className }: { className?: string }) => (\r\n \r\n);\r\n\r\nconst FileIcon = ({ className }: { className?: string }) => (\r\n \r\n);\r\n\r\n// ============================================\r\n// Types & Interfaces\r\n// ============================================\r\n\r\nexport type FolderVariant =\r\n | \"devi\"\r\n | \"rudras\"\r\n | \"ardra\"\r\n | \"shakti\"\r\n | \"kubera\"\r\n | \"hari\"\r\n | \"ravi\"\r\n | \"durga\"\r\n | \"nandi\";\r\n\r\nexport interface FolderPreviewProps {\r\n variant?: FolderVariant;\r\n images?: string[];\r\n files?: { name: string; type?: \"txt\" | \"gif\" | \"mp3\" | \"default\" }[];\r\n label?: string;\r\n size?: \"sm\" | \"md\" | \"lg\";\r\n className?: string;\r\n onClick?: () => void;\r\n}\r\n\r\n// ============================================\r\n// Color Schemes for Each Variant\r\n// ============================================\r\n\r\nconst variantColors: Record<\r\n FolderVariant,\r\n {\r\n back: string;\r\n cover: string;\r\n deco: string;\r\n caption: string;\r\n bg: string;\r\n }\r\n> = {\r\n devi: {\r\n back: \"text-gray-500\",\r\n cover: \"text-gray-400\",\r\n deco: \"text-gray-400 brightness-125\",\r\n caption: \"text-gray-800 dark:text-gray-200\",\r\n bg: \"bg-gray-100 dark:bg-gray-900\",\r\n },\r\n rudras: {\r\n back: \"text-gray-700 dark:text-gray-600\",\r\n cover: \"text-gray-600 dark:text-gray-500\",\r\n deco: \"text-gray-400\",\r\n caption: \"text-blue-600 dark:text-blue-400\",\r\n bg: \"bg-slate-200 dark:bg-slate-800\",\r\n },\r\n ardra: {\r\n back: \"text-blue-800 dark:text-blue-700\",\r\n cover: \"text-blue-600 dark:text-blue-500\",\r\n deco: \"text-blue-700 dark:text-blue-600\",\r\n caption: \"text-blue-500 dark:text-blue-400\",\r\n bg: \"bg-gray-800 dark:bg-gray-950\",\r\n },\r\n shakti: {\r\n back: \"text-indigo-800\",\r\n cover: \"text-indigo-700\",\r\n deco: \"text-indigo-800\",\r\n caption: \"text-green-400\",\r\n bg: \"bg-blue-600 dark:bg-blue-800\",\r\n },\r\n kubera: {\r\n back: \"text-gray-900\",\r\n cover: \"text-gray-700\",\r\n deco: \"text-gray-600\",\r\n caption: \"text-gray-900 dark:text-gray-100\",\r\n bg: \"bg-emerald-400 dark:bg-emerald-600\",\r\n },\r\n hari: {\r\n back: \"text-blue-800\",\r\n cover: \"text-blue-700\",\r\n deco: \"text-blue-800\",\r\n caption: \"text-yellow-400\",\r\n bg: \"bg-sky-500 dark:bg-sky-700\",\r\n },\r\n ravi: {\r\n back: \"text-gray-900\",\r\n cover: \"text-gray-700\",\r\n deco: \"text-black dark:text-white\",\r\n caption: \"text-gray-900 dark:text-gray-100\",\r\n bg: \"bg-gray-200 dark:bg-gray-800\",\r\n },\r\n durga: {\r\n back: \"text-green-600\",\r\n cover: \"text-green-500\",\r\n deco: \"text-green-600\",\r\n caption: \"text-green-400 font-mono\",\r\n bg: \"bg-gray-900 dark:bg-black\",\r\n },\r\n nandi: {\r\n back: \"text-amber-500\",\r\n cover: \"text-amber-400\",\r\n deco: \"text-amber-500\",\r\n caption: \"text-gray-900 dark:text-gray-100\",\r\n bg: \"bg-green-100 dark:bg-green-950\",\r\n },\r\n};\r\n\r\n// ============================================\r\n// Size Configuration\r\n// ============================================\r\n\r\nconst sizeConfig = {\r\n sm: {\r\n folder: \"w-16\",\r\n thumb: \"w-10 h-10\",\r\n deco: \"w-4 h-4\",\r\n caption: \"text-xs\",\r\n },\r\n md: {\r\n folder: \"w-24\",\r\n thumb: \"w-14 h-14\",\r\n deco: \"w-6 h-6\",\r\n caption: \"text-sm\",\r\n },\r\n lg: {\r\n folder: \"w-32\",\r\n thumb: \"w-20 h-20\",\r\n deco: \"w-8 h-8\",\r\n caption: \"text-base\",\r\n },\r\n};\r\n\r\n// ============================================\r\n// Animation Variants\r\n// ============================================\r\n\r\nconst createCircularPositions = (count: number, radius: number = 120) => {\r\n return Array.from({ length: count }, (_, i) => {\r\n const startAngle = Math.PI / count;\r\n const angle = startAngle / 2 + startAngle * i;\r\n return {\r\n x: Math.round(radius * Math.cos(angle)),\r\n y: Math.round(-radius * Math.sin(angle)),\r\n };\r\n });\r\n};\r\n\r\n// ============================================\r\n// Individual Folder Components for each Variant\r\n// ============================================\r\n\r\nconst DeviFolder: React.FC<{\r\n images: string[];\r\n isHovered: boolean;\r\n colors: typeof variantColors.devi;\r\n sizes: typeof sizeConfig.md;\r\n label?: string;\r\n}> = ({ images, isHovered, colors, sizes, label }) => {\r\n const positions = createCircularPositions(images.length, 80);\r\n\r\n return (\r\n