"use client"; /** * MentionPopup — the R3 mention picker's listbox (the popup the composer + * inline `@` open). A pure presentational component: it renders the grouped, * fuzzy-ranked `MentionGroup[]` from `buildMentionGroups` and forwards the * selection. Keyboard nav (arrows/Enter/Tab/Esc) + the flat highlight index * live in the host `MentionInput`; this component maps the flat index back * to the group row it belongs to. * * A11y (ux §12 "mention popup = listbox"): the container is `role=listbox`, * each group is a labelled `role=group`, each option is `role=option` with * the accessible name = "Label (Kind)" (e.g. "Engineering (Team)"), * `aria-selected` on the highlighted row. */ import { UserAvatar } from "@/components/database/cell-renderer"; import { AtSign, Database, FileText, Users } from "lucide-react"; import type { MentionGroup, MentionItem, MentionKind } from "./mention-model"; export interface MentionPopupProps { groups: MentionGroup[]; /** The flat highlight index across ALL groups' items (the keyboard cursor). */ highlight: number; loading?: boolean; onPick: (item: MentionItem) => void; onHover: (flatIndex: number) => void; } const GROUP_ICON: Record = { user: AtSign, team: Users, page: FileText, database: Database }; /** * The SINGULAR kind descriptor for an option's accessible name (ux §12): * "Ana (Member)", "Engineering (Team)", "Launch Plan (Page)". The group * headers stay the plural labels; the per-option name is singular. */ const KIND_A11Y: Record = { user: "Member", team: "Team", page: "Page", database: "Database" }; export function MentionPopup({ groups, highlight, loading, onPick, onHover }: MentionPopupProps) { let flat = 0; return ( ); }