import { AriaAttributes, FunctionComponent, MouseEvent } from 'react'; import { SpringValues } from '@react-spring/web'; import { Box, Dimensions, SvgDefsAndFill, MotionProps, ValueFormat } from '@nivo/core'; import { PartialTheme } from '@nivo/theming'; import { InheritedColorConfig, OrdinalColorScaleConfig } from '@nivo/colors'; import { LegendProps } from '@nivo/legends'; import { Vertex, GridCell, GridFillDirection } from '@nivo/grid'; export type DatumId = string | number; export interface Datum { id: string; label: string; value: number; } export interface ComputedDatum extends Datum { data: D; isHidden: boolean; formattedValue: string; groupIndex: number; startAt: number; endAt: number; polygons: readonly Vertex[][]; color: string; fill?: string; borderColor: string; } export interface EmptyCell extends GridCell { color: string; fill?: string; opacity: number; borderColor: string; } export interface DataCell extends EmptyCell { data: ComputedDatum; } export type Cell = EmptyCell | DataCell; export declare const isDataCell: (cell: Cell) => cell is DataCell; export type CellAnimatedProps = { x: number; y: number; size: number; color: string; opacity: number; borderColor: string; }; export interface LegendDatum { id: D['id']; label: D['label']; color: string; data: ComputedDatum; } /** * When using a custom cell component, if you want to preserve transitions, * you should use an SVG element from `@react-spring/web`, for example * `animated.rect`. */ export interface CellComponentProps { cell: Cell; padding: number; animatedProps: SpringValues; borderRadius: number; borderWidth: number; testIdPrefix?: string; } export type CellComponent = FunctionComponent>; export interface DataProps { data: readonly D[]; total: number; rows: number; columns: number; } export interface TooltipProps { data: ComputedDatum; } export type TooltipComponent = FunctionComponent>; export interface CommonProps extends MotionProps { hiddenIds: readonly D['id'][]; margin: Box; valueFormat?: ValueFormat; fillDirection: GridFillDirection; padding: number; theme: PartialTheme; colors: OrdinalColorScaleConfig; emptyColor: string; emptyOpacity: number; borderRadius: number; borderWidth: number; borderColor: InheritedColorConfig | { color: string; }>; isInteractive: boolean; tooltip: TooltipComponent; forwardLegendData: (data: LegendDatum[]) => void; role: string; renderWrapper: boolean; ariaLabel: AriaAttributes['aria-label']; ariaLabelledBy: AriaAttributes['aria-labelledby']; ariaDescribedBy: AriaAttributes['aria-describedby']; } export type MouseHandler = (data: ComputedDatum, event: MouseEvent) => void; export interface MouseHandlers { onClick: MouseHandler; onMouseEnter: MouseHandler; onMouseMove: MouseHandler; onMouseLeave: MouseHandler; } export type LayerId = 'cells' | 'areas' | 'legends'; export interface CustomLayerProps { cells: readonly Cell[]; computedData: readonly ComputedDatum[]; } export type WaffleSvgLayer = LayerId | FunctionComponent>; export type WaffleSvgProps = DataProps & Dimensions & Partial> & SvgDefsAndFill> & Partial> & { layers?: readonly WaffleSvgLayer[]; legends?: readonly LegendProps[]; cellComponent?: CellComponent; motionStagger?: number; testIdPrefix?: string; }; export type HtmlLayerId = Exclude; export type WaffleHtmlLayer = HtmlLayerId | FunctionComponent>; export type WaffleHtmlProps = DataProps & Dimensions & Partial> & Partial> & { layers?: readonly WaffleHtmlLayer[]; cellComponent?: CellComponent; motionStagger?: number; testIdPrefix?: string; }; export type CanvasProps = DataProps & Dimensions & Partial> & Partial, 'onMouseEnter' | 'onMouseLeave'>> & { legends?: readonly LegendProps[]; pixelRatio?: number; }; //# sourceMappingURL=types.d.ts.map