| 1 |
/// <reference types="react" /> |
| 2 |
import { MenuProps } from '../Menu'; |
| 3 |
import { PopperOptions } from '../../helpers/Popper/Popper'; |
| 4 |
import type { DropdownItemProps } from './DropdownItem'; |
| 5 |
import { OUIAProps } from '../../helpers'; |
| 6 |
/** @deprecated Use PopperOptions instead */ |
| 7 |
export type DropdownPopperProps = PopperOptions; |
| 8 |
export interface DropdownToggleProps { |
| 9 |
/** Dropdown 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 DropdownProps extends MenuProps, OUIAProps { |
| 18 |
/** Anything which can be rendered in a dropdown. */ |
| 19 |
children?: React.ReactNode; |
| 20 |
/** Classes applied to root element of dropdown. */ |
| 21 |
className?: string; |
| 22 |
/** Dropdown 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. */ |
| 23 |
toggle: DropdownToggleProps | ((toggleRef: React.RefObject<any>) => React.ReactNode); |
| 24 |
/** Flag to indicate if menu is opened.*/ |
| 25 |
isOpen?: boolean; |
| 26 |
/** 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. */ |
| 27 |
shouldFocusToggleOnSelect?: boolean; |
| 28 |
/** Function callback called when user selects item. */ |
| 29 |
onSelect?: (event?: React.MouseEvent<Element, MouseEvent>, value?: DropdownItemProps['value']) => void; |
| 30 |
/** Callback to allow the dropdown component to change the open state of the menu. |
| 31 |
* Triggered by clicking outside of the menu, or by pressing any keys specified in onOpenChangeKeys. */ |
| 32 |
onOpenChange?: (isOpen: boolean) => void; |
| 33 |
/** 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. */ |
| 34 |
onOpenChangeKeys?: string[]; |
| 35 |
/** 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. */ |
| 36 |
onToggleKeydown?: (event: KeyboardEvent) => void; |
| 37 |
/** Indicates if the menu should be without the outer box-shadow. */ |
| 38 |
isPlain?: boolean; |
| 39 |
/** Indicates if the menu should be scrollable. */ |
| 40 |
isScrollable?: boolean; |
| 41 |
/** @hide Forwarded ref */ |
| 42 |
innerRef?: React.Ref<any>; |
| 43 |
/** Value to overwrite the randomly generated data-ouia-component-id.*/ |
| 44 |
ouiaId?: number | string; |
| 45 |
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ |
| 46 |
ouiaSafe?: boolean; |
| 47 |
/** When applied, wraps dropdown in a container with a data-ouia-component-id.*/ |
| 48 |
containerOuiaId?: number | string; |
| 49 |
/** Set the value of data-ouia-safe for the container when containerOuiaId is applied. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ |
| 50 |
containerOuiaSafe?: boolean; |
| 51 |
/** Sets the base component to render for the container. Defaults to <span> */ |
| 52 |
containerComponent?: React.ReactNode; |
| 53 |
/** z-index of the dropdown menu */ |
| 54 |
zIndex?: number; |
| 55 |
/** Additional properties to pass to the Popper */ |
| 56 |
popperProps?: PopperOptions; |
| 57 |
/** Height of the dropdown menu */ |
| 58 |
menuHeight?: string; |
| 59 |
/** Maximum height of dropdown menu */ |
| 60 |
maxMenuHeight?: string; |
| 61 |
/** @beta Flag indicating the first menu item should be focused after opening the dropdown. */ |
| 62 |
shouldFocusFirstItemOnOpen?: boolean; |
| 63 |
/** Flag indicating if scroll on focus of the first menu item should occur. */ |
| 64 |
shouldPreventScrollOnItemFocus?: boolean; |
| 65 |
/** Time in ms to wait before firing the toggles' focus event. Defaults to 0 */ |
| 66 |
focusTimeoutDelay?: number; |
| 67 |
} |
| 68 |
export declare const Dropdown: import("react").ForwardRefExoticComponent<DropdownProps & import("react").RefAttributes<any>>; |
| 69 |
//# sourceMappingURL=Dropdown.d.ts.map |