/** * Color Editor — compact list item with inline expand-to-edit * * Shows a color swatch + name row by default. * Pencil icon appears on hover. Clicking the row expands the editor inline. */ import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Button } from '@/components/ui/button' import { Pencil, Trash2, ChevronUp } from 'lucide-react' import { cn } from '@/lib/utils' import { GlobalColor } from '../config' interface ColorEditorProps { color: GlobalColor onChange: (updated: GlobalColor) => void onDelete?: () => void isOpen?: boolean onToggle?: () => void } export function ColorEditor({ color, onChange, onDelete, isOpen, onToggle }: ColorEditorProps) { return (
{/* ── Compact row ── */} {/* ── Expanded editor ── */} {isOpen && (
{/* Name */}
onChange({ ...color, name: e.target.value })} placeholder="Color name" className="h-8 text-sm" />
{/* Color picker + hex input */}
onChange({ ...color, value: e.target.value })} className="w-10 h-8 p-0 cursor-pointer shrink-0" /> onChange({ ...color, value: e.target.value })} placeholder="#000000" className="h-8 font-mono text-sm" />
{/* Delete (only for user-added tokens) */} {!color.isDefault && onDelete && ( )}
)}
) }