import { useRef, useState } from 'react'; import type { BrandInputs, BrandOutputs, ColorSwatch, LockedSections, Typography } from '../types'; import { CopyButton } from './CopyButton'; // ── Editable text ───────────────────────────────────────────────────────────── interface EditableProps { value: string; onChange: (v: string) => void; multiline?: boolean; } function Editable({ value, onChange, multiline = false }: EditableProps) { const [editing, setEditing] = useState(false); const [draft, setDraft] = useState(value); const ref = useRef(null); const commit = () => { setEditing(false); if (draft !== value) onChange(draft); }; if (!editing) { return (
{ setDraft(value); setEditing(true); }} title="Click to edit" style={{ whiteSpace: multiline ? 'pre-wrap' : 'normal', padding: '2px 4px', margin: '-2px -4px' }} > {value}
); } if (multiline) { return (