@lilt-ui/charts 0.12.0 → 0.12.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 +262 -253
- package/README.md +6 -20
- package/dist/finance.js +5 -1
- package/dist/index.js +416 -367
- package/dist/interaction/axis-cursor.d.ts +5 -0
- package/dist/interaction/use-pin-release.d.ts +9 -0
- package/dist/interaction/use-touch-glide.d.ts +4 -0
- package/dist/marks/contract.d.ts +6 -0
- package/dist/primitives/hover-band.d.ts +2 -1
- package/dist/{skeleton-block-CxrRuqe0.js → skeleton-block-ClcPgFdK.js} +1320 -1296
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,11 +97,11 @@ That's the whole card: the headline, the change chip, value tiles, and hover all
|
|
|
97
97
|
| **Spread** | Range (floating bars, error bars, timeline intervals) and Box plot |
|
|
98
98
|
| **Markets** | Candlestick, Indicators, Price, Depth, Order book, and Portfolio |
|
|
99
99
|
|
|
100
|
-
###
|
|
100
|
+
### Companion cards
|
|
101
101
|
|
|
102
102
|
`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.
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
They take the same `depth`, loading, empty, and header props as every other card, plus `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).
|
|
105
105
|
|
|
106
106
|
## Finance charts
|
|
107
107
|
|
|
@@ -206,8 +206,10 @@ Cards that need attention rise, what you've seen calms down, and what clears set
|
|
|
206
206
|
|
|
207
207
|
- **Linked hover.** Give cards the same `sync` name and they read the same moment together.
|
|
208
208
|
- **Targets and forecasts.** `target` draws a goal line and counts the points that reach it. `forecast` marks projected rows and keeps them out of the headline.
|
|
209
|
-
- **Pin and compare.** Click to pin
|
|
209
|
+
- **Pin and compare.** Click any mark to pin it; press anywhere off the marks, or Escape, to let go. Add `compare` and drag across a chart to see what changed, in the headline or, with `compare="badge"`, in the card's tab.
|
|
210
210
|
- **Honest data.** `null` is a gap, never a zero, and missing values say so.
|
|
211
|
+
- **Loading and empty.** `loading` shows a skeleton that `"shimmer"`s, `"draw"`s, or `"breathe"`s in the chart's own shape, then hands over to the data. A period with no rows shows a still empty state, or your own with `empty`, and the headline reads a dash, never zero.
|
|
212
|
+
- **Long series.** Line and area cards draw tens of thousands of points from four per pixel column; hover, tiles, and exports still read every row.
|
|
211
213
|
- **Watch.** `normal` flags what's unusual and says why; a `ChartBoard` raises what needs attention.
|
|
212
214
|
- **Calm by default.** Keyboard navigation, screen reader labels, and motion that respects reduced-motion settings.
|
|
213
215
|
|
|
@@ -235,7 +237,7 @@ function PeriodSelect({ value, options, onValueChange, ...rest }: ChartRangeSele
|
|
|
235
237
|
<ChartComponentsProvider rangeSelect={PeriodSelect}>{children}</ChartComponentsProvider>;
|
|
236
238
|
```
|
|
237
239
|
|
|
238
|
-
|
|
240
|
+
Every card that pins works from the keyboard: Tab to the chart, arrows to inspect, Enter or Space to pin, and Escape to clear. Radial, Funnel, and Horizontal bar cards can hand their pin to you with a controlled `selected`; a click, Escape, or a press off the marks then asks `onSelectedChange` instead of changing it.
|
|
239
241
|
|
|
240
242
|
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.
|
|
241
243
|
|
|
@@ -246,22 +248,6 @@ Every Lilt style lives in the `lilt` cascade layer, so your CSS wins without spe
|
|
|
246
248
|
@import 'tailwindcss';
|
|
247
249
|
```
|
|
248
250
|
|
|
249
|
-
## Upgrading from 0.1
|
|
250
|
-
|
|
251
|
-
0.2 replaces a series' `interval` with named `fields`, which carry any companion values: a forecast's low and high, quartiles, or a candle's open, high, and low. `IntervalBand` now names the fields it reads:
|
|
252
|
-
|
|
253
|
-
```tsx
|
|
254
|
-
// 0.1
|
|
255
|
-
{ id: 'revenue', accessor: (row) => row.revenue, interval: { lower: (row) => row.low, upper: (row) => row.high, meaning: 'Forecast' } }
|
|
256
|
-
<IntervalBand series="revenue" />
|
|
257
|
-
|
|
258
|
-
// 0.2
|
|
259
|
-
{ id: 'revenue', accessor: (row) => row.revenue, fields: { low: { label: 'Low', accessor: (row) => row.low }, high: { label: 'High', accessor: (row) => row.high } } }
|
|
260
|
-
<IntervalBand series="revenue" lower="low" upper="high" />
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
Cards are unchanged: `forecast={{ from, lower, upper }}` works as before. Tooltip content reads `series[].fields` instead of `series[].interval`.
|
|
264
|
-
|
|
265
251
|
## License
|
|
266
252
|
|
|
267
253
|
MIT © Lilt UI
|
package/dist/finance.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { $ as e, A as t, C as n, I as r, J as i, L as a, P as o, Q as s, R as c, S as l, T as u, X as d, Z as f, _ as p, a as m, b as h, bt as g, dt as _, f as v, i as y, n as b, rt as x, st as S, t as C, u as w, v as T, w as E, x as D, y as O, z as k } from "./skeleton-block-
|
|
2
|
+
import { $ as e, A as t, C as n, I as r, J as i, L as a, P as o, Q as s, R as c, S as l, T as u, X as d, Z as f, _ as p, a as m, b as h, bt as g, dt as _, f as v, i as y, n as b, rt as x, st as S, t as C, u as w, v as T, w as E, x as D, y as O, z as k } from "./skeleton-block-ClcPgFdK.js";
|
|
3
3
|
import { C as A, d as j, g as ee, h as M, p as N, u as P } from "./report-context-DLA3I57K.js";
|
|
4
4
|
import { useEffect as F, useMemo as I, useRef as L, useState as R } from "react";
|
|
5
5
|
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
@@ -191,6 +191,10 @@ var ae = c(function({ series: t, open: n, high: r, low: i, display: a = "candle"
|
|
|
191
191
|
e.high,
|
|
192
192
|
e.low
|
|
193
193
|
],
|
|
194
|
+
color: (e, { row: t, descriptor: n }) => {
|
|
195
|
+
let r = K(t, e.series, e);
|
|
196
|
+
return r ? q(n, t, r) : void 0;
|
|
197
|
+
},
|
|
194
198
|
highlight: (e, { row: t, snapshot: r, descriptor: i }) => {
|
|
195
199
|
let a = K(t, e.series, e);
|
|
196
200
|
if (!a) return null;
|