import { AriaListBoxProps } from 'react-aria/useListBox'; import { ClassNameOrFunction, ContextValue, DOMRenderProps, PossibleLinkDOMRenderProps, RenderProps, SlotProps, StyleProps, StyleRenderProps } from './utils'; import { CollectionProps, ItemRenderProps, SectionProps } from './Collection'; import { DragAndDropHooks } from './useDragAndDrop'; import { FocusEvents, GlobalDOMAttributes, HoverEvents, Key, KeyboardEvents, LinkDOMProps, PressEvents } from '@react-types/shared'; import { ListState } from 'react-stately/useListState'; import { LoadMoreSentinelProps } from 'react-aria/private/utils/useLoadMoreSentinel'; import { Orientation, SelectionBehavior } from '@react-types/shared'; import React, { ReactNode } from 'react'; export interface ListBoxRenderProps { /** * Whether the listbox has no items and should display its empty state. * @selector [data-empty] */ isEmpty: boolean; /** * Whether the listbox is currently focused. * @selector [data-focused] */ isFocused: boolean; /** * Whether the listbox is currently keyboard focused. * @selector [data-focus-visible] */ isFocusVisible: boolean; /** * Whether the listbox is currently the active drop target. * @selector [data-drop-target] */ isDropTarget: boolean; /** * Whether the items are arranged in a stack or grid. * @selector [data-layout="stack | grid"] */ layout: 'stack' | 'grid'; /** * The primary orientation of the items. * @selector [data-orientation="vertical | horizontal"] */ orientation: Orientation; /** * State of the listbox. */ state: ListState; } export interface ListBoxProps extends Omit, 'children' | 'label'>, CollectionProps, StyleRenderProps, SlotProps, GlobalDOMAttributes { /** * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. * @default 'react-aria-ListBox' */ className?: ClassNameOrFunction; /** * How multiple selection should behave in the collection. * @default "toggle" */ selectionBehavior?: SelectionBehavior; /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the ListBox. */ dragAndDropHooks?: DragAndDropHooks>; /** Provides content to display when there are no items in the list. */ renderEmptyState?: (props: ListBoxRenderProps) => ReactNode; /** * Whether the items are arranged in a stack or grid. * @default 'stack' */ layout?: 'stack' | 'grid'; /** * The primary orientation of the items. Usually this is the * direction that the collection scrolls. * @default 'vertical' */ orientation?: Orientation; } export declare const ListBoxContext: React.Context, HTMLDivElement>>; export declare const ListStateContext: React.Context | null>; /** * A listbox displays a list of options and allows a user to select one or more of them. */ export declare const ListBox: (props: ListBoxProps & React.RefAttributes) => React.ReactElement> | null; export interface ListBoxSectionProps extends SectionProps, DOMRenderProps<'section', undefined> { /** * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. * @default 'react-aria-ListBoxSection' */ className?: string; } /** * A ListBoxSection represents a section within a ListBox. */ export declare const ListBoxSection: (props: ListBoxSectionProps & React.RefAttributes) => React.ReactElement> | null; export interface ListBoxItemRenderProps extends ItemRenderProps { } export interface ListBoxItemProps extends Omit, 'render'>, PossibleLinkDOMRenderProps<'div', ListBoxItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, KeyboardEvents, FocusEvents, Omit, 'onClick'> { /** * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. * @default 'react-aria-ListBoxItem' */ className?: ClassNameOrFunction; /** The unique id of the item. */ id?: Key; /** The object value that this item represents. When using dynamic collections, this is set automatically. */ value?: T; /** A string representation of the item's contents, used for features like typeahead. */ textValue?: string; /** An accessibility label for this item. */ 'aria-label'?: string; /** Whether the item is disabled. */ isDisabled?: boolean; /** * Handler that is called when a user performs an action on the item. The exact user event depends on * the collection's `selectionBehavior` prop and the interaction modality. */ onAction?: () => void; } /** * A ListBoxItem represents an individual option in a ListBox. */ export declare const ListBoxItem: (props: ListBoxItemProps & React.RefAttributes) => React.ReactElement> | null; export interface ListBoxLoadMoreItemProps extends Omit, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes { /** * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. * @default 'react-aria-ListBoxLoadMoreItem' */ className?: string; /** * The load more spinner to render when loading additional items. */ children?: ReactNode; /** * Whether or not the loading spinner should be rendered or not. */ isLoading?: boolean; } export declare const ListBoxLoadMoreItem: (props: ListBoxLoadMoreItemProps & React.RefAttributes) => React.ReactElement> | null;