@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
76 lines (75 loc) • 2.64 kB
TypeScript
import { BaseComponentProps } from '../internal/base-component';
import { NonCancelableEventHandler } from '../internal/events';
import { PopoverProps } from '../popover';
export interface SeriesInfo {
label: string;
color: string;
index: number;
markerType: 'line' | 'rectangle';
}
export interface ChartDetailPair {
key: string;
value: string | number;
}
export interface PieChartProps<T extends PieChartProps.Datum = PieChartProps.Datum> extends BaseComponentProps {
data: ReadonlyArray<T>;
size?: 'small' | 'medium' | 'large';
variant?: 'pie' | 'donut';
detailPopoverContent?: PieChartProps.DetailPopoverContentFunction<T>;
segmentDescription?: PieChartProps.SegmentDescriptionFunction<T>;
detailPopoverSize?: PopoverProps.Size;
hideLegend?: boolean;
hideTitles?: boolean;
hideDescriptions?: boolean;
hideFilter?: boolean;
innerMetricValue?: string;
innerMetricDescription?: string;
legendTitle?: string;
additionalFilters?: React.ReactNode;
highlightedSegment?: T | null;
visibleSegments?: ReadonlyArray<T>;
statusType?: 'loading' | 'finished' | 'error';
empty?: React.ReactNode;
noMatch?: React.ReactNode;
loadingText?: string;
errorText?: string;
recoveryText?: string;
onRecoveryClick?: NonCancelableEventHandler;
onHighlightChange?: NonCancelableEventHandler<PieChartProps.HighlightChangeDetail<T>>;
onFilterChange?: NonCancelableEventHandler<PieChartProps.FilterChangeDetail<T>>;
ariaLabel?: string;
ariaLabelledby?: string;
ariaDescription?: string;
i18nStrings?: PieChartProps.I18nStrings;
}
export declare namespace PieChartProps {
interface Datum {
title: string;
value: number;
color?: string;
}
type PieChartData = ReadonlyArray<Datum>;
interface DetailPopoverContentFunction<T = Datum> {
(segment: T, visibleDataSum: number): ReadonlyArray<ChartDetailPair>;
}
interface SegmentDescriptionFunction<T = Datum> {
(segment: T, visibleDataSum: number): string;
}
interface HighlightChangeDetail<T> {
highlightedSegment: T | null;
}
interface FilterChangeDetail<T> {
visibleSegments: ReadonlyArray<T>;
}
interface I18nStrings {
detailsValue?: string;
detailsPercentage?: string;
filterLabel?: string;
filterPlaceholder?: string;
filterSelectedAriaLabel?: string;
legendAriaLabel?: string;
detailPopoverDismissAriaLabel?: string;
chartAriaRoleDescription?: string;
segmentAriaRoleDescription?: string;
}
}