UNPKG

3.06 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent2, InputGroupProps2, IPopoverProps } from "@blueprintjs/core";
3import { ListItemsProps } from "../../common";
4export declare type SelectProps<T> = ISelectProps<T>;
5/** @deprecated use SelectProps */
6export interface ISelectProps<T> extends ListItemsProps<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}
57/**
58 * Select component.
59 *
60 * @see https://blueprintjs.com/docs/#select/select-component
61 * @deprecated use { Select2 } from "@blueprintjs/select"
62 */
63export declare class Select<T> extends AbstractPureComponent2<SelectProps<T>, ISelectState> {
64 static displayName: string;
65 static ofType<U>(): new (props: SelectProps<U>) => Select<U>;
66 state: ISelectState;
67 inputElement: HTMLInputElement | null;
68 private queryList;
69 private previousFocusedElement;
70 private handleInputRef;
71 private handleQueryListRef;
72 render(): JSX.Element;
73 componentDidUpdate(prevProps: SelectProps<T>, prevState: ISelectState): void;
74 private renderQueryList;
75 private maybeRenderClearButton;
76 private handleTargetKeyDown;
77 private handleItemSelect;
78 private handlePopoverInteraction;
79 private handlePopoverOpening;
80 private handlePopoverOpened;
81 private handlePopoverClosing;
82 private resetQuery;
83}