import type { RefObject } from "react";
import { type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from "react";
export interface TextareaCommand {
    id: string;
    label: ReactNode;
    description?: ReactNode;
    icon?: ReactNode;
    /** Text to insert at the caret. Can be a string OR a function that
     *  receives the live query and returns the string — useful for
     *  commands that consume the typed query (e.g. `/mention bob` →
     *  `@bob`). */
    insert: string | ((query: string) => string);
    /** Extra keywords to match against the typed query in addition to
     *  the rendered `label` (when label is a string) and `description`. */
    keywords?: string[];
}
export interface UseTextareaCommandsOptions {
    textareaRef: RefObject<HTMLTextAreaElement | null>;
    /** Controlled value — pass the same string you pass to the textarea. */
    value: string;
    /** Setter — receives the new full value after insertion. */
    onChange: (next: string) => void;
    commands: TextareaCommand[];
    /** Trigger character. Default `"/"`. */
    trigger?: string;
    /** Open the palette as soon as the trigger is typed (even with no
     *  query). Default `true`. Set `false` if you want consumers to type
     *  at least one character to open. */
    openOnEmptyTrigger?: boolean;
    /** Maximum visible items in the filtered result list. Default 8. */
    maxItems?: number;
}
export interface UseTextareaCommandsReturn {
    /** Whether the palette is currently open. */
    isOpen: boolean;
    /** Query typed after the trigger (without the trigger character). */
    query: string;
    /** Highlighted item index (0-based). */
    activeIndex: number;
    /** Filtered + capped list of matching commands. */
    items: TextareaCommand[];
    /** Keydown handler — wire to the textarea's `onKeyDown`. Returns
     *  `true` if the key was consumed (so the consumer can stop). */
    onKeyDown: (e: ReactKeyboardEvent<HTMLTextAreaElement>) => boolean;
    /** Force-close the palette (e.g. on textarea blur). */
    dismiss: () => void;
    /** Commit the supplied command — inserts its text at the trigger
     *  position and consumes the trigger + query. */
    commit: (cmd: TextareaCommand) => void;
    /** Pixel position of the caret at the moment the palette opened.
     *  Use to anchor the popover in your own UI. */
    caretRect: DOMRect | null;
}
export declare function useTextareaCommands({ textareaRef, value, onChange, commands, trigger, openOnEmptyTrigger, maxItems, }: UseTextareaCommandsOptions): UseTextareaCommandsReturn;
//# sourceMappingURL=useTextareaCommands.d.ts.map