import React, { CSSProperties, ChangeEvent, FocusEvent, KeyboardEvent, ReactElement, ReactNode, Ref, RefObject, SyntheticEvent } from "react"; import * as _$react_jsx_runtime0 from "react/jsx-runtime"; //#region src/types.d.ts type MentionTrigger = string | RegExp; type MentionIdentifier = string | number; interface MentionSerializerMatch { markup: string; index: number; id: string; display?: string | null; } interface MentionSerializer { id: string; insert: (input: { id: MentionIdentifier; display: string; }) => string; findAll: (value: string) => MentionSerializerMatch[]; } type MentionDataItem = Record> = { id: MentionIdentifier; display?: string; highlights?: { start: number; end: number; }[]; } & Omit; type SuggestionDataItem = Record> = MentionDataItem; type MaybePromise = T | Promise; type MentionSearchReason = 'query' | 'page'; type MentionPageCursor = string | number | boolean | symbol | bigint | object; interface MentionSearchContext { signal: AbortSignal; cursor?: MentionPageCursor | null; reason: MentionSearchReason; } interface MentionDataPage = Record> { items: ReadonlyArray>; nextCursor?: MentionPageCursor | null; hasMore?: boolean; } type MentionDataProviderResult = Record> = ReadonlyArray> | MentionDataPage; type DataSource = Record> = ReadonlyArray> | ((query: string, context: MentionSearchContext) => MaybePromise>); interface QueryInfo { childIndex: number; query: string; querySequenceStart: number; querySequenceEnd: number; } interface SuggestionQueryState = Record> { queryInfo: QueryInfo; results: SuggestionDataItem[]; status: 'loading' | 'success' | 'error'; ignoreAccents?: boolean; error?: unknown; pagination?: { nextCursor: MentionPageCursor | null; hasMore: boolean; isLoading: boolean; error?: unknown; }; } type MentionRenderSuggestion = Record> = (suggestion: SuggestionDataItem, query: string, highlightedDisplay: ReactNode, index: number, focused: boolean) => ReactNode; type MentionRenderEmpty = (query: string) => ReactNode; type MentionRenderError = (query: string, error: unknown) => ReactNode; type DisplayTransform = (id: MentionIdentifier, display?: string | null) => string; type MentionSelectionState = 'inside' | 'boundary' | 'partial' | 'full'; interface MentionComponentProps = Record> { trigger?: MentionTrigger; markup?: string | MentionSerializer; displayTransform?: DisplayTransform; renderSuggestion?: MentionRenderSuggestion | null; renderEmpty?: MentionRenderEmpty | null; renderError?: MentionRenderError | null; data: DataSource; onAdd?: (params: { id: MentionIdentifier; display: string; startPos: number; endPos: number; serializerId: string; }) => void; onRemove?: (id: MentionIdentifier) => void; isLoading?: boolean; appendSpaceOnAdd?: boolean; debounceMs?: number; maxSuggestions?: number; selectionState?: MentionSelectionState; } type MentionsInputChangeTriggerType = 'input' | 'paste' | 'cut' | 'mention-add' | 'mention-remove' | 'insert-text'; interface MentionsInputChangeTrigger { type: MentionsInputChangeTriggerType; nativeEvent?: Event; } interface MentionOccurrence = Record> { id: MentionIdentifier; display: string; childIndex: number; index: number; plainTextIndex: number; data?: MentionDataItem; } interface MentionSelection = Record> extends MentionOccurrence { selection: MentionSelectionState; plainTextStart: number; plainTextEnd: number; serializerId: string; } interface MentionSelectionChangeEvent = Record> { value: string; plainTextValue: string; idValue: string; mentions: MentionOccurrence[]; mentionIds: MentionIdentifier[]; mentionId?: MentionIdentifier; } interface MentionsInputChangeEvent = Record> { trigger: MentionsInputChangeTrigger; value: string; plainTextValue: string; idValue: string; mentionId?: MentionIdentifier; mentions: MentionOccurrence[]; previousValue: string; } type MentionsInputChangeHandler = Record> = (change: MentionsInputChangeEvent) => void; type MentionSelectionChangeHandler = Record> = (selection: MentionSelection[], context?: MentionSelectionChangeEvent) => void; type MentionsInputKeyDownHandler = (event: KeyboardEvent) => void; type MentionsInputAnchorMode = 'caret' | 'left'; type InputComponentProps = React.ComponentPropsWithoutRef<'input'> & React.ComponentPropsWithoutRef<'textarea'>; type InputComponent = React.ComponentType | React.ForwardRefExoticComponent>; interface MentionsInputHandle { insertText: (text: string) => void; } interface MentionsInputProps = Record> extends Omit, 'children' | 'onChange' | 'value' | 'defaultValue' | 'style' | 'onBlur'> { a11ySuggestionsListLabel?: string; anchorMode?: MentionsInputAnchorMode; suggestionsPlacement?: 'auto' | 'above' | 'below'; customSuggestionsContainer?: (children: ReactElement) => ReactElement; disabled?: boolean; inputComponent?: InputComponent; inputRef?: RefObject | ((el: HTMLInputElement | HTMLTextAreaElement | null) => void) | null; spellCheck?: boolean; onBlur?: (event: FocusEvent) => void; onMentionBlur?: (event: FocusEvent, clickedSuggestion: boolean) => void; onChange?: (event: ChangeEvent) => void; onMentionsChange?: MentionsInputChangeHandler; onMentionSelectionChange?: MentionSelectionChangeHandler; onKeyDown?: MentionsInputKeyDownHandler; onSelect?: (event: SyntheticEvent) => void; readOnly?: boolean; singleLine?: boolean; autoResize?: boolean; style?: React.CSSProperties; className?: string; classNames?: MentionsInputClassNames; suggestionsPortalHost?: Element | Document | null; suggestionsDisplay?: 'overlay' | 'inline'; value?: string; children: ReactElement> | Array>>; } /** * CSS class names for customizing the appearance of MentionsInput components. * All fields are optional and will be merged with the default styles. */ type MentionsInputClassNames = Partial<{ /** The outer wrapper div that contains the highlighter, input, and inline suggestions */control: string; /** The highlighter div that overlays the input to display mentions with custom styling */ highlighter: string; /** The span elements within the highlighter that render plain text substrings */ highlighterSubstring: string; /** The span element that marks the caret position in the highlighter for positioning inline suggestions */ highlighterCaret: string; /** The input or textarea element where the user types */ input: string; /** The wrapper div for inline autocomplete suggestions (when suggestionsDisplay='inline') */ inlineSuggestion: string; /** The span that wraps the inline suggestion text content */ inlineSuggestionText: string; /** The hidden prefix span shown before the visible inline suggestion text (for screen readers) */ inlineSuggestionPrefix: string; /** The visible suffix span containing the remaining suggestion text after the user's input */ inlineSuggestionSuffix: string; /** The outer container div for the suggestions overlay (when suggestionsDisplay='overlay') */ suggestions: string; /** Status content rendered when async results are empty or fail */ suggestionsStatus: string; /** The ul element that contains the list of suggestion items */ suggestionsList: string; /** The li element for each individual suggestion item */ suggestionItem: string; /** Additional class applied to the currently focused/highlighted suggestion item */ suggestionItemFocused: string; /** The span that wraps the display text of a suggestion */ suggestionDisplay: string; /** The b element used to highlight matching text within a suggestion */ suggestionHighlight: string; /** The outer div wrapper for the loading indicator */ loadingIndicator: string; /** The inner div that contains the loading spinner animation elements */ loadingSpinner: string; /** The individual span elements that make up the loading spinner dots */ loadingSpinnerElement: string; }>; type InputElement = HTMLInputElement | HTMLTextAreaElement; //#endregion //#region src/MentionsInput.d.ts type MentionsInputComponentProps = Record> = MentionsInputProps & { ref?: Ref; }; declare const MentionsInput: = Record>({ ref, ...props }: MentionsInputComponentProps) => ReactElement | null; //#endregion //#region src/Mention.d.ts interface MentionProps = Record> extends MentionComponentProps { readonly display?: string; readonly className?: string; readonly style?: CSSProperties; } declare function Mention = Record>({ display, className, style, selectionState }: Readonly>): _$react_jsx_runtime0.JSX.Element; //#endregion //#region src/utils/createMarkupSerializer.d.ts declare const createMarkupSerializer: (markup: string) => MentionSerializer; //#endregion //#region src/utils/makeTriggerRegex.d.ts interface TriggerOptions { allowSpaceInQuery?: boolean; ignoreAccents?: boolean; } declare const makeTriggerRegex: (trigger?: string | RegExp, options?: TriggerOptions) => RegExp; //#endregion //#region src/utils/getSubstringIndex.d.ts declare const getSubstringIndex: (haystack: string, needle: string, ignoreAccents?: boolean, caseInsensitive?: boolean) => number; //#endregion export { Mention, type MentionComponentProps, type MentionDataItem, type MentionDataPage, type MentionDataProviderResult, type MentionPageCursor, type MentionRenderEmpty, type MentionRenderError, type MentionSearchContext, type MentionSearchReason, type MentionSelection, type MentionSelectionState, type MentionSerializer, type MentionSerializerMatch, MentionsInput, type MentionsInputChangeEvent, type MentionsInputChangeHandler, type MentionsInputChangeTrigger, type MentionsInputChangeTriggerType, type MentionsInputClassNames, type MentionsInputHandle, type MentionsInputProps, type SuggestionQueryState, createMarkupSerializer, getSubstringIndex, makeTriggerRegex };