1 | /// <reference types="react" />
|
2 | import { AbstractPureComponent2, InputGroupProps2, IPopoverProps } from "@blueprintjs/core";
|
3 | import { ListItemsProps } from "../../common";
|
4 | export declare type SuggestProps<T> = ISuggestProps<T>;
|
5 | /** @deprecated use SuggestProps */
|
6 | export interface ISuggestProps<T> extends ListItemsProps<T> {
|
7 | /**
|
8 | * Whether the popover should close after selecting an item.
|
9 | *
|
10 | * @default true
|
11 | */
|
12 | closeOnSelect?: boolean;
|
13 | /** Whether the input field should be disabled. */
|
14 | disabled?: boolean;
|
15 | /**
|
16 | * Whether the component should take up the full width of its container.
|
17 | * This overrides `popoverProps.fill` and `inputProps.fill`.
|
18 | */
|
19 | fill?: boolean;
|
20 | /**
|
21 | * Props to spread to the query `InputGroup`. To control this input, use
|
22 | * `query` and `onQueryChange` instead of `inputProps.value` and
|
23 | * `inputProps.onChange`.
|
24 | */
|
25 | inputProps?: InputGroupProps2;
|
26 | /** Custom renderer to transform an item into a string for the input value. */
|
27 | inputValueRenderer: (item: T) => string;
|
28 | /**
|
29 | * The uncontrolled default selected item.
|
30 | * This prop is ignored if `selectedItem` is used to control the state.
|
31 | */
|
32 | defaultSelectedItem?: T;
|
33 | /**
|
34 | * The currently selected item, or `null` to indicate that no item is selected.
|
35 | * If omitted or `undefined`, this prop will be uncontrolled (managed by the component's state).
|
36 | * Use `onItemSelect` to listen for updates.
|
37 | */
|
38 | selectedItem?: T | null;
|
39 | /**
|
40 | * If true, the component waits until a keydown event in the TagInput
|
41 | * before opening its popover.
|
42 | *
|
43 | * If false, the popover opens immediately after a mouse click or TAB key
|
44 | * interaction focuses the component's TagInput.
|
45 | *
|
46 | * @default false
|
47 | */
|
48 | openOnKeyDown?: boolean;
|
49 | /** Props to spread to `Popover`. Note that `content` cannot be changed. */
|
50 | popoverProps?: Partial<IPopoverProps> & object;
|
51 | /**
|
52 | * Whether the active item should be reset to the first matching item _when
|
53 | * the popover closes_. The query will also be reset to the empty string.
|
54 | *
|
55 | * @default false
|
56 | */
|
57 | resetOnClose?: boolean;
|
58 | }
|
59 | export interface ISuggestState<T> {
|
60 | isOpen: boolean;
|
61 | selectedItem: T | null;
|
62 | }
|
63 | /**
|
64 | * Suggest component.
|
65 | *
|
66 | * @see https://blueprintjs.com/docs/#select/suggest
|
67 | * @deprecated use { Suggest2 } from "@blueprintjs/select"
|
68 | */
|
69 | export declare class Suggest<T> extends AbstractPureComponent2<SuggestProps<T>, ISuggestState<T>> {
|
70 | static displayName: string;
|
71 | static defaultProps: Partial<SuggestProps<any>>;
|
72 | static ofType<U>(): new (props: SuggestProps<U>) => Suggest<U>;
|
73 | state: ISuggestState<T>;
|
74 | inputElement: HTMLInputElement | null;
|
75 | private queryList;
|
76 | private handleInputRef;
|
77 | private handleQueryListRef;
|
78 | render(): JSX.Element;
|
79 | componentDidUpdate(prevProps: SuggestProps<T>, prevState: ISuggestState<T>): void;
|
80 | private renderQueryList;
|
81 | private selectText;
|
82 | private handleInputFocus;
|
83 | private handleItemSelect;
|
84 | private getInitialSelectedItem;
|
85 | private handlePopoverInteraction;
|
86 | private handlePopoverOpening;
|
87 | private handlePopoverOpened;
|
88 | private getTargetKeyDownHandler;
|
89 | private getTargetKeyUpHandler;
|
90 | private maybeResetActiveItemToSelectedItem;
|
91 | }
|