@lilt-ui/charts 0.4.0 → 0.5.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/activity-ring.d.ts +3 -1
  3. package/dist/cards/activity-ring-card.d.ts +3 -1
  4. package/dist/cards/bar-chart-card.d.ts +5 -2
  5. package/dist/cards/box-plot-card.d.ts +3 -1
  6. package/dist/cards/cartesian-card.d.ts +15 -3
  7. package/dist/cards/combo-chart-card.d.ts +4 -2
  8. package/dist/cards/funnel-chart-card.d.ts +26 -2
  9. package/dist/cards/heatmap-chart-card.d.ts +6 -1
  10. package/dist/cards/horizontal-bar-chart-card.d.ts +7 -3
  11. package/dist/cards/progress-card.d.ts +6 -1
  12. package/dist/cards/radar-chart-card.d.ts +9 -2
  13. package/dist/cards/radial-chart-card.d.ts +14 -5
  14. package/dist/cards/range-chart-card.d.ts +3 -1
  15. package/dist/cards/sankey-chart-card.d.ts +6 -1
  16. package/dist/cards/scatter-chart-card.d.ts +11 -2
  17. package/dist/cards/slope-chart-card.d.ts +6 -1
  18. package/dist/cards/stat-card.d.ts +7 -2
  19. package/dist/{cartesian-card-Cj1o38DC.js → cartesian-card-7DAiMU3w.js} +2023 -1604
  20. package/dist/engine/depth.d.ts +42 -0
  21. package/dist/engine/isometric-bars.d.ts +25 -0
  22. package/dist/engine/ranges.d.ts +31 -0
  23. package/dist/finance/candle-geometry.d.ts +13 -2
  24. package/dist/finance/candles.d.ts +5 -0
  25. package/dist/finance/cards/candlestick-chart-card.d.ts +6 -1
  26. package/dist/finance/cards/depth-chart-card.d.ts +3 -1
  27. package/dist/finance/order-book.d.ts +4 -2
  28. package/dist/finance.js +492 -447
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +2276 -1765
  31. package/dist/interaction/legend-meter.d.ts +11 -0
  32. package/dist/interaction/value-legend.d.ts +8 -2
  33. package/dist/marks/use-range-mark.d.ts +8 -0
  34. package/dist/primitives/depth-paint.d.ts +103 -0
  35. package/dist/primitives/isometric-bar.d.ts +18 -0
  36. package/dist/styles.css +1 -1
  37. package/dist/types.d.ts +30 -4
  38. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import { ReactElement } from 'react';
