import { Except } from '@remirror/core'; import type { ChangeReason, ExitReason, SuggestChangeHandlerProps, Suggester, SuggestState } from '@remirror/pm/suggest'; /** * This hook allows you to dynamically create a suggester which can respond to * user input of activation characters or regex patterns. * * By adding a suggester it is possible to keep track of what the user has * typed and receive meaningful information in return. * * This includes * * - The range of the matching text * - The matching text value * - The query value, which excludes the matching character (or character regex). * - The matching capture groups [FULL_MATCH, MATCHING_CHARACTER, CUSTOM_GROUPS] * * The return value has two keys, `exit` and `change` which can both be * `undefined`. The reason for including both the `exit` and `change` return * values is that it's possible for both to occur at the the same time during a * **jump** from one [[`Suggester`]] _match_ to another suggester match. * * The cursor has exited and entered (changed) at the same time. */ export declare function useSuggest(props: UseSuggestProps): UseSuggestReturn; export interface UseSuggestProps extends Except { /** * Set to `true` to ignore changes which are purely caused by focus events. * * TODO - NOT YET IMPLEMENTED */ ignoreFocus?: boolean; } type SuggestStateMethods = Pick; interface ExitReasonProps { /** * The reason for the exit. More details can be found in the [[`ExitReason`]] docs. */ reason: ExitReason; } interface ChangeReasonProps { /** * The reason for the change. More details can be found in the [[`ChangeReason`]] docs. */ reason: ChangeReason; } export interface UseSuggestReturn extends SuggestStateMethods { change: (Pick & ChangeReasonProps) | undefined; exit: (Pick & ExitReasonProps) | undefined; } export {};