mirror of
https://github.com/bitbaum/kits.git
synced 2026-12-04 22:07:10 +01:00
* feat(chartkit): LineExplorer — a chart the reader works; numbers shown with every value a link
- @bitbaum/chartkit/explore: LineExplorer ("use client") over LineChart.
Toggle series (never the last), narrow periods, figures or change since
the first period; the view is data the app keeps in its URL
(initial / onViewChange). Every control 44px, every word from the app.
- LineChart `numbers`: the table behind the chart shown behind a
disclosure, each value a link to its source. Hidden table stays text.
- TableCell can be { text, href }. LineSeries.colour keeps a colour stable.
- Browser test works the explorer at 390/1280, light/dark: toggles,
range, change from 0, table links, 44px targets, no overflow, audit.
First of Solon's "every number clickable, slice and dice" phases; upstream
so every product gets it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(chatkit): the reader's place is where it was when history loads, not a fixed 240px
The Messenger check failed on main every run (325px): loading starts 200px
before the top (the observer's margin), so where the reader stands when the
page arrives varies. Measure the first message before and after the load;
a lost place still fails (it would jump down a whole page, off screen).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(chartkit): the explorer's figures/change switch reads as a choice, not as switched off
The unchosen option was drawn muted, like a series switched off. It is a
choice of two: the chosen one is filled, the other reads as any button.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(chartkit): LineExplorer defaultView — the app's own start, what Reset returns to
A product that keeps a series off until asked for (a second grey median)
showed Reset on first load. defaultView is the starting view: Reset returns
to it and only a departure from it counts as a change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.5 KiB
TypeScript
54 lines
2.5 KiB
TypeScript
import { type LineSeries } from "../index.js";
|
|
import { type LineChartProps } from "../react/LineChart.js";
|
|
/** What a reader has chosen: the state an app can keep in its URL. */
|
|
export interface ExploreView {
|
|
/** Ids of the series switched off. */
|
|
hidden: string[];
|
|
/** First and last period shown, as they appear in the points; null is the data's own end. */
|
|
from: string | null;
|
|
to: string | null;
|
|
/** `value` draws the figures; `change` draws each series' change since the first period shown. */
|
|
mode: "value" | "change";
|
|
}
|
|
/** Every word the controls print, in the product's own language. */
|
|
export interface LineExplorerTexts {
|
|
/** Group label for the series toggles: "Places". */
|
|
series: string;
|
|
from: string;
|
|
to: string;
|
|
/** Group label for the value/change switch: "Show". */
|
|
mode: string;
|
|
value: string;
|
|
/** "Change since {period}" — `{period}` is replaced with the first period shown. */
|
|
change: string;
|
|
reset: string;
|
|
/** Read out on a series toggle that would leave nothing drawn. */
|
|
lastSeries?: string;
|
|
}
|
|
export interface LineExplorerProps extends Omit<LineChartProps, "series" | "yFrom"> {
|
|
series: LineSeries[];
|
|
texts: LineExplorerTexts;
|
|
/** Where the value axis starts in `value` mode (in `change` mode it follows the data). */
|
|
yFrom?: "zero" | "data";
|
|
/** The unit of a change, when it differs from the figure's: "pp" for a percentage. */
|
|
changeUnit?: string;
|
|
/** The view to open with, e.g. read from the URL. */
|
|
initial?: Partial<ExploreView>;
|
|
/**
|
|
* The app's own starting view (a series it keeps off until asked for):
|
|
* what Reset returns to, and what counts as unchanged. Left out, every
|
|
* series on, every period, the figures.
|
|
*/
|
|
defaultView?: Partial<ExploreView>;
|
|
/** Called after the reader changes the view, never on the first render. */
|
|
onViewChange?: (view: ExploreView) => void;
|
|
}
|
|
/**
|
|
* A line chart the reader can work: switch series off and on, narrow the
|
|
* periods, and see change since the first period instead of the figures. The
|
|
* drawing is chartkit's own `LineChart` — the same marks, links and table on
|
|
* the server and after every change — and the view is plain data the app can
|
|
* put in its URL, so what a reader set up is a link they can share.
|
|
*/
|
|
export declare function LineExplorer({ series, texts, initial, defaultView, onViewChange, changeUnit, unit, yFrom, locale, ...chart }: LineExplorerProps): import("react").JSX.Element;
|
|
//# sourceMappingURL=LineExplorer.d.ts.map
|