2
+ /** The largest positive value a `bars` legend measures against, or null when there is none. */
3
+ export declare function legendMeterScale(values: readonly (number | null)[]): number | null;
4
+ /**
5
+ * A thin bar under a legend value, as long as the value against the largest one shown. Missing,
6
+ * zero and negative values draw an empty track rather than a false sliver.
7
+ */
8
+ export declare function LegendMeter({ value, scale, }: {
9
+ value: number | null;
10
+ scale: number | null;
11
+ }): ReactElement;
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
+ import { CardLegend, ChartLegendSwatch, ChartLegendVariant } from '../types';
2
3
  export interface ValueLegendEntry {
3
4
  id: string;
4
5
  label: string;
@@ -6,9 +7,14 @@ export interface ValueLegendEntry {
6
7
  value: number | null;
7
8
  formattedValue: string;
8
9
  }
10
+ /** The legend layout a card's `legend` prop names: its value tiles are the `cards` layout. */
11
+ export declare const cardLegendVariant: (legend: CardLegend) => ChartLegendVariant;
9
12
  export interface ValueLegendProps<Entries extends readonly ValueLegendEntry[]> {
10
13
  items: Entries;
11
- variant?: 'cards' | 'inline';
14
+ /** `cards` (default), `inline`, `list`, `pills`, or `bars`. */
15
+ variant?: ChartLegendVariant;
16
+ /** The mark beside each label: `square` (default), `dot`, or `line`. */
17
+ swatch?: ChartLegendSwatch;
12
18
  activeId?: NoInfer<Entries[number]['id']> | null;
13
19
  selectedId?: NoInfer<Entries[number]['id']> | null;
14
20
  onHoverIdChange?: (id: NoInfer<Entries[number]['id']> | null) => void;
@@ -29,4 +35,4 @@ export interface ValueLegendProps<Entries extends readonly ValueLegendEntry[]> {
29
35
  style?: CSSProperties;
30
36
  }
31
37
  /** Family-neutral values and layout. The consumer supplies measurements and interaction ownership. */
32
- export declare function ValueLegend<const Entries extends readonly ValueLegendEntry[]>({ items, variant, activeId, selectedId, onHoverIdChange, onSelectedIdChange, hiddenIds, onHiddenIdsChange, renderLabel, renderValue, renderSwatch, renderItem, 'aria-label': ariaLabel, className, style, }: ValueLegendProps<Entries>): import("react/jsx-runtime").JSX.Element;
38
+ export declare function ValueLegend<const Entries extends readonly ValueLegendEntry[]>({ items, variant, swatch, activeId, selectedId, onHoverIdChange, onSelectedIdChange, hiddenIds, onHiddenIdsChange, renderLabel, renderValue, renderSwatch, renderItem, 'aria-label': ariaLabel, className, style, }: ValueLegendProps<Entries>): import("react/jsx-runtime").JSX.Element;
@@ -11,6 +11,14 @@ export interface RangeMarkState {
11
11
  /** The reveal mask while the entrance sweeps in. */
12
12
  mask: string | undefined;
13
13
  clipPath: string;
14
+ /** Like `clipPath`, with headroom above the plot for the tops of marks drawn with depth. */
15
+ depthClip: {
16
+ id: string;
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ };
14
22
  reducedMotion: boolean;
15
23
  inspecting: boolean;
16
24
  }
@@ -0,0 +1,103 @@
1
+ import { ReactElement, SVGProps } from 'react';
2
+ /** Positive lightens toward white, negative darkens toward black, in oklab to keep chroma. */
3
+ export declare const shade: (color: string, amount: number) => string;
4
+ /**
5
+ * Gradient stops through `[offset, shade]` keys, eased between each pair. Linear ramps between
6
+ * a few stops leave visible bands where the slope changes; smoothstep keeps every join soft.
7
+ */
8
+ export declare function ramp(color: string, keys: readonly (readonly [number, number])[]): import("react/jsx-runtime").JSX.Element[];
9
+ /** Flat face colors for marks drawn in batches, where one gradient per shape would cost too much. */
10
+ export declare const prismShades: (color: string) => {
11
+ front: string;
12
+ top: string;
13
+ side: string;
14
+ };
15
+ /** Batched prism faces: every side, then every top, then every front, each in its own shade. */
16
+ export declare function PrismPaths({ batches, front, }: {
17
+ batches: {
18
+ sides: {
19
+ entries(): {
20
+ color: string;
21
+ d: string;
22
+ }[];
23
+ };
24
+ tops: {
25
+ entries(): {
26
+ color: string;
27
+ d: string;
28
+ }[];
29
+ };
30
+ fronts: {
31
+ entries(): {
32
+ color: string;
33
+ d: string;
34
+ }[];
35
+ };
36
+ };
37
+ /** Front paint for a color; defaults to the color itself. */
38
+ front?: (color: string) => SVGProps<SVGPathElement>;
39
+ }): ReactElement;
40
+ /** A clip with headroom for the tops of marks drawn with depth. */
41
+ export declare function DepthClip({ clip, }: {
42
+ clip: {
43
+ id: string;
44
+ x: number;
45
+ y: number;
46
+ width: number;
47
+ height: number;
48
+ };
49
+ }): ReactElement;
50
+ export interface TubeLayer {
51
+ strokeWidth: number;
52
+ /** Shade applied to the band's color, as in `shade`. */
53
+ amount: number;
54
+ transform: string;
55
+ }
56
+ /**
57
+ * The cross-section of a band lit as a tube or a groove, as stacked strokes of its centerline:
58
+ * the full width first, then ever narrower strokes moved toward the light. Every layer stays
59
+ * inside the full stroke, round caps included, so the band's outline never changes: a ring,
60
+ * arc, or progress track keeps its exact angle and length.
61
+ *
62
+ * A `tube` bulges toward the reader: a shaded rim, a lit crown, and a narrow highlight toward
63
+ * the upper left. A `groove` is cut into the card: its upper-left wall is in shadow.
64
+ */
65
+ export declare function tubeLayers(width: number, kind?: 'tube' | 'groove',
66
+ /** Where the light falls from, as a unit vector; the upper left by default. */
67
+ light?: readonly [number, number]): TubeLayer[];
68
+ /** A soft shadow under a drawing lit from the upper left, lifting it off the card. */
69
+ export declare function DropShadow({ id, size, region, }: {
70
+ id: string;
71
+ size: number;
72
+ /**
73
+ * The area the shadow may cover, in the SVG's units. Defaults to a margin around the shape,
74
+ * which is too tight for a thin, nearly flat line.
75
+ */
76
+ region?: {
77
+ x: number;
78
+ y: number;
79
+ width: number;
80
+ height: number;
81
+ };
82
+ }): ReactElement;
83
+ /**
84
+ * A line drawn as a lit tube: every layer of `tubeLayers` along one path. The centerline stays
85
+ * the line's own path, so every point reads exactly where the flat line puts it.
86
+ */
87
+ export declare function TubePath({ d, color, width, dasharray, opacity, }: {
88
+ d: string;
89
+ color: string;
90
+ width: number;
91
+ dasharray?: string;
92
+ opacity?: number;
93
+ }): ReactElement;
94
+ /** The width a line takes as a tube: wide enough for its light to read. */
95
+ export declare const tubeWidth: (lineWidth?: number) => number;
96
+ /**
97
+ * A lit sphere for any circle, mapped to the circle's own bounds: a highlight toward the upper
98
+ * left, the series color through the middle, and shade at the far rim.
99
+ */
100
+ export declare function SphereGradient({ id, color }: {
101
+ id: string;
102
+ color: string;
103
+ }): ReactElement;
@@ -0,0 +1,18 @@
1
+ import { barMarkPath, BarGeometry } from '../engine/bars';
2
+ /**
3
+ * Paint only: the chart still measures, inspects, and animates the original bar geometry.
4
+ * One key light sits above, in front, and to the left: the roof is brightest, the front is lit
5
+ * and falls off toward the floor, and the side turns away into shade. Edges come from the faces
6
+ * meeting, never from stroked lines. `active` raises the light on the inspected bar.
7
+ */
8
+ export declare function IsometricBar({ bar, mark, id, color, fill, fillOpacity, stroke, strokeWidth, active, }: {
9
+ bar: BarGeometry;
10
+ mark: Parameters<typeof barMarkPath>[1];
11
+ id: string;
12
+ color: string;
13
+ fill: string;
14
+ fillOpacity: number;
15
+ stroke?: string;
16
+ strokeWidth?: number;
17
+ active?: boolean;
18
+ }): import("react/jsx-runtime").JSX.Element | null;