import React from 'react'; import { SankeyProps as RechartsSankeyProps, TooltipProps } from 'recharts'; import { BoxProps, ElementProps, Factory, MantineColor, StylesApiProps } from '@mantine/core'; import { ChartTooltipStylesNames } from '../ChartTooltip/ChartTooltip'; export interface SankeyChartNode { name: string; color?: MantineColor; [key: string]: unknown; } export interface SankeyChartLink { source: number; target: number; value: number; [key: string]: unknown; } export interface SankeyChartData { nodes: SankeyChartNode[]; links: SankeyChartLink[]; } export type SankeyChartStylesNames = 'root' | ChartTooltipStylesNames; export type SankeyChartCssVariables = { root: '--chart-node-color' | '--chart-link-color' | '--chart-text-color' | '--chart-height'; }; export interface SankeyChartProps extends BoxProps, StylesApiProps, ElementProps<'div'> { /** Data used to render chart, must include `nodes` and `links` arrays */ data: SankeyChartData; /** Controls chart height @default 300 */ height?: number; /** The width of each node @default 10 */ nodeWidth?: number; /** The padding between nodes @default 10 */ nodePadding?: number; /** The curvature of links between nodes @default 0.5 */ linkCurvature?: number; /** The number of relaxation iterations @default 32 */ iterations?: number; /** Default color for nodes, by default depends on color scheme */ nodeColor?: MantineColor; /** An array of colors used for nodes when no `color` is set on individual nodes */ colors?: MantineColor[]; /** Default color for links, by default depends on color scheme */ linkColor?: MantineColor; /** Opacity of the link fill @default 0.4 */ linkOpacity?: number; /** Determines whether the tooltip should be displayed when hovered @default true */ withTooltip?: boolean; /** Tooltip animation duration in ms @default 0 */ tooltipAnimationDuration?: number; /** Props passed down to `Tooltip` recharts component */ tooltipProps?: Omit, 'ref'>; /** Props passed down to recharts `Sankey` component */ sankeyProps?: Partial>; /** Controls text color of labels @default dimmed */ textColor?: MantineColor; /** A function to format values inside the tooltip and node labels */ valueFormatter?: (value: number) => string; /** Additional elements rendered inside `Sankey` component */ children?: React.ReactNode; } export type SankeyChartFactory = Factory<{ props: SankeyChartProps; ref: HTMLDivElement; stylesNames: SankeyChartStylesNames; vars: SankeyChartCssVariables; }>; export declare const SankeyChart: import("@mantine/core").MantineComponent<{ props: SankeyChartProps; ref: HTMLDivElement; stylesNames: SankeyChartStylesNames; vars: SankeyChartCssVariables; }>;