@lilt-ui/charts 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +40 -10
- package/dist/cards/activity-ring-card.d.ts +7 -2
- package/dist/cards/calendar-heatmap-card.d.ts +18 -0
- package/dist/cards/cartesian-card.d.ts +9 -3
- package/dist/cards/chart-card.d.ts +7 -3
- package/dist/cards/funnel-chart-card.d.ts +9 -3
- package/dist/cards/heatmap-chart-card.d.ts +7 -2
- package/dist/cards/horizontal-bar-chart-card.d.ts +7 -2
- package/dist/cards/keys.d.ts +2 -0
- package/dist/cards/observations-card.d.ts +82 -0
- package/dist/cards/progress-card.d.ts +7 -2
- package/dist/cards/radar-chart-card.d.ts +9 -3
- package/dist/cards/radial-chart-card.d.ts +9 -3
- package/dist/cards/range-select.d.ts +28 -0
- package/dist/cards/sankey-chart-card.d.ts +7 -2
- package/dist/cards/scatter-chart-card.d.ts +9 -3
- package/dist/cards/slope-chart-card.d.ts +7 -2
- package/dist/cards/stat-card.d.ts +7 -2
- package/dist/cards/strip-chart-card.d.ts +15 -0
- package/dist/cards/timeline-chart-card.d.ts +18 -0
- package/dist/cards/treemap-chart-card.d.ts +24 -0
- package/dist/engine/keyed.d.ts +19 -0
- package/dist/engine/lifecycle.d.ts +1 -1
- package/dist/engine/sankey.d.ts +16 -0
- package/dist/finance/cards/depth-chart-card.d.ts +7 -2
- package/dist/finance/order-book.d.ts +7 -2
- package/dist/finance.js +324 -326
- package/dist/index.d.ts +11 -1
- package/dist/index.js +3258 -2144
- package/dist/marks/contract.d.ts +0 -2
- package/dist/motion/use-chart-motion.d.ts +5 -0
- package/dist/motion/use-departing.d.ts +7 -0
- package/dist/motion/use-snap-bars.d.ts +27 -0
- package/dist/{report-context-CkzH-r8B.js → report-context-UrwaoLYZ.js} +416 -238
- package/dist/{skeleton-block-CHH5SIAo.js → skeleton-block-C8gOUsxn.js} +1672 -1422
- package/dist/styles.css +1 -1
- package/dist/watch/board/board-state.d.ts +0 -2
- package/dist/watch.js +129 -127
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
Every chart family now moves with one motion language, and cards are softer by default.
|
|
6
|
+
|
|
7
|
+
- Added `TreemapChartCard` for flat or grouped part-to-whole layouts, `CalendarHeatmapCard` for UTC daily activity, `TimelineChartCard` for intervals with overlapping lanes, and `StripChartCard` for strip/beeswarm distributions.
|
|
8
|
+
- All four include flat/depth paint, shared shimmer/draw/breathe skeletons and the existing opacity exit, reduced motion, retained rows during refresh, header composition, keyboard inspection, pin/release, and consumer-owned selection readouts.
|
|
9
|
+
- Treemap has its own showcase page. The other additions live as forms of Heatmap, Range, and Scatter, with matching Preview/Code, data, props, shared settings, and loading controls.
|
|
10
|
+
- Period switches morph on lines and areas. When time or number data changes to rows that share x values with the old ones, such as 7 → 21 days, the chart draws both sets while the x and y domains glide: shared points move to their new places, new days arrive from the edge and dropped days leave through it, in one layer. Unrelated rows still cross-fade; reduced motion still switches instantly.
|
|
11
|
+
- Every chart family moves the same way. Horizontal bar rows blur while they travel to a new rank and drain away on leaving; radial slices land on the spring, departing slices collapse and new ones blur in; activity ring columns regrow dot by dot round the day; progress and stat rings land on the spring; funnel stages, radar vertices and sankey flows reshape from where they are instead of redrawing; scatter points, observation marks (treemap, calendar, timeline, strip) travel on the spring and departing ones shrink away; heatmap and calendar cells re-colour in a diagonal ripple. A light motion blur passes over each family as its period changes (line, area, combo, range, box and finance charts included; live charts excepted), and nothing animates on a plain resize. Data arriving after the last row grows out of it, so a line draws itself forward.
|
|
12
|
+
- Bars snap when the set of bars changes, such as a shorter period. New bars rise out of the floor with a soft blur, rippling in; leaving bars drain back into it and narrow toward the gap, which the rest start closing partway through; bars that stay spring to their new place, width and height. A light motion blur passes over the plot as it happens. Bars are tracked by category on category axes, so a reordered chart moves each bar to its new slot. The first entrance uses the same arrival, so loading a page and changing period feel like one motion. Value-only updates are unchanged, and reduced motion switches instantly.
|
|
13
|
+
- Showing or hiding a line or area series glides the y scale in a single layer while the series fades, instead of cross-fading two charts. Bars and stacks keep their existing transitions.
|
|
14
|
+
- Cards draw Lilt's own period select instead of the native one: a pill that opens a frosted list of periods, with a blur swap of the chosen label, a highlight that travels between options, and the listbox keys (arrows, Home/End, Enter, Escape, type-ahead) returning focus to the pill. `ChartComponentsProvider rangeSelect={…}` swaps in your own select for every card below it, typed by `ChartRangeSelectProps`.
|
|
15
|
+
- Softer cards by default. Elevated cards use a 24px radius and are lifted by tone and a hairline shadow instead of a border. The period select, card actions, delta chip, and axis hover badges are pills. Legend tiles lose their outline. The soft and accent tooltips are frosted glass (opaque under reduced transparency) with an 18px radius. Area fills fade fully to transparent. Colors, palettes, plot backgrounds (dots stay the default), and geometry are unchanged; `--lilt-card-radius` still overrides the radius.
|
|
16
|
+
|
|
17
|
+
## 0.9.2
|
|
18
|
+
|
|
19
|
+
Cards can fit inside an existing dashboard widget without duplicating its heading and legend.
|
|
20
|
+
|
|
21
|
+
### Card composition
|
|
22
|
+
|
|
23
|
+
- Every chart card accepts an optional `title`, an independent `aria-label`, and `header={false}`. Omitted titles render no title element. Hiding the header removes the headline, delta and period controls without reserving their space. Depth summary stats follow the header; order book column headings and stat ring graphics remain.
|
|
24
|
+
- Cards with legend layouts accept `legend={false}` without changing their data, colours or marks. Existing layouts and defaults remain. `surface="ghost"` continues to change only the visual frame.
|
|
25
|
+
- Radial cards keep custom centre content, controlled selection and pointer inspection with the header and legend hidden. The graphic supports keyboard inspection and pinning, with a screen-reader data table and no stale readings while loading.
|
|
26
|
+
|
|
27
|
+
### Fixes
|
|
28
|
+
|
|
29
|
+
- Escape releases a radial pin in every legend layout, including inline, and requests `onSelectedChange(null)` for controlled selection.
|
|
30
|
+
|
|
31
|
+
### Documentation
|
|
32
|
+
|
|
33
|
+
- Family prop tables, card composition guidance, a radial Plot only preview and its generated source, package READMEs, API contract and both LLM references describe the same embedding controls.
|
|
34
|
+
|
|
3
35
|
## 0.9.1
|
|
4
36
|
|
|
5
37
|
Charts fit small dashboard widgets, and category cards share their selection with your page. From a first adoption in an existing app.
|
package/README.md
CHANGED
|
@@ -76,16 +76,22 @@ That's the whole card: the headline, the change chip, value tiles, and hover all
|
|
|
76
76
|
<img alt="Stat cards with sparklines, bars, and a goal meter above a needle bar chart and a retention heatmap" src="https://cdn.jsdelivr.net/npm/@lilt-ui/charts/media/cards-dark.webp" />
|
|
77
77
|
</picture>
|
|
78
78
|
|
|
79
|
-
| For | Cards
|
|
80
|
-
| -------------------- |
|
|
81
|
-
| **Trends** | Area, Line, Bar, and Combo cards, overlapping, stacked, or as shares
|
|
82
|
-
| **At a glance** | Stat cards with a sparkline, bars, a meter, or a ring
|
|
83
|
-
| **Parts and goals** | Radial, Progress, and Activity ring
|
|
84
|
-
| **Rankings** | Horizontal bar, with shares and an "Other" row
|
|
85
|
-
| **Flows and change** | Funnel, Sankey, and Slope
|
|
86
|
-
| **Patterns** | Heatmap, Scatter,
|
|
87
|
-
| **Spread** | Range (floating
|
|
88
|
-
| **Markets** | Candlestick, Indicators, Price, Depth, Order book, and Portfolio
|
|
79
|
+
| For | Cards |
|
|
80
|
+
| -------------------- | ----------------------------------------------------------------------- |
|
|
81
|
+
| **Trends** | Area, Line, Bar, and Combo cards, overlapping, stacked, or as shares |
|
|
82
|
+
| **At a glance** | Stat cards with a sparkline, bars, a meter, or a ring |
|
|
83
|
+
| **Parts and goals** | Radial, Treemap, Progress, and Activity ring |
|
|
84
|
+
| **Rankings** | Horizontal bar, with shares and an "Other" row |
|
|
85
|
+
| **Flows and change** | Funnel, Sankey, and Slope |
|
|
86
|
+
| **Patterns** | Heatmap (matrix and calendar), Scatter (points, strip, beeswarm), Radar |
|
|
87
|
+
| **Spread** | Range (floating bars, error bars, timeline intervals) and Box plot |
|
|
88
|
+
| **Markets** | Candlestick, Indicators, Price, Depth, Order book, and Portfolio |
|
|
89
|
+
|
|
90
|
+
### More ways to read observations
|
|
91
|
+
|
|
92
|
+
`TreemapChartCard` reads `label`, `value`, and an optional `group` for one parent level. `CalendarHeatmapCard` reads `date` and `value`, with optional inclusive UTC `from`/`to` bounds. `TimelineChartCard` reads `label`, `start`, and `end`, and packs overlaps within optional `lane` categories. `StripChartCard` reads `category` and `value`; `display="beeswarm"` separates collisions without moving numeric positions.
|
|
93
|
+
|
|
94
|
+
All four support `depth`, `loadingStyle="shimmer" | "draw" | "breathe"`, the shared skeleton fade, and reduced motion. Background refreshes keep accepted readings. They also accept `header={false}`, `onSelectionChange`, and `renderReadout` for your own presentation. Treemap areas must be nonnegative, calendar dates are UTC, and timeline durations are measured in milliseconds (displayed as hours by default).
|
|
89
95
|
|
|
90
96
|
## Finance charts
|
|
91
97
|
|
|
@@ -197,6 +203,30 @@ Cards that need attention rise, what you've seen calms down, and what clears set
|
|
|
197
203
|
|
|
198
204
|
## Fits your design system
|
|
199
205
|
|
|
206
|
+
Omit `title` to render no visible title. `header={false}` removes the entire header, including the headline, delta and period controls. Cards with legend layouts accept `legend={false}` independently. `surface="ghost"` only removes the visual frame. Give embedded charts an `aria-label`; pass `data` directly when your app owns the period selector.
|
|
207
|
+
|
|
208
|
+
Cards with `ranges` draw Lilt's period select: a pill that opens a frosted list, with arrows, Home/End, Enter, Escape and type-ahead. To use your design system's select in every card instead, wrap them once:
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
import { ChartComponentsProvider, type ChartRangeSelectProps } from '@lilt-ui/charts';
|
|
212
|
+
|
|
213
|
+
function PeriodSelect({ value, options, onValueChange, ...rest }: ChartRangeSelectProps) {
|
|
214
|
+
return (
|
|
215
|
+
<Select value={value} onValueChange={onValueChange} aria-label={rest['aria-label']}>
|
|
216
|
+
{options.map((option) => (
|
|
217
|
+
<SelectItem key={option.id} value={option.id}>
|
|
218
|
+
{option.label}
|
|
219
|
+
</SelectItem>
|
|
220
|
+
))}
|
|
221
|
+
</Select>
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
<ChartComponentsProvider rangeSelect={PeriodSelect}>{children}</ChartComponentsProvider>;
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
`RadialChartCard` keeps its centre and pointer interaction with the legend hidden. Tab to the graphic and use arrows to inspect, Enter/Space to pin, and Escape to clear. With a controlled `selected`, Escape requests `onSelectedChange(null)` in every legend layout.
|
|
229
|
+
|
|
200
230
|
Cards follow shadcn theme variables when your app defines them: `--card`, `--card-foreground`, `--muted-foreground`, `--border`, `--ring`, and `--chart-1` to `--chart-5`. Anything you leave out falls back to Lilt's own palette.
|
|
201
231
|
|
|
202
232
|
Every Lilt style lives in the `lilt` cascade layer, so your CSS wins without specificity tricks. With Tailwind, declare the layer order once at the top of your global stylesheet:
|
|
@@ -6,7 +6,12 @@ import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
|
6
6
|
/** How the resting headline sums up the day. */
|
|
7
7
|
export type ActivityAggregate = 'sum' | 'mean' | 'max';
|
|
8
8
|
export interface ActivityRingCardProps<Row, Key extends NumericKey<Row>> {
|
|
9
|
-
title
|
|
9
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
12
|
+
header?: boolean;
|
|
13
|
+
/** Accessible name, independent of the visible title. */
|
|
14
|
+
'aria-label'?: string;
|
|
10
15
|
/** One row per time slot. Omit when `ranges` supplies the data. */
|
|
11
16
|
data?: readonly Row[];
|
|
12
17
|
/** Numeric field with the time of day in hours, from 0 up to 24; 14.5 is 14:30. */
|
|
@@ -60,4 +65,4 @@ export declare function clockLabel(hour: number): string;
|
|
|
60
65
|
* filled by how much happened then. Hovering or stepping around the ring reads each slot in the
|
|
61
66
|
* headline; tiles name the busiest and quietest times.
|
|
62
67
|
*/
|
|
63
|
-
export declare function ActivityRingCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, hour, value, bucketMinutes, unit, maximum: suppliedMaximum, aggregate, height, depth, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, loadingStyle, motion, className, style, }: ActivityRingCardProps<Row, Key>): ReactElement;
|
|
68
|
+
export declare function ActivityRingCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, hour, value, bucketMinutes, unit, maximum: suppliedMaximum, aggregate, height, depth, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, loadingStyle, motion, className, style, }: ActivityRingCardProps<Row, Key>): ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NumericKey, TimeKey } from './keys';
|
|
2
|
+
import { ObservationsCardProps, ObservationScene } from './observations-card';
|
|
3
|
+
/** Calendar dates are UTC days. Date-only strings are validated rather than rolled over. */
|
|
4
|
+
export declare function utcDate(value: unknown): number | null;
|
|
5
|
+
export interface CalendarHeatmapCardProps<Row, Key extends NumericKey<Row>> extends Omit<ObservationsCardProps<Row>, 'legend' | 'legendSwatch'> {
|
|
6
|
+
date: TimeKey<Row>;
|
|
7
|
+
value: Key;
|
|
8
|
+
/** Inclusive UTC date bounds. Default to the observed range. */
|
|
9
|
+
from?: string | number | Date;
|
|
10
|
+
to?: string | number | Date;
|
|
11
|
+
/** Monday by default; Sunday is 0. */
|
|
12
|
+
weekStartsOn?: 0 | 1;
|
|
13
|
+
/** UTC day used to distinguish unobserved future dates. Defaults to today. */
|
|
14
|
+
today?: string | number | Date;
|
|
15
|
+
domain?: readonly [number, number];
|
|
16
|
+
}
|
|
17
|
+
export declare function calendarLayout<Row>(data: readonly Row[], date: string, value: string, width: number, height: number, options?: Pick<CalendarHeatmapCardProps<Row, NumericKey<Row>>, 'from' | 'to' | 'today' | 'weekStartsOn' | 'domain' | 'color' | 'locale'>): ObservationScene<Row>;
|
|
18
|
+
export declare function CalendarHeatmapCard<Row, const Key extends NumericKey<Row>>({ date, value, from, to, weekStartsOn, today, domain, color, locale, ...props }: CalendarHeatmapCardProps<Row, Key>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -61,7 +61,12 @@ export interface CardRange<Row> {
|
|
|
61
61
|
}
|
|
62
62
|
/** Props every Cartesian card shares. Each card adds its own shape options. */
|
|
63
63
|
export interface CartesianCardProps<Row, Key extends NumericKey<Row>> {
|
|
64
|
-
title
|
|
64
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
65
|
+
title?: string;
|
|
66
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
67
|
+
header?: boolean;
|
|
68
|
+
/** Accessible name, independent of the visible title. */
|
|
69
|
+
'aria-label'?: string;
|
|
65
70
|
/** One row per x position. Omit when `ranges` supplies the data. */
|
|
66
71
|
data?: readonly Row[];
|
|
67
72
|
/** Field used for the x axis: labels, numbers, or dates. */
|
|
@@ -89,8 +94,9 @@ export interface CartesianCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
89
94
|
/**
|
|
90
95
|
* How the legend under the plot lays out: value `tiles` (default), compact `inline` labels,
|
|
91
96
|
* `list` rows, tinted `pills`, or `bars` that also draw each value against the largest.
|
|
97
|
+
* False removes the legend without changing the data or marks.
|
|
92
98
|
*/
|
|
93
|
-
legend?: CardLegend;
|
|
99
|
+
legend?: CardLegend | false;
|
|
94
100
|
/** The mark beside each legend label: `square` (default), `dot`, or `line`. */
|
|
95
101
|
legendSwatch?: ChartLegendSwatch;
|
|
96
102
|
/**
|
|
@@ -295,7 +301,7 @@ export declare const CARD_PADDING = 20;
|
|
|
295
301
|
* The shared card body: headline, delta, period, plot, and value tiles, with hover sync and
|
|
296
302
|
* range comparison. Area, Line, and Bar cards differ only in their `shape`.
|
|
297
303
|
*/
|
|
298
|
-
export declare function CartesianCard<Row, Key extends NumericKey<Row>>({ shape, title, data: suppliedData, x, series: seriesInput, headline: suppliedHeadline, aggregate: suppliedAggregate, headlineSeries, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, tiles, legend, legendSwatch, depth, height, valueFormat, locale, formatValue: suppliedFormatValue, formatAxisValue: suppliedFormatAxisValue, formatX, xType, compare, target: suppliedTarget, forecast, sync, axis, hover, hoverStyle, background, spotlight, decimate, surface, badge, numberStyle, palette, bleed, axisInset, pillSeries, pillValue, pillPosition, tooltipIndicator, loading, loadingStyle, motion, className, style, panes, live, heading, restCaption, normal, onNormalChange, }: Omit<CartesianCardProps<Row, Key>, 'series'> & {
|
|
304
|
+
export declare function CartesianCard<Row, Key extends NumericKey<Row>>({ shape, title, header, 'aria-label': ariaLabel, data: suppliedData, x, series: seriesInput, headline: suppliedHeadline, aggregate: suppliedAggregate, headlineSeries, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, tiles, legend, legendSwatch, depth, height, valueFormat, locale, formatValue: suppliedFormatValue, formatAxisValue: suppliedFormatAxisValue, formatX, xType, compare, target: suppliedTarget, forecast, sync, axis, hover, hoverStyle, background, spotlight, decimate, surface, badge, numberStyle, palette, bleed, axisInset, pillSeries, pillValue, pillPosition, tooltipIndicator, loading, loadingStyle, motion, className, style, panes, live, heading, restCaption, normal, onNormalChange, }: Omit<CartesianCardProps<Row, Key>, 'series'> & {
|
|
299
305
|
series: readonly CoreSeries<Key>[];
|
|
300
306
|
shape: CardShape;
|
|
301
307
|
/** Linked panes under the plot, such as volume or indicators. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, KeyboardEventHandler, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
3
3
|
import { ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
4
4
|
export interface ChartCardProps {
|
|
@@ -19,6 +19,7 @@ export interface ChartCardProps {
|
|
|
19
19
|
className?: string;
|
|
20
20
|
style?: CSSProperties | ChartStyle;
|
|
21
21
|
'aria-label'?: string;
|
|
22
|
+
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* What a container such as a watch board adds to the card directly inside it: a tab that takes
|
|
@@ -32,7 +33,7 @@ export interface CardFrame {
|
|
|
32
33
|
/** Set by a container around one card. Cards nested inside that card do not see it. */
|
|
33
34
|
export declare const CardFrameContext: import('react').Context<CardFrame | null>;
|
|
34
35
|
/** The card surface every Lilt card shares: padding, radius, border, and theme tokens. */
|
|
35
|
-
export declare function ChartCard({ children, surface, palette, motion, numberStyle, badge: ownBadge, className, style, 'aria-label': ariaLabel, }: ChartCardProps): ReactElement;
|
|
36
|
+
export declare function ChartCard({ children, surface, palette, motion, numberStyle, badge: ownBadge, className, style, 'aria-label': ariaLabel, onKeyDown, }: ChartCardProps): ReactElement;
|
|
36
37
|
export interface CardBadgeProps {
|
|
37
38
|
children?: ReactNode;
|
|
38
39
|
className?: string;
|
|
@@ -84,5 +85,8 @@ export interface ChartCardRangeProps<Option extends ChartCardRangeOption> {
|
|
|
84
85
|
value?: NoInfer<Option['id']>;
|
|
85
86
|
onValueChange?: (id: NoInfer<Option['id']>) => void;
|
|
86
87
|
}
|
|
87
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Period pill. With options it becomes Lilt's period select, or the select supplied through
|
|
90
|
+
* `ChartComponentsProvider`.
|
|
91
|
+
*/
|
|
88
92
|
export declare function ChartCardRange<const Option extends ChartCardRangeOption>({ label, options, value, onValueChange, }: ChartCardRangeProps<Option>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,12 @@ import { CardRange } from './cartesian-card';
|
|
|
4
4
|
import { NumericKey, TextKey } from './keys';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
6
6
|
export interface FunnelChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
7
|
-
title
|
|
7
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
10
|
+
header?: boolean;
|
|
11
|
+
/** Accessible name, independent of the visible title. */
|
|
12
|
+
'aria-label'?: string;
|
|
8
13
|
/** One row per stage, in funnel order. Omit when `ranges` supplies the data. */
|
|
9
14
|
data?: readonly Row[];
|
|
10
15
|
/** Text field that names each stage. Names must be unique. */
|
|
@@ -37,8 +42,9 @@ export interface FunnelChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
37
42
|
/**
|
|
38
43
|
* How the legend lays out: value `tiles` (default), compact `inline` labels, `list` rows, tinted
|
|
39
44
|
* `pills`, or `bars` that also draw each value against the largest.
|
|
45
|
+
* False removes the legend without changing the data or marks.
|
|
40
46
|
*/
|
|
41
|
-
legend?: CardLegend;
|
|
47
|
+
legend?: CardLegend | false;
|
|
42
48
|
/** The mark beside each legend label: `square` (default), `dot`, or `line`. */
|
|
43
49
|
legendSwatch?: ChartLegendSwatch;
|
|
44
50
|
valueFormat?: Intl.NumberFormatOptions;
|
|
@@ -91,4 +97,4 @@ export declare function pipeEnd(x: number, half: number, rx: number, side: 'left
|
|
|
91
97
|
* its percentage on the band and its count in a tile beneath. Hovering a stage reads it in the
|
|
92
98
|
* headline with the conversion from the step before.
|
|
93
99
|
*/
|
|
94
|
-
export declare function FunnelChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, category, value, curve, colors, tracks, depth, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, legend, legendSwatch, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, selected, onSelectedChange, loading, loadingStyle, motion: motionMode, className, style, }: FunnelChartCardProps<Row, Key>): ReactElement;
|
|
100
|
+
export declare function FunnelChartCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, category, value, curve, colors, tracks, depth, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, legend, legendSwatch, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, selected, onSelectedChange, loading, loadingStyle, motion: motionMode, className, style, }: FunnelChartCardProps<Row, Key>): ReactElement;
|
|
@@ -6,7 +6,12 @@ import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
|
6
6
|
/** How the resting headline summarizes every known cell. */
|
|
7
7
|
export type HeatmapAggregate = 'sum' | 'mean' | 'max';
|
|
8
8
|
export interface HeatmapChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
9
|
-
title
|
|
9
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
12
|
+
header?: boolean;
|
|
13
|
+
/** Accessible name, independent of the visible title. */
|
|
14
|
+
'aria-label'?: string;
|
|
10
15
|
/** One row per cell. Omit when `ranges` supplies the data. */
|
|
11
16
|
data?: readonly Row[];
|
|
12
17
|
/** Text field that places a cell in a column, e.g. the hour. */
|
|
@@ -110,4 +115,4 @@ export declare function labelTier(index: number, count: number): 'major' | 'mino
|
|
|
110
115
|
* labeled. Hovering or focusing a cell reads it in the headline; arrow keys move between cells.
|
|
111
116
|
* Missing cells are hatched and say "No data", so they never read as zero.
|
|
112
117
|
*/
|
|
113
|
-
export declare function HeatmapChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, x, y, value, columns, rows: rowOrder, domain, aggregate, height, radius, gap, depth, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: HeatmapChartCardProps<Row, Key>): ReactElement;
|
|
118
|
+
export declare function HeatmapChartCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, x, y, value, columns, rows: rowOrder, domain, aggregate, height, radius, gap, depth, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: HeatmapChartCardProps<Row, Key>): ReactElement;
|
|
@@ -5,7 +5,12 @@ import { NumericKey, TextKey } from './keys';
|
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
6
6
|
export { rankRows } from './rank';
|
|
7
7
|
export interface HorizontalBarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
8
|
-
title
|
|
8
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
11
|
+
header?: boolean;
|
|
12
|
+
/** Accessible name, independent of the visible title. */
|
|
13
|
+
'aria-label'?: string;
|
|
9
14
|
/** One row per category. Omit when `ranges` supplies the data. */
|
|
10
15
|
data?: readonly Row[];
|
|
11
16
|
/** Text field that names each row. Names must be unique. */
|
|
@@ -69,4 +74,4 @@ export interface HorizontalBarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
69
74
|
* A ranked list card: each row carries a bar, its value, and its share of the total. Hovering a
|
|
70
75
|
* row reads it in the headline; click pins it and the arrow keys move through the list.
|
|
71
76
|
*/
|
|
72
|
-
export declare function HorizontalBarChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, category, value, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, sort, limit, otherLabel, share, rank, depth, barStyle, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, selected, onSelectedChange, loading, loadingStyle, motion: motionMode, className, style, }: HorizontalBarChartCardProps<Row, Key>): ReactElement;
|
|
77
|
+
export declare function HorizontalBarChartCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, category, value, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, sort, limit, otherLabel, share, rank, depth, barStyle, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, selected, onSelectedChange, loading, loadingStyle, motion: motionMode, className, style, }: HorizontalBarChartCardProps<Row, Key>): ReactElement;
|
package/dist/cards/keys.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export type NumericKey<Row> = KeysOfType<Row, number | null | undefined>;
|
|
|
8
8
|
export type TextKey<Row> = KeysOfType<Row, string>;
|
|
9
9
|
/** Row keys usable as an x position: labels, numbers, or dates. */
|
|
10
10
|
export type XKey<Row> = KeysOfType<Row, string | number | Date>;
|
|
11
|
+
/** Nullable time fields for observations whose endpoints may still be missing. */
|
|
12
|
+
export type TimeKey<Row> = KeysOfType<Row, string | number | Date | null | undefined>;
|
|
11
13
|
export type XKind = 'category' | 'number' | 'time';
|
|
12
14
|
export interface ResolvedX<Row> {
|
|
13
15
|
kind: XKind;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CardLegend, ChartLegendSwatch, ChartLoadingStyle, CategorySelection } from '../types';
|
|
3
|
+
import { ChartCardProps } from './chart-card';
|
|
4
|
+
import { CardRange } from './cartesian-card';
|
|
5
|
+
/** Shared presentation options for observation-based cards. */
|
|
6
|
+
export interface ObservationsCardProps<Row> extends Omit<ChartCardProps, 'children'> {
|
|
7
|
+
title?: string;
|
|
8
|
+
header?: boolean;
|
|
9
|
+
data?: readonly Row[];
|
|
10
|
+
height?: number;
|
|
11
|
+
depth?: boolean;
|
|
12
|
+
color?: string;
|
|
13
|
+
headline?: number;
|
|
14
|
+
aggregate?: 'sum' | 'mean' | 'max';
|
|
15
|
+
delta?: number;
|
|
16
|
+
deltaTone?: 'default' | 'inverse' | 'neutral';
|
|
17
|
+
range?: string;
|
|
18
|
+
ranges?: readonly CardRange<Row>[];
|
|
19
|
+
defaultRange?: string;
|
|
20
|
+
valueFormat?: Intl.NumberFormatOptions;
|
|
21
|
+
locale?: string;
|
|
22
|
+
formatValue?: (value: number) => string;
|
|
23
|
+
legend?: CardLegend | false;
|
|
24
|
+
legendSwatch?: ChartLegendSwatch;
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
loadingStyle?: ChartLoadingStyle;
|
|
27
|
+
onSelectionChange?: (selection: CategorySelection<Row | null> | null) => void;
|
|
28
|
+
/** Optional consumer-owned readout, also available when the header is hidden. */
|
|
29
|
+
renderReadout?: (selection: CategorySelection<Row | null> | null) => ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export interface ObservationMark<Row> {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
datum: Row | null;
|
|
35
|
+
value: number | null;
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
color: string;
|
|
41
|
+
group?: string;
|
|
42
|
+
text?: string;
|
|
43
|
+
detail?: string;
|
|
44
|
+
shape?: 'dot' | 'bar' | 'tile';
|
|
45
|
+
missing?: boolean;
|
|
46
|
+
future?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface ObservationScene<Row> {
|
|
49
|
+
marks: ObservationMark<Row>[];
|
|
50
|
+
labels?: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
text: string;
|
|
54
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
55
|
+
}[];
|
|
56
|
+
/** All readings, including observations with no visible area or position. */
|
|
57
|
+
readings?: {
|
|
58
|
+
id: string;
|
|
59
|
+
label: string;
|
|
60
|
+
value: number | null;
|
|
61
|
+
detail?: string;
|
|
62
|
+
}[];
|
|
63
|
+
groups?: {
|
|
64
|
+
id: string;
|
|
65
|
+
label: string;
|
|
66
|
+
color: string;
|
|
67
|
+
value: number | null;
|
|
68
|
+
}[];
|
|
69
|
+
note?: string;
|
|
70
|
+
error?: string;
|
|
71
|
+
height?: number;
|
|
72
|
+
width?: number;
|
|
73
|
+
}
|
|
74
|
+
export declare const seriesColor: (index: number) => string;
|
|
75
|
+
export declare const readField: (row: unknown, key: string) => unknown;
|
|
76
|
+
export declare const readNumber: (row: unknown, key: string) => number | null;
|
|
77
|
+
/** Private shell: every family uses the same inspection, card and skeleton lifecycle. */
|
|
78
|
+
export declare function ObservationsCard<Row>({ title, header, data: suppliedData, height, depth, headline, aggregate, delta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue, legend, legendSwatch, loading, loadingStyle, onSelectionChange, renderReadout, motion, className, color, layout, placeholder, family, ...frame }: ObservationsCardProps<Row> & {
|
|
79
|
+
family: string;
|
|
80
|
+
layout: (data: readonly Row[], width: number, height: number) => ObservationScene<Row>;
|
|
81
|
+
placeholder: (width: number, height: number) => ObservationScene<Row>;
|
|
82
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,12 @@ export interface ProgressRange {
|
|
|
10
10
|
delta?: number;
|
|
11
11
|
}
|
|
12
12
|
export interface ProgressCardProps {
|
|
13
|
-
title
|
|
13
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
16
|
+
header?: boolean;
|
|
17
|
+
/** Accessible name, independent of the visible title. */
|
|
18
|
+
'aria-label'?: string;
|
|
14
19
|
/** The measured amount. `null` shows a dash and an empty track, never zero. */
|
|
15
20
|
value?: number | null;
|
|
16
21
|
/** The goal, in the same unit as the value. */
|
|
@@ -58,4 +63,4 @@ export interface ProgressCardProps {
|
|
|
58
63
|
* One value against a goal: the value in the header, and a large ring or gauge with the
|
|
59
64
|
* percentage reached. Past the goal the ring stays full and the percentage keeps counting.
|
|
60
65
|
*/
|
|
61
|
-
export declare function ProgressCard({ title, value: suppliedValue, target: suppliedTarget, label, variant, depth, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, footer, valueFormat, locale, formatValue, color, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: ProgressCardProps): ReactElement;
|
|
66
|
+
export declare function ProgressCard({ title, header, 'aria-label': ariaLabel, value: suppliedValue, target: suppliedTarget, label, variant, depth, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, footer, valueFormat, locale, formatValue, color, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: ProgressCardProps): ReactElement;
|
|
@@ -6,7 +6,12 @@ import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
|
6
6
|
/** How the resting headline sums up the first series across dimensions. */
|
|
7
7
|
export type RadarAggregate = 'mean' | 'sum' | 'max';
|
|
8
8
|
export interface RadarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
9
|
-
title
|
|
9
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
12
|
+
header?: boolean;
|
|
13
|
+
/** Accessible name, independent of the visible title. */
|
|
14
|
+
'aria-label'?: string;
|
|
10
15
|
/** One row per dimension, in the order to draw them clockwise from the top. */
|
|
11
16
|
data?: readonly Row[];
|
|
12
17
|
/** Text field that names each dimension. Names must be unique. */
|
|
@@ -37,8 +42,9 @@ export interface RadarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
37
42
|
/**
|
|
38
43
|
* How the legend lays out: value `tiles` (default), compact `inline` labels, `list` rows, tinted
|
|
39
44
|
* `pills`, or `bars` that also draw each value against the largest.
|
|
45
|
+
* False removes the legend without changing the data or marks.
|
|
40
46
|
*/
|
|
41
|
-
legend?: CardLegend;
|
|
47
|
+
legend?: CardLegend | false;
|
|
42
48
|
/** The mark beside each legend label: `square` (default), `dot`, or `line`. */
|
|
43
49
|
legendSwatch?: ChartLegendSwatch;
|
|
44
50
|
valueFormat?: Intl.NumberFormatOptions;
|
|
@@ -97,5 +103,5 @@ export declare function profilePath(fractions: readonly (number | null)[], radiu
|
|
|
97
103
|
* shape of strengths and gaps reads at a glance. Hovering or stepping around the spokes reads
|
|
98
104
|
* every profile at that dimension.
|
|
99
105
|
*/
|
|
100
|
-
export declare function RadarChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, category, series, domain: suppliedDomain, aggregate, grid, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, legend, legendSwatch, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: RadarChartCardProps<Row, Key>): ReactElement;
|
|
106
|
+
export declare function RadarChartCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, category, series, domain: suppliedDomain, aggregate, grid, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, legend, legendSwatch, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: RadarChartCardProps<Row, Key>): ReactElement;
|
|
101
107
|
export {};
|
|
@@ -6,7 +6,12 @@ import { RankedRow } from './rank';
|
|
|
6
6
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
7
7
|
export type RadialChartCardVariant = 'donut' | 'pie' | 'semi' | 'rings';
|
|
8
8
|
export interface RadialChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
9
|
-
title
|
|
9
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
12
|
+
header?: boolean;
|
|
13
|
+
/** Accessible name, independent of the visible title. */
|
|
14
|
+
'aria-label'?: string;
|
|
10
15
|
/** One row per category. Omit when `ranges` supplies the data. */
|
|
11
16
|
data?: readonly Row[];
|
|
12
17
|
/** Text field that names each slice. Names must be unique. */
|
|
@@ -28,8 +33,9 @@ export interface RadialChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
28
33
|
* `list` rows with value and share, value `tiles`, an `inline` key, tinted `pills`, or `bars`
|
|
29
34
|
* that also draw each value against the largest. Defaults to tiles for rings, inline for semi,
|
|
30
35
|
* and list otherwise.
|
|
36
|
+
* False removes the legend without changing the data or marks.
|
|
31
37
|
*/
|
|
32
|
-
legend?: CardLegend;
|
|
38
|
+
legend?: CardLegend | false;
|
|
33
39
|
/** The mark beside each legend label: `square` (default), `dot`, or `line`. */
|
|
34
40
|
legendSwatch?: ChartLegendSwatch;
|
|
35
41
|
/** Resting headline. Defaults to the total of every slice. */
|
|
@@ -113,5 +119,5 @@ export declare function ringAngles(rows: readonly RankedRow[]): Slice[];
|
|
|
113
119
|
* A donut or pie card: the headline total, slices with a matching legend, and each slice's
|
|
114
120
|
* share. Hovering a slice or a legend row reads it in the headline.
|
|
115
121
|
*/
|
|
116
|
-
export declare function RadialChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, category, value, variant, depth, legend, legendSwatch, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, limit, otherLabel, sort, valueFormat, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, selected, onSelectedChange, colors: fixedColors, center, loading, loadingStyle, motion: motionMode, className, style, }: RadialChartCardProps<Row, Key>): ReactElement;
|
|
122
|
+
export declare function RadialChartCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, category, value, variant, depth, legend, legendSwatch, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, limit, otherLabel, sort, valueFormat, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, selected, onSelectedChange, colors: fixedColors, center, loading, loadingStyle, motion: motionMode, className, style, }: RadialChartCardProps<Row, Key>): ReactElement;
|
|
117
123
|
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
/** What a card hands its period select: the periods, the chosen one, and how to change it. */
|
|
3
|
+
export interface ChartRangeSelectProps {
|
|
4
|
+
value: string;
|
|
5
|
+
options: readonly {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
onValueChange: (id: string) => void;
|
|
10
|
+
/** Accessible name for the control, e.g. "Period". */
|
|
11
|
+
'aria-label': string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Swap in your own components for the controls cards draw. `rangeSelect` replaces every card's
|
|
15
|
+
* period select below it, so an app can use its design system's select (shadcn, Base UI, …).
|
|
16
|
+
* Without it, cards use Lilt's own.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ChartComponentsProvider({ rangeSelect, children, }: {
|
|
19
|
+
rangeSelect?: ComponentType<ChartRangeSelectProps>;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function useCustomRangeSelect(): ComponentType<ChartRangeSelectProps> | null;
|
|
23
|
+
/**
|
|
24
|
+
* Lilt's period select: a pill that opens a frosted list of periods. It follows the listbox
|
|
25
|
+
* pattern, so arrows, Home, End, Enter, Escape and typing a period's first letter all work,
|
|
26
|
+
* and focus returns to the pill when the list closes.
|
|
27
|
+
*/
|
|
28
|
+
export declare function RangeSelect({ value, options, onValueChange, 'aria-label': ariaLabel, }: ChartRangeSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,12 @@ import { CardRange } from './cartesian-card';
|
|
|
5
5
|
import { NumericKey, TextKey } from './keys';
|
|
6
6
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
7
7
|
export interface SankeyChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
8
|
-
title
|
|
8
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
11
|
+
header?: boolean;
|
|
12
|
+
/** Accessible name, independent of the visible title. */
|
|
13
|
+
'aria-label'?: string;
|
|
9
14
|
/** One row per flow between two steps. Omit when `ranges` supplies the data. */
|
|
10
15
|
data?: readonly Row[];
|
|
11
16
|
/** Text field naming the step a flow leaves. */
|
|
@@ -71,5 +76,5 @@ export declare function sankeyGraph<Row>({ data, source, target, value, conserva
|
|
|
71
76
|
* amount that moved. Hovering or stepping through flows with the arrow keys reads each in the
|
|
72
77
|
* headline with its share of the step it left.
|
|
73
78
|
*/
|
|
74
|
-
export declare function SankeyChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, source, target, value, conservation, depth, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: SankeyChartCardProps<Row, Key>): ReactElement;
|
|
79
|
+
export declare function SankeyChartCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, source, target, value, conservation, depth, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: SankeyChartCardProps<Row, Key>): ReactElement;
|
|
75
80
|
export {};
|
|
@@ -6,7 +6,12 @@ import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
|
6
6
|
/** How the resting headline sums up every plotted point's `y`. */
|
|
7
7
|
export type ScatterAggregate = 'sum' | 'mean' | 'max';
|
|
8
8
|
export interface ScatterChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
9
|
-
title
|
|
9
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
12
|
+
header?: boolean;
|
|
13
|
+
/** Accessible name, independent of the visible title. */
|
|
14
|
+
'aria-label'?: string;
|
|
10
15
|
/** One row per point. Omit when `ranges` supplies the data. */
|
|
11
16
|
data?: readonly Row[];
|
|
12
17
|
/** Numeric field for the horizontal position. */
|
|
@@ -45,8 +50,9 @@ export interface ScatterChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
45
50
|
/**
|
|
46
51
|
* How the legend lays out: value `tiles` (default), compact `inline` labels, `list` rows, tinted
|
|
47
52
|
* `pills`, or `bars` that also draw each value against the largest.
|
|
53
|
+
* False removes the legend without changing the data or marks.
|
|
48
54
|
*/
|
|
49
|
-
legend?: CardLegend;
|
|
55
|
+
legend?: CardLegend | false;
|
|
50
56
|
/** The mark beside each legend label: `square` (default), `dot`, or `line`. */
|
|
51
57
|
legendSwatch?: ChartLegendSwatch;
|
|
52
58
|
/** Number format for `y`: the headline, legend, and y axis. */
|
|
@@ -98,4 +104,4 @@ export declare function clipTrend(fit: {
|
|
|
98
104
|
* and colored by group. Hovering or stepping through points with the arrow keys reads each one in
|
|
99
105
|
* the headline, with its position marked on both axes.
|
|
100
106
|
*/
|
|
101
|
-
export declare function ScatterChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, x, y, size, sizeLabel, group, label, xLabel, yLabel, trend, depth, height, aggregate, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, legend, legendSwatch, xFormat, locale, formatValue: suppliedFormatValue, formatX: suppliedFormatX, color, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: ScatterChartCardProps<Row, Key>): ReactElement;
|
|
107
|
+
export declare function ScatterChartCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, x, y, size, sizeLabel, group, label, xLabel, yLabel, trend, depth, height, aggregate, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, legend, legendSwatch, xFormat, locale, formatValue: suppliedFormatValue, formatX: suppliedFormatX, color, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: ScatterChartCardProps<Row, Key>): ReactElement;
|
|
@@ -6,7 +6,12 @@ import { NumericKey, TextKey } from './keys';
|
|
|
6
6
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
7
7
|
export type { SlopeOrder } from '../engine/slope';
|
|
8
8
|
export interface SlopeChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
9
|
-
title
|
|
9
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
12
|
+
header?: boolean;
|
|
13
|
+
/** Accessible name, independent of the visible title. */
|
|
14
|
+
'aria-label'?: string;
|
|
10
15
|
/** One row per category with both measurements. Omit when `ranges` supplies the data. */
|
|
11
16
|
data?: readonly Row[];
|
|
12
17
|
/** Text field that names each row. Names must be unique. */
|
|
@@ -76,4 +81,4 @@ export interface SlopeChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
76
81
|
* category reads its later value and change in the headline; click pins it, and the arrow keys
|
|
77
82
|
* move through categories.
|
|
78
83
|
*/
|
|
79
|
-
export declare function SlopeChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, category, from, to, fromLabel, toLabel, variant, depth, sort, aggregate, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, color, height, valueFormat, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: SlopeChartCardProps<Row, Key>): ReactElement;
|
|
84
|
+
export declare function SlopeChartCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data: suppliedData, category, from, to, fromLabel, toLabel, variant, depth, sort, aggregate, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, color, height, valueFormat, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, loading, loadingStyle, motion: motionMode, className, style, }: SlopeChartCardProps<Row, Key>): ReactElement;
|
|
@@ -6,7 +6,12 @@ import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
|
6
6
|
export type StatCardChart = 'area' | 'line' | 'bars' | 'meter' | 'ring' | 'none';
|
|
7
7
|
export interface StatCardProps<Row, Key extends NumericKey<Row>> {
|
|
8
8
|
/** The metric's name, e.g. "Revenue". Also names the card for screen readers. */
|
|
9
|
-
title
|
|
9
|
+
/** Optional visible title. Use aria-label to name an embedded chart. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Show the header, including headline and period controls. Defaults to true. */
|
|
12
|
+
header?: boolean;
|
|
13
|
+
/** Accessible name, independent of the visible title. */
|
|
14
|
+
'aria-label'?: string;
|
|
10
15
|
/** One row per observation. Optional when `headline` is supplied. */
|
|
11
16
|
data?: readonly Row[];
|
|
12
17
|
/** Numeric field to summarize and chart. */
|
|
@@ -71,4 +76,4 @@ export interface StatCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
71
76
|
}
|
|
72
77
|
/** Cells of a meter: whole cells up to the value, then one cell trimmed to the exact remainder. */
|
|
73
78
|
export declare function meterCells(ratio: number, count?: number): number[];
|
|
74
|
-
export declare function StatCard<Row, const Key extends NumericKey<Row>>({ title, data, value: valueKey, x, xType, headline: suppliedHeadline, aggregate, delta, deltaTone, caption, chart, depth, barStyle, target, sync, height, color, aside, valueFormat, locale, formatValue: suppliedFormatValue, formatX, surface, badge, numberStyle, palette, loading, motion, loadingStyle, className, style, }: StatCardProps<Row, Key>): ReactElement;
|
|
79
|
+
export declare function StatCard<Row, const Key extends NumericKey<Row>>({ title, header, 'aria-label': ariaLabel, data, value: valueKey, x, xType, headline: suppliedHeadline, aggregate, delta, deltaTone, caption, chart, depth, barStyle, target, sync, height, color, aside, valueFormat, locale, formatValue: suppliedFormatValue, formatX, surface, badge, numberStyle, palette, loading, motion, loadingStyle, className, style, }: StatCardProps<Row, Key>): ReactElement;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NumericKey, TextKey } from './keys';
|
|
2
|
+
import { ObservationsCardProps, ObservationScene } from './observations-card';
|
|
3
|
+
export interface StripChartCardProps<Row, Key extends NumericKey<Row>> extends Omit<ObservationsCardProps<Row>, 'legend' | 'legendSwatch'> {
|
|
4
|
+
category: TextKey<Row>;
|
|
5
|
+
value: Key;
|
|
6
|
+
/** Unique point identity and accessible name. Falls back to the row index. */
|
|
7
|
+
label?: TextKey<Row>;
|
|
8
|
+
/** Strip uses deterministic vertical jitter; beeswarm avoids collisions. */
|
|
9
|
+
display?: 'strip' | 'beeswarm';
|
|
10
|
+
radius?: number;
|
|
11
|
+
}
|
|
12
|
+
/** Move only across the category band; each numeric position stays exact. */
|
|
13
|
+
export declare function swarmOffsets(positions: readonly number[], diameter: number): number[];
|
|
14
|
+
export declare function stripLayout<Row>(data: readonly Row[], category: string, value: string, label: string | undefined, width: number, height: number, display: 'strip' | 'beeswarm', radius: number, format: (value: number) => string, color?: string): ObservationScene<Row>;
|
|
15
|
+
export declare function StripChartCard<Row, const Key extends NumericKey<Row>>({ category, value, label, display, radius, color, locale, valueFormat, formatValue, aggregate, ...props }: StripChartCardProps<Row, Key>): import("react/jsx-runtime").JSX.Element;
|