UNPKG

2.03 kBTypeScriptView Raw
1import * as React from 'react';
2import { ConfigConsumerProps } from '../CompatibleConsumer';
3export declare type MentionPlacement = 'top' | 'bottom';
4declare type SuggestionItem = React.ReactElement<{
5 value?: string;
6}> | string;
7export interface MentionProps {
8 prefixCls?: string;
9 suggestionStyle?: React.CSSProperties;
10 defaultSuggestions?: Array<SuggestionItem>;
11 suggestions?: Array<React.ReactElement<any>>;
12 onSearchChange?: (value: string, trigger: string) => any;
13 onChange?: (contentState: any) => void;
14 notFoundContent?: any;
15 loading?: boolean;
16 style?: React.CSSProperties;
17 defaultValue?: any;
18 value?: any;
19 className?: string;
20 multiLines?: boolean;
21 prefix?: string | string[];
22 placeholder?: string;
23 getSuggestionContainer?: (triggerNode: Element) => HTMLElement;
24 onFocus?: React.FocusEventHandler<HTMLElement>;
25 onBlur?: React.FocusEventHandler<HTMLElement>;
26 onSelect?: (suggestion: string, data?: any) => void;
27 readOnly?: boolean;
28 disabled?: boolean;
29 placement?: MentionPlacement;
30}
31export interface MentionState {
32 filteredSuggestions?: Array<any>;
33 focus?: Boolean;
34}
35declare class Mention extends React.Component<MentionProps, MentionState> {
36 static getMentions: any;
37 static defaultProps: {
38 notFoundContent: string;
39 loading: boolean;
40 multiLines: boolean;
41 placement: MentionPlacement;
42 };
43 static Nav: any;
44 static toString: any;
45 static toContentState: any;
46 private mentionEle;
47 constructor(props: MentionProps);
48 mentionRef: (ele: any) => void;
49 onSearchChange: (value: string, prefix: string) => any;
50 onChange: (editorState: any) => void;
51 onFocus: (ev: React.FocusEvent<HTMLElement>) => void;
52 onBlur: (ev: React.FocusEvent<HTMLElement>) => void;
53 focus: () => void;
54 defaultSearchChange(value: string): void;
55 renderMention: ({ getPrefixCls }: ConfigConsumerProps) => JSX.Element;
56 render(): JSX.Element;
57}
58export default Mention;