import type { Theme } from '@mui/material' import type { EChartsOption } from 'echarts' import type { WidgetSeries } from '../types' /** A single category entry in a bar series. */ export interface BarDatum { name: string | number value: number } /** v2 bar widget data shape: array of series, each a flat list of `{name, value}`. */ export type BarWidgetData = readonly (readonly BarDatum[])[] /** Inputs to the structural-only {@link barOptions} builder. */ export interface BarOptionsInput { theme: Theme formatter?: (value: number) => string labelFormatter?: (value: string | number) => string | number } /** * Combined inputs for the option factory creator. Carries everything the * widget needs across BOTH phases — the structural-build (`theme`, * `formatter`, `labelFormatter`, `optionsOverride`) AND the data merge * (`series`, `selection`). */ export interface BarOptionFactoryInput { theme: Theme formatter?: (value: number) => string labelFormatter?: (value: string | number) => string | number /** * Per-series metadata — drives the legend, `series[i].name`, and * (when `color` is set) per-series `itemStyle.color`. Paired with the * data series by index. */ series?: readonly WidgetSeries[] /** * When set, every datum whose `name` is **not** in this list renders dimmed * (`itemStyle.opacity: 0.15`, matching `outOfBrush` styling). `null`/empty * means "no selection active" — every bar is fully opaque. */ selection?: readonly (string | number)[] | null /** * Consumer-supplied partial option merged into the structural option at * structural-build time (via `mergeOptions`). Lets stories override pieces * of the theme-aware base without forking the structural builder. */ optionsOverride?: Partial } export type BarEChartsOption = EChartsOption