1 | import * as React from "react";
|
2 | import { AbstractPureComponent2, InputGroupProps2 } from "@blueprintjs/core";
|
3 | import { ListItemsProps, SelectPopoverProps } from "../../common";
|
4 | export interface Select2Props<T> extends ListItemsProps<T>, SelectPopoverProps {
|
5 | /**
|
6 | * Element which triggers the select popover. In most cases, you should display
|
7 | * the name or label of the curently selected item here.
|
8 | */
|
9 | children?: React.ReactNode;
|
10 | /**
|
11 | * Whether the component is non-interactive.
|
12 | * If true, the list's item renderer will not be called.
|
13 | * Note that you'll also need to disable the component's children, if appropriate.
|
14 | *
|
15 | * @default false
|
16 | */
|
17 | disabled?: boolean;
|
18 | /**
|
19 | * Whether the component should take up the full width of its container.
|
20 | * You also have to ensure that the child component has `fill` set to `true` or is styled appropriately.
|
21 | */
|
22 | fill?: boolean;
|
23 | /**
|
24 | * Whether the dropdown list can be filtered.
|
25 | * Disabling this option will remove the `InputGroup` and ignore `inputProps`.
|
26 | *
|
27 | * @default true
|
28 | */
|
29 | filterable?: boolean;
|
30 | /**
|
31 | * Props to pass to the query [InputGroup component](#core/components/text-inputs.input-group).
|
32 | *
|
33 | * Some properties are unavailable:
|
34 | * - `inputProps.value`: use `query` instead
|
35 | * - `inputProps.onChange`: use `onQueryChange` instead
|
36 | */
|
37 | inputProps?: Partial<Omit<InputGroupProps2, "value" | "onChange">>;
|
38 | /**
|
39 | * HTML attributes to add to the `Menu` listbox containing the selectable options.
|
40 | */
|
41 | menuProps?: React.HTMLAttributes<HTMLUListElement>;
|
42 | /**
|
43 | * Whether the active item should be reset to the first matching item _when
|
44 | * the popover closes_. The query will also be reset to the empty string.
|
45 | *
|
46 | * @default false
|
47 | */
|
48 | resetOnClose?: boolean;
|
49 | }
|
50 | export interface Select2State {
|
51 | isOpen: boolean;
|
52 | }
|
53 | /**
|
54 | * Select (v2) component.
|
55 | *
|
56 | * @see https://blueprintjs.com/docs/#select/select2
|
57 | */
|
58 | export declare class Select2<T> extends AbstractPureComponent2<Select2Props<T>, Select2State> {
|
59 | static displayName: string;
|
60 | /** @deprecated no longer necessary now that the TypeScript parser supports type arguments on JSX element tags */
|
61 | static ofType<U>(): new (props: Select2Props<U>) => Select2<U>;
|
62 | state: Select2State;
|
63 | inputElement: HTMLInputElement | null;
|
64 | private queryList;
|
65 | private previousFocusedElement;
|
66 | private handleInputRef;
|
67 | private handleQueryListRef;
|
68 | private listboxId;
|
69 | render(): JSX.Element;
|
70 | componentDidUpdate(prevProps: Select2Props<T>, prevState: Select2State): void;
|
71 | private renderQueryList;
|
72 | private getPopoverTargetRenderer;
|
73 | private maybeRenderClearButton;
|
74 | private withPopoverTargetPropsHandler;
|
75 | /**
|
76 | * Target wrapper element "keydown" handler while the popover is closed.
|
77 | */
|
78 | private handleTargetKeyDown;
|
79 | private handleItemSelect;
|
80 | private handlePopoverInteraction;
|
81 | private handlePopoverOpening;
|
82 | private handlePopoverOpened;
|
83 | private handlePopoverClosing;
|
84 | private resetQuery;
|
85 | }
|