@furystack/shades-common-components
Version:
Common UI components for FuryStack Shades
35 lines • 1.46 kB
TypeScript
import type { ChildrenList, PartialElement } from '@furystack/shades';
import type { ListService } from '../../services/list-service.js';
export type ListItemState = {
isFocused: boolean;
isSelected: boolean;
};
export type ListPaginationProps = {
/** Number of items to display per page */
itemsPerPage: number;
/** Current page (1-indexed) */
page: number;
/** Callback fired when the page changes */
onPageChange: (page: number) => void;
};
export type ListProps<T> = {
items: T[];
listService: ListService<T>;
renderItem: (item: T, state: ListItemState) => JSX.Element;
renderIcon?: (item: T) => JSX.Element;
renderSecondaryActions?: (item: T) => JSX.Element[];
variant?: 'contained' | 'outlined';
onItemActivate?: (item: T) => void;
onSelectionChange?: (selected: T[]) => void;
/** Optional pagination configuration. When provided, items are sliced and a Pagination control is rendered. */
pagination?: ListPaginationProps;
/**
* Section name for spatial navigation scoping.
* Sets `data-nav-section` on the list wrapper so that SpatialNavigationService
* constrains arrow-key navigation within the list.
* Auto-generated per instance when not provided.
*/
navSection?: string;
} & PartialElement<HTMLDivElement>;
export declare const List: <T>(props: ListProps<T>, children: ChildrenList) => JSX.Element<any>;
//# sourceMappingURL=list.d.ts.map