@zsherman/charts 0.0.0-stage → 0.1.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/CHANGELOG.md +24 -0
- package/LICENSE +373 -0
- package/README.md +13 -2
- package/THIRD_PARTY_NOTICES.md +33 -0
- package/dist/dom/bar-list/bar-list.js +386 -0
- package/dist/dom/bar-list/bar-list.styles.js +171 -0
- package/dist/dom/bar-list/index.js +1 -0
- package/dist/dom/chart/chart.js +716 -0
- package/dist/dom/chart/chart.styles.js +165 -0
- package/dist/dom/chart/index.js +1 -0
- package/dist/dom/chart-grid/chart-grid.js +67 -0
- package/dist/dom/chart-grid/index.js +1 -0
- package/dist/dom/donut/donut.js +565 -0
- package/dist/dom/donut/donut.styles.js +111 -0
- package/dist/dom/donut/index.js +1 -0
- package/dist/dom/heat-graph/calendar.js +118 -0
- package/dist/dom/heat-graph/heat-graph.js +423 -0
- package/dist/dom/heat-graph/heat-graph.styles.js +168 -0
- package/dist/dom/heat-graph/index.js +1 -0
- package/dist/dom/heat-matrix/heat-matrix.js +346 -0
- package/dist/dom/heat-matrix/heat-matrix.styles.js +155 -0
- package/dist/dom/heat-matrix/index.js +1 -0
- package/dist/dom/heat-matrix/model.js +41 -0
- package/dist/dom/index.js +13 -0
- package/dist/dom/internal/colors.js +44 -0
- package/dist/dom/internal/floating-tip.js +83 -0
- package/dist/dom/internal/format.js +43 -0
- package/dist/dom/internal/grid-context.js +5 -0
- package/dist/dom/internal/hidden.styles.js +16 -0
- package/dist/dom/internal/legend.js +112 -0
- package/dist/dom/internal/legend.styles.js +108 -0
- package/dist/dom/internal/markers.js +101 -0
- package/dist/dom/internal/options.js +300 -0
- package/dist/dom/internal/place.js +27 -0
- package/dist/dom/internal/scheme-watch.js +73 -0
- package/dist/dom/internal/share.js +28 -0
- package/dist/dom/internal/types.js +0 -0
- package/dist/dom/row-chart/index.js +1 -0
- package/dist/dom/row-chart/model.js +59 -0
- package/dist/dom/row-chart/row-chart.js +691 -0
- package/dist/dom/row-chart/row-chart.styles.js +242 -0
- package/dist/dom/segmented-bar/index.js +1 -0
- package/dist/dom/segmented-bar/segmented-bar.js +280 -0
- package/dist/dom/segmented-bar/segmented-bar.styles.js +88 -0
- package/dist/dom/sparkline/index.js +1 -0
- package/dist/dom/sparkline/sparkline.js +145 -0
- package/dist/dom/stacked-histogram/histogram.js +137 -0
- package/dist/dom/stacked-histogram/index.js +1 -0
- package/dist/dom/stacked-histogram/stacked-histogram.js +761 -0
- package/dist/dom/stacked-histogram/stacked-histogram.styles.js +211 -0
- package/dist/dom/state-timeline/index.js +1 -0
- package/dist/dom/state-timeline/model.js +166 -0
- package/dist/dom/state-timeline/state-timeline.js +729 -0
- package/dist/dom/state-timeline/state-timeline.styles.js +171 -0
- package/dist/dom/status-history/index.js +1 -0
- package/dist/dom/status-history/status-history.js +542 -0
- package/dist/dom/status-history/status-history.styles.js +171 -0
- package/dist/solid/bar-list/bar-list.jsx +139 -0
- package/dist/solid/bar-list/bar-list.styles.jsx +171 -0
- package/dist/solid/bar-list/index.jsx +1 -0
- package/dist/solid/chart/chart.jsx +454 -0
- package/dist/solid/chart/chart.styles.jsx +165 -0
- package/dist/solid/chart/index.jsx +1 -0
- package/dist/solid/chart-grid/chart-grid.jsx +46 -0
- package/dist/solid/chart-grid/index.jsx +1 -0
- package/dist/solid/donut/donut.jsx +291 -0
- package/dist/solid/donut/donut.styles.jsx +111 -0
- package/dist/solid/donut/index.jsx +1 -0
- package/dist/solid/heat-graph/calendar.jsx +118 -0
- package/dist/solid/heat-graph/heat-graph.jsx +228 -0
- package/dist/solid/heat-graph/heat-graph.styles.jsx +168 -0
- package/dist/solid/heat-graph/index.jsx +1 -0
- package/dist/solid/heat-matrix/heat-matrix.jsx +165 -0
- package/dist/solid/heat-matrix/heat-matrix.styles.jsx +155 -0
- package/dist/solid/heat-matrix/index.jsx +1 -0
- package/dist/solid/heat-matrix/model.jsx +41 -0
- package/dist/solid/index.jsx +13 -0
- package/dist/solid/internal/colors.jsx +44 -0
- package/dist/solid/internal/floating-tip.jsx +68 -0
- package/dist/solid/internal/format.jsx +43 -0
- package/dist/solid/internal/grid-context.jsx +5 -0
- package/dist/solid/internal/hidden.styles.jsx +16 -0
- package/dist/solid/internal/legend.jsx +35 -0
- package/dist/solid/internal/legend.styles.jsx +108 -0
- package/dist/solid/internal/markers.jsx +101 -0
- package/dist/solid/internal/options.jsx +300 -0
- package/dist/solid/internal/place.jsx +27 -0
- package/dist/solid/internal/scheme-watch.jsx +73 -0
- package/dist/solid/internal/share.jsx +28 -0
- package/dist/solid/internal/types.jsx +0 -0
- package/dist/solid/row-chart/index.jsx +1 -0
- package/dist/solid/row-chart/model.jsx +59 -0
- package/dist/solid/row-chart/row-chart.jsx +312 -0
- package/dist/solid/row-chart/row-chart.styles.jsx +242 -0
- package/dist/solid/segmented-bar/index.jsx +1 -0
- package/dist/solid/segmented-bar/segmented-bar.jsx +125 -0
- package/dist/solid/segmented-bar/segmented-bar.styles.jsx +88 -0
- package/dist/solid/sparkline/index.jsx +1 -0
- package/dist/solid/sparkline/sparkline.jsx +88 -0
- package/dist/solid/stacked-histogram/histogram.jsx +137 -0
- package/dist/solid/stacked-histogram/index.jsx +1 -0
- package/dist/solid/stacked-histogram/stacked-histogram.jsx +381 -0
- package/dist/solid/stacked-histogram/stacked-histogram.styles.jsx +211 -0
- package/dist/solid/state-timeline/index.jsx +1 -0
- package/dist/solid/state-timeline/model.jsx +166 -0
- package/dist/solid/state-timeline/state-timeline.jsx +387 -0
- package/dist/solid/state-timeline/state-timeline.styles.jsx +171 -0
- package/dist/solid/status-history/index.jsx +1 -0
- package/dist/solid/status-history/status-history.jsx +279 -0
- package/dist/solid/status-history/status-history.styles.jsx +171 -0
- package/dist/styles.css +1 -0
- package/dist/types/bar-list/bar-list.d.ts +91 -0
- package/dist/types/bar-list/bar-list.styles.d.ts +148 -0
- package/dist/types/bar-list/index.d.ts +3 -0
- package/dist/types/chart/chart.d.ts +98 -0
- package/dist/types/chart/chart.styles.d.ts +145 -0
- package/dist/types/chart/index.d.ts +3 -0
- package/dist/types/chart-grid/chart-grid.d.ts +35 -0
- package/dist/types/chart-grid/index.d.ts +2 -0
- package/dist/types/donut/donut.d.ts +124 -0
- package/dist/types/donut/donut.styles.d.ts +96 -0
- package/dist/types/donut/index.d.ts +3 -0
- package/dist/types/heat-graph/calendar.d.ts +61 -0
- package/dist/types/heat-graph/heat-graph.d.ts +82 -0
- package/dist/types/heat-graph/heat-graph.styles.d.ts +141 -0
- package/dist/types/heat-graph/index.d.ts +4 -0
- package/dist/types/heat-matrix/heat-matrix.d.ts +65 -0
- package/dist/types/heat-matrix/heat-matrix.styles.d.ts +135 -0
- package/dist/types/heat-matrix/index.d.ts +3 -0
- package/dist/types/heat-matrix/model.d.ts +15 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/internal/colors.d.ts +22 -0
- package/dist/types/internal/floating-tip.d.ts +15 -0
- package/dist/types/internal/format.d.ts +7 -0
- package/dist/types/internal/grid-context.d.ts +9 -0
- package/dist/types/internal/hidden.styles.d.ts +15 -0
- package/dist/types/internal/legend.d.ts +18 -0
- package/dist/types/internal/legend.styles.d.ts +96 -0
- package/dist/types/internal/markers.d.ts +16 -0
- package/dist/types/internal/options.d.ts +59 -0
- package/dist/types/internal/place.d.ts +20 -0
- package/dist/types/internal/scheme-watch.d.ts +12 -0
- package/dist/types/internal/share.d.ts +19 -0
- package/dist/types/internal/types.d.ts +163 -0
- package/dist/types/row-chart/index.d.ts +4 -0
- package/dist/types/row-chart/model.d.ts +50 -0
- package/dist/types/row-chart/row-chart.d.ts +148 -0
- package/dist/types/row-chart/row-chart.styles.d.ts +216 -0
- package/dist/types/segmented-bar/index.d.ts +3 -0
- package/dist/types/segmented-bar/segmented-bar.d.ts +65 -0
- package/dist/types/segmented-bar/segmented-bar.styles.d.ts +75 -0
- package/dist/types/sparkline/index.d.ts +3 -0
- package/dist/types/sparkline/sparkline.d.ts +38 -0
- package/dist/types/stacked-histogram/histogram.d.ts +48 -0
- package/dist/types/stacked-histogram/index.d.ts +4 -0
- package/dist/types/stacked-histogram/stacked-histogram.d.ts +73 -0
- package/dist/types/stacked-histogram/stacked-histogram.styles.d.ts +187 -0
- package/dist/types/state-timeline/index.d.ts +3 -0
- package/dist/types/state-timeline/model.d.ts +63 -0
- package/dist/types/state-timeline/state-timeline.d.ts +108 -0
- package/dist/types/state-timeline/state-timeline.styles.d.ts +151 -0
- package/dist/types/status-history/index.d.ts +3 -0
- package/dist/types/status-history/status-history.d.ts +72 -0
- package/dist/types/status-history/status-history.styles.d.ts +150 -0
- package/docs/api.json +1346 -0
- package/docs/bar-list.md +190 -0
- package/docs/chart-grid.md +77 -0
- package/docs/chart.md +355 -0
- package/docs/donut.md +182 -0
- package/docs/heat-graph.md +121 -0
- package/docs/heat-matrix.md +108 -0
- package/docs/llms.txt +68 -0
- package/docs/row-chart.md +193 -0
- package/docs/search-index.json +291 -0
- package/docs/segmented-bar.md +128 -0
- package/docs/sparkline.md +82 -0
- package/docs/stacked-histogram.md +123 -0
- package/docs/state-timeline.md +141 -0
- package/docs/status-history.md +121 -0
- package/package.json +109 -4
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
2
|
+
import type { ChartColor } from "../internal/types.js";
|
|
3
|
+
/** One category of the whole. */
|
|
4
|
+
export interface DonutDatum<T = unknown> {
|
|
5
|
+
/** The category ("EMEA"). */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Its amount. A missing, zero or negative value draws no slice; it keeps its legend row, at 0. */
|
|
8
|
+
value: number | null;
|
|
9
|
+
/** Identifies the category for `selected` when labels repeat. Defaults to `label`. */
|
|
10
|
+
key?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Its color: a chart token or any CSS color. Defaults to the next chart token among the drawn slices. Set
|
|
13
|
+
* it for a category that must keep its color when the data changes.
|
|
14
|
+
*/
|
|
15
|
+
color?: ChartColor;
|
|
16
|
+
/** Your own data, handed back to `onSelect`. */
|
|
17
|
+
data?: T;
|
|
18
|
+
}
|
|
19
|
+
/** A drawn slice: one category, or "Other" with every category folded into it. */
|
|
20
|
+
export interface DonutSlice<T = unknown> {
|
|
21
|
+
/** The category's `key` (or label); for "Other", the "Other" word. */
|
|
22
|
+
key: string;
|
|
23
|
+
/** The category's label, or the "Other" word. */
|
|
24
|
+
label: string;
|
|
25
|
+
/** Its amount (for "Other", the folded categories' sum). */
|
|
26
|
+
value: number;
|
|
27
|
+
/** Its share of the total, 0 to 1. */
|
|
28
|
+
share: number;
|
|
29
|
+
/** Its CSS color. */
|
|
30
|
+
color: string;
|
|
31
|
+
/** Its position among the slices, from the top, clockwise. */
|
|
32
|
+
index: number;
|
|
33
|
+
/** Whether it's "Other". */
|
|
34
|
+
other: boolean;
|
|
35
|
+
/** The data behind it: one category, or every category folded into "Other". */
|
|
36
|
+
items: readonly DonutDatum<T>[];
|
|
37
|
+
}
|
|
38
|
+
/** The words the donut writes. Also set app-wide with the kit's `LocaleProvider messages={{ donut }}`. */
|
|
39
|
+
export interface DonutLabels {
|
|
40
|
+
/** Under the total in the centre, and in the name ("Total"). */
|
|
41
|
+
total: string;
|
|
42
|
+
/** The slice the smallest categories fold into past `maxSlices`. */
|
|
43
|
+
other: string;
|
|
44
|
+
/** In the centre and the name when nothing adds up. */
|
|
45
|
+
empty: string;
|
|
46
|
+
/** The name while `loading`. */
|
|
47
|
+
loading: string;
|
|
48
|
+
}
|
|
49
|
+
export interface DonutProps<T = unknown> extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "children" | "class" | "onSelect"> {
|
|
50
|
+
/** What the whole is ("Revenue by region"). The image's name is this, the total, then each slice's share. */
|
|
51
|
+
label: string;
|
|
52
|
+
/** The categories, in the order they're drawn from the top, clockwise. */
|
|
53
|
+
data: readonly DonutDatum<T>[];
|
|
54
|
+
/**
|
|
55
|
+
* The donut's width and height in pixels. Under 80 it's a compact mark with nothing in the centre.
|
|
56
|
+
* @defaultValue 160
|
|
57
|
+
*/
|
|
58
|
+
size?: number;
|
|
59
|
+
/** The ring's width in pixels. Defaults to an eighth of `size` (a fifth under 64). */
|
|
60
|
+
thickness?: number;
|
|
61
|
+
/** The space between slices in pixels. Defaults to 2 (1 under 64). */
|
|
62
|
+
gap?: number;
|
|
63
|
+
/** Replaces the centre's content (by default the total, or the hovered or focused slice). `false` keeps the default. */
|
|
64
|
+
center?: JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* The legend list beside the donut, the way to read and choose slices. `false` keeps the values in the
|
|
67
|
+
* page for assistive technology only, and the slices aren't clickable. Children replace it: place a
|
|
68
|
+
* `DonutLegend` among them (it offers the choice even with `legend={false}`).
|
|
69
|
+
* @defaultValue true
|
|
70
|
+
*/
|
|
71
|
+
legend?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The most slices drawn: past it, the smallest categories fold into one "Other" slice, whose legend row
|
|
74
|
+
* lists them.
|
|
75
|
+
* @defaultValue 8
|
|
76
|
+
*/
|
|
77
|
+
maxSlices?: number;
|
|
78
|
+
/** How values are written. Defaults to the locale's numbers, compact from 10,000. */
|
|
79
|
+
format?: (value: number) => string;
|
|
80
|
+
/**
|
|
81
|
+
* Makes each legend row a toggle button (and each slice clickable): filter the page by the chosen
|
|
82
|
+
* category. With `legend={false}` the slices aren't clickable; a `DonutLegend` in children still offers
|
|
83
|
+
* the choice.
|
|
84
|
+
*/
|
|
85
|
+
onSelect?: (slice: DonutSlice<T>) => void;
|
|
86
|
+
/**
|
|
87
|
+
* The `key` (or label) of the category that is on, for a filter: its row is pressed and its slice stays
|
|
88
|
+
* highlighted. A category folded into "Other" marks "Other". `null` or nothing: none is on.
|
|
89
|
+
*/
|
|
90
|
+
selected?: string | null;
|
|
91
|
+
/** A skeleton ring while the data loads; the root is `aria-busy`. */
|
|
92
|
+
loading?: boolean;
|
|
93
|
+
/** The words, in your wording or language (app-wide: `LocaleProvider messages.donut`). */
|
|
94
|
+
labels?: Partial<DonutLabels>;
|
|
95
|
+
/** Where the legend goes, in place of the built-in one: a `DonutLegend` and anything around it. */
|
|
96
|
+
children?: JSX.Element;
|
|
97
|
+
/** Extra classes on the root. */
|
|
98
|
+
class?: JSX.ClassValue;
|
|
99
|
+
}
|
|
100
|
+
export interface DonutLegendProps {
|
|
101
|
+
/**
|
|
102
|
+
* Each row's share of the total, after its value.
|
|
103
|
+
* @defaultValue true
|
|
104
|
+
*/
|
|
105
|
+
share?: boolean;
|
|
106
|
+
/** Extra classes on the list. */
|
|
107
|
+
class?: JSX.ClassValue;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Part-to-whole as a ring of slices: revenue by region, traffic by channel. The total is in the centre, or
|
|
111
|
+
* the hovered or focused slice's value; the legend list beside it carries the values and is how slices are
|
|
112
|
+
* read and chosen. Past `maxSlices`, the smallest fold into "Other". The ring is an image named from the
|
|
113
|
+
* data ("Revenue by region, Total $1.2M: EMEA 42%, …"). Plain SVG, rendered on the server.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* <Donut label="Revenue by region" data={[{ label: "EMEA", value: 420 }, { label: "Americas", value: 350 }]} />
|
|
117
|
+
*/
|
|
118
|
+
export declare function Donut<T = unknown>(props: DonutProps<T>): JSX.Element;
|
|
119
|
+
/**
|
|
120
|
+
* The donut's legend list, for a place of your own inside `Donut`'s children: each slice's swatch, label,
|
|
121
|
+
* value and share. Hovering or focusing a row highlights its slice, and the reverse; with `onSelect` each
|
|
122
|
+
* row is a toggle button.
|
|
123
|
+
*/
|
|
124
|
+
export declare function DonutLegend(props: DonutLegendProps): JSX.Element;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
export declare const styles: Readonly<{
|
|
3
|
+
readonly root: Readonly<{
|
|
4
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
5
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
6
|
+
readonly flexWrap: stylex.StyleXClassNameFor<"flexWrap", "wrap">;
|
|
7
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
8
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
9
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
10
|
+
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
11
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
12
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
13
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
14
|
+
}>;
|
|
15
|
+
readonly figure: Readonly<{
|
|
16
|
+
readonly position: stylex.StyleXClassNameFor<"position", "relative">;
|
|
17
|
+
readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
|
|
18
|
+
readonly width: stylex.StyleXClassNameFor<"width", "var(--donut-size)">;
|
|
19
|
+
readonly height: stylex.StyleXClassNameFor<"height", "var(--donut-size)">;
|
|
20
|
+
}>;
|
|
21
|
+
readonly svg: Readonly<{
|
|
22
|
+
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
23
|
+
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
24
|
+
readonly height: stylex.StyleXClassNameFor<"height", "100%">;
|
|
25
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "visible">;
|
|
26
|
+
}>;
|
|
27
|
+
readonly slice: Readonly<{
|
|
28
|
+
readonly fill: stylex.StyleXClassNameFor<"fill", "var(--swatch)">;
|
|
29
|
+
readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
|
|
30
|
+
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "opacity">;
|
|
31
|
+
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
32
|
+
}>;
|
|
33
|
+
readonly clickable: Readonly<{
|
|
34
|
+
readonly cursor: stylex.StyleXClassNameFor<"cursor", "pointer">;
|
|
35
|
+
}>;
|
|
36
|
+
readonly track: Readonly<{
|
|
37
|
+
readonly fill: stylex.StyleXClassNameFor<"fill", string>;
|
|
38
|
+
readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
|
|
39
|
+
}>;
|
|
40
|
+
readonly pulse: Readonly<{
|
|
41
|
+
readonly animationName: stylex.StyleXClassNameFor<"animationName", string>;
|
|
42
|
+
readonly animationDuration: stylex.StyleXClassNameFor<"animationDuration", "1.6s">;
|
|
43
|
+
readonly animationTimingFunction: stylex.StyleXClassNameFor<"animationTimingFunction", "ease-in-out">;
|
|
44
|
+
readonly animationIterationCount: stylex.StyleXClassNameFor<"animationIterationCount", "infinite">;
|
|
45
|
+
}>;
|
|
46
|
+
readonly center: Readonly<{
|
|
47
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
48
|
+
readonly inset: stylex.StyleXClassNameFor<"inset", 0>;
|
|
49
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
50
|
+
readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
|
|
51
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
52
|
+
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
|
|
53
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
54
|
+
readonly margin: stylex.StyleXClassNameFor<"margin", "auto">;
|
|
55
|
+
readonly width: stylex.StyleXClassNameFor<"width", "calc(var(--donut-hole) * 0.78)">;
|
|
56
|
+
readonly height: stylex.StyleXClassNameFor<"height", "calc(var(--donut-hole) * 0.78)">;
|
|
57
|
+
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "center">;
|
|
58
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
59
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "none">;
|
|
60
|
+
}>;
|
|
61
|
+
readonly value: Readonly<{
|
|
62
|
+
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
63
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "100%">;
|
|
64
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
65
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
66
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
67
|
+
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
68
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
69
|
+
readonly unicodeBidi: stylex.StyleXClassNameFor<"unicodeBidi", "plaintext">;
|
|
70
|
+
}>;
|
|
71
|
+
readonly caption: Readonly<{
|
|
72
|
+
readonly display: stylex.StyleXClassNameFor<"display", "-webkit-box">;
|
|
73
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "100%">;
|
|
74
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
75
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
76
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
77
|
+
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "break-word">;
|
|
78
|
+
readonly WebkitBoxOrient: stylex.StyleXClassNameFor<"WebkitBoxOrient", "vertical">;
|
|
79
|
+
readonly WebkitLineClamp: stylex.StyleXClassNameFor<"WebkitLineClamp", 2>;
|
|
80
|
+
}>;
|
|
81
|
+
readonly legend: Readonly<{
|
|
82
|
+
readonly flex: stylex.StyleXClassNameFor<"flex", "1 1 12rem">;
|
|
83
|
+
}>;
|
|
84
|
+
readonly skeletonRow: Readonly<{
|
|
85
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
86
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
87
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
88
|
+
readonly height: stylex.StyleXClassNameFor<"height", "1.75rem">;
|
|
89
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
90
|
+
}>;
|
|
91
|
+
readonly skeletonBar: Readonly<{
|
|
92
|
+
readonly height: stylex.StyleXClassNameFor<"height", "0.625rem">;
|
|
93
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
94
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
95
|
+
}>;
|
|
96
|
+
}>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The heat graph's calendar: days as UTC dates keyed `YYYY-MM-DD`, so a range never shifts with a time zone
|
|
3
|
+
* or a daylight-saving change. Pure; the component renders what `layout` returns.
|
|
4
|
+
*/
|
|
5
|
+
/** One day's value. `date` is a calendar day: `"2026-03-04"`, or a `Date` read as its local day. */
|
|
6
|
+
export interface HeatGraphDatum {
|
|
7
|
+
date: string | Date;
|
|
8
|
+
count: number;
|
|
9
|
+
}
|
|
10
|
+
export type WeekStart = "monday" | "sunday";
|
|
11
|
+
/** A day in the grid. */
|
|
12
|
+
export interface HeatGraphDay {
|
|
13
|
+
/** `YYYY-MM-DD`. */
|
|
14
|
+
key: string;
|
|
15
|
+
/** Midnight UTC of the day. */
|
|
16
|
+
date: Date;
|
|
17
|
+
/** The day's total (entries on the same day add up). */
|
|
18
|
+
count: number;
|
|
19
|
+
/** 0 (none) to 4 (most). */
|
|
20
|
+
level: number;
|
|
21
|
+
/** Week column, from 0. */
|
|
22
|
+
column: number;
|
|
23
|
+
/** Weekday row, from 0 (the week's first day). */
|
|
24
|
+
row: number;
|
|
25
|
+
}
|
|
26
|
+
export interface HeatGraphLayout {
|
|
27
|
+
/** Every day in the range, in date order. */
|
|
28
|
+
days: HeatGraphDay[];
|
|
29
|
+
/** Columns (weeks). */
|
|
30
|
+
weeks: number;
|
|
31
|
+
/** Month labels: the first column of each month that has room for its name. */
|
|
32
|
+
months: Array<{
|
|
33
|
+
column: number;
|
|
34
|
+
date: Date;
|
|
35
|
+
}>;
|
|
36
|
+
/** The lower bound of levels 1–4. */
|
|
37
|
+
thresholds: number[];
|
|
38
|
+
max: number;
|
|
39
|
+
total: number;
|
|
40
|
+
}
|
|
41
|
+
/** A calendar day as midnight UTC. */
|
|
42
|
+
export declare function toDay(value: string | Date): Date | undefined;
|
|
43
|
+
export declare const dayKey: (date: Date) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Lower bounds for levels 1–4: quarters of the busiest day. Whole counts get whole bounds (`[1, 4, 7, 10]`
|
|
46
|
+
* for a busiest day of 12, one level per count up to 4); fractional counts (hours) get the quarters.
|
|
47
|
+
*/
|
|
48
|
+
export declare function defaultThresholds(max: number, whole: boolean): number[];
|
|
49
|
+
export declare function levelOf(count: number, thresholds: number[]): number;
|
|
50
|
+
/**
|
|
51
|
+
* Lay the range out in week columns. The range is `start`–`end` (or the data's first and last day); the
|
|
52
|
+
* first column starts on the week's first day, so a range that starts midweek leaves the cells before it
|
|
53
|
+
* empty.
|
|
54
|
+
*/
|
|
55
|
+
export declare function layout(options: {
|
|
56
|
+
data: readonly HeatGraphDatum[];
|
|
57
|
+
start?: string | Date;
|
|
58
|
+
end?: string | Date;
|
|
59
|
+
weekStart: WeekStart;
|
|
60
|
+
thresholds?: number[];
|
|
61
|
+
}): HeatGraphLayout | undefined;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
2
|
+
import type { ChartColor } from "../internal/types.js";
|
|
3
|
+
import { type HeatGraphDatum, type HeatGraphDay, type WeekStart } from "./calendar.js";
|
|
4
|
+
/** The heat graph's built-in words. Also set app-wide with the kit's `LocaleProvider messages={{ heatGraph }}`. */
|
|
5
|
+
export interface HeatGraphLabels {
|
|
6
|
+
/** The legend's low end. */
|
|
7
|
+
less: string;
|
|
8
|
+
/** The legend's high end. */
|
|
9
|
+
more: string;
|
|
10
|
+
/** A day's count in words, for its name and tooltip: `(3, "3") => "3 commits"`. */
|
|
11
|
+
count: (count: number, formatted: string) => string;
|
|
12
|
+
}
|
|
13
|
+
export interface HeatGraphProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "children" | "class"> {
|
|
14
|
+
/** What the graph shows, for assistive technology: the measure, the period and the takeaway. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** One entry per day (entries on the same day add up). Days without one count as 0. */
|
|
17
|
+
data: readonly HeatGraphDatum[];
|
|
18
|
+
/** The first day shown (`"2026-01-01"` or a `Date`). Defaults to the earliest day in `data`. */
|
|
19
|
+
start?: string | Date;
|
|
20
|
+
/** The last day shown. Defaults to the latest day in `data`. Set both to draw an empty period. */
|
|
21
|
+
end?: string | Date;
|
|
22
|
+
/** The weekday each column starts on. Defaults to the locale's (Monday in most, Sunday in the US). */
|
|
23
|
+
weekStart?: WeekStart;
|
|
24
|
+
/**
|
|
25
|
+
* The lower bounds of levels 1–4, such as `[1, 5, 10, 20]`. Defaults to quarters of the busiest day.
|
|
26
|
+
* Fix them when graphs side by side must share a scale.
|
|
27
|
+
*/
|
|
28
|
+
thresholds?: [number, number, number, number];
|
|
29
|
+
/**
|
|
30
|
+
* The ramp's color, from a wash over the muted surface (level 1) to the full color (level 4).
|
|
31
|
+
* @defaultValue "chart-1"
|
|
32
|
+
*/
|
|
33
|
+
color?: ChartColor;
|
|
34
|
+
/**
|
|
35
|
+
* The mark: `rounded` squares read as a calendar; `circle` pairs with `sizeEncoding="value"`.
|
|
36
|
+
* @defaultValue "rounded"
|
|
37
|
+
*/
|
|
38
|
+
shape?: "square" | "rounded" | "circle";
|
|
39
|
+
/**
|
|
40
|
+
* `"value"` sizes each mark by its count too (its area), so magnitude reads without the legend. A zero day
|
|
41
|
+
* keeps a small mark; the whole cell stays the hover and click target.
|
|
42
|
+
* @defaultValue "fixed"
|
|
43
|
+
*/
|
|
44
|
+
sizeEncoding?: "fixed" | "value";
|
|
45
|
+
/** A fixed cell size in pixels. Without it, cells share the width (a year needs about 700px). */
|
|
46
|
+
cellSize?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Space between cells in pixels.
|
|
49
|
+
* @defaultValue 3
|
|
50
|
+
*/
|
|
51
|
+
cellGap?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Month names over the weeks.
|
|
54
|
+
* @defaultValue true
|
|
55
|
+
*/
|
|
56
|
+
monthLabels?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Weekday names beside the rows (every other one).
|
|
59
|
+
* @defaultValue true
|
|
60
|
+
*/
|
|
61
|
+
dayLabels?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The Less → More legend.
|
|
64
|
+
* @defaultValue true
|
|
65
|
+
*/
|
|
66
|
+
legend?: boolean;
|
|
67
|
+
/** Called when a day is clicked or chosen with Enter or Space: open that day's activity. */
|
|
68
|
+
onSelectDay?: (day: HeatGraphDay) => void;
|
|
69
|
+
/** The graph's words, in your wording or language (app-wide: `LocaleProvider messages.heatGraph`). */
|
|
70
|
+
labels?: Partial<HeatGraphLabels>;
|
|
71
|
+
/** Extra classes on the root. */
|
|
72
|
+
class?: JSX.ClassValue;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A calendar of daily counts, one cell per day in week columns, shaded by level: which days and weekdays
|
|
76
|
+
* are busy across weeks or months. A grid with one tab stop: the arrow keys move by day and week, each
|
|
77
|
+
* day is named with its count and date, and the tooltip follows the pointer and the focus.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* <HeatGraph label="Commits in 2026: 1,204, busiest in March" data={commits} start="2026-01-01" end="2026-12-31" />
|
|
81
|
+
*/
|
|
82
|
+
export declare function HeatGraph(props: HeatGraphProps): JSX.Element;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
export declare const styles: Readonly<{
|
|
3
|
+
readonly root: Readonly<{
|
|
4
|
+
readonly position: stylex.StyleXClassNameFor<"position", "relative">;
|
|
5
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
6
|
+
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
7
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
8
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
9
|
+
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
10
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
11
|
+
}>;
|
|
12
|
+
readonly frame: Readonly<{
|
|
13
|
+
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
14
|
+
readonly gridTemplateColumns: stylex.StyleXClassNameFor<"gridTemplateColumns", "var(--hg-columns)">;
|
|
15
|
+
readonly columnGap: stylex.StyleXClassNameFor<"columnGap", "var(--hg-gap)">;
|
|
16
|
+
readonly rowGap: stylex.StyleXClassNameFor<"rowGap", "var(--hg-gap)">;
|
|
17
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
18
|
+
}>;
|
|
19
|
+
readonly months: Readonly<{
|
|
20
|
+
readonly gridColumn: stylex.StyleXClassNameFor<"gridColumn", "1 / -1">;
|
|
21
|
+
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
22
|
+
readonly gridTemplateColumns: stylex.StyleXClassNameFor<"gridTemplateColumns", "subgrid">;
|
|
23
|
+
}>;
|
|
24
|
+
readonly monthLabel: Readonly<{
|
|
25
|
+
readonly gridRow: stylex.StyleXClassNameFor<"gridRow", 1>;
|
|
26
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
27
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
28
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
29
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
30
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "visible">;
|
|
31
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
32
|
+
}>;
|
|
33
|
+
readonly grid: Readonly<{
|
|
34
|
+
readonly gridColumn: stylex.StyleXClassNameFor<"gridColumn", "1 / -1">;
|
|
35
|
+
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
36
|
+
readonly gridTemplateColumns: stylex.StyleXClassNameFor<"gridTemplateColumns", "subgrid">;
|
|
37
|
+
readonly rowGap: stylex.StyleXClassNameFor<"rowGap", "var(--hg-gap)">;
|
|
38
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none">;
|
|
39
|
+
}>;
|
|
40
|
+
readonly row: Readonly<{
|
|
41
|
+
readonly gridColumn: stylex.StyleXClassNameFor<"gridColumn", "1 / -1">;
|
|
42
|
+
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
43
|
+
readonly gridTemplateColumns: stylex.StyleXClassNameFor<"gridTemplateColumns", "subgrid">;
|
|
44
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
45
|
+
}>;
|
|
46
|
+
readonly dayLabel: Readonly<{
|
|
47
|
+
readonly gridColumn: stylex.StyleXClassNameFor<"gridColumn", 1>;
|
|
48
|
+
readonly paddingInlineEnd: stylex.StyleXClassNameFor<"paddingInlineEnd", string>;
|
|
49
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
50
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1>;
|
|
51
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
52
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
53
|
+
}>;
|
|
54
|
+
readonly cell: Readonly<{
|
|
55
|
+
readonly position: stylex.StyleXClassNameFor<"position", "relative">;
|
|
56
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
57
|
+
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
58
|
+
readonly placeItems: stylex.StyleXClassNameFor<"placeItems", "center">;
|
|
59
|
+
readonly width: stylex.StyleXClassNameFor<"width", "var(--hg-cell-size, auto)">;
|
|
60
|
+
readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "1">;
|
|
61
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
62
|
+
readonly padding: stylex.StyleXClassNameFor<"padding", 0>;
|
|
63
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
64
|
+
readonly cursor: stylex.StyleXClassNameFor<"cursor", "default">;
|
|
65
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none" | "solid">;
|
|
66
|
+
readonly outlineWidth: stylex.StyleXClassNameFor<"outlineWidth", "2px">;
|
|
67
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", "1px">;
|
|
68
|
+
readonly outlineColor: stylex.StyleXClassNameFor<"outlineColor", string>;
|
|
69
|
+
}>;
|
|
70
|
+
readonly clickable: Readonly<{
|
|
71
|
+
readonly cursor: stylex.StyleXClassNameFor<"cursor", "pointer">;
|
|
72
|
+
}>;
|
|
73
|
+
readonly mark: Readonly<{
|
|
74
|
+
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
75
|
+
readonly width: stylex.StyleXClassNameFor<"width", "var(--hg-mark, 100%)">;
|
|
76
|
+
readonly height: stylex.StyleXClassNameFor<"height", "var(--hg-mark, 100%)">;
|
|
77
|
+
readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
|
|
78
|
+
}>;
|
|
79
|
+
readonly square: Readonly<{
|
|
80
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", "2px">;
|
|
81
|
+
}>;
|
|
82
|
+
readonly rounded: Readonly<{
|
|
83
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", "25%">;
|
|
84
|
+
}>;
|
|
85
|
+
readonly circle: Readonly<{
|
|
86
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", "50%">;
|
|
87
|
+
}>;
|
|
88
|
+
readonly level0: Readonly<{
|
|
89
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
90
|
+
}>;
|
|
91
|
+
readonly level1: Readonly<{
|
|
92
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "color-mix(in oklab, var(--hg-color) 30%, var(--sui-surface-muted))">;
|
|
93
|
+
}>;
|
|
94
|
+
readonly level2: Readonly<{
|
|
95
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "color-mix(in oklab, var(--hg-color) 55%, var(--sui-surface-muted))">;
|
|
96
|
+
}>;
|
|
97
|
+
readonly level3: Readonly<{
|
|
98
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "color-mix(in oklab, var(--hg-color) 78%, var(--sui-surface-muted))">;
|
|
99
|
+
}>;
|
|
100
|
+
readonly level4: Readonly<{
|
|
101
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "var(--hg-color)">;
|
|
102
|
+
}>;
|
|
103
|
+
readonly legend: Readonly<{
|
|
104
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
105
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
106
|
+
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "flex-end">;
|
|
107
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
108
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
109
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
110
|
+
}>;
|
|
111
|
+
readonly legendMark: Readonly<{
|
|
112
|
+
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
113
|
+
readonly width: stylex.StyleXClassNameFor<"width", "10px">;
|
|
114
|
+
readonly height: stylex.StyleXClassNameFor<"height", "10px">;
|
|
115
|
+
readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
|
|
116
|
+
}>;
|
|
117
|
+
readonly tooltip: Readonly<{
|
|
118
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
119
|
+
readonly zIndex: stylex.StyleXClassNameFor<"zIndex", 1>;
|
|
120
|
+
readonly top: stylex.StyleXClassNameFor<"top", 0>;
|
|
121
|
+
readonly left: stylex.StyleXClassNameFor<"left", 0>;
|
|
122
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
123
|
+
readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", string>;
|
|
124
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
125
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
126
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
127
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
128
|
+
readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", "1px">;
|
|
129
|
+
readonly borderStyle: stylex.StyleXClassNameFor<"borderStyle", "solid">;
|
|
130
|
+
readonly borderColor: stylex.StyleXClassNameFor<"borderColor", "CanvasText" | "transparent">;
|
|
131
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", string>;
|
|
132
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
133
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
134
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
135
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
136
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "none">;
|
|
137
|
+
}>;
|
|
138
|
+
}>;
|
|
139
|
+
export declare const levels: Readonly<{
|
|
140
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
141
|
+
}>[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
2
|
+
/** The matrix's built-in words. Also set app-wide with the kit's `LocaleProvider messages={{ heatMatrix }}`. */
|
|
3
|
+
export interface HeatMatrixLabels {
|
|
4
|
+
/** A cell with no value. */
|
|
5
|
+
missing: string;
|
|
6
|
+
/** In place of the matrix when there are no rows or columns. */
|
|
7
|
+
empty: string;
|
|
8
|
+
/** The legend list's name, from the matrix's `label`. */
|
|
9
|
+
legend: (label: string) => string;
|
|
10
|
+
}
|
|
11
|
+
export interface HeatMatrixProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "children" | "class"> {
|
|
12
|
+
/** The table's name: what the cells measure, between what, over which period ("Route RTT, peak increase"). */
|
|
13
|
+
label: string;
|
|
14
|
+
/** The row headers, top to bottom ("from"). */
|
|
15
|
+
rows: readonly string[];
|
|
16
|
+
/** The column headers, start to end ("to"). */
|
|
17
|
+
columns: readonly string[];
|
|
18
|
+
/** The values, one array per row with one value per column (`values[row][column]`); `null` for none. */
|
|
19
|
+
values: readonly (readonly (number | null | undefined)[])[];
|
|
20
|
+
/** Text in the top corner, over the row headers: what the rows and columns are ("from \\ to"). */
|
|
21
|
+
corner?: JSX.Element;
|
|
22
|
+
/** How values are written in the cells and the legend. Defaults to the locale's numbers. */
|
|
23
|
+
format?: (value: number) => string;
|
|
24
|
+
/**
|
|
25
|
+
* The lower bounds of steps 2–5 of the heat scale, such as `[5, 10, 15, 20]`. Defaults to five even steps
|
|
26
|
+
* between the smallest and the largest value. Fix them when the shades mean something (over 20 ms is bad)
|
|
27
|
+
* or when matrices side by side must share a scale.
|
|
28
|
+
*/
|
|
29
|
+
thresholds?: [number, number, number, number];
|
|
30
|
+
/**
|
|
31
|
+
* Leave the cells where a row meets the column of the same name (a route to itself) out of the scale:
|
|
32
|
+
* they're drawn muted, and their values don't set the default steps.
|
|
33
|
+
*/
|
|
34
|
+
muteDiagonal?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The scale's steps and their ranges under the matrix.
|
|
37
|
+
* @defaultValue true
|
|
38
|
+
*/
|
|
39
|
+
legend?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* A cell's height in pixels.
|
|
42
|
+
* @defaultValue 32
|
|
43
|
+
*/
|
|
44
|
+
cellHeight?: number;
|
|
45
|
+
/** The words, in your wording or language (app-wide: `LocaleProvider messages.heatMatrix`). */
|
|
46
|
+
labels?: Partial<HeatMatrixLabels>;
|
|
47
|
+
/** Extra classes on the root. */
|
|
48
|
+
class?: JSX.ClassValue;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A table of values between two sets of things (routes from one region to another, services by hour),
|
|
52
|
+
* each cell shaded on a five-step heat scale from cool to hot, its value written on it. A real table: the
|
|
53
|
+
* headers name every cell for assistive technology. Plain DOM, so it renders on the server.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* <HeatMatrix
|
|
57
|
+
* label="Route RTT, peak increase over the range minimum"
|
|
58
|
+
* rows={["eu-central", "us-east"]}
|
|
59
|
+
* columns={["eu-central", "us-east"]}
|
|
60
|
+
* values={[[0.1, 4.6], [4.6, 0.1]]}
|
|
61
|
+
* format={(v) => `${v.toFixed(1)} ms`}
|
|
62
|
+
* muteDiagonal
|
|
63
|
+
* />
|
|
64
|
+
*/
|
|
65
|
+
export declare function HeatMatrix(props: HeatMatrixProps): JSX.Element;
|