UNPKG

@atlaskit/mention

Version:

A React component used to display user profiles in a list for 'Mention' functionality

24 lines (23 loc) 1.98 kB
import { type MentionProvider, type MentionContextIdentifier, ErrorCallback, InfoCallback, ResultCallback } from './MentionResource'; import { type MentionDescription, type InviteFromMentionProvider, type XProductInviteMentionProvider } from '../types'; export type { MentionDescription }; export type MentionProviderFunctions = Omit<{ [Key in keyof MentionProvider]: MentionProvider[Key] extends Function ? MentionProvider[Key] : never; }, keyof InviteFromMentionProvider | keyof XProductInviteMentionProvider>; /** * This component is stateful and should be instantianted per contextIdentifiers. */ export default class ContextMentionResource implements MentionProvider { private mentionProvider; private contextIdentifier; constructor(mentionProvider: MentionProvider, contextIdentifier: MentionContextIdentifier); getContextIdentifier(): MentionContextIdentifier | undefined; callWithContextIds: <K extends "subscribe" | "unsubscribe" | "filter" | "recordMentionSelection" | "shouldHighlightMention" | "isFiltering">(f: K, declaredArgs: number) => MentionProvider[K]; callDefault: <K extends "subscribe" | "unsubscribe" | "filter" | "recordMentionSelection" | "shouldHighlightMention" | "isFiltering">(f: K) => MentionProvider[K]; subscribe: (key: string, callback?: ResultCallback<MentionDescription[]> | undefined, errCallback?: ErrorCallback | undefined, infoCallback?: InfoCallback | undefined, allResultsCallback?: ResultCallback<MentionDescription[]> | undefined, analyticsCallback?: import("../types").AnalyticsCallback | undefined) => void; unsubscribe: (key: string) => void; filter: (query?: string | undefined, contextIdentifier?: MentionContextIdentifier | undefined) => void; recordMentionSelection: (mention: MentionDescription, contextIdentifier?: MentionContextIdentifier | undefined) => void; shouldHighlightMention: (mention: MentionDescription) => boolean; isFiltering: (query: string) => boolean; }