@payfit/unity-components
Version:
56 lines (55 loc) • 1.65 kB
TypeScript
import { SelectionBehavior } from '@react-types/shared';
import { Key } from 'react-aria-components/Breadcrumbs';
import { Selection, SelectionMode } from 'react-aria-components/GridList';
interface SelectableItem {
id: Key;
label: string;
[key: string]: unknown;
}
export interface SelectedItemsSectionProps<TType extends SelectableItem> {
/**
* Array of selected items to display
*/
items: TType[];
/**
* Currently selected keys
*/
selectedKeys: Selection;
/**
* Callback when selection changes
*/
onSelectionChange: (keys: Selection) => void;
/**
* Selection mode (single, multiple)
*/
selectionMode?: SelectionMode;
/**
* Selection behavior (toggle, replace)
*/
selectionBehavior?: SelectionBehavior;
/**
* Accessible label for the section
*/
label: string;
/**
* CSS class for the ListBox
*/
className: string;
}
/**
* Displays selected items in a dedicated section at the top of the list.
* Items in this section can be deselected to move them back to the main list.
* @example
* ```tsx
* <SelectedItemsSection
* items={selectedItems}
* selectedKeys={selectedKeys}
* onSelectionChange={handleChange}
* selectionMode="multiple"
* label="Selected Options"
* className={selectedListBoxStyles}
* />
* ```
*/
export declare function SelectedItemsSection<TType extends SelectableItem>({ items, selectedKeys, onSelectionChange, selectionMode, selectionBehavior, label, className, ...rest }: SelectedItemsSectionProps<TType>): import("react/jsx-runtime").JSX.Element | null;
export {};