import type { ReactNode } from 'react'; import type { SankeyNodeAlignment } from './sankey.js'; import type { BehaviorTrackingProps } from '../../../core/types/behavior-tracking-props.js'; import type { DataTestId } from '../../../core/types/data-props.js'; import type { MaskingProps } from '../../../core/types/masking-props.js'; import type { StylingProps } from '../../../core/types/styling-props.js'; import type { TruncationMode } from '../../../typography/text-ellipsis/TextEllipsis.js'; import type { ChartData } from '../../core/types/chart-data.js'; import type { ColorPalette, CustomColorPalette } from '../../core/types/color-palette.js'; /** * @internal */ export interface SankeyChartBaseProps extends MaskingProps, StylingProps, DataTestId, BehaviorTrackingProps { /** Link dataset. Each row is one directed edge. */ data: ChartData; /** Field in `data` rows that holds the source node id. */ sourceAccessor: string; /** Field in `data` rows that holds the target node id. */ targetAccessor: string; /** Field in `data` rows that holds the link volume (numeric). */ valueAccessor: string; /** * The width of the chart. If a number is passed, it will be treated as px. */ width?: number | string; /** * The height of the chart. If a number is passed, it will be treated as px. */ height?: number | string; /** Show the loading indicator when set to true. */ loading?: boolean; /** * The truncation mode to be used as start, middle or end in long node labels. * @defaultValue 'middle' */ truncationMode?: TruncationMode; /** * The color palette used for node coloring. * @defaultValue 'categorical' */ colorPalette?: ColorPalette | CustomColorPalette; children?: ReactNode; } /** * Node-metadata accessors. A two-branch union enforces that `nodeIdAccessor` * is required when `nodes` is provided. * @internal */ export type SankeyNodeProps = { /** No node metadata — nodes are inferred from link topology. */ nodes?: undefined; nodeIdAccessor?: never; nodeLabelAccessor?: never; columnAccessor?: never; } | { /** Node metadata. Each row adds labels and column placement to one node. */ nodes: ChartData; /** Field in `nodes` rows that uniquely identifies the node. */ nodeIdAccessor: string; /** Field in `nodes` rows that holds the display label. */ nodeLabelAccessor?: string; /** Field in `nodes` rows that holds the column index. Topology-inferred when omitted. */ columnAccessor?: string; }; /** * @internal */ export type SankeyChartProps = SankeyChartBaseProps & SankeyNodeProps; /** * Props for the `SankeyChart.Nodes` slot. `remainderColor` is only valid when * `remainder` is `'exit'` (enforced via the discriminated union). * @internal */ export type SankeyChartNodesProps = { /** Width of each node rectangle in pixels. */ width?: number; /** Horizontal node alignment within columns. */ alignment?: SankeyNodeAlignment; } & ({ remainder?: 'hidden'; } | { remainder: 'exit'; remainderColor?: string; }); //# sourceMappingURL=sankey-props.d.ts.map