@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
57 lines (56 loc) • 1.93 kB
TypeScript
import React from 'react';
import { BaseComponentProps } from '../internal/base-component';
import { NonCancelableEventHandler } from '../internal/events';
export interface CardsForwardRefType {
<T>(props: CardsProps<T> & {
ref?: React.Ref<{}>;
}): JSX.Element;
}
export interface CardsProps<T = any> extends BaseComponentProps {
empty?: React.ReactNode;
header?: React.ReactNode;
filter?: React.ReactNode;
pagination?: React.ReactNode;
preferences?: React.ReactNode;
items: ReadonlyArray<T>;
loading?: boolean;
loadingText?: string;
cardDefinition: CardsProps.CardDefinition<T>;
cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;
trackBy?: CardsProps.TrackBy<T>;
selectionType?: CardsProps.SelectionType;
selectedItems?: ReadonlyArray<T>;
isItemDisabled?: CardsProps.IsItemDisabled<T>;
ariaLabels?: CardsProps.AriaLabels<T>;
visibleSections?: ReadonlyArray<string>;
onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;
}
export declare namespace CardsProps {
interface CardDefinition<T> {
header?(item: T): React.ReactNode;
sections?: ReadonlyArray<SectionDefinition<T>>;
}
interface SectionDefinition<T> {
id?: string;
header?: React.ReactNode;
content?(item: T): React.ReactNode;
width?: number;
}
interface CardsLayout {
cards: number;
minWidth?: number;
}
type TrackBy<T> = string | ((item: T) => string);
type SelectionType = 'single' | 'multi';
interface SelectionState<T> {
selectedItems: ReadonlyArray<T>;
}
interface SelectionChangeDetail<T> {
selectedItems: T[];
}
type IsItemDisabled<T> = (item: T) => boolean;
interface AriaLabels<T> {
itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;
selectionGroupLabel: string;
}
}