1 | import type { CommonInputProps } from 'rc-input/lib/interface';
|
2 | import type { TextAreaProps } from 'rc-textarea';
|
3 | import React from 'react';
|
4 | import type { OptionProps } from './Option';
|
5 | import Option from './Option';
|
6 | import { filterOption as defaultFilterOption, validateSearch as defaultValidateSearch } from './util';
|
7 | type BaseTextareaAttrs = Omit<TextAreaProps, 'prefix' | 'onChange' | 'onSelect' | 'showCount' | 'classNames'>;
|
8 | export type Placement = 'top' | 'bottom';
|
9 | export type Direction = 'ltr' | 'rtl';
|
10 | export interface DataDrivenOptionProps extends Omit<OptionProps, 'children'> {
|
11 | label?: React.ReactNode;
|
12 | }
|
13 | export interface MentionsProps extends BaseTextareaAttrs {
|
14 | autoFocus?: boolean;
|
15 | className?: string;
|
16 | defaultValue?: string;
|
17 | notFoundContent?: React.ReactNode;
|
18 | split?: string;
|
19 | style?: React.CSSProperties;
|
20 | transitionName?: string;
|
21 | placement?: Placement;
|
22 | direction?: Direction;
|
23 | prefix?: string | string[];
|
24 | prefixCls?: string;
|
25 | value?: string;
|
26 | silent?: boolean;
|
27 | filterOption?: false | typeof defaultFilterOption;
|
28 | validateSearch?: typeof defaultValidateSearch;
|
29 | onChange?: (text: string) => void;
|
30 | onSelect?: (option: OptionProps, prefix: string) => void;
|
31 | onSearch?: (text: string, prefix: string) => void;
|
32 | onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;
|
33 | onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
|
34 | getPopupContainer?: () => HTMLElement;
|
35 | dropdownClassName?: string;
|
36 |
|
37 | open?: boolean;
|
38 | children?: React.ReactNode;
|
39 | options?: DataDrivenOptionProps[];
|
40 | classNames?: CommonInputProps['classNames'] & {
|
41 | mentions?: string;
|
42 | };
|
43 | onPopupScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
|
44 | }
|
45 | export interface MentionsRef {
|
46 | focus: VoidFunction;
|
47 | blur: VoidFunction;
|
48 |
|
49 | textarea: HTMLTextAreaElement | null;
|
50 | nativeElement: HTMLElement;
|
51 | }
|
52 | declare const Mentions: React.ForwardRefExoticComponent<MentionsProps & React.RefAttributes<MentionsRef>> & {
|
53 | Option: typeof Option;
|
54 | };
|
55 | export default Mentions;
|