"use client"; import { useEffect, useMemo, useRef, useState } from "react"; import type { components } from "@/lib/api/schema"; type Person = components["schemas"]["PersonRead"]; /** * A type-to-filter person picker. Shows a text input; as you type, a dropdown * of matching people appears. Selecting one sets `value` (a person id) and * fills the input with their name. Replaces a plain setOpen(true)} onChange={(e) => { setQuery(e.target.value); setOpen(true); if (value) onChange(""); // typing invalidates the prior pick }} /> {open && (matches.length > 0 || (onCreate && query.trim())) && ( )} ); }