@lilt-ui/charts 0.8.1 → 0.9.1
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 +30 -0
- package/dist/activity-ring.d.ts +4 -1
- package/dist/cards/funnel-chart-card.d.ts +8 -1
- package/dist/cards/horizontal-bar-chart-card.d.ts +8 -1
- package/dist/cards/radial-chart-card.d.ts +28 -1
- package/dist/cards/use-card-selection.d.ts +10 -0
- package/dist/finance.js +382 -378
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2645 -2569
- package/dist/interaction/tooltip-view.d.ts +2 -0
- package/dist/lifecycle/skeleton-exit.d.ts +28 -0
- package/dist/{skeleton-block-JtV7oz8b.js → skeleton-block-CHH5SIAo.js} +2352 -2329
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +17 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
Charts fit small dashboard widgets, and category cards share their selection with your page. From a first adoption in an existing app.
|
|
6
|
+
|
|
7
|
+
### Small and fixed-height plots
|
|
8
|
+
|
|
9
|
+
- The floating tooltip is never taller than its plot. A new `Tooltip` `density` prop, `auto` by default, switches to a compact layout when the panel would not fit: values in two columns, Unpin beside the date, and less padding. Custom content and pin actions follow along, and the panel scrolls as a last resort. `compact` and `comfortable` fix it either way.
|
|
10
|
+
- Keyboard inspection no longer opens a second panel over the tooltip. While the observation slider has keyboard focus, the plot takes the focus ring and a shown tooltip carries the key hints in its footer.
|
|
11
|
+
- `adaptive` now documents what it reserves: below 420px the readout under the plot keeps about 130px even at rest. Set `adaptive={false}` for a widget with a fixed height.
|
|
12
|
+
|
|
13
|
+
### Selection you own
|
|
14
|
+
|
|
15
|
+
- `RadialChartCard`, `FunnelChartCard` and `HorizontalBarChartCard` take `selected` and `onSelectedChange`, so outside filters and a click on the chart share one pinned category. The pin follows the category's name through re-ranking and new values, and a category that leaves the data asks you to clear it.
|
|
16
|
+
- `RadialChartCard` takes `colors`, fixed colors by category name, and `center`, which replaces what the middle of a donut shows.
|
|
17
|
+
|
|
18
|
+
### Docs
|
|
19
|
+
|
|
20
|
+
- The API reference describes the cards that ship instead of the standalone families they replaced, explains category identity versus label, and states decimation as it works. A test now fails when a guide names something the package does not export.
|
|
21
|
+
|
|
22
|
+
## 0.9.0
|
|
23
|
+
|
|
24
|
+
Every chart now leaves its loading skeleton the same way.
|
|
25
|
+
|
|
26
|
+
### Loading
|
|
27
|
+
|
|
28
|
+
- When data lands, the skeleton freezes on the frame it is on, whatever point its loop has reached, then sinks toward where the chart grows from as it fades, and the chart makes its own entrance. Line, area, bar, combo, range, box plot, stat sparklines, scatter and the finance charts sink to the plot's floor; horizontal bars, funnels, sankeys, slopes and stat meters to the left edge; radials, radars, heatmaps, activity rings, progress, stat rings and order books to the centre.
|
|
29
|
+
- A leaving skeleton keeps exactly the shape it was looping in. Bars no longer flash a different, unanimated skeleton as data lands.
|
|
30
|
+
- The fade always completes; on line, area and bar charts the data starts rising just before it ends, so the plot is never empty.
|
|
31
|
+
- The exit animates transform and opacity only, so it stays smooth while the chart's first render is busy. Reduced motion and `motion="none"` swap straight to the data.
|
|
32
|
+
|
|
3
33
|
## 0.8.1
|
|
4
34
|
|
|
5
35
|
### Fixes
|
package/dist/activity-ring.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SkeletonExitOrigin } from './lifecycle/skeleton-exit';
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
3
|
import { ChartLoadingStyle, ChartMotion } from './types';
|
|
3
4
|
export interface ActivitySelection<Row> {
|
|
@@ -24,6 +25,8 @@ export interface ActivityRingProps<Row> {
|
|
|
24
25
|
/** `loading` keeps showing the last accepted day until new data is ready. */
|
|
25
26
|
status?: 'ready' | 'loading';
|
|
26
27
|
loadingStyle?: ChartLoadingStyle;
|
|
28
|
+
/** Set while the skeleton leaves (lifecycle/skeleton-exit.tsx): where it sinks to. */
|
|
29
|
+
skeletonLeaving?: SkeletonExitOrigin;
|
|
27
30
|
/** A new key drops the accepted day and any selection. */
|
|
28
31
|
resetKey?: string | number;
|
|
29
32
|
motion?: ChartMotion;
|
|
@@ -43,5 +46,5 @@ export declare function activitySlots<Row>(data: readonly Row[], hour: (row: Row
|
|
|
43
46
|
* The 24-hour dot ring inside `ActivityRingCard`: one column of dots per time slot, filled by
|
|
44
47
|
* how much happened then. One tab stop; arrow keys step around the day and Enter pins a slot.
|
|
45
48
|
*/
|
|
46
|
-
export declare function ActivityRing<Row>({ data, hour, value, maximum, bucketMinutes, dotDensity, unit, formatValue, center, onSelectionChange, status, loadingStyle, resetKey, motion, height, depth, className, 'aria-label': ariaLabel, }: ActivityRingProps<Row>): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare function ActivityRing<Row>({ data, hour, value, maximum, bucketMinutes, dotDensity, unit, formatValue, center, onSelectionChange, status, loadingStyle, skeletonLeaving, resetKey, motion, height, depth, className, 'aria-label': ariaLabel, }: ActivityRingProps<Row>): import("react/jsx-runtime").JSX.Element;
|
|
47
50
|
export {};
|
|
@@ -51,6 +51,13 @@ export interface FunnelChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
51
51
|
badge?: ReactNode;
|
|
52
52
|
/** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
|
|
53
53
|
numberStyle?: AnimatedNumberVariant;
|
|
54
|
+
/**
|
|
55
|
+
* The pinned stage, by name, for a selection you own: external filters and a click on the
|
|
56
|
+
* chart then share it. `null` pins nothing. Omit it and the card keeps its own pin.
|
|
57
|
+
*/
|
|
58
|
+
selected?: string | null;
|
|
59
|
+
/** Asked when a click, tap, or Escape pins or releases a stage. */
|
|
60
|
+
onSelectedChange?: (stage: string | null) => void;
|
|
54
61
|
palette?: ChartPalette;
|
|
55
62
|
loading?: boolean;
|
|
56
63
|
loadingStyle?: ChartLoadingStyle;
|
|
@@ -84,4 +91,4 @@ export declare function pipeEnd(x: number, half: number, rx: number, side: 'left
|
|
|
84
91
|
* its percentage on the band and its count in a tile beneath. Hovering a stage reads it in the
|
|
85
92
|
* headline with the conversion from the step before.
|
|
86
93
|
*/
|
|
87
|
-
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, loading, loadingStyle, motion: motionMode, className, style, }: FunnelChartCardProps<Row, Key>): ReactElement;
|
|
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;
|
|
@@ -50,6 +50,13 @@ export interface HorizontalBarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
50
50
|
badge?: ReactNode;
|
|
51
51
|
/** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
|
|
52
52
|
numberStyle?: AnimatedNumberVariant;
|
|
53
|
+
/**
|
|
54
|
+
* The pinned category, by name, for a selection you own: external filters and a click on the
|
|
55
|
+
* chart then share it. `null` pins nothing. Omit it and the card keeps its own pin.
|
|
56
|
+
*/
|
|
57
|
+
selected?: string | null;
|
|
58
|
+
/** Asked when a click, tap, or Escape pins or releases a category. */
|
|
59
|
+
onSelectedChange?: (category: string | null) => void;
|
|
53
60
|
palette?: ChartPalette;
|
|
54
61
|
loading?: boolean;
|
|
55
62
|
loadingStyle?: ChartLoadingStyle;
|
|
@@ -62,4 +69,4 @@ export interface HorizontalBarChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
62
69
|
* A ranked list card: each row carries a bar, its value, and its share of the total. Hovering a
|
|
63
70
|
* row reads it in the headline; click pins it and the arrow keys move through the list.
|
|
64
71
|
*/
|
|
65
|
-
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, loading, loadingStyle, motion: motionMode, className, style, }: HorizontalBarChartCardProps<Row, Key>): ReactElement;
|
|
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;
|
|
@@ -42,6 +42,23 @@ export interface RadialChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
42
42
|
/** Period select. Each range replaces data, delta, and headline; slices ease to their new size. */
|
|
43
43
|
ranges?: readonly CardRange<Row>[];
|
|
44
44
|
defaultRange?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The pinned category, by name, for a selection you own: external filters and a click on a
|
|
47
|
+
* slice then share it. `null` pins nothing. Omit it and the card keeps its own pin.
|
|
48
|
+
*/
|
|
49
|
+
selected?: string | null;
|
|
50
|
+
/** Asked when a click, tap, or Escape pins or releases a category. */
|
|
51
|
+
onSelectedChange?: (category: string | null) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Fixed colors by category name, e.g. `{ Critical: '#ef4444' }`, for categories whose color
|
|
54
|
+
* means something. Others take the palette in order, and keep it as values change.
|
|
55
|
+
*/
|
|
56
|
+
colors?: Readonly<Record<string, string>>;
|
|
57
|
+
/**
|
|
58
|
+
* Replaces what the middle of a donut or half donut shows (by default the share of the
|
|
59
|
+
* hovered, pinned, or largest category).
|
|
60
|
+
*/
|
|
61
|
+
center?: (category: RadialCenterCategory) => ReactNode;
|
|
45
62
|
/**
|
|
46
63
|
* Slices shown before the rest are added up as one "Other" slice. Defaults to 5, since more
|
|
47
64
|
* than six colors stop being told apart. `Infinity` shows every category.
|
|
@@ -68,6 +85,16 @@ export interface RadialChartCardProps<Row, Key extends NumericKey<Row>> {
|
|
|
68
85
|
className?: string;
|
|
69
86
|
style?: CSSProperties | ChartStyle;
|
|
70
87
|
}
|
|
88
|
+
/** The category the middle of the chart speaks for: the active one, or else the largest. */
|
|
89
|
+
export interface RadialCenterCategory {
|
|
90
|
+
category: string;
|
|
91
|
+
value: number | null;
|
|
92
|
+
/** Its part of the visible total, 0 to 1; null when unknown. */
|
|
93
|
+
share: number | null;
|
|
94
|
+
/** True while it is hovered, focused, or pinned rather than shown at rest. */
|
|
95
|
+
active: boolean;
|
|
96
|
+
pinned: boolean;
|
|
97
|
+
}
|
|
71
98
|
interface Slice {
|
|
72
99
|
id: string;
|
|
73
100
|
startAngle: number;
|
|
@@ -86,5 +113,5 @@ export declare function ringAngles(rows: readonly RankedRow[]): Slice[];
|
|
|
86
113
|
* A donut or pie card: the headline total, slices with a matching legend, and each slice's
|
|
87
114
|
* share. Hovering a slice or a legend row reads it in the headline.
|
|
88
115
|
*/
|
|
89
|
-
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, loading, loadingStyle, motion: motionMode, className, style, }: RadialChartCardProps<Row, Key>): ReactElement;
|
|
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;
|
|
90
117
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pinned category of a card, owned by the card or by its consumer. Controlled when
|
|
3
|
+
* `selected` is not undefined: the card then only requests changes through `onSelectedChange`,
|
|
4
|
+
* and a selection naming a category that is not in the data shows nothing pinned and asks the
|
|
5
|
+
* owner to clear it. Identity is the category's name, so re-ranking or new values keep the pin.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useCardSelection(selected: string | null | undefined, onSelectedChange: ((category: string | null) => void) | undefined, categories: readonly string[], ready: boolean): readonly [
|
|
8
|
+
string | null,
|
|
9
|
+
(next: string | null | ((current: string | null) => string | null)) => void
|
|
10
|
+
];
|