@atlaskit/mention
Version:
A React component used to display user profiles in a list for 'Mention' functionality
78 lines (77 loc) • 2.76 kB
TypeScript
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next/withAnalyticsEvents';
import React from 'react';
import { type IntlShape } from 'react-intl-next';
import { type MentionProvider } from '../../api/MentionResource';
import { type PresenceProvider } from '../../api/PresenceResource';
import { type OnMentionEvent } from '../../types';
export interface OnOpen {
(): void;
}
export interface OnClose {
(): void;
}
export type Position = 'above' | 'below' | 'auto';
export interface Props {
resourceProvider: MentionProvider;
presenceProvider?: PresenceProvider;
query?: string;
onSelection?: OnMentionEvent;
onOpen?: OnOpen;
onClose?: OnClose;
target?: string;
position?: Position;
zIndex?: number | string;
offsetX?: number;
offsetY?: number;
}
export interface State {
visible: boolean;
info?: string;
}
/**
* @class MentionPicker
*/
export declare class MentionPicker extends React.PureComponent<Props & WithAnalyticsEventsProps & {
intl: IntlShape;
}, State> {
private subscriberKey;
private mentionListRef?;
static defaultProps: {
onSelection: () => void;
onOpen: () => void;
onClose: () => void;
};
constructor(props: Props & WithAnalyticsEventsProps & {
intl: IntlShape;
});
componentDidMount(): void;
UNSAFE_componentWillReceiveProps(nextProps: Props & WithAnalyticsEventsProps): void;
componentWillUnmount(): void;
selectNext: () => void;
selectPrevious: () => void;
selectIndex: (index: number, callback?: () => any) => void;
selectId: (id: string, callback?: () => any) => void;
chooseCurrentSelection: () => void;
mentionsCount: () => number;
private applyPropChanges;
private subscribeResourceProvider;
private unsubscribeResourceProvider;
/**
* Called after the 'visible' state is changed to decide whether the onOpen or onClose
* handlers should be called.
*
* It should be noted that the visible state of the component is not considered in
* this function. Instead the old state and new state should be passed as parameters.
*/
private onFilterVisibilityChange;
private filterChange;
private filterError;
private filterInfo;
private handleMentionListRef;
render(): React.JSX.Element;
}
export declare const MentionPickerWithAnalytics: React.ForwardRefExoticComponent<Omit<Omit<import("react-intl-next").WithIntlProps<React.PropsWithChildren<Props & WithAnalyticsEventsProps & {
intl: IntlShape;
}>>, "ref"> & React.RefAttributes<any>, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
export type MentionPickerWithAnalytics = MentionPicker;
export default MentionPickerWithAnalytics;