import React from 'react'; import PropTypes from 'prop-types'; import { ComponentProps } from '../utils/types'; type ResultsMenuScrollBottomHandler = (event: React.UIEvent | null) => void; interface ResultsMenuPropsBase { /** * Whether or not to show the wait spinner when loading. It's recommended to set this to * `true` when loading may take more than one second. */ animateLoading?: boolean; children?: React.ReactNode; /** * `childrenStart` are nearest the toggle, so they are not necessarily on top. * This is extendable to add `childrenTop`, `childrenEnd`, and `childrenBottom` in the * future. */ childrenStart?: React.ReactNode; /** * A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** * Specifies whether the menu accept/retain focus and how the focus behaves. * If not set, it defaults to `roving` unless the menu is inside a `Dropdown` or `Popover`, * in which case it inherits the value from that component. * * - `never`: The menu will never take focus, and the active menu item will not have a focus-like appearance. * - `normal`: The menu and its children follow the normal focus order of DOM without any interference (no loop, no arrow keys, multiple tab stops). * - `roving`: Does not retain focus inside the menu. One tab stop. Uses up/down arrow keys to navigate and loop inside the menu. */ focusMode?: 'roving' | 'normal' | 'never'; footerMessage?: React.ReactNode; /** * Whether or not to show the loading message and/or wait spinner. It's not recommended to * pass old children when loading new children. The loading animation will show below any * children, so therefore it may be necessary to scroll to see the animation. */ isLoading?: boolean; labelledBy?: string; loadingMessage?: React.ReactNode; menuId?: string; noOptionsMessage?: React.ReactNode; onScroll?: React.UIEventHandler; /** * A callback function for loading additional list items. * Called when the list is scrolled to the bottom or all items in the list are visible. * This is called with an event argument if this is the result of a scroll. * * This should be set this to `null` when all items are loaded. */ onScrollBottom?: ResultsMenuScrollBottomHandler; placement?: string; } declare const propTypes: { animateLoading: PropTypes.Requireable; children: PropTypes.Requireable; childrenStart: PropTypes.Requireable; elementRef: PropTypes.Requireable; focusMode: PropTypes.Requireable; footerMessage: PropTypes.Requireable; isLoading: PropTypes.Requireable; loadingMessage: PropTypes.Requireable; menuId: PropTypes.Requireable; noOptionsMessage: PropTypes.Requireable; onScroll: PropTypes.Requireable<(...args: any[]) => any>; onScrollBottom: PropTypes.Requireable<(...args: any[]) => any>; placement: PropTypes.Requireable; }; type ResultsMenuProps = ComponentProps; declare function ResultsMenu({ animateLoading, 'aria-multiselectable': ariaMultiselectable, children, childrenStart, elementRef, focusMode, footerMessage, isLoading, labelledBy, loadingMessage, menuId, noOptionsMessage, onScroll, onScrollBottom, placement, style, tabIndex, ...otherProps }: ResultsMenuProps): React.JSX.Element; declare namespace ResultsMenu { var propTypes: { animateLoading: PropTypes.Requireable; children: PropTypes.Requireable; childrenStart: PropTypes.Requireable; elementRef: PropTypes.Requireable; focusMode: PropTypes.Requireable; footerMessage: PropTypes.Requireable; isLoading: PropTypes.Requireable; loadingMessage: PropTypes.Requireable; menuId: PropTypes.Requireable; noOptionsMessage: PropTypes.Requireable; onScroll: PropTypes.Requireable<(...args: any[]) => any>; onScrollBottom: PropTypes.Requireable<(...args: any[]) => any>; placement: PropTypes.Requireable; }; } export default ResultsMenu; export { propTypes }; export type { ResultsMenuScrollBottomHandler, ResultsMenuPropsBase };