import type { ReactNode } from 'react'; import { ConvertibleUnit, FormatOptions, Unit } from '@dynatrace-sdk/units'; import { HoneycombLabelsDisplay, HoneycombTileData, HoneycombTileShape } from './honeycomb.js'; import { HoneycombToolbarConfig } from './toolbar.js'; import type { TruncationMode } from '../../../typography/text-ellipsis/TextEllipsis.js'; import { ChartUnit } from '../../core/types/chart-unit.js'; import { ColorPalette, ColorToken } from '../../core/types/color-palette.js'; import type { ColorRuleProps } from '../../core/types/color-rule.js'; import { ColoredRange } from '../../core/types/colored-range.js'; import { Formatter } from '../../core/types/formatter.js'; import type { TextSize } from '../../core/types/text-size.js'; import { HoneycombLegendProps } from '../slots/HoneycombLegend.js'; export type HoneycombTooltipMetadata = HoneycombTileData & { id: string; name: string; color: ColorToken; }; /** * Data provided to the custom tooltip render function for HoneycombChart. * @public */ export type HoneycombTooltipPayload = { /** The tile name */ name: string; /** The raw tile value */ value: number | string; /** The formatted tile value (as displayed in the default tooltip) */ formattedValue: string; /** The resolved CSS color for the tile */ color: string; /** The full original tile data, including any custom fields */ data: HoneycombTileData; }; /** * Props for the HoneycombChart.Tooltip component. * @public */ export type HoneycombChartTooltipProps = { /** When true, suppresses the tooltip entirely. */ hidden?: boolean; children?: (payload: HoneycombTooltipPayload) => ReactNode; }; /** * Tooltip configuration used internally and in the context config API. * @public */ export type HoneycombCustomTooltipConfig = { hidden?: boolean; template?: HoneycombChartTooltipProps['children']; }; /** * @internal */ export interface HoneycombSlotsConfig { legend: HoneycombLegendProps | undefined; toolbar: HoneycombToolbarConfig | undefined; colorRules: ColorRuleProps[]; tooltip?: HoneycombCustomTooltipConfig; } /** * The interface needed after everything is configured * @internal */ export interface HoneycombRequiredConfigProps { /** * The shape of the honeycomb tiles. * @defaultValue 'hexagon' */ shape: HoneycombTileShape; colorScheme: ColorPalette | Record | ColoredRange[] | string[]; toolbar: HoneycombToolbarConfig | undefined; legend: HoneycombLegendProps; /** * Custom formatter for honeycomb's tiles values */ formatter: Formatter | FormatOptions | undefined; /** * The custom unit for honeycomb's tiles values. */ unit: ChartUnit; /** Truncation mode to apply */ truncationMode: TruncationMode; /** The min value to display */ min: 'data-min' | number | undefined; /** The max value to display */ max: 'data-max' | number | undefined; /** Controls which label content is shown inside each honeycomb tile */ labelsDisplay: HoneycombLabelsDisplay; /** Font size (in pixels) for tile labels, or `'auto'` for adaptive sizing */ textSize: TextSize; colorRules: ColorRuleProps[]; tooltip?: HoneycombCustomTooltipConfig; }