+
{
+ setQuery("");
+ setOpen(true);
+ }}
+ onChange={(e) => {
+ setQuery(e.target.value);
+ setOpen(true);
+ }}
+ onBlur={() => setOpen(false)}
+ onKeyDown={(e) => {
+ if (e.key === "Escape") setOpen(false);
+ if (e.key === "Enter" && open) {
+ e.preventDefault();
+ if (shown.length === 1) {
+ onChange(shown[0].name);
+ setOpen(false);
+ }
+ }
+ }}
+ />
+ {selected?.logo && !open && (
+

+ )}
+ {open && institutions && (
+
+ {shown.map((i) => (
+ -
+
+
+ ))}
+ {shown.length === 0 && (
+ - No banks match “{query}”.
+ )}
+ {matches.length > shown.length && (
+ -
+ {matches.length - shown.length} more — keep typing to narrow
+ down.
+
+ )}
+
+ )}
+
+