@umriss-ui/charts 0.42.0 → 0.43.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.
- package/CHANGELOG.md +18 -0
- package/README.md +4 -2
- package/dist/charts.css +1 -1
- package/dist/charts.js +1612 -1580
- package/dist/index.d.ts +42 -21
- package/docs/llms-full.md +458 -163
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
4
|
+
import { Ref } from 'react';
|
|
3
5
|
|
|
4
6
|
/** The props of `Area`. */
|
|
5
7
|
export declare interface AreaProps<T> {
|
|
@@ -20,9 +22,9 @@ export declare interface AreaProps<T> {
|
|
|
20
22
|
unnamed series is a colour nobody can look up.
|
|
21
23
|
@default "Series n", after its place in the chart */
|
|
22
24
|
name?: string;
|
|
23
|
-
/** The value as the tooltip writes it
|
|
25
|
+
/** The value as the tooltip writes it, as a function or `NumberOptions`.
|
|
24
26
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
25
|
-
format?:
|
|
27
|
+
format?: ValueFormat;
|
|
26
28
|
/** Any CSS colour value.
|
|
27
29
|
@default the palette's `--uc-series-N` */
|
|
28
30
|
color?: string;
|
|
@@ -111,7 +113,7 @@ export declare interface AxisConfig<T = unknown> {
|
|
|
111
113
|
accessor?: (d: T, index: number) => AxisValue;
|
|
112
114
|
label?: string;
|
|
113
115
|
tickCount?: number;
|
|
114
|
-
tickFormat?:
|
|
116
|
+
tickFormat?: ValueFormat;
|
|
115
117
|
/** "visible" is a y axis' only: the extent of what its series show inside
|
|
116
118
|
their x axis' domain. */
|
|
117
119
|
domain: "nice" | "data" | "visible" | readonly [number, number];
|
|
@@ -184,9 +186,9 @@ export declare interface BarProps<T> {
|
|
|
184
186
|
unnamed series is a colour nobody can look up.
|
|
185
187
|
@default "Series n", after its place in the chart */
|
|
186
188
|
name?: string;
|
|
187
|
-
/** The value as the tooltip writes it
|
|
189
|
+
/** The value as the tooltip writes it, as a function or `NumberOptions`.
|
|
188
190
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
189
|
-
format?:
|
|
191
|
+
format?: ValueFormat;
|
|
190
192
|
/** Any CSS colour value.
|
|
191
193
|
@default the palette's `--uc-series-N` */
|
|
192
194
|
color?: string;
|
|
@@ -323,9 +325,9 @@ export declare interface BoxPlotProps<T> {
|
|
|
323
325
|
/** The name in legend and tooltip. Without one a warning stands in DEV.
|
|
324
326
|
@default "Series n", after its place in the chart */
|
|
325
327
|
name?: string;
|
|
326
|
-
/** Every number of the box as the tooltip and the table write it
|
|
328
|
+
/** Every number of the box as the tooltip and the table write it, as a function or `NumberOptions`.
|
|
327
329
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
328
|
-
format?:
|
|
330
|
+
format?: ValueFormat;
|
|
329
331
|
/** Any CSS colour value.
|
|
330
332
|
@default the palette's `--uc-series-N` */
|
|
331
333
|
color?: string;
|
|
@@ -444,7 +446,10 @@ export declare interface ChartPerf {
|
|
|
444
446
|
|
|
445
447
|
/** The props of `Chart`. Its rows are not among them: `useChart(rows)` binds
|
|
446
448
|
them (ADR-0048). */
|
|
447
|
-
export declare interface ChartProps {
|
|
449
|
+
export declare interface ChartProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
450
|
+
/** The root element, the `<div>` that `className`, `style`, `id` and the
|
|
451
|
+
`data-*` attributes reach. */
|
|
452
|
+
ref?: Ref<HTMLDivElement>;
|
|
448
453
|
/** Width in CSS pixels, or `"100%"` for the host's: the chart measures its
|
|
449
454
|
host and follows it through a ResizeObserver.
|
|
450
455
|
@default "100%" */
|
|
@@ -458,7 +463,9 @@ export declare interface ChartProps {
|
|
|
458
463
|
height?: number;
|
|
459
464
|
/** Outer spacing of the plot area in CSS pixels. */
|
|
460
465
|
padding?: number | Partial<Padding>;
|
|
461
|
-
/**
|
|
466
|
+
/** Accessible name of the plot. Without a name, `aria-label` or
|
|
467
|
+
`aria-labelledby`, the chart warns in development.
|
|
468
|
+
@deprecated since 0.43 - use `aria-label`. */
|
|
462
469
|
ariaLabel?: string;
|
|
463
470
|
/** Goes to the root element, as it does everywhere in this workspace. */
|
|
464
471
|
className?: string;
|
|
@@ -607,8 +614,9 @@ declare interface CommonProps {
|
|
|
607
614
|
/** Label of a tick. Compared by its source text: one that reads a changed
|
|
608
615
|
closure variable under the same text does not relabel the axis - give it
|
|
609
616
|
a new text or remount. A bound `Intl.NumberFormat#format` is compared by
|
|
610
|
-
identity.
|
|
611
|
-
|
|
617
|
+
identity. Or `NumberOptions`: Intl's options in the wording's locale,
|
|
618
|
+
compared by value; the step's places stay unless the options set digits. */
|
|
619
|
+
tickFormat?: ValueFormat;
|
|
612
620
|
/** Grid lines.
|
|
613
621
|
@default only on the first axis of its orientation */
|
|
614
622
|
grid?: boolean;
|
|
@@ -655,9 +663,9 @@ export declare interface ControlChartProps<T> {
|
|
|
655
663
|
unnamed series is a colour nobody can look up.
|
|
656
664
|
@default "Series n", after its place in the chart */
|
|
657
665
|
name?: string;
|
|
658
|
-
/** The value as the tooltip writes it - on the line and on the violations
|
|
666
|
+
/** The value as the tooltip writes it - on the line and on the violations., as a function or `NumberOptions`.
|
|
659
667
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
660
|
-
format?:
|
|
668
|
+
format?: ValueFormat;
|
|
661
669
|
/** Any CSS colour value.
|
|
662
670
|
@default the palette's `--uc-series-N` */
|
|
663
671
|
color?: string;
|
|
@@ -928,9 +936,9 @@ export declare interface LineProps<T> {
|
|
|
928
936
|
unnamed series is a colour nobody can look up.
|
|
929
937
|
@default "Series n", after its place in the chart */
|
|
930
938
|
name?: string;
|
|
931
|
-
/** The value as the tooltip writes it
|
|
939
|
+
/** The value as the tooltip writes it, as a function or `NumberOptions`.
|
|
932
940
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
933
|
-
format?:
|
|
941
|
+
format?: ValueFormat;
|
|
934
942
|
/** Any CSS colour value.
|
|
935
943
|
@default the palette's `--uc-series-N` */
|
|
936
944
|
color?: string;
|
|
@@ -1041,10 +1049,10 @@ export declare interface MatrixProps<T> {
|
|
|
1041
1049
|
unnamed series is a colour nobody can look up.
|
|
1042
1050
|
@default "Series n", after its place in the chart */
|
|
1043
1051
|
name?: string;
|
|
1044
|
-
/** The level as the tooltip writes it
|
|
1052
|
+
/** The level as the tooltip writes it, as a function or `NumberOptions`. The y axis' `tickFormat` writes the
|
|
1045
1053
|
row, not the level.
|
|
1046
1054
|
@default the built-in number format */
|
|
1047
|
-
format?:
|
|
1055
|
+
format?: ValueFormat;
|
|
1048
1056
|
}
|
|
1049
1057
|
|
|
1050
1058
|
/** A `Matrix` as the chart holds it once registered: its base accessor is the
|
|
@@ -1067,6 +1075,14 @@ export declare type NumberField<T> = NoInfer<{
|
|
|
1067
1075
|
[K in keyof T & string]-?: T[K] extends number | null | undefined ? K : never;
|
|
1068
1076
|
}[keyof T & string]>;
|
|
1069
1077
|
|
|
1078
|
+
/** The options of `Intl.NumberFormat`, plus `decimals` for a fixed number of
|
|
1079
|
+
places (minimum and maximum alike; an Intl digit option given beside it
|
|
1080
|
+
wins). The same shape as core's, declared here because the charts import
|
|
1081
|
+
nothing. */
|
|
1082
|
+
export declare interface NumberOptions extends Intl.NumberFormatOptions {
|
|
1083
|
+
decimals?: number;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1070
1086
|
/** A lane is named or given by its edges: the compiler refuses both at once.
|
|
1071
1087
|
Beside the props and not in them, so that `StateBandProps` stays an
|
|
1072
1088
|
interface another can extend. */
|
|
@@ -1267,9 +1283,9 @@ export declare interface ScatterProps<T> {
|
|
|
1267
1283
|
unnamed series is a colour nobody can look up.
|
|
1268
1284
|
@default "Series n", after its place in the chart */
|
|
1269
1285
|
name?: string;
|
|
1270
|
-
/** The value as the tooltip writes it
|
|
1286
|
+
/** The value as the tooltip writes it, as a function or `NumberOptions`.
|
|
1271
1287
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
1272
|
-
format?:
|
|
1288
|
+
format?: ValueFormat;
|
|
1273
1289
|
/** Any CSS colour value.
|
|
1274
1290
|
@default the palette's `--uc-series-N` */
|
|
1275
1291
|
color?: string;
|
|
@@ -1300,8 +1316,9 @@ export declare interface SeriesBase<T = unknown> {
|
|
|
1300
1316
|
yAxisId: string;
|
|
1301
1317
|
name?: string;
|
|
1302
1318
|
/** The value in the tooltip; before the y axis' `tickFormat`. Compared by its
|
|
1303
|
-
source text, as an accessor is.
|
|
1304
|
-
|
|
1319
|
+
source text, as an accessor is. Or `NumberOptions`: Intl's options in the
|
|
1320
|
+
wording's locale, compared by value. */
|
|
1321
|
+
format?: ValueFormat;
|
|
1305
1322
|
color?: string;
|
|
1306
1323
|
/** A role instead of a colour value: the theme resolves it, in both themes.
|
|
1307
1324
|
For series that mean something rather than just being the next one - the
|
|
@@ -1505,6 +1522,10 @@ export declare function useChart<Z>(rows: readonly Z[], options?: ChartOptions<Z
|
|
|
1505
1522
|
by its name, or a function, compared by its source text (`ValueFunction`). */
|
|
1506
1523
|
export declare type Value<T> = NumberField<T> | ValueFunction<T>;
|
|
1507
1524
|
|
|
1525
|
+
/** A value format: a function, or Intl's options written in the chart's
|
|
1526
|
+
wording's locale. */
|
|
1527
|
+
export declare type ValueFormat = ((value: number) => string) | NumberOptions;
|
|
1528
|
+
|
|
1508
1529
|
/** A **value** computed from the row - the function form of `Value`.
|
|
1509
1530
|
Compared by its source text, not its identity - an inline function is new
|
|
1510
1531
|
on every render. Known limit: one that reads a
|