UNPKG

@atlaskit/mention

Version:

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

78 lines (77 loc) 2.76 kB
import React from 'react'; import { type IntlShape, type WithIntlProps } from 'react-intl-next'; import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next/withAnalyticsEvents'; 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 { offsetX?: number; offsetY?: number; onClose?: OnClose; onOpen?: OnOpen; onSelection?: OnMentionEvent; position?: Position; presenceProvider?: PresenceProvider; query?: string; resourceProvider: MentionProvider; target?: string; zIndex?: number | string; } export interface State { info?: string; visible: boolean; } /** * @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<WithIntlProps<React.PropsWithChildren<Props & WithAnalyticsEventsProps & { intl: IntlShape; }>>, 'ref'> & React.RefAttributes<any>, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>; export type MentionPickerWithAnalytics = MentionPicker; export default MentionPickerWithAnalytics;