/** Charts component prop types — @see docs/COMPONENTS.md#charts (tree-shaken `@godxjp/ui/charts`). */ import type * as React from "react"; import type { ClassNameProp, DescriptionProp, EmptyMessageProp, FooterProp, IdProp, LabelProp, SizeProp } from "../vocabulary/index.js"; /** A single row of chart data — category accessor + one numeric value per series. */ export type ChartDatum = Record; /** One plotted series — `dataKey` accesses the value, `label` is the already-translated legend text. */ export type ChartSeriesProp = { /** Key into each datum holding this series' numeric value. */ dataKey: string; /** Already-translated display label (legend + tooltip). Defaults to `dataKey`. */ label?: string; /** CSS colour or token var. Defaults to the `--chart-1..6` palette by index. */ color?: string; }; /** Shared base for the cartesian charts (Line / Bar / Area). */ type ChartCartesianBase = { /** Row data. Each row is one category with a value per series. */ data: ChartDatum[]; /** One or more plotted series. */ series: ChartSeriesProp[]; /** Key into each datum holding the x-axis category label. */ categoryKey: string; /** Accessible name + visible caption for the chart. REQUIRED (role="img" needs a name). */ label: LabelProp; /** * Paint `label` as a visible caption above the plot. Set `false` when the chart already sits * under a heading that says the same thing (a `CardTitle`, a section `

`): the caption stays * in the DOM as `sr-only`, so `role="img"` keeps its accessible name and only the duplicated * visible title goes away. */ showCaption?: boolean; /** Extra context appended to the screen-reader description. */ description?: DescriptionProp; /** Canvas height preset — `xs|sm|md|lg`. Ignored when `height` is set. */ size?: SizeProp; /** Explicit canvas height in px (overrides `size`). */ height?: number; /** Show the series legend. */ showLegend?: boolean; /** Show the cartesian background grid. */ showGrid?: boolean; /** `Intl.NumberFormat` options for axis ticks + tooltip values (locale is automatic). */ numberFormat?: Intl.NumberFormatOptions; /** Message shown when `data` is empty. Defaults to a localized "no data". */ emptyMessage?: EmptyMessageProp; className?: ClassNameProp; id?: IdProp; }; /** @see LineChart */ export type LineChartProp = ChartCartesianBase & { /** Render smooth (monotone) lines instead of straight segments. */ curved?: boolean; }; /** @see BarChart */ export type BarChartProp = ChartCartesianBase & { /** Stack series into one bar instead of grouping side by side. */ stacked?: boolean; /** Lay bars out horizontally (category on the y-axis). */ horizontal?: boolean; }; /** * @see CompactBarTrend * * Dependency-free (no `recharts`) compact vertical bar trend: N category/value * pairs, muted marks plus ONE emphasized "current" mark. Every dimension resolves * from `--chart-trend-*` tokens, so a screen never writes CSS or an inline height. */ export type CompactBarTrendProp = { /** Row data — one bar per row. Not limited to seven points. */ data: ChartDatum[]; /** Key into each datum holding the category (tick) label. */ categoryKey: string; /** Key into each datum holding the plotted numeric value. */ valueKey: string; /** Accessible name + visible caption for the chart. REQUIRED (role="img" needs a name). */ label: LabelProp; /** * Paint `label` as a visible caption above the plot. Set `false` when the chart already sits * under a heading that says the same thing (a `CardTitle`, a section `

`): the caption stays * in the DOM as `sr-only`, so `role="img"` keeps its accessible name and only the duplicated * visible title goes away. */ showCaption?: boolean; /** Extra context appended to the screen-reader description. */ description?: DescriptionProp; /** Plot-height tier — `xs|sm|md|lg`. Defaults to `xs` (dashboard summary-card density). */ size?: SizeProp; /** * Index of the emphasized ("current") bar. Negative counts from the end (`-1` = the latest * datum); out of range = no emphasis. */ emphasizedIndex?: number; /** Render the category tick labels under the plot. */ showCategoryLabels?: boolean; /** `Intl.NumberFormat` options for the values in the text alternative (locale is automatic). */ numberFormat?: Intl.NumberFormatOptions; /** Activity footer slot rendered below the plot, outside the `role="img"` graphic. */ footer?: FooterProp; /** Message shown when `data` is empty. Defaults to a localized "no data". */ emptyMessage?: EmptyMessageProp; className?: ClassNameProp; id?: IdProp; ref?: React.Ref; }; /** @see AreaChart */ export type AreaChartProp = ChartCartesianBase & { /** Stack series areas instead of overlaying them. */ stacked?: boolean; /** Render smooth (monotone) areas instead of straight segments. */ curved?: boolean; }; /** @see PieChart */ export type PieChartProp = { /** Row data — one slice per row. */ data: ChartDatum[]; /** Key into each datum holding the slice's numeric value. */ dataKey: string; /** Key into each datum holding the slice's category label. */ nameKey: string; /** Per-slice colours, applied by index. Defaults to the `--chart-1..6` palette. */ colors?: string[]; /** Accessible name + visible caption for the chart. REQUIRED. */ label: LabelProp; /** * Paint `label` as a visible caption above the plot. Set `false` when the chart already sits * under a heading that says the same thing (a `CardTitle`, a section `

`): the caption stays * in the DOM as `sr-only`, so `role="img"` keeps its accessible name and only the duplicated * visible title goes away. */ showCaption?: boolean; /** Extra context appended to the screen-reader description. */ description?: DescriptionProp; /** Canvas height preset — `xs|sm|md|lg`. Ignored when `height` is set. */ size?: SizeProp; /** Explicit canvas height in px (overrides `size`). */ height?: number; /** Show the slice legend. */ showLegend?: boolean; /** `Intl.NumberFormat` options for tooltip values (locale is automatic). */ numberFormat?: Intl.NumberFormatOptions; /** Render a donut (hollow centre) instead of a full pie. */ donut?: boolean; /** Message shown when `data` is empty. Defaults to a localized "no data". */ emptyMessage?: EmptyMessageProp; className?: ClassNameProp; id?: IdProp; }; export {};