'use client'; /** * The autosuggest dropdown. Presentational only — it fetches nothing and owns * no state, so the fetching rules and the ARIA rules can be read separately. */ import type { Suggestion } from '@/lib/suggest'; import styles from './SuggestList.module.css'; /** The id the input's aria-activedescendant points at. */ export function suggestOptionId(id: string, index: number): string { return `${id}-option-${index}`; } interface Props { /** Shared with the input's aria-controls. */ id: string; suggestions: Suggestion[]; activeIndex: number; onPick: (s: Suggestion) => void; onHover: (index: number) => void; } export function SuggestList({ id, suggestions, activeIndex, onPick, onHover }: Props) { if (suggestions.length === 0) return null; return ( ); }