@schemavaults/ui 0.108.0 → 0.109.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/dist/components/hooks/index.d.ts +2 -0
- package/dist/components/hooks/index.js +1 -0
- package/dist/components/hooks/index.js.map +1 -1
- package/dist/components/hooks/use-measured-width.d.ts +33 -0
- package/dist/components/hooks/use-measured-width.js +61 -0
- package/dist/components/hooks/use-measured-width.js.map +1 -0
- package/dist/components/ui/bar-chart/bar-chart.d.ts +71 -13
- package/dist/components/ui/bar-chart/bar-chart.js +263 -96
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/bar-list/bar-list.d.ts +63 -0
- package/dist/components/ui/bar-list/bar-list.js +39 -0
- package/dist/components/ui/bar-list/bar-list.js.map +1 -0
- package/dist/components/ui/bar-list/index.d.ts +2 -0
- package/dist/components/ui/bar-list/index.js +2 -0
- package/dist/components/ui/bar-list/index.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-colors.d.ts +69 -0
- package/dist/components/ui/chart-primitives/chart-colors.js +201 -0
- package/dist/components/ui/chart-primitives/chart-colors.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-data-table.d.ts +20 -0
- package/dist/components/ui/chart-primitives/chart-data-table.js +11 -0
- package/dist/components/ui/chart-primitives/chart-data-table.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-format.d.ts +12 -0
- package/dist/components/ui/chart-primitives/chart-format.js +40 -0
- package/dist/components/ui/chart-primitives/chart-format.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-legend.d.ts +20 -0
- package/dist/components/ui/chart-primitives/chart-legend.js +22 -0
- package/dist/components/ui/chart-primitives/chart-legend.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-scale.d.ts +59 -0
- package/dist/components/ui/chart-primitives/chart-scale.js +178 -0
- package/dist/components/ui/chart-primitives/chart-scale.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-tooltip.d.ts +67 -0
- package/dist/components/ui/chart-primitives/chart-tooltip.js +57 -0
- package/dist/components/ui/chart-primitives/chart-tooltip.js.map +1 -0
- package/dist/components/ui/chart-primitives/index.d.ts +12 -0
- package/dist/components/ui/chart-primitives/index.js +7 -0
- package/dist/components/ui/chart-primitives/index.js.map +1 -0
- package/dist/components/ui/chart-primitives/responsive-chart.d.ts +26 -0
- package/dist/components/ui/chart-primitives/responsive-chart.js +25 -0
- package/dist/components/ui/chart-primitives/responsive-chart.js.map +1 -0
- package/dist/components/ui/chart-primitives/use-chart-width.d.ts +30 -0
- package/dist/components/ui/chart-primitives/use-chart-width.js +56 -0
- package/dist/components/ui/chart-primitives/use-chart-width.js.map +1 -0
- package/dist/components/ui/histogram/bin-values.d.ts +53 -0
- package/dist/components/ui/histogram/bin-values.js +137 -0
- package/dist/components/ui/histogram/bin-values.js.map +1 -0
- package/dist/components/ui/histogram/histogram.d.ts +76 -0
- package/dist/components/ui/histogram/histogram.js +149 -0
- package/dist/components/ui/histogram/histogram.js.map +1 -0
- package/dist/components/ui/histogram/index.d.ts +4 -0
- package/dist/components/ui/histogram/index.js +3 -0
- package/dist/components/ui/histogram/index.js.map +1 -0
- package/dist/components/ui/index.d.ts +6 -0
- package/dist/components/ui/index.js +3 -0
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.d.ts +104 -20
- package/dist/components/ui/line-chart/line-chart.js +290 -151
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/pie-chart/pie-chart.d.ts +35 -7
- package/dist/components/ui/pie-chart/pie-chart.js +200 -88
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
- package/dist/components/ui/scatter-plot/scatter-plot.d.ts +123 -21
- package/dist/components/ui/scatter-plot/scatter-plot.js +507 -243
- package/dist/components/ui/scatter-plot/scatter-plot.js.map +1 -1
- package/dist/components/ui/sparkline/sparkline.d.ts +15 -5
- package/dist/components/ui/sparkline/sparkline.js +21 -37
- package/dist/components/ui/sparkline/sparkline.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import type { HTMLAttributes, KeyboardEvent, MouseEvent, ReactElement, ReactNode, Ref } from "react";
|
|
3
|
+
import { type ChartColorId, type ChartPaint } from "../../ui/chart-primitives/chart-colors";
|
|
4
|
+
import { type ChartWidth } from "../../ui/chart-primitives/use-chart-width";
|
|
3
5
|
export declare const scatterPlotSizeIds: ["sm", "md", "lg", "xl"];
|
|
4
6
|
export type ScatterPlotSizeId = (typeof scatterPlotSizeIds)[number];
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
+
/** Preset series colours; see `chartColorIds`. */
|
|
8
|
+
export declare const scatterPlotColorIds: ["chart-1", "chart-2", "chart-3", "chart-4", "chart-5", "chart-6", "chart-7", "chart-8", "other", "default", "brand", "primary", "positive", "warning", "destructive", "muted"];
|
|
9
|
+
export type ScatterPlotColorId = ChartColorId;
|
|
7
10
|
export declare const scatterPlotShapeIds: ["circle", "square", "triangle", "diamond"];
|
|
8
11
|
export type ScatterPlotShapeId = (typeof scatterPlotShapeIds)[number];
|
|
12
|
+
export declare const scatterPlotYScaleIds: ["linear", "log"];
|
|
13
|
+
export type ScatterPlotYScaleId = (typeof scatterPlotYScaleIds)[number];
|
|
9
14
|
export declare const scatterPlotVariants: (props?: ({
|
|
10
15
|
size?: "sm" | "lg" | "xl" | "md" | null | undefined;
|
|
11
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -25,6 +30,11 @@ export interface ScatterPlotPoint {
|
|
|
25
30
|
label?: string;
|
|
26
31
|
/** Stable identifier for the point. Defaults to the index. */
|
|
27
32
|
id?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional group the point belongs to (e.g. an operation name). Hovering a
|
|
35
|
+
* point fades every other group, so one group's spread stands out.
|
|
36
|
+
*/
|
|
37
|
+
group?: string;
|
|
28
38
|
}
|
|
29
39
|
export interface ScatterPlotSeries {
|
|
30
40
|
/** Stable identifier for the series. Used as React key and click payload. */
|
|
@@ -33,14 +43,19 @@ export interface ScatterPlotSeries {
|
|
|
33
43
|
label?: string;
|
|
34
44
|
/** Points to plot. Order is irrelevant except for paint order. */
|
|
35
45
|
points: ReadonlyArray<ScatterPlotPoint>;
|
|
36
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Preset color. Defaults to the series' palette slot (its position in
|
|
48
|
+
* `seriesOrder` when the chart has one, else in `series`); only the first
|
|
49
|
+
* three series get a hue, later ones are `"other"`. Ignored if `color` is
|
|
50
|
+
* provided.
|
|
51
|
+
*/
|
|
37
52
|
colorId?: ScatterPlotColorId;
|
|
38
53
|
/**
|
|
39
54
|
* Override the marker color with a raw CSS color (e.g. `"#ff0080"` or
|
|
40
|
-
* `"
|
|
55
|
+
* `"var(--chart-2)"`). Takes precedence over `colorId`.
|
|
41
56
|
*/
|
|
42
57
|
color?: string;
|
|
43
|
-
/** Marker shape. Defaults to a rotation based on the series
|
|
58
|
+
/** Marker shape. Defaults to a rotation based on the series' slot. */
|
|
44
59
|
shape?: ScatterPlotShapeId;
|
|
45
60
|
/** Override the chart-level `pointRadius` for this series. */
|
|
46
61
|
pointRadius?: number;
|
|
@@ -58,6 +73,15 @@ export interface ScatterPlotValueLabelContext {
|
|
|
58
73
|
point: ScatterPlotPoint;
|
|
59
74
|
index: number;
|
|
60
75
|
}
|
|
76
|
+
export interface ScatterPlotTooltipContext {
|
|
77
|
+
series: ScatterPlotSeries;
|
|
78
|
+
point: ScatterPlotPoint;
|
|
79
|
+
/** `formatX(point.x)`. */
|
|
80
|
+
formattedX: string;
|
|
81
|
+
/** `formatY(point.y)`. */
|
|
82
|
+
formattedY: string;
|
|
83
|
+
paint: ChartPaint;
|
|
84
|
+
}
|
|
61
85
|
export interface ScatterPlotReferenceLine {
|
|
62
86
|
/** Position of the line in domain units. */
|
|
63
87
|
value: number;
|
|
@@ -71,18 +95,43 @@ export interface ScatterPlotProps extends Omit<HTMLAttributes<HTMLDivElement>, "
|
|
|
71
95
|
series: ReadonlyArray<ScatterPlotSeries>;
|
|
72
96
|
/** Accessible label describing what the chart represents. */
|
|
73
97
|
label: string;
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Canvas width in pixels (defaults are size-aware), or `"auto"` to fill the
|
|
100
|
+
* container and redraw when it resizes. An `"auto"` chart renders an empty
|
|
101
|
+
* placeholder at its height until it has been measured, so the server
|
|
102
|
+
* render carries no pixel width and no tick labels.
|
|
103
|
+
*/
|
|
104
|
+
width?: ChartWidth;
|
|
105
|
+
/**
|
|
106
|
+
* Override the rendered canvas height in pixels (defaults are size-aware).
|
|
107
|
+
* A legend, when shown, sits above this box.
|
|
108
|
+
*/
|
|
77
109
|
height?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Every series id the chart can show, in colour-slot order. Pass the full,
|
|
112
|
+
* unfiltered list and a series you filter out never repaints the others.
|
|
113
|
+
*/
|
|
114
|
+
seriesOrder?: ReadonlyArray<string>;
|
|
78
115
|
/** Lower bound of the x-axis. Defaults to the smallest x across series. */
|
|
79
116
|
xMin?: number;
|
|
80
117
|
/** Upper bound of the x-axis. Defaults to the largest x across series. */
|
|
81
118
|
xMax?: number;
|
|
82
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Lower bound of the y-axis. Defaults to the smallest y across series (on a
|
|
121
|
+
* log scale, the decade below the smallest positive y).
|
|
122
|
+
*/
|
|
83
123
|
yMin?: number;
|
|
84
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Upper bound of the y-axis. Defaults to the largest y across series (on a
|
|
126
|
+
* log scale, the decade above it).
|
|
127
|
+
*/
|
|
85
128
|
yMax?: number;
|
|
129
|
+
/**
|
|
130
|
+
* `"log"` spreads values over orders of magnitude (latencies, sizes): the
|
|
131
|
+
* y-axis ticks sit at whole decades, and zero or negative values are drawn
|
|
132
|
+
* on the bottom decade. Defaults to `"linear"`.
|
|
133
|
+
*/
|
|
134
|
+
yScale?: ScatterPlotYScaleId;
|
|
86
135
|
/** Marker radius in pixels when points carry no `size`. Defaults to `4`. */
|
|
87
136
|
pointRadius?: number;
|
|
88
137
|
/**
|
|
@@ -96,31 +145,79 @@ export interface ScatterPlotProps extends Omit<HTMLAttributes<HTMLDivElement>, "
|
|
|
96
145
|
showAxis?: boolean;
|
|
97
146
|
/**
|
|
98
147
|
* Number of evenly-spaced horizontal gridlines drawn across the y-axis. `0`
|
|
99
|
-
* disables them. Defaults to `0`.
|
|
148
|
+
* disables them. Defaults to `0`. With y-axis labels shown, any non-zero
|
|
149
|
+
* count draws a hairline at each tick instead (a log scale always has its
|
|
150
|
+
* decade lines).
|
|
100
151
|
*/
|
|
101
152
|
gridLineCount?: number;
|
|
102
153
|
/**
|
|
103
154
|
* Number of evenly-spaced vertical gridlines drawn across the x-axis. `0`
|
|
104
|
-
* disables them. Defaults to `0`.
|
|
155
|
+
* disables them. Defaults to `0`. With x-axis labels shown, any non-zero
|
|
156
|
+
* count draws a hairline at each tick instead.
|
|
105
157
|
*/
|
|
106
158
|
verticalGridLineCount?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Format an x value for the x-axis ticks and the tooltip (e.g. an epoch
|
|
161
|
+
* timestamp as a time). Giving it turns the x-axis tick labels on unless
|
|
162
|
+
* `showXAxisLabels` is `false`; `xTickFormatter` wins for the ticks.
|
|
163
|
+
*/
|
|
164
|
+
formatX?: (x: number) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Format a y value for the y-axis ticks and the tooltip. Giving it turns
|
|
167
|
+
* the y-axis tick labels on unless `showYAxisLabels` is `false`;
|
|
168
|
+
* `yTickFormatter` wins for the ticks.
|
|
169
|
+
*/
|
|
170
|
+
formatY?: (y: number) => string;
|
|
171
|
+
/** Replace the hover / focus readout's content. */
|
|
172
|
+
formatTooltip?: (context: ScatterPlotTooltipContext) => ReactNode;
|
|
173
|
+
/** Show the nearest-point readout on hover and keyboard focus. Defaults to `true`. */
|
|
174
|
+
showTooltip?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* How close, in pixels, the pointer must come to a point for it to be read
|
|
177
|
+
* out; the pointer need not land on the dot. Defaults to `24`.
|
|
178
|
+
*/
|
|
179
|
+
hitRadius?: number;
|
|
180
|
+
/**
|
|
181
|
+
* Show a legend above the plot. Defaults to `true` for two or more series.
|
|
182
|
+
*/
|
|
183
|
+
showLegend?: boolean;
|
|
107
184
|
/**
|
|
108
185
|
* Format an x-axis tick label. Return `null` to skip the tick. When omitted,
|
|
109
|
-
* ticks render only if `showXAxisLabels` is
|
|
186
|
+
* ticks render only if `showXAxisLabels` is on (formatted with `formatX`).
|
|
110
187
|
*/
|
|
111
188
|
xTickFormatter?: (x: number, index: number) => string | null;
|
|
112
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* About how many x-axis ticks to draw. Defaults to `5`. Ignored when
|
|
191
|
+
* `xTickValues` is given. Labels that would overlap are dropped on a
|
|
192
|
+
* narrow chart.
|
|
193
|
+
*/
|
|
113
194
|
xTickCount?: number;
|
|
114
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* Exact x positions for the x-axis ticks (e.g. every whole hour of a time
|
|
197
|
+
* axis). Values outside the x domain are skipped.
|
|
198
|
+
*/
|
|
199
|
+
xTickValues?: ReadonlyArray<number>;
|
|
200
|
+
/** Render x-axis tick labels. Defaults to on when `formatX` is given. */
|
|
115
201
|
showXAxisLabels?: boolean;
|
|
116
202
|
/**
|
|
117
203
|
* Format a y-axis tick label. Return `null` to skip the tick. When omitted,
|
|
118
|
-
* ticks render only if `showYAxisLabels` is
|
|
204
|
+
* ticks render only if `showYAxisLabels` is on (formatted with `formatY`).
|
|
119
205
|
*/
|
|
120
206
|
yTickFormatter?: (y: number, index: number) => string | null;
|
|
121
|
-
/**
|
|
207
|
+
/**
|
|
208
|
+
* About how many y-axis ticks to draw. Defaults to `5`. A log scale ticks
|
|
209
|
+
* every decade instead.
|
|
210
|
+
*/
|
|
122
211
|
yTickCount?: number;
|
|
123
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Place the x-axis and linear y-axis ticks on round values inside the
|
|
214
|
+
* domain rather than evenly between its ends. Only the ticks move.
|
|
215
|
+
* Defaults to on, except for an axis given an `xTickFormatter` /
|
|
216
|
+
* `yTickFormatter`, which keeps evenly spaced ticks that include both
|
|
217
|
+
* ends (as before). For a time axis, pass `xTickValues` on round times.
|
|
218
|
+
*/
|
|
219
|
+
niceTicks?: boolean;
|
|
220
|
+
/** Render y-axis tick labels. Defaults to on when `formatY` is given. */
|
|
124
221
|
showYAxisLabels?: boolean;
|
|
125
222
|
/**
|
|
126
223
|
* Width in pixels reserved for y-axis tick labels (the left gutter).
|
|
@@ -131,9 +228,9 @@ export interface ScatterPlotProps extends Omit<HTMLAttributes<HTMLDivElement>, "
|
|
|
131
228
|
xAxisTitle?: string;
|
|
132
229
|
/** Axis title rendered (rotated) alongside the y-axis. */
|
|
133
230
|
yAxisTitle?: string;
|
|
134
|
-
/** Vertical reference line(s) at fixed x positions. */
|
|
231
|
+
/** Vertical reference line(s) at fixed x positions, drawn above the points. */
|
|
135
232
|
xReferenceLines?: ReadonlyArray<ScatterPlotReferenceLine>;
|
|
136
|
-
/** Horizontal reference line(s) at fixed y positions. */
|
|
233
|
+
/** Horizontal reference line(s) at fixed y positions, drawn above the points. */
|
|
137
234
|
yReferenceLines?: ReadonlyArray<ScatterPlotReferenceLine>;
|
|
138
235
|
/** Render a text label next to every point. Defaults to `false`. */
|
|
139
236
|
showValueLabels?: boolean;
|
|
@@ -142,6 +239,11 @@ export interface ScatterPlotProps extends Omit<HTMLAttributes<HTMLDivElement>, "
|
|
|
142
239
|
* the point's `label`, falling back to `(x, y)`.
|
|
143
240
|
*/
|
|
144
241
|
valueLabelFormatter?: (context: ScatterPlotValueLabelContext) => string | null;
|
|
242
|
+
/**
|
|
243
|
+
* Hold the current render at reduced opacity while new data loads, rather
|
|
244
|
+
* than flashing a skeleton.
|
|
245
|
+
*/
|
|
246
|
+
loading?: boolean;
|
|
145
247
|
/**
|
|
146
248
|
* Fallback handler invoked for any point that doesn't have its own
|
|
147
249
|
* series-level `onPointClick`.
|
|
@@ -162,7 +264,7 @@ export interface ScatterPlotProps extends Omit<HTMLAttributes<HTMLDivElement>, "
|
|
|
162
264
|
/** Optional ref forwarded to the wrapper element. */
|
|
163
265
|
ref?: Ref<HTMLDivElement>;
|
|
164
266
|
}
|
|
165
|
-
declare function ScatterPlot({ series, label, size, width, height, xMin, xMax, yMin, yMax, pointRadius, sizeRange, pointOpacity, showAxis, gridLineCount, verticalGridLineCount, xTickFormatter, xTickCount, showXAxisLabels, yTickFormatter, yTickCount, showYAxisLabels, yTickLabelWidth, xAxisTitle, yAxisTitle, xReferenceLines, yReferenceLines, showValueLabels, valueLabelFormatter, onPointClick, emptyMessage, children, className, overlayClassName, valueLabelClassName, tickLabelClassName, axisClassName, ref, ...props }: ScatterPlotProps): ReactElement;
|
|
267
|
+
declare function ScatterPlot({ series, label, size, width, height, seriesOrder, xMin, xMax, yMin, yMax, yScale, pointRadius, sizeRange, pointOpacity, showAxis, gridLineCount, verticalGridLineCount, formatX, formatY, formatTooltip, showTooltip, hitRadius, showLegend, xTickFormatter, xTickCount, xTickValues, showXAxisLabels, yTickFormatter, yTickCount, niceTicks, showYAxisLabels, yTickLabelWidth, xAxisTitle, yAxisTitle, xReferenceLines, yReferenceLines, showValueLabels, valueLabelFormatter, loading, onPointClick, emptyMessage, children, className, style, overlayClassName, valueLabelClassName, tickLabelClassName, axisClassName, ref, ...props }: ScatterPlotProps): ReactElement;
|
|
166
268
|
declare namespace ScatterPlot {
|
|
167
269
|
var displayName: string;
|
|
168
270
|
}
|