| 1 |
/// <reference types="react" /> |
| 2 |
import { MenuProps } from '../Menu'; |
| 3 |
import { PopperOptions } from '../../helpers/Popper/Popper'; |
| 4 |
import { OUIAProps } from '../../helpers'; |
| 5 |
import type { SelectOptionProps } from './SelectOption'; |
| 6 |
/** @deprecated Use PopperOptions instead */ |
| 7 |
export type SelectPopperProps = PopperOptions; |
| 8 |
export interface SelectToggleProps { |
| 9 |
/** Select toggle node. */ |
| 10 |
toggleNode: React.ReactNode; |
| 11 |
/** Reference to the toggle. */ |
| 12 |
toggleRef?: React.RefObject<HTMLButtonElement | null>; |
| 13 |
} |
| 14 |
/** |
| 15 |
* See the Menu documentation for additional props that may be passed. |
| 16 |
*/ |
| 17 |
export interface SelectProps extends MenuProps, OUIAProps { |
| 18 |
/** Anything which can be rendered in a select */ |
| 19 |
children?: React.ReactNode; |
| 20 |
/** Classes applied to root element of select */ |
| 21 |
className?: string; |
| 22 |
/** Flag to indicate if select is open */ |
| 23 |
isOpen?: boolean; |
| 24 |
/** Single select option value for single select menus, or array of select option values for multi select. You can also specify isSelected on the SelectOption. */ |
| 25 |
selected?: any | any[]; |
| 26 |
/** Select toggle. The toggle should either be a renderer function which forwards the given toggle ref, or a direct ReactNode that should be passed along with the toggleRef property. */ |
| 27 |
toggle: SelectToggleProps | ((toggleRef: React.RefObject<any>) => React.ReactNode); |
| 28 |
/** Flag indicating the toggle should be focused after a selection. If this use case is too restrictive, the optional toggleRef property with a node toggle may be used to control focus. */ |
| 29 |
shouldFocusToggleOnSelect?: boolean; |
| 30 |
/** @beta Flag indicating the first menu item should be focused after opening the menu. */ |
| 31 |
shouldFocusFirstItemOnOpen?: boolean; |
| 32 |
/** Function callback when user selects an option. */ |
| 33 |
onSelect?: (event?: React.MouseEvent<Element, MouseEvent>, value?: SelectOptionProps['value']) => void; |
| 34 |
/** Callback to allow the select component to change the open state of the menu. |
| 35 |
* Triggered by clicking outside of the menu, or by pressing any keys specified in onOpenChangeKeys. */ |
| 36 |
onOpenChange?: (isOpen: boolean) => void; |
| 37 |
/** Keys that trigger onOpenChange, defaults to tab and escape. It is highly recommended to include Escape in the array, while Tab may be omitted if the menu contains non-menu items that are focusable. */ |
| 38 |
onOpenChangeKeys?: string[]; |
| 39 |
/** Callback to override the toggle keydown behavior. By default, when the toggle has focus and the menu is open, pressing the up/down arrow keys will focus a valid non-disabled menu item - the first item for the down arrow key and last item for the up arrow key. */ |
| 40 |
onToggleKeydown?: (event: KeyboardEvent) => void; |
| 41 |
/** Select variant. For typeahead variant focus won't shift to menu items when pressing up/down arrows. */ |
| 42 |
variant?: 'default' | 'typeahead'; |
| 43 |
/** Indicates if the select should be without the outer box-shadow */ |
| 44 |
isPlain?: boolean; |
| 45 |
/** @hide Forwarded ref */ |
| 46 |
innerRef?: React.Ref<HTMLDivElement>; |
| 47 |
/** z-index of the select menu */ |
| 48 |
zIndex?: number; |
| 49 |
/** Determines the accessible role of the select. For a checkbox select pass in "menu". */ |
| 50 |
role?: string; |
| 51 |
/** Additional properties to pass to the popper */ |
| 52 |
popperProps?: PopperOptions; |
| 53 |
/** Height of the select menu */ |
| 54 |
menuHeight?: string; |
| 55 |
/** Maximum height of select menu */ |
| 56 |
maxMenuHeight?: string; |
| 57 |
/** Indicates if the select menu should be scrollable */ |
| 58 |
isScrollable?: boolean; |
| 59 |
/** Flag indicating if scroll on focus of the first menu item should occur. */ |
| 60 |
shouldPreventScrollOnItemFocus?: boolean; |
| 61 |
/** Time in ms to wait before firing the toggles' focus event. Defaults to 0 */ |
| 62 |
focusTimeoutDelay?: number; |
| 63 |
} |
| 64 |
export declare const Select: import("react").ForwardRefExoticComponent<SelectProps & import("react").RefAttributes<any>>; |
| 65 |
//# sourceMappingURL=Select.d.ts.map |