import type { ReactNode } from "react"; import { type MentionSource } from "./mentionAutocomplete"; export type UseMentionAutocompleteOptions = { /** The textarea the mentions are typed into (e.g. an OverType instance's textarea). */ textarea: HTMLTextAreaElement | null; /** Reads the current full text. Defaults to `textarea.value`. */ getText?: () => string; /** * Writes the full text back and positions the caret. Defaults to mutating * `textarea.value` directly; pass a custom writer when a wrapper (OverType, * a controlled component) owns the value. */ setText?: (text: string, caret: number) => void; /** Sources to use. Falls back to the global registry (`setMentionSources`). */ sources?: MentionSource[]; /** Master switch; when false the popup never opens. Default true. */ enabled?: boolean; /** * When true (default) the hook attaches its own capture-phase keydown listener * to the textarea. Set false to drive navigation yourself via the returned * `onKeyDown` (useful when another handler must take priority ordering). */ attachKeyDown?: boolean; /** Debounce (ms) before an async `search` runs. Default 150. */ searchDebounceMs?: number; }; export type UseMentionAutocompleteResult = { /** Render this somewhere in the tree; it portals the popup to `document.body`. */ overlay: ReactNode; /** * Feed keydown events here when `attachKeyDown` is false. Returns true when the * event was consumed (it also calls preventDefault / stopImmediatePropagation). */ onKeyDown: (event: KeyboardEvent) => boolean; isOpen: boolean; close: () => void; }; export declare function useMentionAutocomplete(options: UseMentionAutocompleteOptions): UseMentionAutocompleteResult;