import React from 'react'; import { useSortable } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; import { Activity, ArrowUpDown, BarChart3, Bell, BookOpen, Bot, Calendar, CheckSquare, Copy, FileText, FolderOpen, Link as LinkIcon, Mail, MessageSquare, Settings, Shield, Sparkles, Tag, GripVertical, Trash2, Users, UsersRound, Workflow, } from 'lucide-react'; import clsx from 'clsx'; // Curated icon map — avoids `import * as LucideIcons` which loads ALL icons // and causes OOM in tests (ARCH-063). const ICON_MAP: Record> = { Activity, ArrowUpDown, BarChart: BarChart3, BarChart3, Bell, BookOpen, Bot, Calendar, CheckSquare, Copy, FolderOpen, Link: LinkIcon, Mail, MessageSquare, Settings, Shield, Sparkles, Tag, Trash: Trash2, Trash2, Users, UsersRound, Workflow, }; interface SortableMenuItemProps { id: string; label: string; icon: string; isGroup?: boolean; } function getIcon(name: string): React.ReactNode { const Icon = ICON_MAP[name]; return Icon ? : ; } export function SortableMenuItem({ id, label, icon, isGroup }: SortableMenuItemProps) { const { attributes, listeners, setNodeRef, transform, transition, isDragging, } = useSortable({ id }); const style = { transform: CSS.Transform.toString(transform), transition, }; return (
{isGroup ? : getIcon(icon)} {isGroup && {label}} {!isGroup && label}
); }