/** * dashboard-client/src/components/ui/SortableCard.tsx — sortable wrapper for * Overview grid cards. * * Drag isolation (Plexus PR #59 pattern): the sortable listeners live ONLY on * the grip icon. The card surface is not directly draggable — it keeps its * onClick (drill-down) and stays keyboard-accessible. */ import type React from "react"; import { useSortable } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; import { GripVertical } from "lucide-react"; import type { CardId } from "../../types/card"; export interface SortableCardProps { id: CardId; children: React.ReactNode; onClick?: () => void; } export function SortableCard({ id, children, onClick, }: SortableCardProps): React.ReactElement { const { attributes, listeners, setNodeRef, transform, transition, isDragging, } = useSortable({ id }); const style: React.CSSProperties = { transform: CSS.Transform.toString(transform), transition, opacity: isDragging ? 0.5 : 1, zIndex: isDragging ? 10 : undefined, }; const handleKeyDown = (e: React.KeyboardEvent) => { if (onClick && (e.key === "Enter" || e.key === " ")) { e.preventDefault(); onClick(); } }; return (