@lilt-ui/charts 0.9.2 → 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 +14 -0
- package/README.md +36 -10
- package/dist/cards/calendar-heatmap-card.d.ts +18 -0
- package/dist/cards/chart-card.d.ts +4 -1
- package/dist/cards/keys.d.ts +2 -0
- package/dist/cards/observations-card.d.ts +82 -0
- package/dist/cards/range-select.d.ts +28 -0
- 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.js +2 -2
- package/dist/index.d.ts +11 -1
- package/dist/index.js +3426 -2362
- 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-C8gOUsxn.js} +1848 -1598
- 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 +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
3
17
|
## 0.9.2
|
|
4
18
|
|
|
5
19
|
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.
|
|
@@ -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;
|
|
@@ -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;
|
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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NumericKey, TextKey } from './keys';
|
|
2
|
+
import { ObservationsCardProps, ObservationScene } from './observations-card';
|
|
3
|
+
export interface TreemapChartCardProps<Row, Key extends NumericKey<Row>> extends ObservationsCardProps<Row> {
|
|
4
|
+
/** Unique text field naming each leaf within its group. */
|
|
5
|
+
label: TextKey<Row>;
|
|
6
|
+
/** Nonnegative area. Null is missing; zero has no area. */
|
|
7
|
+
value: Key;
|
|
8
|
+
/** Optional parent category. Input rows are leaves, never parent totals. */
|
|
9
|
+
group?: TextKey<Row>;
|
|
10
|
+
}
|
|
11
|
+
interface Rect {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
/** Balanced binary tiling. Input order stays deterministic, with no random placement. */
|
|
18
|
+
export declare function tileAreas<T>(items: readonly T[], weight: (item: T) => number, rect: Rect): {
|
|
19
|
+
item: T;
|
|
20
|
+
rect: Rect;
|
|
21
|
+
}[];
|
|
22
|
+
export declare function treemapLayout<Row>(data: readonly Row[], label: string, value: string, group: string | undefined, width: number, height: number, color?: string): ObservationScene<Row>;
|
|
23
|
+
export declare function TreemapChartCard<Row, const Key extends NumericKey<Row>>({ label, value, group, color, ...props }: TreemapChartCardProps<Row, Key>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChartSeries } from '../types';
|
|
2
|
+
import { NormalizedData } from './normalize';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a change of rows can morph by x value rather than cross-fade: both frames are time or
|
|
5
|
+
* number data in ascending order, they keep the same series, and they share at least two x values
|
|
6
|
+
* to anchor the glide. A period switch such as 30 → 90 days qualifies; categories do not.
|
|
7
|
+
*/
|
|
8
|
+
export declare function canMorphByKey<T>(from: NormalizedData<T>, to: NormalizedData<T>, series: readonly ChartSeries<T>[]): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* One frame of a keyed morph: every row from both frames, in x order. Rows in both ease from
|
|
11
|
+
* their old values to their new ones; rows added after the old last row grow out of its value,
|
|
12
|
+
* so arriving data draws the line forward; other one-sided rows keep their own values, and the
|
|
13
|
+
* gliding domain carries them in or out past the plot edge.
|
|
14
|
+
*/
|
|
15
|
+
export declare function keyedFrame<T>(from: NormalizedData<T>, to: NormalizedData<T>, progress: number): NormalizedData<T>;
|
|
16
|
+
/** Ease for something moving across the plot: slow out, quick through, soft landing. */
|
|
17
|
+
export declare function morphEase(progress: number): number;
|
|
18
|
+
/** A domain between two others, at the same eased progress as the data. */
|
|
19
|
+
export declare function mixDomain(from: readonly [number, number], to: readonly [number, number], progress: number): readonly [number, number];
|
|
@@ -5,6 +5,6 @@ export interface LifecycleGeneration {
|
|
|
5
5
|
isCurrent: (generation: number) => boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare function createLifecycleGeneration(): LifecycleGeneration;
|
|
8
|
-
export declare function durationForPhase(phase: 'initial' | 'matched-update' | 'topology-update', reducedMotion: boolean, animateIn?: boolean): number;
|
|
8
|
+
export declare function durationForPhase(phase: 'initial' | 'matched-update' | 'keyed-update' | 'topology-update', reducedMotion: boolean, animateIn?: boolean): number;
|
|
9
9
|
/** Preserve full data fidelity while avoiding repeated per-sample geometry tweens. */
|
|
10
10
|
export declare function skipDataTweenForWorkload(sampleCount: number, millisecondsSinceLastUpdate: number): boolean;
|
package/dist/engine/sankey.d.ts
CHANGED
|
@@ -34,3 +34,19 @@ export declare function layoutSankey(graph: SankeyGraph, width: number, height:
|
|
|
34
34
|
nodes: PositionedSankeyNode[];
|
|
35
35
|
links: PositionedSankeyLink[];
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* A frame between two layouts of the same flows, at `t` from 0 to 1 (a spring may pass 1).
|
|
39
|
+
* Nodes move and resize, links keep their ends attached as they thicken or thin, and nodes or
|
|
40
|
+
* links new to `to` grow from nothing. Matched by id, so a period change reads as the same
|
|
41
|
+
* flows changing rather than a redraw.
|
|
42
|
+
*/
|
|
43
|
+
export declare function mixSankeyLayout(from: {
|
|
44
|
+
nodes: readonly PositionedSankeyNode[];
|
|
45
|
+
links: readonly PositionedSankeyLink[];
|
|
46
|
+
}, to: {
|
|
47
|
+
nodes: readonly PositionedSankeyNode[];
|
|
48
|
+
links: readonly PositionedSankeyLink[];
|
|
49
|
+
}, t: number): {
|
|
50
|
+
nodes: PositionedSankeyNode[];
|
|
51
|
+
links: PositionedSankeyLink[];
|
|
52
|
+
};
|
package/dist/finance.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A as e, C as t, I as n, J as r, L as i, P as a, R as o, S as s, T as c, X as l, Y as u, _ as d, _t as f, a as p, b as m, ct as h, et as g, f as _, i as v, it as y, n as b, q as x, t as S, u as C, v as w, w as T, x as E, y as D, z as O } from "./skeleton-block-
|
|
3
|
-
import {
|
|
2
|
+
import { A as e, C as t, I as n, J as r, L as i, P as a, R as o, S as s, T as c, X as l, Y as u, _ as d, _t as f, a as p, b as m, ct as h, et as g, f as _, i as v, it as y, n as b, q as x, t as S, u as C, v as w, w as T, x as E, y as D, z as O } from "./skeleton-block-C8gOUsxn.js";
|
|
3
|
+
import { C as k, d as A, g as j, h as M, p as ee, u as N } from "./report-context-UrwaoLYZ.js";
|
|
4
4
|
import { useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
|
|
5
5
|
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
6
6
|
import { min as V } from "d3-array";
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export type { FunnelRow as FunnelStageSummary } from './engine/analysis';
|
|
|
41
41
|
export type { ChartSummary, CsvColumn } from './data/chart-data';
|
|
42
42
|
export { ChartRangeSummary } from './toolkit/chart-range-summary';
|
|
43
43
|
export type { ChartRangeSummaryProps } from './toolkit/chart-range-summary';
|
|
44
|
+
export { ChartComponentsProvider } from './cards/range-select';
|
|
45
|
+
export type { ChartRangeSelectProps } from './cards/range-select';
|
|
44
46
|
export { AreaChartCard } from './cards/area-chart-card';
|
|
45
47
|
export type { AreaChartCardProps, CardSeries, CardRange } from './cards/area-chart-card';
|
|
46
48
|
export { LineChartCard } from './cards/line-chart-card';
|
|
@@ -62,6 +64,14 @@ export type { ProgressCardProps, ProgressRange } from './cards/progress-card';
|
|
|
62
64
|
export { FunnelChartCard } from './cards/funnel-chart-card';
|
|
63
65
|
export type { FunnelChartCardProps } from './cards/funnel-chart-card';
|
|
64
66
|
export { HeatmapChartCard } from './cards/heatmap-chart-card';
|
|
67
|
+
export { TreemapChartCard } from './cards/treemap-chart-card';
|
|
68
|
+
export type { TreemapChartCardProps } from './cards/treemap-chart-card';
|
|
69
|
+
export { CalendarHeatmapCard } from './cards/calendar-heatmap-card';
|
|
70
|
+
export type { CalendarHeatmapCardProps } from './cards/calendar-heatmap-card';
|
|
71
|
+
export { TimelineChartCard } from './cards/timeline-chart-card';
|
|
72
|
+
export type { TimelineChartCardProps } from './cards/timeline-chart-card';
|
|
73
|
+
export { StripChartCard } from './cards/strip-chart-card';
|
|
74
|
+
export type { StripChartCardProps } from './cards/strip-chart-card';
|
|
65
75
|
export type { HeatmapAggregate, HeatmapChartCardProps } from './cards/heatmap-chart-card';
|
|
66
76
|
export { ScatterChartCard } from './cards/scatter-chart-card';
|
|
67
77
|
export type { ScatterAggregate, ScatterChartCardProps } from './cards/scatter-chart-card';
|
|
@@ -79,5 +89,5 @@ export { ActivityRingCard } from './cards/activity-ring-card';
|
|
|
79
89
|
export type { ActivityAggregate, ActivityRingCardProps } from './cards/activity-ring-card';
|
|
80
90
|
export { ChartCard, ChartCardHeader, ChartCardTitle, ChartCardValue, ChartCardDelta, ChartCardCaption, ChartCardRange, CardBadge, CardFrameContext, } from './cards/chart-card';
|
|
81
91
|
export type { CardFrame, ChartCardProps, ChartCardHeaderProps, ChartCardValueProps, ChartCardDeltaProps, ChartCardRangeProps, ChartCardRangeOption, CardBadgeProps, } from './cards/chart-card';
|
|
82
|
-
export type { KeysOfType, NumericKey, TextKey, XKey, XKind } from './cards/keys';
|
|
92
|
+
export type { KeysOfType, NumericKey, TextKey, TimeKey, XKey, XKind } from './cards/keys';
|
|
83
93
|
export type { NormalReport } from './watch/board/board-state';
|