@payfit/unity-components
Version:
24 lines (23 loc) • 852 B
TypeScript
import { Selection } from 'react-aria-components/GridList';
interface ProcessedItems<TType> {
selectedItems: TType[];
remainingItems: Iterable<TType> | undefined;
}
/**
* Hook to process items for selected-first sorting.
* Separates selected items into a dedicated section at the top.
* @param items - The items to process (flat or nested structure)
* @param selectedKeys - Currently selected keys
* @param enabled - Whether selected-first sorting is enabled
* @returns Processed items with selected items separated
* @example
* ```tsx
* const processed = useSelectedFirstSorting(
* items,
* selectedKeys,
* sortSelectedFirst
* )
* ```
*/
export declare function useSelectedFirstSorting<TType extends object>(items: Iterable<TType> | undefined, selectedKeys: Selection, enabled: boolean): ProcessedItems<TType>;
export {};