import type { ReactNode } from 'react'; import type { ConvertibleUnit, FormatOptions, Unit } from '@dynatrace-sdk/units'; import type { AriaLabelingProps } from '../../../core/types/a11y-props.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 { ChartUnit } from '../../core/types/chart-unit.js'; import type { ColorPalette, CustomColorPalette } from '../../core/types/color-palette.js'; import type { Formatter } from '../../core/types/formatter.js'; import type { SankeyLabelsDisplay, SankeyNodeAlignment, SankeySeriesActions } from './sankey.js'; /** * Fixed highlight configuration for the `highlightedNodes` prop. * @internal */ export type SankeyHighlightedNodes = { /** * Highlight mode. `'interactions'` emphasizes the listed nodes and the edges * between two listed nodes. */ type: 'interactions'; /** * Ids of the nodes to emphasize. Ids that do not match a node are ignored. */ value: string[]; }; /** * @internal */ export interface SankeyChartBaseProps extends MaskingProps, StylingProps, DataTestId, BehaviorTrackingProps, AriaLabelingProps { /** Edge dataset. Each row is one directed edge. */ edges: ChartData; /** Field in `edges` rows that holds the id of the node the edge starts at. */ fromAccessor: string; /** Field in `edges` rows that holds the id of the node the edge ends at. */ toAccessor: string; /** Field in `edges` rows that holds the edge 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; /** * Custom formatter for numeric volume values. */ formatter?: Formatter | FormatOptions; /** * Unit for numeric volume values. */ unit?: ChartUnit; /** * Custom actions offered for the node or edge the tooltip is pinned to. */ seriesActions?: SankeySeriesActions; /** * Nodes to emphasize from the start. The listed nodes and the edges between * two listed nodes stay emphasized, and everything else is dimmed, regardless * of hover or click. An empty list, or a list where no id matches a node, * keeps the default hover and click highlighting. */ highlightedNodes?: SankeyHighlightedNodes; children?: ReactNode; } /** * Constrains column-related props: `columnLabels` is only valid when * `columnIdAccessor` is also provided. * @internal */ export type SankeyColumnProps = { columnIdAccessor?: undefined; columnLabels?: never; } | { /** * Field in `nodes` rows that holds the column id. Columns are laid out * left to right in the order in which their ids first appear in `nodes`. * Topology-inferred when omitted. */ columnIdAccessor: string; /** * Labels to display above each column, keyed by column id. A column * without an entry shows its id as the label, and an empty string hides * the header of that column. */ columnLabels?: Record; }; /** * Node-metadata accessors. Enforces that `nodeIdAccessor` is required when * `nodes` is provided, and composes with `SankeyColumnProps` to gate * `columnLabels` behind `columnIdAccessor`. * @internal */ export type SankeyNodeProps = { /** No node metadata — nodes are inferred from edge topology. */ nodes?: undefined; nodeIdAccessor?: never; nodeLabelAccessor?: never; columnIdAccessor?: never; columnLabels?: 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; } & SankeyColumnProps); /** * @internal */ export type SankeyChartProps = SankeyChartBaseProps & SankeyNodeProps; /** * Defines when a node is small enough to be clustered. * @internal */ export type SankeyClusteringThreshold = { /** * `'auto'` clusters nodes that take up less than 2% of the chart height. */ mode: 'auto'; } | { /** * Unit of `value`. `'pixels'` compares against the node height in pixels. * `'domain'` compares against the node value, which is the larger of its * summed incoming and outgoing flow. */ mode: 'pixels' | 'domain'; /** * Nodes below this value are clustered. A value of 0 clusters nothing. */ value: number; }; /** * Configuration of the node clustering. * @internal */ export type SankeyClusteringConfig = { /** * Label of the "Other" node. * @defaultValue 'Other' */ label?: string; /** * Position of the "Other" node within its column. `'auto'` places it by its * value like any other node, `'bottom'` always places it last. * @defaultValue 'auto' */ position?: 'auto' | 'bottom'; /** * Sets when a node is small enough to be clustered. A column is only * clustered when at least two of its nodes are below the threshold. With * `{ mode: 'auto' }`, nodes that take up less than 2% of the chart height * are clustered. * @defaultValue `{ mode: 'auto' }` */ threshold?: SankeyClusteringThreshold; }; /** * Props for the `SankeyChart.NodeStyle` slot. * @internal */ export type SankeyChartNodeStyleProps = { /** * Merges the nodes below the threshold into one "Other" node per column, so * dense charts stay readable. A column is only clustered when at least two of * its nodes are below the threshold. The default threshold is 2% of the chart * height. Set `threshold` in the clustering config to change it. * * Enable it with `clustering={{}}`. * @defaultValue false */ clustering?: false | SankeyClusteringConfig; /** Width of each node rectangle in pixels. */ width?: number; /** Horizontal node alignment within columns. */ alignment?: SankeyNodeAlignment; /** * Controls the visibility of node labels in all zones (left, inside and * right of the nodes). * - `'all'`: always renders every label, even when chips overlap. * - `'none'`: renders no labels. The label areas on the left and right of * the chart collapse, so the chart area uses the full width. * - `'auto'`: hides the label of a node when its chip would overlap the * chip of a larger node in the same column. * @defaultValue 'auto' */ labelsDisplay?: SankeyLabelsDisplay; }; //# sourceMappingURL=sankey-props.d.ts.map