1 | import * as React from "react";
|
2 | import { AbstractPureComponent, type InputGroupProps } from "@blueprintjs/core";
|
3 | import { type ListItemsProps, type SelectPopoverProps } from "../../common";
|
4 | export interface SelectProps<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/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<InputGroupProps, "value" | "onChange">>;
|
38 | /**
|
39 | * HTML attributes to add to the `Menu` listbox containing the selectable options.
|
40 | */
|
41 | menuProps?: React.HTMLAttributes<HTMLUListElement>;
|
42 | /**
|
43 | * A placeholder string passed to the filter text input.
|
44 | * Applicable only when `filterable` is `true`.
|
45 | *
|
46 | * @default "Filter..."
|
47 | */
|
48 | placeholder?: string;
|
49 | /**
|
50 | * Whether the active item should be reset to the first matching item _when
|
51 | * the popover closes_. The query will also be reset to the empty string.
|
52 | *
|
53 | * @default false
|
54 | */
|
55 | resetOnClose?: boolean;
|
56 | }
|
57 | /** Exported for testing, not part of public API */
|
58 | export interface SelectState {
|
59 | isOpen: boolean;
|
60 | }
|
61 | /**
|
62 | * Select component.
|
63 | *
|
64 | * @see https://blueprintjs.com/docs/#select/select
|
65 | */
|
66 | export declare class Select<T> extends AbstractPureComponent<SelectProps<T>, SelectState> {
|
67 | static displayName: string;
|
68 | /** @deprecated no longer necessary now that the TypeScript parser supports type arguments on JSX element tags */
|
69 | static ofType<U>(): new (props: SelectProps<U>) => Select<U>;
|
70 | state: SelectState;
|
71 | inputElement: HTMLInputElement | null;
|
72 | private queryList;
|
73 | private previousFocusedElement;
|
74 | private handleInputRef;
|
75 | private handleQueryListRef;
|
76 | private listboxId;
|
77 | render(): React.JSX.Element;
|
78 | componentDidUpdate(prevProps: SelectProps<T>, prevState: SelectState): void;
|
79 | private renderQueryList;
|
80 | private getPopoverTargetRenderer;
|
81 | private maybeRenderClearButton;
|
82 | private withPopoverTargetPropsHandler;
|
83 | /**
|
84 | * Target wrapper element "keydown" handler while the popover is closed.
|
85 | */
|
86 | private handleTargetKeyDown;
|
87 | private handleItemSelect;
|
88 | private handlePopoverInteraction;
|
89 | private handlePopoverOpening;
|
90 | private handlePopoverOpened;
|
91 | private handlePopoverClosing;
|
92 | private resetQuery;
|
93 | }
|