UNPKG

2.94 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent2, InputGroupProps2, IPopoverProps } from "@blueprintjs/core";
3import { IListItemsProps } from "../../common";
4export declare type SelectProps<T> = ISelectProps<T>;
5/** @deprecated use SelectProps */
6export interface ISelectProps<T> extends IListItemsProps<T> {
7 children?: React.ReactNode;
8 /**
9 * Whether the component should take up the full width of its container.
10 * This overrides `popoverProps.fill`. You also have to ensure that the child
11 * component has `fill` set to `true` or is styled appropriately.
12 */
13 fill?: boolean;
14 /**
15 * Whether the dropdown list can be filtered.
16 * Disabling this option will remove the `InputGroup` and ignore `inputProps`.
17 *
18 * @default true
19 */
20 filterable?: boolean;
21 /**
22 * Whether the component is non-interactive.
23 * If true, the list's item renderer will not be called.
24 * Note that you'll also need to disable the component's children, if appropriate.
25 *
26 * @default false
27 */
28 disabled?: boolean;
29 /**
30 * Props to spread to the query `InputGroup`. Use `query` and
31 * `onQueryChange` instead of `inputProps.value` and `inputProps.onChange`
32 * to control this input.
33 */
34 inputProps?: InputGroupProps2;
35 /**
36 * Whether the select popover should be styled so that it matches the width of the target.
37 * This is done using a popper.js modifier passed through `popoverProps`.
38 *
39 * Note that setting `matchTargetWidth={true}` will also set `popoverProps.usePortal={false}` and `popoverProps.wrapperTagName="div"`.
40 *
41 * @default false
42 */
43 matchTargetWidth?: boolean;
44 /** Props to spread to `Popover`. Note that `content` cannot be changed. */
45 popoverProps?: Partial<IPopoverProps> & object;
46 /**
47 * Whether the active item should be reset to the first matching item _when
48 * the popover closes_. The query will also be reset to the empty string.
49 *
50 * @default false
51 */
52 resetOnClose?: boolean;
53}
54export interface ISelectState {
55 isOpen: boolean;
56}
57export declare class Select<T> extends AbstractPureComponent2<SelectProps<T>, ISelectState> {
58 static displayName: string;
59 static ofType<U>(): new (props: SelectProps<U>) => Select<U>;
60 state: ISelectState;
61 private TypedQueryList;
62 inputElement: HTMLInputElement | null;
63 private queryList;
64 private previousFocusedElement;
65 private handleInputRef;
66 private handleQueryListRef;
67 render(): JSX.Element;
68 componentDidUpdate(prevProps: SelectProps<T>, prevState: ISelectState): void;
69 private renderQueryList;
70 private maybeRenderClearButton;
71 private handleTargetKeyDown;
72 private handleItemSelect;
73 private handlePopoverInteraction;
74 private handlePopoverOpening;
75 private handlePopoverOpened;
76 private handlePopoverClosing;
77 private resetQuery;
78}