// The sidebar's search field: a substring filter over the tree (name, command // and cwd). Escape clears it and hands the keyboard back to the list. export interface SidebarSearchProps { value: string; onChange(value: string): void; /** Escape on an already-empty field — the list wants the keyboard back. */ onDismiss?(): void; } export function SidebarSearch({ value, onChange, onDismiss }: SidebarSearchProps) { return (
onChange(e.currentTarget.value)} onKeyDown={(e) => { if (e.key !== "Escape") return; e.preventDefault(); if (value) onChange(""); else onDismiss?.(); }} />
); }