@lilt-ui/charts 0.9.2 → 0.11.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 +22 -0
- package/README.md +36 -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 +10 -2
- package/dist/cards/chart-card.d.ts +4 -1
- package/dist/cards/funnel-chart-card.d.ts +7 -2
- 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 +87 -0
- package/dist/cards/radar-chart-card.d.ts +7 -2
- package/dist/cards/radial-chart-card.d.ts +7 -2
- 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 +7 -2
- 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/chart.d.ts +1 -1
- 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 +334 -327
- package/dist/index.d.ts +14 -2
- package/dist/index.js +3336 -2217
- package/dist/lifecycle/chart-empty.d.ts +29 -0
- 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-CVNzZBRd.js → report-context-UrwaoLYZ.js} +408 -231
- package/dist/{skeleton-block-Ha7mwDOY.js → skeleton-block-CPaKI7op.js} +2188 -1813
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/watch/board/board-state.d.ts +0 -2
- package/dist/watch.js +129 -127
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
Every chart has a quiet empty state, and it can be yours.
|
|
6
|
+
|
|
7
|
+
- A period with no data shows the same empty state on every card family: a still dot field around "No data for this period" by default, or `empty="shape"` for the chart's own outline at a whisper behind the message. Neither moves, so an empty chart never reads as loading.
|
|
8
|
+
- `empty` takes a built-in look, any element of your own, or `null` for nothing. The chart places it in the plot area, inset to the card's padding; an empty card keeps its size. `ChartEmpty` is the built-in look as a component, so `empty={<ChartEmpty>No visits yet</ChartEmpty>}` keeps it with your words. Composed charts take `empty` on `Chart`.
|
|
9
|
+
- Empty cards no longer claim a value: the headline reads a dash instead of 0, a supplied `delta` chip steps aside, and every family uses the same wording. An empty radial card keeps its height instead of collapsing to its header.
|
|
10
|
+
|
|
11
|
+
## 0.10.0
|
|
12
|
+
|
|
13
|
+
Every chart family now moves with one motion language, and cards are softer by default.
|
|
14
|
+
|
|
15
|
+
- 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.
|
|
16
|
+
- 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.
|
|
17
|
+
- 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.
|
|
18
|
+
- 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.
|
|
19
|
+
- 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.
|
|
20
|
+
- 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.
|
|
21
|
+
- 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.
|
|
22
|
+
- 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`.
|
|
23
|
+
- 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.
|
|
24
|
+
|
|
3
25
|
## 0.9.2
|
|
4
26
|
|
|
5
27
|
Cards can fit inside an existing dashboard widget without duplicating its heading and legend.
|
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
|
|
|
@@ -199,6 +205,26 @@ Cards that need attention rise, what you've seen calms down, and what clears set
|
|
|
199
205
|
|
|
200
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.
|
|
201
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
|
+
|
|
202
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.
|
|
203
229
|
|
|
204
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.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
2
|
+
import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
3
3
|
import { CardRange } from './cartesian-card';
|
|
4
4
|
import { NumericKey } from './keys';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -53,6 +53,11 @@ export interface ActivityRingCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
53
53
|
palette?: ChartPalette;
|
|
54
54
|
loading?: boolean;
|
|
55
55
|
loadingStyle?: ChartLoadingStyle;
|
|
56
|
+
/**
|
|
57
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
58
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
59
|
+
*/
|
|
60
|
+
empty?: ChartEmptyState;
|
|
56
61
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
57
62
|
motion?: ChartMotion;
|
|
58
63
|
className?: string;
|
|
@@ -65,4 +70,4 @@ export declare function clockLabel(hour: number): string;
|
|
|
65
70
|
* filled by how much happened then. Hovering or stepping around the ring reads each slot in the
|
|
66
71
|
* headline; tiles name the busiest and quietest times.
|
|
67
72
|
*/
|
|
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;
|
|
73
|
+
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, empty: emptyState, 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;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartController, ChartMargins, ChartTooltipContext, NumericXConfig, TimeXConfig, ChartAxis, ChartBarAppearance, ChartBackground, ChartCurve, ChartMotion, ChartPalette, ChartHoverReadout, ChartHoverStyle, ChartSeries, ChartTooltipIndicator, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch, ChartLoadingStyle } from '../types';
|
|
2
|
+
import { ChartController, ChartMargins, ChartTooltipContext, NumericXConfig, TimeXConfig, ChartAxis, ChartBarAppearance, ChartBackground, ChartCurve, ChartMotion, ChartPalette, ChartHoverReadout, ChartHoverStyle, ChartSeries, ChartTooltipIndicator, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch, ChartLoadingStyle, ChartEmptyState } from '../types';
|
|
3
3
|
import { NumericKey, ResolvedX, XKey, XKind } from './keys';
|
|
4
4
|
import { CardAggregate } from './format';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
6
|
+
import { ChartEmptyShape } from '../lifecycle/chart-empty';
|
|
6
7
|
import { NormalSpec } from '../watch/engine/normal';
|
|
7
8
|
import { NormalBreakdown } from '../watch/engine/explain';
|
|
8
9
|
import { NormalReport } from '../watch/board/board-state';
|
|
@@ -206,6 +207,11 @@ export interface CartesianCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
206
207
|
* Moving skeletons on a page share a clock.
|
|
207
208
|
*/
|
|
208
209
|
loadingStyle?: ChartLoadingStyle;
|
|
210
|
+
/**
|
|
211
|
+
* What the plot shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
212
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
213
|
+
*/
|
|
214
|
+
empty?: ChartEmptyState;
|
|
209
215
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
210
216
|
motion?: ChartMotion;
|
|
211
217
|
className?: string;
|
|
@@ -277,6 +283,8 @@ export interface CardMarks {
|
|
|
277
283
|
xAxis?: boolean;
|
|
278
284
|
/** Extra text after the hovered x in the headline caption, e.g. open, high and low. */
|
|
279
285
|
describe?: (inspection: ChartTooltipContext) => string | null;
|
|
286
|
+
/** The outline the `shape` empty look draws. Defaults to `bars` for column marks. */
|
|
287
|
+
emptyShape?: ChartEmptyShape;
|
|
280
288
|
}
|
|
281
289
|
/** Panes drawn under the main plot, linked to it: same data, x, margins and crosshair. */
|
|
282
290
|
export interface CardPaneContext<Row> {
|
|
@@ -301,7 +309,7 @@ export declare const CARD_PADDING = 20;
|
|
|
301
309
|
* The shared card body: headline, delta, period, plot, and value tiles, with hover sync and
|
|
302
310
|
* range comparison. Area, Line, and Bar cards differ only in their `shape`.
|
|
303
311
|
*/
|
|
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'> & {
|
|
312
|
+
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, empty, motion, className, style, panes, live, heading, restCaption, normal, onNormalChange, }: Omit<CartesianCardProps<Row, Key>, 'series'> & {
|
|
305
313
|
series: readonly CoreSeries<Key>[];
|
|
306
314
|
shape: CardShape;
|
|
307
315
|
/** Linked panes under the plot, such as volume or indicators. */
|
|
@@ -85,5 +85,8 @@ export interface ChartCardRangeProps<Option extends ChartCardRangeOption> {
|
|
|
85
85
|
value?: NoInfer<Option['id']>;
|
|
86
86
|
onValueChange?: (id: NoInfer<Option['id']>) => void;
|
|
87
87
|
}
|
|
88
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Period pill. With options it becomes Lilt's period select, or the select supplied through
|
|
90
|
+
* `ChartComponentsProvider`.
|
|
91
|
+
*/
|
|
89
92
|
export declare function ChartCardRange<const Option extends ChartCardRangeOption>({ label, options, value, onValueChange, }: ChartCardRangeProps<Option>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch } from '../types';
|
|
2
|
+
import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch } from '../types';
|
|
3
3
|
import { CardRange } from './cartesian-card';
|
|
4
4
|
import { NumericKey, TextKey } from './keys';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -67,6 +67,11 @@ export interface FunnelChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
67
67
|
palette?: ChartPalette;
|
|
68
68
|
loading?: boolean;
|
|
69
69
|
loadingStyle?: ChartLoadingStyle;
|
|
70
|
+
/**
|
|
71
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
72
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
73
|
+
*/
|
|
74
|
+
empty?: ChartEmptyState;
|
|
70
75
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
71
76
|
motion?: ChartMotion;
|
|
72
77
|
className?: string;
|
|
@@ -97,4 +102,4 @@ export declare function pipeEnd(x: number, half: number, rx: number, side: 'left
|
|
|
97
102
|
* its percentage on the band and its count in a tile beneath. Hovering a stage reads it in the
|
|
98
103
|
* headline with the conversion from the step before.
|
|
99
104
|
*/
|
|
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;
|
|
105
|
+
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, empty: emptyState, motion: motionMode, className, style, }: FunnelChartCardProps<Row, Key>): ReactElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
2
|
+
import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
3
3
|
import { CardRange } from './cartesian-card';
|
|
4
4
|
import { NumericKey, TextKey } from './keys';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -65,6 +65,11 @@ export interface HeatmapChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
65
65
|
palette?: ChartPalette;
|
|
66
66
|
loading?: boolean;
|
|
67
67
|
loadingStyle?: ChartLoadingStyle;
|
|
68
|
+
/**
|
|
69
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
70
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
71
|
+
*/
|
|
72
|
+
empty?: ChartEmptyState;
|
|
68
73
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
69
74
|
motion?: ChartMotion;
|
|
70
75
|
className?: string;
|
|
@@ -115,4 +120,4 @@ export declare function labelTier(index: number, count: number): 'major' | 'mino
|
|
|
115
120
|
* labeled. Hovering or focusing a cell reads it in the headline; arrow keys move between cells.
|
|
116
121
|
* Missing cells are hatched and say "No data", so they never read as zero.
|
|
117
122
|
*/
|
|
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;
|
|
123
|
+
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, empty: emptyState, motion: motionMode, className, style, }: HeatmapChartCardProps<Row, Key>): ReactElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface, RankingOrder } from '../types';
|
|
2
|
+
import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface, RankingOrder } from '../types';
|
|
3
3
|
import { CardRange } from './cartesian-card';
|
|
4
4
|
import { NumericKey, TextKey } from './keys';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -65,6 +65,11 @@ export interface HorizontalBarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
65
65
|
palette?: ChartPalette;
|
|
66
66
|
loading?: boolean;
|
|
67
67
|
loadingStyle?: ChartLoadingStyle;
|
|
68
|
+
/**
|
|
69
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
70
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
71
|
+
*/
|
|
72
|
+
empty?: ChartEmptyState;
|
|
68
73
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
69
74
|
motion?: ChartMotion;
|
|
70
75
|
className?: string;
|
|
@@ -74,4 +79,4 @@ export interface HorizontalBarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
74
79
|
* A ranked list card: each row carries a bar, its value, and its share of the total. Hovering a
|
|
75
80
|
* row reads it in the headline; click pins it and the arrow keys move through the list.
|
|
76
81
|
*/
|
|
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;
|
|
82
|
+
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, empty: emptyState, 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,87 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CardLegend, ChartLegendSwatch, ChartLoadingStyle, ChartEmptyState, 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
|
+
/**
|
|
28
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
29
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
30
|
+
*/
|
|
31
|
+
empty?: ChartEmptyState;
|
|
32
|
+
onSelectionChange?: (selection: CategorySelection<Row | null> | null) => void;
|
|
33
|
+
/** Optional consumer-owned readout, also available when the header is hidden. */
|
|
34
|
+
renderReadout?: (selection: CategorySelection<Row | null> | null) => ReactNode;
|
|
35
|
+
}
|
|
36
|
+
export interface ObservationMark<Row> {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
datum: Row | null;
|
|
40
|
+
value: number | null;
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
color: string;
|
|
46
|
+
group?: string;
|
|
47
|
+
text?: string;
|
|
48
|
+
detail?: string;
|
|
49
|
+
shape?: 'dot' | 'bar' | 'tile';
|
|
50
|
+
missing?: boolean;
|
|
51
|
+
future?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface ObservationScene<Row> {
|
|
54
|
+
marks: ObservationMark<Row>[];
|
|
55
|
+
labels?: {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
text: string;
|
|
59
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
60
|
+
}[];
|
|
61
|
+
/** All readings, including observations with no visible area or position. */
|
|
62
|
+
readings?: {
|
|
63
|
+
id: string;
|
|
64
|
+
label: string;
|
|
65
|
+
value: number | null;
|
|
66
|
+
detail?: string;
|
|
67
|
+
}[];
|
|
68
|
+
groups?: {
|
|
69
|
+
id: string;
|
|
70
|
+
label: string;
|
|
71
|
+
color: string;
|
|
72
|
+
value: number | null;
|
|
73
|
+
}[];
|
|
74
|
+
note?: string;
|
|
75
|
+
error?: string;
|
|
76
|
+
height?: number;
|
|
77
|
+
width?: number;
|
|
78
|
+
}
|
|
79
|
+
export declare const seriesColor: (index: number) => string;
|
|
80
|
+
export declare const readField: (row: unknown, key: string) => unknown;
|
|
81
|
+
export declare const readNumber: (row: unknown, key: string) => number | null;
|
|
82
|
+
/** Private shell: every family uses the same inspection, card and skeleton lifecycle. */
|
|
83
|
+
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, empty: emptyState, onSelectionChange, renderReadout, motion, className, color, layout, placeholder, family, ...frame }: ObservationsCardProps<Row> & {
|
|
84
|
+
family: string;
|
|
85
|
+
layout: (data: readonly Row[], width: number, height: number) => ObservationScene<Row>;
|
|
86
|
+
placeholder: (width: number, height: number) => ObservationScene<Row>;
|
|
87
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch } from '../types';
|
|
2
|
+
import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch } from '../types';
|
|
3
3
|
import { CardRange, CardSeries } from './cartesian-card';
|
|
4
4
|
import { NumericKey, TextKey } from './keys';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -58,6 +58,11 @@ export interface RadarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
58
58
|
palette?: ChartPalette;
|
|
59
59
|
loading?: boolean;
|
|
60
60
|
loadingStyle?: ChartLoadingStyle;
|
|
61
|
+
/**
|
|
62
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
63
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
64
|
+
*/
|
|
65
|
+
empty?: ChartEmptyState;
|
|
61
66
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
62
67
|
motion?: ChartMotion;
|
|
63
68
|
className?: string;
|
|
@@ -103,5 +108,5 @@ export declare function profilePath(fractions: readonly (number | null)[], radiu
|
|
|
103
108
|
* shape of strengths and gaps reads at a glance. Hovering or stepping around the spokes reads
|
|
104
109
|
* every profile at that dimension.
|
|
105
110
|
*/
|
|
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;
|
|
111
|
+
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, empty: emptyState, motion: motionMode, className, style, }: RadarChartCardProps<Row, Key>): ReactElement;
|
|
107
112
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartMotion, ChartLoadingStyle, ChartPalette, ChartStyle, ChartSurface, RankingOrder, CardLegend, ChartLegendSwatch } from '../types';
|
|
2
|
+
import { ChartMotion, ChartLoadingStyle, ChartEmptyState, ChartPalette, ChartStyle, ChartSurface, RankingOrder, CardLegend, ChartLegendSwatch } from '../types';
|
|
3
3
|
import { CardRange } from './cartesian-card';
|
|
4
4
|
import { NumericKey, TextKey } from './keys';
|
|
5
5
|
import { RankedRow } from './rank';
|
|
@@ -86,6 +86,11 @@ export interface RadialChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
86
86
|
loading?: boolean;
|
|
87
87
|
/** Shimmer (default), a clockwise draw, or a gentle pulse. Honors reduced motion. */
|
|
88
88
|
loadingStyle?: ChartLoadingStyle;
|
|
89
|
+
/**
|
|
90
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
91
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
92
|
+
*/
|
|
93
|
+
empty?: ChartEmptyState;
|
|
89
94
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
90
95
|
motion?: ChartMotion;
|
|
91
96
|
className?: string;
|
|
@@ -119,5 +124,5 @@ export declare function ringAngles(rows: readonly RankedRow[]): Slice[];
|
|
|
119
124
|
* A donut or pie card: the headline total, slices with a matching legend, and each slice's
|
|
120
125
|
* share. Hovering a slice or a legend row reads it in the headline.
|
|
121
126
|
*/
|
|
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;
|
|
127
|
+
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, empty: emptyState, motion: motionMode, className, style, }: RadialChartCardProps<Row, Key>): ReactElement;
|
|
123
128
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { SankeyGraph, SankeyLink, SankeyNode } from '../engine/sankey';
|
|
3
|
-
import { ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
3
|
+
import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
4
4
|
import { CardRange } from './cartesian-card';
|
|
5
5
|
import { NumericKey, TextKey } from './keys';
|
|
6
6
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -52,6 +52,11 @@ export interface SankeyChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
52
52
|
palette?: ChartPalette;
|
|
53
53
|
loading?: boolean;
|
|
54
54
|
loadingStyle?: ChartLoadingStyle;
|
|
55
|
+
/**
|
|
56
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
57
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
58
|
+
*/
|
|
59
|
+
empty?: ChartEmptyState;
|
|
55
60
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
56
61
|
motion?: ChartMotion;
|
|
57
62
|
className?: string;
|
|
@@ -76,5 +81,5 @@ export declare function sankeyGraph<Row>({ data, source, target, value, conserva
|
|
|
76
81
|
* amount that moved. Hovering or stepping through flows with the arrow keys reads each in the
|
|
77
82
|
* headline with its share of the step it left.
|
|
78
83
|
*/
|
|
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;
|
|
84
|
+
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, empty: emptyState, motion: motionMode, className, style, }: SankeyChartCardProps<Row, Key>): ReactElement;
|
|
80
85
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch } from '../types';
|
|
2
|
+
import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch } from '../types';
|
|
3
3
|
import { CardRange } from './cartesian-card';
|
|
4
4
|
import { NumericKey, TextKey } from './keys';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -72,6 +72,11 @@ export interface ScatterChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
72
72
|
palette?: ChartPalette;
|
|
73
73
|
loading?: boolean;
|
|
74
74
|
loadingStyle?: ChartLoadingStyle;
|
|
75
|
+
/**
|
|
76
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
77
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
78
|
+
*/
|
|
79
|
+
empty?: ChartEmptyState;
|
|
75
80
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
76
81
|
motion?: ChartMotion;
|
|
77
82
|
className?: string;
|
|
@@ -104,4 +109,4 @@ export declare function clipTrend(fit: {
|
|
|
104
109
|
* and colored by group. Hovering or stepping through points with the arrow keys reads each one in
|
|
105
110
|
* the headline, with its position marked on both axes.
|
|
106
111
|
*/
|
|
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;
|
|
112
|
+
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, empty: emptyState, motion: motionMode, className, style, }: ScatterChartCardProps<Row, Key>): ReactElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { SlopeOrder } from '../engine/slope';
|
|
3
|
-
import { ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
3
|
+
import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
4
4
|
import { CardRange } from './cartesian-card';
|
|
5
5
|
import { NumericKey, TextKey } from './keys';
|
|
6
6
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -70,6 +70,11 @@ export interface SlopeChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
70
70
|
palette?: ChartPalette;
|
|
71
71
|
loading?: boolean;
|
|
72
72
|
loadingStyle?: ChartLoadingStyle;
|
|
73
|
+
/**
|
|
74
|
+
* What the card shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
75
|
+
* your own element such as `<ChartEmpty>No visits yet</ChartEmpty>`, or `null` for nothing.
|
|
76
|
+
*/
|
|
77
|
+
empty?: ChartEmptyState;
|
|
73
78
|
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
74
79
|
motion?: ChartMotion;
|
|
75
80
|
className?: string;
|
|
@@ -81,4 +86,4 @@ export interface SlopeChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
81
86
|
* category reads its later value and change in the headline; click pins it, and the arrow keys
|
|
82
87
|
* move through categories.
|
|
83
88
|
*/
|
|
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;
|
|
89
|
+
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, empty: emptyState, motion: motionMode, className, style, }: SlopeChartCardProps<Row, Key>): ReactElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ChartBarAppearance, ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
2
|
+
import { ChartBarAppearance, ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
3
3
|
import { NumericKey, XKey, XKind } from './keys';
|
|
4
4
|
import { CardAggregate } from './format';
|
|
5
5
|
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
@@ -70,10 +70,15 @@ export interface StatCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
70
70
|
palette?: ChartPalette;
|
|
71
71
|
loading?: boolean;
|
|
72
72
|
loadingStyle?: ChartLoadingStyle;
|
|
73
|
+
/**
|
|
74
|
+
* What the trend shows when the period has no data: `dots` (default), the chart's own `shape`,
|
|
75
|
+
* your own element, or `null` for nothing. The headline reads a dash either way.
|
|
76
|
+
*/
|
|
77
|
+
empty?: ChartEmptyState;
|
|
73
78
|
motion?: ChartMotion;
|
|
74
79
|
className?: string;
|
|
75
80
|
style?: CSSProperties | ChartStyle;
|
|
76
81
|
}
|
|
77
82
|
/** Cells of a meter: whole cells up to the value, then one cell trimmed to the exact remainder. */
|
|
78
83
|
export declare function meterCells(ratio: number, count?: number): number[];
|
|
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;
|
|
84
|
+
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, empty, 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;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TextKey, TimeKey } from './keys';
|
|
2
|
+
import { ObservationsCardProps, ObservationScene } from './observations-card';
|
|
3
|
+
export interface TimelineChartCardProps<Row> extends ObservationsCardProps<Row> {
|
|
4
|
+
label: TextKey<Row>;
|
|
5
|
+
/** Optional stable identity when labels repeat. */
|
|
6
|
+
id?: TextKey<Row>;
|
|
7
|
+
start: TimeKey<Row>;
|
|
8
|
+
end: TimeKey<Row>;
|
|
9
|
+
/** Intervals sharing a lane stack into subrows when they overlap. */
|
|
10
|
+
lane?: TextKey<Row>;
|
|
11
|
+
/** Optional color category, such as a machine state. */
|
|
12
|
+
group?: TextKey<Row>;
|
|
13
|
+
/** Formats UTC axis labels and interval endpoints. */
|
|
14
|
+
formatTime?: (timestamp: number) => string;
|
|
15
|
+
}
|
|
16
|
+
export declare function intervalTime(value: unknown): number | null;
|
|
17
|
+
export declare function timelineLayout<Row>(data: readonly Row[], options: Pick<TimelineChartCardProps<Row>, 'label' | 'id' | 'start' | 'end' | 'lane' | 'group' | 'color'>, width: number, height: number, formatTime: (time: number) => string): ObservationScene<Row>;
|
|
18
|
+
export declare function TimelineChartCard<Row>({ label, id, start, end, lane, group, color, formatTime: suppliedFormatTime, locale, formatValue, aggregate, ...props }: TimelineChartCardProps<Row>): import("react/jsx-runtime").JSX.Element;
|