UNPKG

1.92 kBTypeScriptView Raw
1/**
2 * To match accessibility requirement, we always provide an input in the component.
3 * Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
4 * For focused select, we set `aria-live="polite"` to update the accessibility content.
5 *
6 * ref:
7 * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
8 *
9 * New api:
10 * - listHeight
11 * - listItemHeight
12 * - component
13 *
14 * Remove deprecated api:
15 * - multiple
16 * - tags
17 * - combobox
18 * - firstActiveValue
19 * - dropdownMenuStyle
20 * - openClassName (Not list in api)
21 *
22 * Update:
23 * - `backfill` only support `combobox` mode
24 * - `combobox` mode not support `labelInValue` since it's meaningless
25 * - `getInputElement` only support `combobox` mode
26 * - `onChange` return OptionData instead of ReactNode
27 * - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
28 * - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
29 * - `combobox` mode not support `optionLabelProp`
30 */
31import * as React from 'react';
32import type { OptionsType as SelectOptionsType } from './interface';
33import Option from './Option';
34import OptGroup from './OptGroup';
35import type { SelectProps, RefSelectProps } from './generate';
36import type { DefaultValueType } from './interface/generator';
37export declare type ExportedSelectProps<ValueType extends DefaultValueType = DefaultValueType> = SelectProps<SelectOptionsType, ValueType>;
38/**
39 * Typescript not support generic with function component,
40 * we have to wrap an class component to handle this.
41 */
42declare class Select<VT> extends React.Component<SelectProps<SelectOptionsType, VT>> {
43 static Option: typeof Option;
44 static OptGroup: typeof OptGroup;
45 selectRef: React.RefObject<RefSelectProps>;
46 focus: () => void;
47 blur: () => void;
48 render(): JSX.Element;
49}
50export default Select;