import { type CSSProperties, type ReactNode } from 'react'; /** How many series a chart colors: a series past the eighth folds into "Other" (`foldSeries`) * rather than taking a hue made up for it. */ export declare const SERIES_LIMIT: 8; /** The key `foldSeries` gives the series that sums those past the limit. */ export declare const OTHER_SERIES_KEY = "__other__"; /** The mark color of the "Other" series: a neutral gray, so it never reads as one more series. */ export declare const OTHER_SERIES_COLOR = "color-mix(in oklch, var(--theme-muted-text-color) 75%, var(--theme-panel-bg))"; /** The color of a chart's nth series, 1–8: the theme's category hue, between the slot's soft * fill and its text and twice as saturated, so a bar or a line stands out from the page in * light and dark alike. Past the eighth it is the "Other" gray; a hue is never repeated. */ export declare function seriesSlotColor(position: number): string; /** Colors for a chart's series by their place in `keys`: the first takes the first color, the * second the next, so the first few are always the most distinct. Pass every key the chart can * show, in an order that doesn't depend on the data shown, such as by name or as configured: * a filter that hides a series then leaves the others their colors. `OTHER_SERIES_KEY`, and any * key past the eighth, is the "Other" gray; fold them first with `foldSeries`. */ export declare function seriesColors(keys: readonly string[]): Record; /** Splits a chart's series at the limit: up to eight show as they are, and more keep the first * seven and fold the rest into one "Other" series, `OTHER_SERIES_KEY`, whose value at a point * is the sum of `folded`. Name it with the `chart.other` string. */ export declare function foldSeries(keys: readonly string[], limit?: number): { keys: string[]; folded: string[]; }; export type SeriesSwatchShape = 'square' | 'dot' | 'line'; /** A series' color as a mark, for a legend or a tooltip's row. Only seen: the series' name * beside it says which it is. */ export declare function SeriesSwatch({ color, shape, className, }: { color: string; shape?: SeriesSwatchShape | undefined; className?: string | undefined; }): import("react").JSX.Element; /** Which series is in focus, from hovering a mark or the legend, and how strongly every other * series draws while it is: their marks fade so the one in focus reads alone. */ export declare function useSeriesHighlight(): { highlighted: string | null; highlight: (key: string | null) => void; /** 1 for the series in focus or when none is, 0.3 for the rest. */ opacity: (key: string) => number; }; /** A series' opacity while `highlighted` is in focus: full for it, or for all when none is. */ export declare function seriesOpacity(key: string, highlighted: string | null | undefined): number; export interface ChartLegendItem { key: string; label: ReactNode; color: string; } /** A chart's legend: each series' swatch and name. With `onHighlight` hovering or focusing a * name puts its series in focus, and pressing one keeps it there until pressed again. */ export declare function ChartLegendList({ items, highlighted, onHighlight, shape, className, }: { items: readonly ChartLegendItem[]; highlighted?: string | null | undefined; onHighlight?: ((key: string | null) => void) | undefined; shape?: SeriesSwatchShape | undefined; className?: string | undefined; }): import("react").JSX.Element; export interface ChartTooltipItem { key: string; name: ReactNode; /** Detail under the name and value, such as what a ratio was measured from, in muted text. * It wraps onto as many lines as it needs and is never cut. */ detail?: ReactNode; value: number; color: string; } /** How a reading lists its series: in the order given, which is the legend's, or largest * first. */ export type ChartReadingOrder = 'series' | 'value'; /** What a chart's tooltip shows for a point: its label, then each series' swatch, name and * value in the legend's order, zeros too, the series in focus in bold, and a total when there * is more than one. A charting library's tooltip renders it as its content. */ export declare function ChartTooltipContent({ label, items, formatValue, total, highlighted, hideZero, order, sort, className, style, }: { label?: ReactNode; items: readonly ChartTooltipItem[]; /** Formats each value and the total, such as a currency; numbers in the host's locale * (`UIProvider locale`) by default. */ formatValue?: ((n: number) => string) | undefined; /** Adds a total row; on by default when more than one series shows. */ total?: boolean | undefined; highlighted?: string | null | undefined; /** Leaves out series whose value is zero; off by default, since a zero is a reading too. */ hideZero?: boolean | undefined; /** `series` (the default) keeps the order of `items`, which is the legend's; `value` lists * the largest first. */ order?: ChartReadingOrder | undefined; /** @deprecated Use `order="value"`. */ sort?: boolean | undefined; className?: string | undefined; /** Places it; `ChartTooltipBeside` places it beside a crosshair. */ style?: CSSProperties | undefined; }): import("react").JSX.Element; export interface ChartTooltipPlacement { /** The tooltip's left edge. */ left: number; /** The tooltip's top edge: `top` beside the crosshair, or above the plot when it goes there. */ top: number; /** Beside the crosshair to its left or right, or above the plot when neither side has room. */ side: 'left' | 'right' | 'above'; /** A width to hold it to, its names truncating, when its side has room for less than all of * it. */ maxWidth: number | null; } /** Where a chart's tooltip goes so it never covers the point being read: `gap` beside the * crosshair at `x`, on the side with more room, so it flips sides as the crosshair passes the * middle, and held narrower when that side is short, its names truncating. * Only when that side is narrower still does it go above the plot, clear of every point, * where the chart must leave it room. `start` and `end` * bound it in the same coordinates as `x`, such as the chart's own box, so it stays inside * the card, and `top` is the plot's top. A charting library's tooltip takes `left` and `top` * as its position. */ export declare function chartTooltipPlacement({ x, width, height, start, end, top, gap, minWidth, prefer, }: { x: number; width: number; /** The tooltip's height, for placing it above the plot. */ height?: number | undefined; start: number; end: number; top?: number | undefined; gap?: number | undefined; /** The narrowest it is held to beside the crosshair before it goes above instead. */ minWidth?: number | undefined; /** The side it takes when both have the same room, such as the left in a right-to-left * layout. */ prefer?: 'left' | 'right' | undefined; }): ChartTooltipPlacement; /** Holds a chart's tooltip beside its crosshair, inside a positioned box around the plot: `x` * is the crosshair in that box, and the tooltip sits `top` from its top on the side with more * room, flipping as the crosshair passes the middle, held narrower and tighter when that side * is short, and above the plot only when it is shorter still. It stays inside the box's width * and never covers the point being read or the pointer on it. Nothing shows while `x` is null. * On a narrow chart, such as on a phone, `ChartTooltipFrame` docks the reading in a readout * above the plot instead. */ export declare function ChartTooltipBeside({ x, top, gap, className, children, }: { x: number | null; top?: number | undefined; gap?: number | undefined; className?: string | undefined; children: ReactNode; }): import("react").JSX.Element | null; /** A point's reading: what a chart's tooltip or readout shows for it. */ export interface ChartReading { label?: ReactNode; items: readonly ChartTooltipItem[]; /** Formats each value and the total; numbers in the host's locale by default. */ formatValue?: ((n: number) => string) | undefined; /** Adds the total; on by default when there is more than one series. */ total?: boolean | undefined; highlighted?: string | null | undefined; /** `series` (the default) lists the series in the order of `items`, the legend's; `value` * lists the largest first. The tooltip and the readout both follow it. */ order?: ChartReadingOrder | undefined; /** Leaves out series whose value is zero; off by default, since a zero is a reading too. */ hideZero?: boolean | undefined; } /** A point's reading docked above a chart's plot, for a chart too narrow for a tooltip beside * its crosshair: the label and total on one line, then each series' swatch, name and value, * in two columns as wide as their content when everything fits at full length, else one. * By default every series keeps its place and its row, zero or not, so the readout keeps its * height and order as the reading changes. */ export declare function ChartReadout({ label, items, formatValue, total, highlighted, order, hideZero, className, }: ChartReading & { className?: string | undefined; }): import("react").JSX.Element; /** A chart's plot with its reading, placed for its width: on a wide chart a tooltip beside the * crosshair at `x` while a point is hovered, and under 28rem, as on a phone, a readout docked * above the plot that never covers it or its legend, showing `rest`, such as the latest point, * while none is. `children` is the plot, and `x` the crosshair in it, or null. The app positions * nothing: the frame measures itself through a container query. */ export declare function ChartTooltipFrame({ x, reading, rest, top, gap, className, children, }: { x: number | null; /** The hovered point's reading, or null while none is. */ reading: ChartReading | null; /** What the readout shows while no point is hovered, so it keeps its place. */ rest: ChartReading; top?: number | undefined; gap?: number | undefined; className?: string | undefined; children: ReactNode; }): import("react").JSX.Element;