gridsmith-ui 0.17.2 → 0.17.3
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/dist/charts.d.ts +88 -24
- package/dist/charts.js +1043 -398
- package/dist/charts.js.map +1 -1
- package/dist/index.d.ts +41 -7
- package/dist/index.js +307 -200
- package/dist/index.js.map +1 -1
- package/dist/roots.css +14 -0
- package/package.json +1 -1
package/dist/charts.d.ts
CHANGED
|
@@ -2,6 +2,24 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Sprint 25.9, A3 — what a chart's category axis holds, and how its labels fit. No Recharts here: the charts entry and
|
|
7
|
+
* the tests import it, and it never measures on its own (the measurer is handed in).
|
|
8
|
+
*
|
|
9
|
+
* - `categoryKind(labels)`: "scale" when every non-empty label is a date, a time, a period or a number, else "names".
|
|
10
|
+
* Anchored patterns only — never `Date.parse`, which V8 lets read "Tier 1", "Sprint 1" and "Northern Region 2" as dates.
|
|
11
|
+
* - `createAxisMeasurer(el)`: canvas text widths in the axis's resolved font, read from a probe that carries
|
|
12
|
+
* `font-size: var(--ds-font-size-xs)`, so a `calc()` token (`calc(16px * .75)`, a 14 px base) measures right.
|
|
13
|
+
* - `fitLabel(name, width, measure)`: one line; else two lines split at a space; else "…" on the second. Never drops it.
|
|
14
|
+
*/
|
|
15
|
+
type CategoryKind = "names" | "scale";
|
|
16
|
+
/**
|
|
17
|
+
* Whether a category axis holds names or a scale (dates, times, periods, numbers). Every non-empty label must match an
|
|
18
|
+
* anchored pattern to be "scale"; an all-empty set is "scale". LineChart and AreaChart are always "scale"; BarChart and
|
|
19
|
+
* CompositeChart guess with this, and their `categoryKind` prop overrides the guess.
|
|
20
|
+
*/
|
|
21
|
+
declare function categoryKind(labels: ReadonlyArray<unknown>): CategoryKind;
|
|
22
|
+
|
|
5
23
|
type XAxisInterval = number | "preserveStart" | "preserveEnd" | "preserveStartEnd" | "equidistantPreserveStart";
|
|
6
24
|
|
|
7
25
|
interface BarDef {
|
|
@@ -17,23 +35,38 @@ interface BarDef {
|
|
|
17
35
|
}
|
|
18
36
|
interface BarChartProps {
|
|
19
37
|
/**
|
|
20
|
-
* Which category ticks show. Leave it out: the chart measures its widest label with
|
|
21
|
-
* k-th category from the first, the last only when it falls on the step (Sprint
|
|
22
|
-
* labels every Nth category instead. The Recharts strings ("preserveStartEnd") are
|
|
23
|
-
* mean the same measured labelling
|
|
38
|
+
* Which category ticks show on an axis of dates or numbers. Leave it out: the chart measures its widest label with
|
|
39
|
+
* the chart's font and labels every k-th category from the first, the last only when it falls on the step (Sprint
|
|
40
|
+
* 25.4 C-11, decision 7). A number labels every Nth category instead. The Recharts strings ("preserveStartEnd") are
|
|
41
|
+
* accepted for compatibility and mean the same measured labelling (round 13). A names axis is never thinned.
|
|
24
42
|
*/
|
|
25
43
|
xAxisInterval?: XAxisInterval;
|
|
26
44
|
data: Record<string, unknown>[];
|
|
27
45
|
bars: BarDef[];
|
|
28
46
|
xAxisKey: string;
|
|
29
|
-
|
|
47
|
+
/**
|
|
48
|
+
* "auto" (the default): the chart sizes itself — sideways, a row per category; upright, two wide to one high. A
|
|
49
|
+
* preset or a number overrides it; inside a ChartContainer, the container's own height wins.
|
|
50
|
+
*/
|
|
51
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
30
52
|
/** Every bar without a stackId joins one stack. */
|
|
31
53
|
stacked?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Bars running sideways, one row per category. Leave it out: an upright chart of names turns itself sideways when a
|
|
56
|
+
* name would be cut to fewer than six characters, and back when there's room (D8). true or false forces either.
|
|
57
|
+
*/
|
|
32
58
|
horizontal?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* What the categories are. "names" are never skipped: each wraps onto two lines, then ends with "…", with the full
|
|
61
|
+
* name on hover. "scale" (dates, times, numbers) is labelled at an even step. Leave it out: guessed from the labels.
|
|
62
|
+
*/
|
|
63
|
+
categoryKind?: "names" | "scale";
|
|
33
64
|
showGrid?: boolean;
|
|
34
65
|
showTooltip?: boolean;
|
|
35
66
|
showLegend?: boolean;
|
|
67
|
+
/** The category axis's title, as drawn upright (below it). A sideways chart puts the category title above its names. */
|
|
36
68
|
xAxisLabel?: string;
|
|
69
|
+
/** The value axis's title, drawn horizontally above the axis. */
|
|
37
70
|
yAxisLabel?: string;
|
|
38
71
|
animated?: boolean;
|
|
39
72
|
"aria-label"?: string;
|
|
@@ -57,13 +90,15 @@ interface LineChartProps {
|
|
|
57
90
|
data: Record<string, unknown>[];
|
|
58
91
|
lines: LineDef[];
|
|
59
92
|
xAxisKey: string;
|
|
60
|
-
|
|
93
|
+
/** "auto" (the default): two wide to one high. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
94
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
61
95
|
curved?: boolean;
|
|
62
96
|
showDots?: boolean;
|
|
63
97
|
showGrid?: boolean;
|
|
64
98
|
showTooltip?: boolean;
|
|
65
99
|
showLegend?: boolean;
|
|
66
100
|
xAxisLabel?: string;
|
|
101
|
+
/** The value axis's title, drawn horizontally above the axis. */
|
|
67
102
|
yAxisLabel?: string;
|
|
68
103
|
animated?: boolean;
|
|
69
104
|
"aria-label"?: string;
|
|
@@ -86,7 +121,8 @@ interface AreaChartProps {
|
|
|
86
121
|
data: Record<string, unknown>[];
|
|
87
122
|
areas: AreaDef[];
|
|
88
123
|
xAxisKey: string;
|
|
89
|
-
|
|
124
|
+
/** "auto" (the default): two wide to one high. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
125
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
90
126
|
stacked?: boolean;
|
|
91
127
|
curved?: boolean;
|
|
92
128
|
showGrid?: boolean;
|
|
@@ -94,6 +130,7 @@ interface AreaChartProps {
|
|
|
94
130
|
showLegend?: boolean;
|
|
95
131
|
gradient?: boolean;
|
|
96
132
|
xAxisLabel?: string;
|
|
133
|
+
/** The value axis's title, drawn horizontally above the axis. */
|
|
97
134
|
yAxisLabel?: string;
|
|
98
135
|
animated?: boolean;
|
|
99
136
|
"aria-label"?: string;
|
|
@@ -107,7 +144,8 @@ interface PieChartProps {
|
|
|
107
144
|
value: number;
|
|
108
145
|
[key: string]: unknown;
|
|
109
146
|
}[];
|
|
110
|
-
|
|
147
|
+
/** "auto" (the default): square. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
148
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
111
149
|
donut?: boolean;
|
|
112
150
|
showTooltip?: boolean;
|
|
113
151
|
showLegend?: boolean;
|
|
@@ -120,17 +158,21 @@ declare const PieChart: react.ForwardRefExoticComponent<PieChartProps & react.Re
|
|
|
120
158
|
|
|
121
159
|
interface CompositeChartProps {
|
|
122
160
|
/**
|
|
123
|
-
* Which category ticks show. Leave it out: the chart measures its widest label with
|
|
124
|
-
* k-th category from the first, the last only when it falls on the step (Sprint
|
|
125
|
-
* labels every Nth category instead. The Recharts strings ("preserveStartEnd") are
|
|
126
|
-
* mean the same measured labelling
|
|
161
|
+
* Which category ticks show on an axis of dates or numbers. Leave it out: the chart measures its widest label with
|
|
162
|
+
* the chart's font and labels every k-th category from the first, the last only when it falls on the step (Sprint
|
|
163
|
+
* 25.4 C-11, decision 7). A number labels every Nth category instead. The Recharts strings ("preserveStartEnd") are
|
|
164
|
+
* accepted for compatibility and mean the same measured labelling (round 13). A names axis is never thinned.
|
|
127
165
|
*/
|
|
128
166
|
xAxisInterval?: XAxisInterval;
|
|
129
167
|
data: Record<string, unknown>[];
|
|
130
168
|
bars: BarDef[];
|
|
131
169
|
lines: LineDef[];
|
|
132
170
|
xAxisKey: string;
|
|
133
|
-
|
|
171
|
+
/**
|
|
172
|
+
* "auto" (the default): two wide to one high; sideways, a row per category. A preset or a number overrides it; a
|
|
173
|
+
* ChartContainer's own height wins.
|
|
174
|
+
*/
|
|
175
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
134
176
|
/** Every bar without a stackId joins one stack; lines draw over it (Sprint 25.7, C4). A bar's stackId works too. */
|
|
135
177
|
stacked?: boolean;
|
|
136
178
|
/**
|
|
@@ -139,10 +181,22 @@ interface CompositeChartProps {
|
|
|
139
181
|
* reads against the stack's own scale. An explicit value wins.
|
|
140
182
|
*/
|
|
141
183
|
dualAxis?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* What the categories are. "names" are never skipped: each wraps onto two lines, then ends with "…", with the full
|
|
186
|
+
* name on hover. "scale" (dates, times, numbers) is labelled at an even step. Leave it out: guessed from the labels.
|
|
187
|
+
*/
|
|
188
|
+
categoryKind?: "names" | "scale";
|
|
189
|
+
/**
|
|
190
|
+
* Bars running sideways, one row per category, with the lines crossing the rows. Leave it out: a chart of names turns
|
|
191
|
+
* itself sideways when a name would be cut to fewer than six characters, and back when there's room (D8). true or
|
|
192
|
+
* false forces either.
|
|
193
|
+
*/
|
|
194
|
+
horizontal?: boolean;
|
|
142
195
|
showGrid?: boolean;
|
|
143
196
|
showTooltip?: boolean;
|
|
144
197
|
showLegend?: boolean;
|
|
145
198
|
xAxisLabel?: string;
|
|
199
|
+
/** The value axis's title, drawn horizontally above the axis. */
|
|
146
200
|
yAxisLabel?: string;
|
|
147
201
|
animated?: boolean;
|
|
148
202
|
"aria-label"?: string;
|
|
@@ -161,8 +215,10 @@ interface ScatterSeries {
|
|
|
161
215
|
interface ScatterChartProps {
|
|
162
216
|
data: ScatterSeries[];
|
|
163
217
|
xLabel?: string;
|
|
218
|
+
/** The value axis's title, drawn horizontally above the axis. */
|
|
164
219
|
yLabel?: string;
|
|
165
|
-
|
|
220
|
+
/** "auto" (the default): two wide to one high. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
221
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
166
222
|
showGrid?: boolean;
|
|
167
223
|
showTooltip?: boolean;
|
|
168
224
|
showLegend?: boolean;
|
|
@@ -180,7 +236,8 @@ interface RadarChartProps {
|
|
|
180
236
|
data: Record<string, unknown>[];
|
|
181
237
|
dataKeys: RadarDataKey[];
|
|
182
238
|
axisKey: string;
|
|
183
|
-
|
|
239
|
+
/** "auto" (the default): square. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
240
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
184
241
|
filled?: boolean;
|
|
185
242
|
showDots?: boolean;
|
|
186
243
|
showTooltip?: boolean;
|
|
@@ -198,7 +255,8 @@ interface RadialBarChartProps {
|
|
|
198
255
|
max?: number;
|
|
199
256
|
[key: string]: unknown;
|
|
200
257
|
}[];
|
|
201
|
-
|
|
258
|
+
/** "auto" (the default): square. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
259
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
202
260
|
showTooltip?: boolean;
|
|
203
261
|
showLegend?: boolean;
|
|
204
262
|
showLabels?: boolean;
|
|
@@ -216,8 +274,10 @@ interface FunnelChartProps {
|
|
|
216
274
|
value: number;
|
|
217
275
|
[key: string]: unknown;
|
|
218
276
|
}[];
|
|
219
|
-
|
|
277
|
+
/** "auto" (the default): a row per stage. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
278
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
220
279
|
showTooltip?: boolean;
|
|
280
|
+
/** Kept for compatibility: a funnel has no legend, its labels name the stages (Recharts gives it no legend entries). */
|
|
221
281
|
showLegend?: boolean;
|
|
222
282
|
showLabels?: boolean;
|
|
223
283
|
animated?: boolean;
|
|
@@ -234,7 +294,8 @@ interface TreemapNode {
|
|
|
234
294
|
}
|
|
235
295
|
interface TreemapChartProps {
|
|
236
296
|
data: TreemapNode[];
|
|
237
|
-
|
|
297
|
+
/** "auto" (the default): two wide to one high. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
298
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
238
299
|
showTooltip?: boolean;
|
|
239
300
|
animated?: boolean;
|
|
240
301
|
"aria-label"?: string;
|
|
@@ -253,7 +314,8 @@ interface SankeyChartProps {
|
|
|
253
314
|
value: number;
|
|
254
315
|
}[];
|
|
255
316
|
};
|
|
256
|
-
|
|
317
|
+
/** "auto" (the default): two wide to one high. A preset or a number overrides it; a ChartContainer's own height wins. */
|
|
318
|
+
height?: "auto" | "sm" | "md" | "lg" | number;
|
|
257
319
|
showTooltip?: boolean;
|
|
258
320
|
animated?: boolean;
|
|
259
321
|
"aria-label"?: string;
|
|
@@ -277,11 +339,13 @@ declare const Sparkline: react.ForwardRefExoticComponent<SparklineProps & react.
|
|
|
277
339
|
|
|
278
340
|
interface ChartContainerProps {
|
|
279
341
|
/**
|
|
280
|
-
* "
|
|
281
|
-
*
|
|
282
|
-
*
|
|
342
|
+
* "auto" (the default): the chart sizes itself from its type and its data (Sprint 25.9, A2) — a row per item for
|
|
343
|
+
* sideways bars and funnels, two wide to one high for charts over dates or numbers, square for round charts — and in
|
|
344
|
+
* a row its frame matches the tallest block while the chart grows only to its bound. "fill" means the same as "auto".
|
|
345
|
+
* A preset (sm, md, lg) or a number of px sets this chart's height instead, and beats the chart's own.
|
|
283
346
|
*/
|
|
284
|
-
height?: "sm" | "md" | "lg" |
|
|
347
|
+
height?: "auto" | "fill" | "sm" | "md" | "lg" | number;
|
|
348
|
+
/** The insight, as a heading (h3) in the card-title style, never cut. The chart's graphic is named by it. */
|
|
285
349
|
title?: string;
|
|
286
350
|
loading?: boolean;
|
|
287
351
|
emptyState?: ReactNode;
|
|
@@ -294,4 +358,4 @@ declare function ChartContainer({ height, title, loading, emptyState, variant, c
|
|
|
294
358
|
|
|
295
359
|
declare function useChartColors(count: number, soft?: boolean): string[];
|
|
296
360
|
|
|
297
|
-
export { AreaChart, type AreaChartProps, type AreaDef, BarChart, type BarChartProps, type BarDef, ChartContainer, CompositeChart, type CompositeChartProps, FunnelChart, type FunnelChartProps, LineChart, type LineChartProps, type LineDef, PieChart, type PieChartProps, RadarChart, type RadarChartProps, type RadarDataKey, RadialBarChart, type RadialBarChartProps, SankeyChart, type SankeyChartProps, ScatterChart, type ScatterChartProps, type ScatterSeries, Sparkline, type SparklineProps, TreemapChart, type TreemapChartProps, type TreemapNode, useChartColors };
|
|
361
|
+
export { AreaChart, type AreaChartProps, type AreaDef, BarChart, type BarChartProps, type BarDef, ChartContainer, CompositeChart, type CompositeChartProps, FunnelChart, type FunnelChartProps, LineChart, type LineChartProps, type LineDef, PieChart, type PieChartProps, RadarChart, type RadarChartProps, type RadarDataKey, RadialBarChart, type RadialBarChartProps, SankeyChart, type SankeyChartProps, ScatterChart, type ScatterChartProps, type ScatterSeries, Sparkline, type SparklineProps, TreemapChart, type TreemapChartProps, type TreemapNode, categoryKind, useChartColors };
|