@lilt-ui/charts 0.1.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 (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/THIRD_PARTY_NOTICES.md +25 -0
  4. package/dist/activity-ring.d.ts +44 -0
  5. package/dist/analysis-BLLWEKBw.js +105 -0
  6. package/dist/cards/activity-ring-card.d.ts +60 -0
  7. package/dist/cards/area-chart-card.d.ts +19 -0
  8. package/dist/cards/area-chart-card.typecheck.d.ts +9 -0
  9. package/dist/cards/bar-chart-card.d.ts +34 -0
  10. package/dist/cards/cartesian-card.d.ts +206 -0
  11. package/dist/cards/chart-card.d.ts +77 -0
  12. package/dist/cards/combo-chart-card.d.ts +51 -0
  13. package/dist/cards/format.d.ts +36 -0
  14. package/dist/cards/funnel-chart-card.d.ts +62 -0
  15. package/dist/cards/heatmap-chart-card.d.ts +107 -0
  16. package/dist/cards/horizontal-bar-chart-card.d.ts +60 -0
  17. package/dist/cards/keys.d.ts +19 -0
  18. package/dist/cards/line-chart-card.d.ts +19 -0
  19. package/dist/cards/progress-card.d.ts +55 -0
  20. package/dist/cards/radar-chart-card.d.ts +93 -0
  21. package/dist/cards/radial-chart-card.d.ts +79 -0
  22. package/dist/cards/rank.d.ts +21 -0
  23. package/dist/cards/sankey-chart-card.d.ts +69 -0
  24. package/dist/cards/scatter-chart-card.d.ts +91 -0
  25. package/dist/cards/slope-chart-card.d.ts +73 -0
  26. package/dist/cards/stat-card.d.ts +68 -0
  27. package/dist/chart-context.d.ts +102 -0
  28. package/dist/chart-plot.d.ts +13 -0
  29. package/dist/chart.d.ts +17 -0
  30. package/dist/data/chart-data.d.ts +24 -0
  31. package/dist/data.d.ts +5 -0
  32. package/dist/data.js +2 -0
  33. package/dist/engine/analysis.d.ts +11 -0
  34. package/dist/engine/bars.d.ts +38 -0
  35. package/dist/engine/comparison.d.ts +3 -0
  36. package/dist/engine/composition.d.ts +6 -0
  37. package/dist/engine/domains.d.ts +13 -0
  38. package/dist/engine/geometry.d.ts +73 -0
  39. package/dist/engine/lifecycle.d.ts +10 -0
  40. package/dist/engine/lookup.d.ts +3 -0
  41. package/dist/engine/normalize.d.ts +21 -0
  42. package/dist/engine/ranking.d.ts +20 -0
  43. package/dist/engine/sankey.d.ts +36 -0
  44. package/dist/engine/scatter.d.ts +15 -0
  45. package/dist/engine/slope.d.ts +46 -0
  46. package/dist/engine/stack.d.ts +11 -0
  47. package/dist/export-chart-svg.d.ts +8 -0
  48. package/dist/index.d.ts +73 -0
  49. package/dist/index.js +11309 -0
  50. package/dist/interaction/adaptive-readout.d.ts +16 -0
  51. package/dist/interaction/axis-cursor.d.ts +30 -0
  52. package/dist/interaction/brush-gesture.d.ts +15 -0
  53. package/dist/interaction/brush-view.d.ts +12 -0
  54. package/dist/interaction/chart-controller.d.ts +6 -0
  55. package/dist/interaction/chart-sync.d.ts +35 -0
  56. package/dist/interaction/comparison-answer.d.ts +11 -0
  57. package/dist/interaction/comparison-layer.d.ts +19 -0
  58. package/dist/interaction/comparison-tooltip.d.ts +14 -0
  59. package/dist/interaction/focus-overview.d.ts +10 -0
  60. package/dist/interaction/inspection-layer.d.ts +29 -0
  61. package/dist/interaction/legend.d.ts +50 -0
  62. package/dist/interaction/pin-marker.d.ts +12 -0
  63. package/dist/interaction/tooltip-context.d.ts +4 -0
  64. package/dist/interaction/tooltip-view.d.ts +26 -0
  65. package/dist/interaction/tooltip.d.ts +10 -0
  66. package/dist/interaction/use-category-state.d.ts +24 -0
  67. package/dist/interaction/use-pinned-selection.d.ts +3 -0
  68. package/dist/interaction/value-legend.d.ts +32 -0
  69. package/dist/interaction/visibility.d.ts +8 -0
  70. package/dist/lifecycle/loading-layer.d.ts +38 -0
  71. package/dist/lifecycle/skeleton-sheen.d.ts +18 -0
  72. package/dist/lifecycle/status-content.d.ts +6 -0
  73. package/dist/model/cartesian-model.d.ts +132 -0
  74. package/dist/model/cartesian-model.typecheck.d.ts +1 -0
  75. package/dist/model/use-chart-state.d.ts +6 -0
  76. package/dist/motion/animated-number.d.ts +54 -0
  77. package/dist/motion/bounded-text.d.ts +13 -0
  78. package/dist/motion/entrance.d.ts +9 -0
  79. package/dist/motion/number-format.d.ts +4 -0
  80. package/dist/motion/use-chart-motion.d.ts +10 -0
  81. package/dist/motion/use-focus-domain.d.ts +7 -0
  82. package/dist/motion/use-glide.d.ts +13 -0
  83. package/dist/motion/use-series-weights.d.ts +2 -0
  84. package/dist/paint.d.ts +11 -0
  85. package/dist/primitives/annotations.d.ts +4 -0
  86. package/dist/primitives/area.d.ts +8 -0
  87. package/dist/primitives/axes.d.ts +9 -0
  88. package/dist/primitives/bar-shape.d.ts +39 -0
  89. package/dist/primitives/bar.d.ts +7 -0
  90. package/dist/primitives/change-comparison.d.ts +3 -0
  91. package/dist/primitives/grid.d.ts +3 -0
  92. package/dist/primitives/interval-band.d.ts +4 -0
  93. package/dist/primitives/line.d.ts +8 -0
  94. package/dist/primitives/plot-background.d.ts +10 -0
  95. package/dist/primitives/reference-line.d.ts +4 -0
  96. package/dist/primitives/runoff.d.ts +49 -0
  97. package/dist/runtime/chart-runtime.d.ts +95 -0
  98. package/dist/styles.css +2 -0
  99. package/dist/toolkit/chart-brush.d.ts +3 -0
  100. package/dist/toolkit/chart-overview.d.ts +3 -0
  101. package/dist/toolkit/chart-range-summary.d.ts +5 -0
  102. package/dist/toolkit/chart-readout.d.ts +3 -0
  103. package/dist/toolkit/chart-toolbar.d.ts +3 -0
  104. package/dist/toolkit/comparison-details.d.ts +7 -0
  105. package/dist/types.d.ts +555 -0
  106. package/dist/use-chart-width.d.ts +5 -0
  107. package/media/cards-dark.webp +0 -0
  108. package/media/cards-light.webp +0 -0
  109. package/media/hero-dark.webp +0 -0
  110. package/media/hero-light.webp +0 -0
  111. package/package.json +71 -0
@@ -0,0 +1,77 @@
1
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
2
+ import { AnimatedNumberVariant } from '../motion/animated-number';
3
+ import { ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
4
+ export interface ChartCardProps {
5
+ children?: ReactNode;
6
+ /** `elevated` (default) lifts the card; `outline` is border-only; `ghost` drops the frame. */
7
+ surface?: ChartSurface;
8
+ /** Series colors for everything inside the card. */
9
+ palette?: ChartPalette;
10
+ /** `none` stops decorative motion inside the card, such as loading shimmer. */
11
+ motion?: ChartMotion;
12
+ /** How the headline animates: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
13
+ numberStyle?: AnimatedNumberVariant;
14
+ /**
15
+ * A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. With a
16
+ * badge, `className` and `style` apply to the frame that holds the tab and the card.
17
+ */
18
+ badge?: ReactNode;
19
+ className?: string;
20
+ style?: CSSProperties | ChartStyle;
21
+ 'aria-label'?: string;
22
+ }
23
+ /** The card surface every Lilt card shares: padding, radius, border, and theme tokens. */
24
+ export declare function ChartCard({ children, surface, palette, motion, numberStyle, badge, className, style, 'aria-label': ariaLabel, }: ChartCardProps): ReactElement;
25
+ export interface CardBadgeProps {
26
+ children?: ReactNode;
27
+ className?: string;
28
+ }
29
+ /**
30
+ * The glass tab a card's `badge` renders. On its own above another panel, tuck the tab's lower
31
+ * edge behind that panel: `position: relative; z-index: 1; margin-top: -12px`.
32
+ */
33
+ export declare function CardBadge({ children, className }: CardBadgeProps): ReactElement;
34
+ export interface ChartCardHeaderProps {
35
+ children?: ReactNode;
36
+ /** Right-aligned content such as a period select or legend. */
37
+ aside?: ReactNode;
38
+ className?: string;
39
+ }
40
+ export declare function ChartCardHeader({ children, aside, className }: ChartCardHeaderProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function ChartCardTitle({ children }: {
42
+ children?: ReactNode;
43
+ }): import("react/jsx-runtime").JSX.Element;
44
+ export interface ChartCardValueProps {
45
+ value: number | null;
46
+ format?: (value: number) => string;
47
+ /** Shown beside the value, e.g. a delta chip or the hovered x label. */
48
+ children?: ReactNode;
49
+ loading?: boolean;
50
+ motion?: 'auto' | 'none';
51
+ }
52
+ export declare function ChartCardValue({ value, format, children, loading, motion, }: ChartCardValueProps): import("react/jsx-runtime").JSX.Element;
53
+ export interface ChartCardDeltaProps {
54
+ /** Fractional change: 0.082 renders as +8.2%. */
55
+ value: number;
56
+ /** Direction is not desirability. Use `inverse` when a decrease is good, `neutral` for neither. */
57
+ tone?: 'default' | 'inverse' | 'neutral';
58
+ format?: (value: number) => string;
59
+ }
60
+ export declare function ChartCardDelta({ value, tone, format }: ChartCardDeltaProps): import("react/jsx-runtime").JSX.Element;
61
+ /** Quiet secondary text beside the value, e.g. the hovered x label. */
62
+ export declare function ChartCardCaption({ children }: {
63
+ children?: ReactNode;
64
+ }): import("react/jsx-runtime").JSX.Element;
65
+ export interface ChartCardRangeOption {
66
+ id: string;
67
+ label: string;
68
+ }
69
+ export interface ChartCardRangeProps<Option extends ChartCardRangeOption> {
70
+ /** A single static label, or options for a period select. */
71
+ label?: string;
72
+ options?: readonly Option[];
73
+ value?: NoInfer<Option['id']>;
74
+ onValueChange?: (id: NoInfer<Option['id']>) => void;
75
+ }
76
+ /** Period pill. Renders a native select when options are supplied. */
77
+ export declare function ChartCardRange<const Option extends ChartCardRangeOption>({ label, options, value, onValueChange, }: ChartCardRangeProps<Option>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { ReactElement } from 'react';
2
+ import { CardSeries, CartesianCardProps } from './cartesian-card';
3
+ import { CardAggregate } from './format';
4
+ import { NumericKey } from './keys';
5
+ import { ChartBarAppearance } from '../types';
6
+ export interface ComboLineSeries<Key extends string> extends CardSeries<Key> {
7
+ /** Number format for this line's tiles, pill, and right-hand labels, e.g. a percentage. */
8
+ valueFormat?: Intl.NumberFormatOptions;
9
+ /**
10
+ * How this line's tile summarizes the period. Defaults to the card's `aggregate`, or `mean`
11
+ * when the line has its own scale, since those are usually rates.
12
+ */
13
+ aggregate?: CardAggregate;
14
+ }
15
+ export interface ComboChartCardProps<Row, Key extends NumericKey<Row>> extends Omit<CartesianCardProps<Row, Key>, 'series' | 'pillValue'> {
16
+ /** Numeric fields drawn as bars, grouped or stacked. They make up the headline. */
17
+ bars: readonly CardSeries<Key>[];
18
+ /**
19
+ * Stack the bars: `true` adds them, `'percent'` shows each bar series' share. Lines stay
20
+ * unstacked over the stack, such as a target over stacked revenue. Omit to group the bars.
21
+ */
22
+ stack?: boolean | 'percent';
23
+ /** Numeric fields drawn as lines over the bars, e.g. a budget, a forecast, or a rate. */
24
+ lines: readonly ComboLineSeries<Key>[];
25
+ /**
26
+ * `shared` (default) puts lines on the bar scale, so heights compare directly, as with actual
27
+ * against budget. `own` fits lines to their own scale for a different unit, such as margin
28
+ * over revenue; its labels sit on the right and share the bar gridlines.
29
+ */
30
+ lineScale?: 'shared' | 'own';
31
+ /** Corner radius in pixels. Defaults to 6. */
32
+ radius?: number;
33
+ /** `end` (default) rounds each bar's value end; `all` rounds every corner. */
34
+ corners?: 'end' | 'all';
35
+ /** Quiet full-height lanes behind each bar or stack. Defaults to false. */
36
+ tracks?: boolean;
37
+ /** Maximum bar width in pixels; bars never exceed their slot. */
38
+ barWidth?: number;
39
+ /** `solid` (default), `segmented`, `needle`, `gradient`, or `outline`. */
40
+ barStyle?: ChartBarAppearance;
41
+ /** `smooth` (default) or `linear` line segments. */
42
+ curve?: 'smooth' | 'linear';
43
+ /** Mark every line observation with a small dot. Defaults to true. */
44
+ points?: boolean;
45
+ }
46
+ /**
47
+ * Bars and lines in one card: amounts as bars, with a target, forecast, or rate drawn over them.
48
+ * The headline totals the bars; every series gets a tile, and the pill reads whichever mark is
49
+ * nearest the pointer.
50
+ */
51
+ export declare function ComboChartCard<Row, const Key extends NumericKey<Row>>({ bars, lines, lineScale, stack, radius, corners, tracks, barWidth, barStyle, curve, points, aggregate, pillPosition, ...props }: ComboChartCardProps<Row, Key>): ReactElement;
@@ -0,0 +1,36 @@
1
+ export type CardAggregate = 'sum' | 'mean' | 'last' | 'max';
2
+ /** Observed values of a field, skipping gaps. */
3
+ export declare function valuesOf<Row>(rows: readonly Row[], key: string): number[];
4
+ /** One number for a period. `null` when nothing was observed, never zero. */
5
+ export declare function summarize(values: readonly number[], aggregate: CardAggregate): number | null;
6
+ export interface CardFormatOptions {
7
+ valueFormat?: Intl.NumberFormatOptions;
8
+ locale?: string;
9
+ formatValue?: (value: number) => string;
10
+ formatAxisValue?: (value: number) => string;
11
+ }
12
+ export interface CardFormatters {
13
+ /** Full value text for headlines, tiles, and pills. */
14
+ value: (value: number) => string;
15
+ /** Compact text for axis labels. */
16
+ axis: (value: number) => string;
17
+ /** Stable wrappers that always call the latest formatter, for memoized chart config. */
18
+ stable: {
19
+ value: (value: number) => string;
20
+ axis: (value: number) => string;
21
+ };
22
+ /** Changes only when the format itself changes. */
23
+ key: string;
24
+ }
25
+ export declare function numberFormatters(locale: string, valueFormat?: Intl.NumberFormatOptions): {
26
+ full: (value: number) => string;
27
+ compact: (value: number) => string;
28
+ plain: (value: number) => string;
29
+ };
30
+ /**
31
+ * Card number formatting: `valueFormat` options, or full control with `formatValue`. Inline
32
+ * formatters are read through a ref so they never rebuild the chart model.
33
+ */
34
+ export declare function useCardFormat({ valueFormat, locale, formatValue, formatAxisValue, }: CardFormatOptions): CardFormatters;
35
+ /** Signed change text: +$1,200 or −$300. */
36
+ export declare function signedFormat(format: (value: number) => string): (value: number) => string;
@@ -0,0 +1,62 @@
1
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
2
+ import { ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
3
+ import { CardRange } from './cartesian-card';
4
+ import { NumericKey, TextKey } from './keys';
5
+ import { AnimatedNumberVariant } from '../motion/animated-number';
6
+ export interface FunnelChartCardProps<Row, Key extends NumericKey<Row>> {
7
+ title: string;
8
+ /** One row per stage, in funnel order. Omit when `ranges` supplies the data. */
9
+ data?: readonly Row[];
10
+ /** Text field that names each stage. Names must be unique. */
11
+ category: TextKey<Row>;
12
+ /** How many reached each stage. Counts never rise from one stage to the next. */
13
+ value: Key;
14
+ /** `smooth` (default) eases each stage into the next; `linear` tapers in straight lines. */
15
+ curve?: 'smooth' | 'linear';
16
+ /** `stages` (default) gives each stage its own palette color; `single` uses one color. */
17
+ colors?: 'stages' | 'single';
18
+ /** A quiet full-height lane behind each stage, marking where 100% sits. Defaults to false. */
19
+ tracks?: boolean;
20
+ /** Plot height in pixels. Defaults to 180. */
21
+ height?: number;
22
+ /** Resting headline. Defaults to the first stage. */
23
+ headline?: number;
24
+ /** Fractional change shown as a chip, e.g. 0.052 → +5.2%. */
25
+ delta?: number;
26
+ deltaTone?: 'default' | 'inverse' | 'neutral';
27
+ /** Static period label, e.g. "Last 7 days". */
28
+ range?: string;
29
+ /** Period select. Each range replaces data, delta, and headline; bands ease to their new size. */
30
+ ranges?: readonly CardRange<Row>[];
31
+ defaultRange?: string;
32
+ valueFormat?: Intl.NumberFormatOptions;
33
+ locale?: string;
34
+ formatValue?: (value: number) => string;
35
+ /** Any CSS color for `colors="single"`. Defaults to the palette's first color. */
36
+ color?: string;
37
+ surface?: ChartSurface;
38
+ /** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */
39
+ badge?: ReactNode;
40
+ /** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
41
+ numberStyle?: AnimatedNumberVariant;
42
+ palette?: ChartPalette;
43
+ loading?: boolean;
44
+ /** `none` turns off decorative motion; reduced-motion users get this automatically. */
45
+ motion?: ChartMotion;
46
+ className?: string;
47
+ style?: CSSProperties | ChartStyle;
48
+ }
49
+ /** Share of the first stage as text; anything above zero but under 1% says so. */
50
+ export declare function stageShare(share: number | null): string;
51
+ /**
52
+ * The band of one stage in a 100-wide column of a 100-tall plot: it holds its own height, then
53
+ * reaches the next stage's height at the column edge. The last stage and stages before a gap
54
+ * stay level.
55
+ */
56
+ export declare function stagePath(index: number, height: number, next: number | null, curve: 'smooth' | 'linear'): string;
57
+ /**
58
+ * A funnel card: stages left to right, each band sized by its share of the first stage, with
59
+ * its percentage on the band and its count in a tile beneath. Hovering a stage reads it in the
60
+ * headline with the conversion from the step before.
61
+ */
62
+ export declare function FunnelChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, category, value, curve, colors, tracks, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, motion: motionMode, className, style, }: FunnelChartCardProps<Row, Key>): ReactElement;
@@ -0,0 +1,107 @@
1
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
2
+ import { ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
3
+ import { CardRange } from './cartesian-card';
4
+ import { NumericKey, TextKey } from './keys';
5
+ import { AnimatedNumberVariant } from '../motion/animated-number';
6
+ /** How the resting headline summarizes every known cell. */
7
+ export type HeatmapAggregate = 'sum' | 'mean' | 'max';
8
+ export interface HeatmapChartCardProps<Row, Key extends NumericKey<Row>> {
9
+ title: string;
10
+ /** One row per cell. Omit when `ranges` supplies the data. */
11
+ data?: readonly Row[];
12
+ /** Text field that places a cell in a column, e.g. the hour. */
13
+ x: TextKey<Row>;
14
+ /** Text field that places a cell in a row, e.g. the weekday. */
15
+ y: TextKey<Row>;
16
+ /** The measurement that sets the cell's color. `null` or an absent cell reads "No data". */
17
+ value: Key;
18
+ /** Column order. Defaults to the order columns first appear in the data. */
19
+ columns?: readonly string[];
20
+ /** Row order. Defaults to the order rows first appear in the data. */
21
+ rows?: readonly string[];
22
+ /**
23
+ * Values at the light and dark ends of the scale. Fix it to compare periods on one scale;
24
+ * by default it runs from zero (or the lowest value, if negative) to the highest value.
25
+ */
26
+ domain?: readonly [number, number];
27
+ /** How the resting headline sums up the cells: `sum` (default), `mean`, or `max`. */
28
+ aggregate?: HeatmapAggregate;
29
+ /** Grid height in pixels, shared by the rows. Defaults to 30 pixels per row. */
30
+ height?: number;
31
+ /** Corner radius of each cell in pixels. Defaults to 5; 0 gives square cells. */
32
+ radius?: number;
33
+ /** Space between cells in pixels. Defaults to 4. */
34
+ gap?: number;
35
+ /** Resting headline. Defaults to the `aggregate` of every known cell. */
36
+ headline?: number;
37
+ /** Fractional change shown as a chip, e.g. 0.052 → +5.2%. */
38
+ delta?: number;
39
+ deltaTone?: 'default' | 'inverse' | 'neutral';
40
+ /** Static period label, e.g. "Last 7 days". */
41
+ range?: string;
42
+ /** Period select. Each range replaces data, delta, and headline; cells ease to their new color. */
43
+ ranges?: readonly CardRange<Row>[];
44
+ defaultRange?: string;
45
+ valueFormat?: Intl.NumberFormatOptions;
46
+ locale?: string;
47
+ formatValue?: (value: number) => string;
48
+ /** Any CSS color for the dark end of the scale. Defaults to the palette's first color. */
49
+ color?: string;
50
+ surface?: ChartSurface;
51
+ /** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */
52
+ badge?: ReactNode;
53
+ /** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
54
+ numberStyle?: AnimatedNumberVariant;
55
+ palette?: ChartPalette;
56
+ loading?: boolean;
57
+ /** `none` turns off decorative motion; reduced-motion users get this automatically. */
58
+ motion?: ChartMotion;
59
+ className?: string;
60
+ style?: CSSProperties | ChartStyle;
61
+ }
62
+ export interface HeatmapGridCell<Row> {
63
+ /** `row` and `column` joined, unique within the grid. */
64
+ id: string;
65
+ label: string;
66
+ row: string;
67
+ column: string;
68
+ datum: Row | null;
69
+ /** `null` when the cell is missing or has no value; zero is a real reading. */
70
+ value: number | null;
71
+ /** Position between the domain ends, 0 to 1. `null` when there is no value. */
72
+ intensity: number | null;
73
+ }
74
+ export interface HeatmapGrid<Row> {
75
+ columns: string[];
76
+ rows: string[];
77
+ /** Row-major: every column of the first row, then the next row. */
78
+ cells: HeatmapGridCell<Row>[];
79
+ domain: readonly [number, number];
80
+ error: string | null;
81
+ }
82
+ /**
83
+ * Lay rows of data out as a grid. Rows and columns keep the order given, or the order they
84
+ * first appear; a cell with no row, or a `null` value, stays in the grid as missing.
85
+ */
86
+ export declare function heatmapGrid<Row>({ data, x, y, value, columns: columnOrder, rows: rowOrder, domain: suppliedDomain, }: {
87
+ data: readonly Row[];
88
+ x: string;
89
+ y: string;
90
+ value: string;
91
+ columns?: readonly string[];
92
+ rows?: readonly string[];
93
+ domain?: readonly [number, number];
94
+ }): HeatmapGrid<Row>;
95
+ /** The share of the accent color a cell gets: never fully clear, so zero still reads as a value. */
96
+ export declare const cellStrength: (intensity: number) => number;
97
+ /**
98
+ * Which axis labels show. Up to eight columns always fit; beyond that, narrow cards drop every
99
+ * other label (`minor`), and past twelve columns only every nth label shows at all.
100
+ */
101
+ export declare function labelTier(index: number, count: number): 'major' | 'minor' | 'hidden';
102
+ /**
103
+ * A heatmap card: a grid of cells colored by value, with the row and column of each cell
104
+ * labeled. Hovering or focusing a cell reads it in the headline; arrow keys move between cells.
105
+ * Missing cells are hatched and say "No data", so they never read as zero.
106
+ */
107
+ export declare function HeatmapChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, x, y, value, columns, rows: rowOrder, domain, aggregate, height, radius, gap, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, motion: motionMode, className, style, }: HeatmapChartCardProps<Row, Key>): ReactElement;
@@ -0,0 +1,60 @@
1
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
2
+ import { ChartMotion, ChartPalette, ChartStyle, ChartSurface, RankingOrder } from '../types';
3
+ import { CardRange } from './cartesian-card';
4
+ import { NumericKey, TextKey } from './keys';
5
+ import { AnimatedNumberVariant } from '../motion/animated-number';
6
+ export { rankRows } from './rank';
7
+ export interface HorizontalBarChartCardProps<Row, Key extends NumericKey<Row>> {
8
+ title: string;
9
+ /** One row per category. Omit when `ranges` supplies the data. */
10
+ data?: readonly Row[];
11
+ /** Text field that names each row. Names must be unique. */
12
+ category: TextKey<Row>;
13
+ /** Numeric field to rank by. `null` rows show "No data" and sort last. */
14
+ value: Key;
15
+ /** Resting headline. Defaults to the total of every row. */
16
+ headline?: number;
17
+ /** Fractional change shown as a chip, e.g. 0.082 → +8.2%. */
18
+ delta?: number;
19
+ deltaTone?: 'default' | 'inverse' | 'neutral';
20
+ /** Static period label, e.g. "This month". */
21
+ range?: string;
22
+ /** Period select. Each range replaces data, delta, and headline; rows re-rank smoothly. */
23
+ ranges?: readonly CardRange<Row>[];
24
+ defaultRange?: string;
25
+ /** `descending` (default) puts the largest first; `input` keeps your order. */
26
+ sort?: RankingOrder;
27
+ /** Show the first rows only and add the rest together as one "Other" row. */
28
+ limit?: number;
29
+ /** Label of the combined row. Defaults to "Other". */
30
+ otherLabel?: string;
31
+ /** Each row's share of the total. Defaults to true; hidden when values are negative. */
32
+ share?: boolean;
33
+ /** Number each row by rank. Defaults to false. */
34
+ rank?: boolean;
35
+ /**
36
+ * `inline` (default) sets each label on a soft bar; `track` draws a slim bar under the label.
37
+ */
38
+ barStyle?: 'inline' | 'track';
39
+ valueFormat?: Intl.NumberFormatOptions;
40
+ locale?: string;
41
+ formatValue?: (value: number) => string;
42
+ /** Any CSS color for the bars. Defaults to the palette's first color. */
43
+ color?: string;
44
+ surface?: ChartSurface;
45
+ /** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */
46
+ badge?: ReactNode;
47
+ /** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
48
+ numberStyle?: AnimatedNumberVariant;
49
+ palette?: ChartPalette;
50
+ loading?: boolean;
51
+ /** `none` turns off decorative motion; reduced-motion users get this automatically. */
52
+ motion?: ChartMotion;
53
+ className?: string;
54
+ style?: CSSProperties | ChartStyle;
55
+ }
56
+ /**
57
+ * A ranked list card: each row carries a bar, its value, and its share of the total. Hovering a
58
+ * row reads it in the headline; click pins it and the arrow keys move through the list.
59
+ */
60
+ 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, barStyle, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, motion: motionMode, className, style, }: HorizontalBarChartCardProps<Row, Key>): ReactElement;
@@ -0,0 +1,19 @@
1
+ /** Row keys whose values extend `Value`. Used to type key-based chart props. */
2
+ export type KeysOfType<Row, Value> = {
3
+ [Key in keyof Row]-?: Row[Key] extends Value ? Key : never;
4
+ }[keyof Row] & string;
5
+ /** Row keys that hold a measurement. `null` and `undefined` are missing values. */
6
+ export type NumericKey<Row> = KeysOfType<Row, number | null | undefined>;
7
+ /** Row keys that hold text, such as category names. */
8
+ export type TextKey<Row> = KeysOfType<Row, string>;
9
+ /** Row keys usable as an x position: labels, numbers, or dates. */
10
+ export type XKey<Row> = KeysOfType<Row, string | number | Date>;
11
+ export type XKind = 'category' | 'number' | 'time';
12
+ export interface ResolvedX<Row> {
13
+ kind: XKind;
14
+ /** Plot position. Category labels are placed by input order. */
15
+ position: (row: Row) => number;
16
+ format: (value: number) => string;
17
+ }
18
+ /** Infer the x kind from the first value, then build a position and a tick formatter. */
19
+ export declare function resolveX<Row>(data: readonly Row[], key: string, kind?: XKind, format?: (value: string | number | Date) => string): ResolvedX<Row>;
@@ -0,0 +1,19 @@
1
+ import { ReactElement } from 'react';
2
+ import { CartesianCardProps } from './cartesian-card';
3
+ import { NumericKey } from './keys';
4
+ export interface LineChartCardProps<Row, Key extends NumericKey<Row>> extends CartesianCardProps<Row, Key> {
5
+ /** `smooth` uses a monotone curve, `linear` straight segments, `step` holds each value flat. */
6
+ curve?: 'smooth' | 'linear' | 'step';
7
+ /** Mark every observation with a small dot. Defaults to false. */
8
+ points?: boolean;
9
+ /**
10
+ * `auto` (default) fits the y axis to the data so trends fill the plot; `zero` starts it at
11
+ * zero when the absolute level matters.
12
+ */
13
+ baseline?: 'auto' | 'zero';
14
+ }
15
+ /**
16
+ * A complete line chart card: headline, delta, period, plot, and value tiles.
17
+ * The headline and tiles follow the hovered point, and the y pill follows the nearest line.
18
+ */
19
+ export declare function LineChartCard<Row, const Key extends NumericKey<Row>>({ curve, points, baseline, ...props }: LineChartCardProps<Row, Key>): ReactElement;
@@ -0,0 +1,55 @@
1
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
2
+ import { AnimatedNumberVariant } from '../motion/animated-number';
3
+ import { ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
4
+ export interface ProgressRange {
5
+ id: string;
6
+ label: string;
7
+ value: number | null;
8
+ /** Defaults to the card's `target`. */
9
+ target?: number;
10
+ delta?: number;
11
+ }
12
+ export interface ProgressCardProps {
13
+ title: string;
14
+ /** The measured amount. `null` shows a dash and an empty track, never zero. */
15
+ value?: number | null;
16
+ /** The goal, in the same unit as the value. */
17
+ target: number;
18
+ /** Words under the percentage. Defaults to "of goal". */
19
+ label?: string;
20
+ /**
21
+ * `ring` (default) is a thin full ring, `thick` a heavy ring around a soft disc, and `gauge`
22
+ * a half ring that opens downward.
23
+ */
24
+ variant?: 'ring' | 'thick' | 'gauge';
25
+ /** Fractional change shown as a chip, e.g. 0.052 → +5.2%. */
26
+ delta?: number;
27
+ deltaTone?: 'default' | 'inverse' | 'neutral';
28
+ /** Static period label, e.g. "Last 7 days". */
29
+ range?: string;
30
+ /** Period select. Each range brings its own value, and optionally its own target and delta. */
31
+ ranges?: readonly ProgressRange[];
32
+ defaultRange?: string;
33
+ /** Content below the ring, e.g. a note on how the goal was set. */
34
+ footer?: ReactNode;
35
+ valueFormat?: Intl.NumberFormatOptions;
36
+ locale?: string;
37
+ formatValue?: (value: number) => string;
38
+ /** Any CSS color for the progress. Defaults to the palette's first color. */
39
+ color?: string;
40
+ surface?: ChartSurface;
41
+ /** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */
42
+ badge?: ReactNode;
43
+ /** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
44
+ numberStyle?: AnimatedNumberVariant;
45
+ palette?: ChartPalette;
46
+ loading?: boolean;
47
+ motion?: ChartMotion;
48
+ className?: string;
49
+ style?: CSSProperties | ChartStyle;
50
+ }
51
+ /**
52
+ * One value against a goal: the value in the header, and a large ring or gauge with the
53
+ * percentage reached. Past the goal the ring stays full and the percentage keeps counting.
54
+ */
55
+ export declare function ProgressCard({ title, value: suppliedValue, target: suppliedTarget, label, variant, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, footer, valueFormat, locale, formatValue, color, surface, badge, numberStyle, palette, loading, motion: motionMode, className, style, }: ProgressCardProps): ReactElement;
@@ -0,0 +1,93 @@
1
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
2
+ import { ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
3
+ import { CardRange, CardSeries } from './cartesian-card';
4
+ import { NumericKey, TextKey } from './keys';
5
+ import { AnimatedNumberVariant } from '../motion/animated-number';
6
+ /** How the resting headline sums up the first series across dimensions. */
7
+ export type RadarAggregate = 'mean' | 'sum' | 'max';
8
+ export interface RadarChartCardProps<Row, Key extends NumericKey<Row>> {
9
+ title: string;
10
+ /** One row per dimension, in the order to draw them clockwise from the top. */
11
+ data?: readonly Row[];
12
+ /** Text field that names each dimension. Names must be unique. */
13
+ category: TextKey<Row>;
14
+ /**
15
+ * Profiles to compare, one numeric field each. Dashed series, such as a target, draw as an
16
+ * outline without a fill and stay out of the headline.
17
+ */
18
+ series: readonly CardSeries<Key>[];
19
+ /** Values at the center and the outer ring. Defaults to zero through a round maximum. */
20
+ domain?: readonly [number, number];
21
+ /** How the resting headline sums up the first series: `mean` (default), `sum`, or `max`. */
22
+ aggregate?: RadarAggregate;
23
+ /** `polygon` (default) rings follow the spokes; `circle` rings are round. */
24
+ grid?: 'polygon' | 'circle';
25
+ /** Plot height in pixels. Defaults to 300. */
26
+ height?: number;
27
+ /** Resting headline. Defaults to the `aggregate` of the first series. */
28
+ headline?: number;
29
+ /** Fractional change shown as a chip, e.g. 0.052 → +5.2%. */
30
+ delta?: number;
31
+ deltaTone?: 'default' | 'inverse' | 'neutral';
32
+ /** Static period label, e.g. "Q3". */
33
+ range?: string;
34
+ /** Period select. Each range replaces data, delta, and headline; profiles ease to their shape. */
35
+ ranges?: readonly CardRange<Row>[];
36
+ defaultRange?: string;
37
+ valueFormat?: Intl.NumberFormatOptions;
38
+ locale?: string;
39
+ formatValue?: (value: number) => string;
40
+ surface?: ChartSurface;
41
+ /** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */
42
+ badge?: ReactNode;
43
+ /** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
44
+ numberStyle?: AnimatedNumberVariant;
45
+ palette?: ChartPalette;
46
+ loading?: boolean;
47
+ /** `none` turns off decorative motion; reduced-motion users get this automatically. */
48
+ motion?: ChartMotion;
49
+ className?: string;
50
+ style?: CSSProperties | ChartStyle;
51
+ }
52
+ interface Dimension {
53
+ name: string;
54
+ /** One reading per series; `null` when missing. */
55
+ values: (number | null)[];
56
+ }
57
+ /** A label that doesn't fit its room breaks at the space nearest its middle. */
58
+ export declare function labelLines(text: string, room: number): string[];
59
+ /** Rows to dimensions, with the domain and any problem stated plainly. */
60
+ export declare function radarDimensions<Row>({ data, category, series, domain: suppliedDomain, }: {
61
+ data: readonly Row[];
62
+ category: string;
63
+ series: readonly string[];
64
+ domain?: readonly [number, number];
65
+ }): {
66
+ dimensions: Dimension[];
67
+ domain: readonly [number, number];
68
+ error: string | null;
69
+ };
70
+ /**
71
+ * A point on spoke `index` of `count`, `fraction` of the way out; spoke 0 points straight up.
72
+ * Rounded to hundredths of a pixel: server and browser trig can differ in the last digit, which
73
+ * would otherwise mismatch on hydration.
74
+ */
75
+ export declare function spokePoint(index: number, count: number, fraction: number, radius: number): {
76
+ x: number;
77
+ y: number;
78
+ };
79
+ /**
80
+ * The outline of a profile. A missing value breaks the outline there and drops the fill, so a gap
81
+ * never reads as a low score.
82
+ */
83
+ export declare function profilePath(fractions: readonly (number | null)[], radius: number): {
84
+ path: string;
85
+ complete: boolean;
86
+ };
87
+ /**
88
+ * A radar card: several dimensions on spokes around a center, one outline per profile, so the
89
+ * shape of strengths and gaps reads at a glance. Hovering or stepping around the spokes reads
90
+ * every profile at that dimension.
91
+ */
92
+ export declare function RadarChartCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, category, series, domain: suppliedDomain, aggregate, grid, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, loading, motion: motionMode, className, style, }: RadarChartCardProps<Row, Key>): ReactElement;
93
+ export {};