@mtg-rio/mui-mentions
Version:
@mention people in a MUI TextField
23 lines (22 loc) • 1.24 kB
TypeScript
import React from 'react';
import { BaseSuggestionData, SuggestionData, SuggestionDataSource, SuggestionsQueryInfo } from './types';
interface SuggestionsOverlayProps<T extends BaseSuggestionData> {
/** The markup value string. */
value: string;
/** An array of data sources used in the markup string. */
dataSources: SuggestionDataSource<T>[];
/** The start of the selected text range in the plain text value. */
selectionStart: number | null;
/** The end of the selected text range in the plain text value. */
selectionEnd: number | null;
/** Whether the suggestions data is loading. */
loading: boolean;
/** A ref to the element which keeps track of the cursor position. */
cursorRef: React.RefObject<HTMLSpanElement>;
/** Callback invoked with the selected suggestion. */
onSelect: ({ id, display }: SuggestionData<T>, { childIndex, querySequenceStart, querySequenceEnd, plainTextValue }: SuggestionsQueryInfo) => void;
/** Callback invoked on mouse down in the suggestions overlay. */
onMouseDown: () => void;
}
declare function SuggestionsOverlay<T extends BaseSuggestionData>(props: SuggestionsOverlayProps<T>): React.JSX.Element | null;
export default SuggestionsOverlay;