@stackone/malachite 2.86.0 → 2.88.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/COMPONENTS.md +5 -4
- package/dist/components/Accordion.js +206 -179
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Button.js +118 -81
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +128 -75
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Chat/ChatModelPicker.js +70 -67
- package/dist/components/Chat/ChatModelPicker.js.map +1 -1
- package/dist/components/FilterSearch.js +237 -232
- package/dist/components/FilterSearch.js.map +1 -1
- package/dist/components/FrameHeader.js +36 -0
- package/dist/components/FrameHeader.js.map +1 -0
- package/dist/components/LoadingBar.js +5 -5
- package/dist/components/LoadingBar.js.map +1 -1
- package/dist/components/MultiSelect.js +438 -388
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/PinnedCornerCap.js +32 -19
- package/dist/components/PinnedCornerCap.js.map +1 -1
- package/dist/components/QueryInput.js +95 -92
- package/dist/components/QueryInput.js.map +1 -1
- package/dist/components/SplitButton.js +62 -61
- package/dist/components/SplitButton.js.map +1 -1
- package/dist/components/Surface.js +98 -94
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Table/Table.js +630 -606
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TimeBarChart/TimeBarChart.js +241 -0
- package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js +49 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js +58 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js +29 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js +33 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js +77 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js.map +1 -0
- package/dist/components/TimeBarChart/stackLayout.js +25 -0
- package/dist/components/TimeBarChart/stackLayout.js.map +1 -0
- package/dist/components/TimeBarChart/timeBuckets.js +133 -0
- package/dist/components/TimeBarChart/timeBuckets.js.map +1 -0
- package/dist/components/TimeBarChart/tones.js +10 -0
- package/dist/components/TimeBarChart/tones.js.map +1 -0
- package/dist/components/Tooltip.js +93 -90
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/activeElement.js +5 -1
- package/dist/components/activeElement.js.map +1 -1
- package/dist/components/dateMath.js +1 -0
- package/dist/components/dateMath.js.map +1 -1
- package/dist/components/filterSearchModel.js +53 -45
- package/dist/components/filterSearchModel.js.map +1 -1
- package/dist/components/frameStyles.js +14 -0
- package/dist/components/frameStyles.js.map +1 -0
- package/dist/components/headerContent.js +10 -0
- package/dist/components/headerContent.js.map +1 -0
- package/dist/components/useFollowTrigger.js +28 -0
- package/dist/components/useFollowTrigger.js.map +1 -0
- package/dist/index.d.ts +131 -9
- package/dist/index.js +24 -22
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/dist/theme.js +340 -340
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { jsx as i, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as Dt, useId as kt, useLayoutEffect as Ct, useMemo as rt } from "react";
|
|
3
|
+
import Nt from "../Spinner.js";
|
|
4
|
+
import { FOCUS_RING as Pt } from "../focusRing.js";
|
|
5
|
+
import Et from "./TimeBarChartAxes.js";
|
|
6
|
+
import St from "./TimeBarChartBars.js";
|
|
7
|
+
import Ot from "./TimeBarChartLegend.js";
|
|
8
|
+
import Rt from "./TimeBarChartTable.js";
|
|
9
|
+
import _t from "./TimeBarChartTooltip.js";
|
|
10
|
+
import { toInstant as P, bucketSlots as zt, slotIndexOf as F, valueTicks as Ft, axisTicks as Gt, formatBucket as Ht } from "./timeBuckets.js";
|
|
11
|
+
const Wt = { small: 120, medium: 160, large: 240 }, Lt = 36, Xt = 22, $t = 8, jt = 4, Ut = 0.8, Yt = 5, at = {
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
justifyContent: "center",
|
|
16
|
+
gap: 4,
|
|
17
|
+
textAlign: "center"
|
|
18
|
+
}, re = ({
|
|
19
|
+
series: c,
|
|
20
|
+
buckets: w,
|
|
21
|
+
interval: h,
|
|
22
|
+
range: b,
|
|
23
|
+
size: st = "medium",
|
|
24
|
+
loading: E = !1,
|
|
25
|
+
error: it = !1,
|
|
26
|
+
errorTitle: ct = "No chart data to display",
|
|
27
|
+
errorSubTitle: lt = "An error occurred while fetching the chart data.",
|
|
28
|
+
valueLabel: G = "Total",
|
|
29
|
+
legend: dt = !0,
|
|
30
|
+
highlightTime: H,
|
|
31
|
+
onRangeSelect: y,
|
|
32
|
+
"aria-label": W,
|
|
33
|
+
"aria-labelledby": L,
|
|
34
|
+
className: X = "",
|
|
35
|
+
style: $
|
|
36
|
+
}) => {
|
|
37
|
+
var et, nt;
|
|
38
|
+
const [S, ht] = N(null), j = Dt(null), [m, mt] = N(0), [U, u] = N(-1), [r, I] = N(null), Y = kt(), f = Wt[st];
|
|
39
|
+
Ct(() => {
|
|
40
|
+
if (!S || typeof ResizeObserver > "u") return;
|
|
41
|
+
const t = new ResizeObserver(([e]) => mt(e.contentRect.width));
|
|
42
|
+
return t.observe(S), () => t.disconnect();
|
|
43
|
+
}, [S]);
|
|
44
|
+
const ut = rt(() => {
|
|
45
|
+
const t = w.map((T) => P(T.start)), e = b ? P(b.start) : Math.min(...t), o = b ? P(b.end) - 1 : Math.max(...t), a = Number.isFinite(e) && Number.isFinite(o) ? zt(e, o, h) : [], x = a.map(() => c.map(() => 0));
|
|
46
|
+
w.forEach((T, z) => {
|
|
47
|
+
const k = F(a, t[z]);
|
|
48
|
+
k < 0 || c.forEach((At, Bt) => {
|
|
49
|
+
const ot = T.values[At.key];
|
|
50
|
+
Number.isFinite(ot) && (x[k][Bt] += ot);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
const D = x.map((T) => T.reduce((z, k) => z + k, 0));
|
|
54
|
+
return { slots: a, values: x, totals: D, yTicks: Ft(Math.max(0, ...D)) };
|
|
55
|
+
}, [w, h, b, c]), { slots: n, values: O, totals: M, yTicks: R } = ut, s = Lt, l = Math.max(s + 1, m - jt), _ = $t, A = f - Xt, ft = A - _, p = ((et = n[0]) == null ? void 0 : et.start) ?? 0, B = ((nt = n[n.length - 1]) == null ? void 0 : nt.end) ?? 1, K = R[R.length - 1] || 1, g = (t) => s + (t - p) / (B - p) * (l - s), pt = (t) => A - t / K * ft, Z = (t) => {
|
|
56
|
+
const e = g(n[t].start), o = g(n[t].end) - e, a = o * Ut;
|
|
57
|
+
return { left: e + (o - a) / 2, width: a };
|
|
58
|
+
}, gt = rt(
|
|
59
|
+
() => n.length && m ? Gt(p, B, h.unit, l - s) : [],
|
|
60
|
+
[n.length, m, p, B, h.unit, l, s]
|
|
61
|
+
), xt = H === void 0 ? -1 : F(n, P(H)), q = (t) => {
|
|
62
|
+
var o;
|
|
63
|
+
const e = (o = j.current) == null ? void 0 : o.getBoundingClientRect();
|
|
64
|
+
return e ? t - e.left : -1;
|
|
65
|
+
}, J = (t) => t < s || t > l ? -1 : F(
|
|
66
|
+
n,
|
|
67
|
+
p + (t - s) / (l - s) * (B - p)
|
|
68
|
+
), Q = (t, e) => {
|
|
69
|
+
const o = Math.min(t, e), a = Math.max(t, e);
|
|
70
|
+
return n.flatMap(
|
|
71
|
+
(x, D) => g(x.start) < a && g(x.end) > o ? [D] : []
|
|
72
|
+
);
|
|
73
|
+
}, bt = (t) => {
|
|
74
|
+
var o, a;
|
|
75
|
+
const e = q(t.clientX);
|
|
76
|
+
!y || t.button !== 0 || J(e) < 0 || (t.preventDefault(), (a = (o = t.currentTarget).setPointerCapture) == null || a.call(o, t.pointerId), u(-1), I({ from: e, to: e }));
|
|
77
|
+
}, yt = (t) => {
|
|
78
|
+
const e = q(t.clientX);
|
|
79
|
+
if (r) {
|
|
80
|
+
I({ ...r, to: Math.min(Math.max(e, s), l) });
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
u(J(e));
|
|
84
|
+
}, vt = () => {
|
|
85
|
+
if (!r) return;
|
|
86
|
+
I(null);
|
|
87
|
+
const t = Q(r.from, r.to);
|
|
88
|
+
Math.abs(r.to - r.from) < Yt || !t.length || !y || y({
|
|
89
|
+
start: new Date(n[t[0]].start).toISOString(),
|
|
90
|
+
end: new Date(n[t[t.length - 1]].end).toISOString(),
|
|
91
|
+
reachesEnd: t[t.length - 1] === n.length - 1
|
|
92
|
+
});
|
|
93
|
+
}, v = U < n.length ? U : -1, Tt = (t) => {
|
|
94
|
+
const e = n.length - 1, o = {
|
|
95
|
+
ArrowLeft: Math.max(0, v - 1),
|
|
96
|
+
ArrowRight: Math.min(e, v + 1),
|
|
97
|
+
Home: 0,
|
|
98
|
+
End: e
|
|
99
|
+
};
|
|
100
|
+
if (t.key === "Escape") {
|
|
101
|
+
u(-1);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
t.key in o && e >= 0 && (t.preventDefault(), u(v < 0 && t.key.startsWith("Arrow") ? e : o[t.key]));
|
|
105
|
+
}, V = M.some((t) => t > 0) || w.length > 0, wt = dt && c.length > 1 ? /* @__PURE__ */ i(Ot, { series: c }) : null;
|
|
106
|
+
if (it)
|
|
107
|
+
return /* @__PURE__ */ C(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
className: `w-full ${X}`,
|
|
111
|
+
style: { ...at, height: f, ...$ },
|
|
112
|
+
role: "alert",
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ i("span", { className: "font-medium text-[length:var(--malachite-font-size-small,13px)] text-[var(--malachite-text-primary,rgb(10,10,10))]", children: ct }),
|
|
115
|
+
/* @__PURE__ */ i("span", { className: "text-[length:var(--malachite-font-size-xsmall,11px)] text-[var(--malachite-text-secondary,rgb(123,123,123))]", children: lt })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
const d = v >= 0 && !r ? v : -1, tt = d >= 0 ? Z(d) : void 0, It = r ? Q(r.from, r.to) : [], Mt = r ? It : [.../* @__PURE__ */ new Set([xt, d])].filter((t) => t >= 0);
|
|
120
|
+
return /* @__PURE__ */ C("div", { className: `w-full ${X}`, style: $, children: [
|
|
121
|
+
wt,
|
|
122
|
+
/* @__PURE__ */ C(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
ref: ht,
|
|
126
|
+
role: "group",
|
|
127
|
+
"aria-roledescription": "chart",
|
|
128
|
+
"aria-label": W,
|
|
129
|
+
"aria-labelledby": L,
|
|
130
|
+
"aria-describedby": d >= 0 ? Y : void 0,
|
|
131
|
+
"aria-busy": E || void 0,
|
|
132
|
+
tabIndex: n.length ? 0 : -1,
|
|
133
|
+
onKeyDown: Tt,
|
|
134
|
+
onBlur: () => u(-1),
|
|
135
|
+
className: `relative rounded-lg ${Pt}`,
|
|
136
|
+
style: {
|
|
137
|
+
height: f,
|
|
138
|
+
opacity: E && V ? 0.5 : 1,
|
|
139
|
+
transition: "opacity 150ms ease"
|
|
140
|
+
},
|
|
141
|
+
children: [
|
|
142
|
+
E && !V ? /* @__PURE__ */ i("div", { style: { ...at, height: f }, children: /* @__PURE__ */ i(Nt, { size: "xsmall" }) }) : m > 0 && /* @__PURE__ */ C(
|
|
143
|
+
"svg",
|
|
144
|
+
{
|
|
145
|
+
ref: j,
|
|
146
|
+
width: m,
|
|
147
|
+
height: f,
|
|
148
|
+
"aria-hidden": !0,
|
|
149
|
+
style: {
|
|
150
|
+
display: "block",
|
|
151
|
+
cursor: y ? "crosshair" : void 0,
|
|
152
|
+
touchAction: y ? "none" : void 0,
|
|
153
|
+
userSelect: "none"
|
|
154
|
+
},
|
|
155
|
+
onPointerDown: bt,
|
|
156
|
+
onPointerMove: yt,
|
|
157
|
+
onPointerUp: vt,
|
|
158
|
+
onPointerCancel: () => I(null),
|
|
159
|
+
onPointerLeave: () => !r && u(-1),
|
|
160
|
+
children: [
|
|
161
|
+
Mt.map((t) => {
|
|
162
|
+
const { left: e, width: o } = Z(t);
|
|
163
|
+
return /* @__PURE__ */ i(
|
|
164
|
+
"rect",
|
|
165
|
+
{
|
|
166
|
+
"data-band": r ? "selection" : "hover",
|
|
167
|
+
x: e,
|
|
168
|
+
y: 0,
|
|
169
|
+
width: o,
|
|
170
|
+
height: A,
|
|
171
|
+
rx: 4,
|
|
172
|
+
fill: r ? "var(--malachite-accent-background-glass, rgba(0, 175, 102, 0.08))" : "var(--malachite-card-border, rgb(232, 232, 232))"
|
|
173
|
+
},
|
|
174
|
+
`band-${t}`
|
|
175
|
+
);
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ i(
|
|
178
|
+
Et,
|
|
179
|
+
{
|
|
180
|
+
yTicks: R,
|
|
181
|
+
yOf: pt,
|
|
182
|
+
xTicks: gt,
|
|
183
|
+
xOf: g,
|
|
184
|
+
plotLeft: s,
|
|
185
|
+
plotRight: l,
|
|
186
|
+
labelY: f - 6
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ i(
|
|
190
|
+
St,
|
|
191
|
+
{
|
|
192
|
+
series: c,
|
|
193
|
+
slots: n,
|
|
194
|
+
values: O,
|
|
195
|
+
totals: M,
|
|
196
|
+
xOf: g,
|
|
197
|
+
plotBottom: A,
|
|
198
|
+
plotTop: _,
|
|
199
|
+
yMax: K
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
tt && /* @__PURE__ */ i(
|
|
206
|
+
_t,
|
|
207
|
+
{
|
|
208
|
+
id: Y,
|
|
209
|
+
band: tt,
|
|
210
|
+
containerWidth: m,
|
|
211
|
+
top: _,
|
|
212
|
+
heading: Ht(n[d].start, h.unit),
|
|
213
|
+
total: M[d],
|
|
214
|
+
valueLabel: G,
|
|
215
|
+
series: c,
|
|
216
|
+
values: O[d]
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
/* @__PURE__ */ i(
|
|
223
|
+
Rt,
|
|
224
|
+
{
|
|
225
|
+
caption: W,
|
|
226
|
+
labelledBy: L,
|
|
227
|
+
series: c,
|
|
228
|
+
slots: n,
|
|
229
|
+
values: O,
|
|
230
|
+
totals: M,
|
|
231
|
+
unit: h.unit,
|
|
232
|
+
valueLabel: G
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
] });
|
|
236
|
+
};
|
|
237
|
+
export {
|
|
238
|
+
re as TimeBarChart,
|
|
239
|
+
re as default
|
|
240
|
+
};
|
|
241
|
+
//# sourceMappingURL=TimeBarChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeBarChart.js","sources":["../../../src/components/TimeBarChart/TimeBarChart.tsx"],"sourcesContent":["import React, { useId, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport Spinner from '../Spinner';\nimport { FOCUS_RING } from '../focusRing';\nimport TimeBarChartAxes from './TimeBarChartAxes';\nimport TimeBarChartBars from './TimeBarChartBars';\nimport TimeBarChartLegend from './TimeBarChartLegend';\nimport TimeBarChartTable from './TimeBarChartTable';\nimport TimeBarChartTooltip from './TimeBarChartTooltip';\nimport {\n type TimeBarChartInterval,\n type TimeInput,\n axisTicks,\n bucketSlots,\n formatBucket,\n slotIndexOf,\n toInstant,\n valueTicks,\n} from './timeBuckets';\n\nexport type TimeBarChartTone = 'success' | 'error' | 'neutral';\nexport type TimeBarChartSize = 'small' | 'medium' | 'large';\n\nexport interface TimeBarChartSeries {\n key: string;\n label: string;\n tone: TimeBarChartTone;\n}\n\nexport interface TimeBarChartBucket {\n /** The bucket's start. A string with no zone is read as UTC. */\n start: TimeInput;\n /** Each series' count in this bucket, by series key. A missing key counts as 0. */\n values: Record<string, number>;\n}\n\nexport interface TimeBarChartRangeSelection {\n /** UTC ISO start of the first selected bucket. */\n start: string;\n /** UTC ISO end of the last selected bucket, exclusive: the start of the bucket after it. */\n end: string;\n /** Whether the selection takes in the last bucket, i.e. \"up to now\" on a live window. */\n reachesEnd: boolean;\n}\n\nexport interface TimeBarChartProps {\n /** Stacked by tone, failures on top (`neutral`, `success`, `error`), and in the order given\n * within a tone. The legend, tooltip and table keep the order given. */\n series: TimeBarChartSeries[];\n /** Only the buckets that have values; empty buckets in `range` are laid out regardless. */\n buckets: TimeBarChartBucket[];\n interval: TimeBarChartInterval;\n /** The window the axis covers, `end` exclusive as `onRangeSelect` reports it, so a selection\n * fed back in shows exactly the buckets selected. Without it the axis spans the buckets\n * given. At most 2,000 buckets are laid out; past that the newest are kept, so a live window\n * still ends at now. */\n range?: { start: TimeInput; end: TimeInput };\n /** The plot's height, axis labels included: 120, 160 or 240px. */\n size?: TimeBarChartSize;\n /** With buckets already drawn, they stay and dim while new ones load. */\n loading?: boolean;\n error?: boolean;\n errorTitle?: string;\n errorSubTitle?: string;\n /** What the stacked total counts, shown in the tooltip, e.g. \"Requests\". */\n valueLabel?: string;\n /** A legend naming each series. Leave it off only where the page labels the series itself. */\n legend?: boolean;\n /** A time whose bucket is shaded behind the bars, e.g. the row under the pointer in a list. */\n highlightTime?: TimeInput;\n /** Turns on click-and-drag selection of whole buckets. */\n onRangeSelect?: (selection: TimeBarChartRangeSelection) => void;\n /** Names the chart. Pass this or `aria-labelledby`; the hidden table takes it as its caption. */\n 'aria-label'?: string;\n /** Names the chart from a visible heading instead, and the hidden table with it. */\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst SIZE_HEIGHT: Record<TimeBarChartSize, number> = { small: 120, medium: 160, large: 240 };\n\nconst Y_GUTTER = 36;\nconst X_BAND = 22;\nconst TOP_PAD = 8;\nconst RIGHT_PAD = 4;\n/** A bucket's shading covers this much of its slot, so neighbours in a selection stay apart. */\nconst BAND_FILL = 0.8;\nconst MIN_DRAG_PX = 5;\n\nconst centredStyle: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n textAlign: 'center',\n};\n\nconst TimeBarChart: React.FC<TimeBarChartProps> = ({\n series,\n buckets,\n interval,\n range,\n size = 'medium',\n loading = false,\n error = false,\n errorTitle = 'No chart data to display',\n errorSubTitle = 'An error occurred while fetching the chart data.',\n valueLabel = 'Total',\n legend = true,\n highlightTime,\n onRangeSelect,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}) => {\n // State, not a ref: the error state unmounts the container, and the observer has to follow\n // whichever one is mounted.\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const svgRef = useRef<SVGSVGElement>(null);\n const [width, setWidth] = useState(0);\n const [activeIndex, setActiveIndex] = useState(-1);\n const [drag, setDrag] = useState<{ from: number; to: number } | null>(null);\n const tooltipId = useId();\n const height = SIZE_HEIGHT[size];\n\n useLayoutEffect(() => {\n if (!container || typeof ResizeObserver === 'undefined') return;\n // The first callback carries the initial width, so the mount path reads no layout.\n const observer = new ResizeObserver(([entry]) => setWidth(entry.contentRect.width));\n observer.observe(container);\n return () => observer.disconnect();\n }, [container]);\n\n const model = useMemo(() => {\n const starts = buckets.map((bucket) => toInstant(bucket.start));\n const from = range ? toInstant(range.start) : Math.min(...starts);\n const to = range ? toInstant(range.end) - 1 : Math.max(...starts);\n const slots =\n Number.isFinite(from) && Number.isFinite(to) ? bucketSlots(from, to, interval) : [];\n const values = slots.map(() => series.map(() => 0));\n buckets.forEach((bucket, index) => {\n const slot = slotIndexOf(slots, starts[index]);\n if (slot < 0) return;\n series.forEach((entry, position) => {\n const count = bucket.values[entry.key];\n if (Number.isFinite(count)) values[slot][position] += count;\n });\n });\n const totals = values.map((row) => row.reduce((sum, value) => sum + value, 0));\n return { slots, values, totals, yTicks: valueTicks(Math.max(0, ...totals)) };\n }, [buckets, interval, range, series]);\n\n const { slots, values, totals, yTicks } = model;\n const plotLeft = Y_GUTTER;\n const plotRight = Math.max(plotLeft + 1, width - RIGHT_PAD);\n const plotTop = TOP_PAD;\n const plotBottom = height - X_BAND;\n const plotHeight = plotBottom - plotTop;\n const domainStart = slots[0]?.start ?? 0;\n const domainEnd = slots[slots.length - 1]?.end ?? 1;\n const yMax = yTicks[yTicks.length - 1] || 1;\n\n const xOf = (instant: number) =>\n plotLeft + ((instant - domainStart) / (domainEnd - domainStart)) * (plotRight - plotLeft);\n const yOf = (value: number) => plotBottom - (value / yMax) * plotHeight;\n const band = (index: number) => {\n const left = xOf(slots[index].start);\n const slotWidth = xOf(slots[index].end) - left;\n const shaded = slotWidth * BAND_FILL;\n return { left: left + (slotWidth - shaded) / 2, width: shaded };\n };\n\n const ticks = useMemo(\n () =>\n slots.length && width\n ? axisTicks(domainStart, domainEnd, interval.unit, plotRight - plotLeft)\n : [],\n [slots.length, width, domainStart, domainEnd, interval.unit, plotRight, plotLeft],\n );\n\n const highlightIndex =\n highlightTime === undefined ? -1 : slotIndexOf(slots, toInstant(highlightTime));\n\n const pixelAt = (clientX: number) => {\n const rect = svgRef.current?.getBoundingClientRect();\n return rect ? clientX - rect.left : -1;\n };\n const slotAtPixel = (pixel: number) =>\n pixel < plotLeft || pixel > plotRight\n ? -1\n : slotIndexOf(\n slots,\n domainStart +\n ((pixel - plotLeft) / (plotRight - plotLeft)) * (domainEnd - domainStart),\n );\n const draggedSlots = (from: number, to: number) => {\n const left = Math.min(from, to);\n const right = Math.max(from, to);\n return slots.flatMap((slot, index) =>\n xOf(slot.start) < right && xOf(slot.end) > left ? [index] : [],\n );\n };\n\n const onPointerDown = (event: React.PointerEvent<SVGSVGElement>) => {\n const pixel = pixelAt(event.clientX);\n if (!onRangeSelect || event.button !== 0 || slotAtPixel(pixel) < 0) return;\n event.preventDefault();\n event.currentTarget.setPointerCapture?.(event.pointerId);\n setActiveIndex(-1);\n setDrag({ from: pixel, to: pixel });\n };\n const onPointerMove = (event: React.PointerEvent<SVGSVGElement>) => {\n const pixel = pixelAt(event.clientX);\n if (drag) {\n setDrag({ ...drag, to: Math.min(Math.max(pixel, plotLeft), plotRight) });\n return;\n }\n setActiveIndex(slotAtPixel(pixel));\n };\n const onPointerUp = () => {\n if (!drag) return;\n setDrag(null);\n const selected = draggedSlots(drag.from, drag.to);\n if (Math.abs(drag.to - drag.from) < MIN_DRAG_PX || !selected.length || !onRangeSelect) {\n return;\n }\n onRangeSelect({\n start: new Date(slots[selected[0]].start).toISOString(),\n end: new Date(slots[selected[selected.length - 1]].end).toISOString(),\n reachesEnd: selected[selected.length - 1] === slots.length - 1,\n });\n };\n\n // Slots can shrink under a held index, on a refetch with a coarser interval or a narrower range.\n const current = activeIndex < slots.length ? activeIndex : -1;\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const last = slots.length - 1;\n const moves: Record<string, number> = {\n ArrowLeft: Math.max(0, current - 1),\n ArrowRight: Math.min(last, current + 1),\n Home: 0,\n End: last,\n };\n if (event.key === 'Escape') {\n setActiveIndex(-1);\n return;\n }\n if (event.key in moves && last >= 0) {\n event.preventDefault();\n setActiveIndex(current < 0 && event.key.startsWith('Arrow') ? last : moves[event.key]);\n }\n };\n\n const hasData = totals.some((total) => total > 0) || buckets.length > 0;\n const legendRow = legend && series.length > 1 ? <TimeBarChartLegend series={series} /> : null;\n\n if (error) {\n return (\n <div\n className={`w-full ${className}`}\n style={{ ...centredStyle, height, ...style }}\n role=\"alert\"\n >\n <span className=\"font-medium text-[length:var(--malachite-font-size-small,13px)] text-[var(--malachite-text-primary,rgb(10,10,10))]\">\n {errorTitle}\n </span>\n <span className=\"text-[length:var(--malachite-font-size-xsmall,11px)] text-[var(--malachite-text-secondary,rgb(123,123,123))]\">\n {errorSubTitle}\n </span>\n </div>\n );\n }\n\n const active = current >= 0 && !drag ? current : -1;\n const activeBand = active >= 0 ? band(active) : undefined;\n const selection = drag ? draggedSlots(drag.from, drag.to) : [];\n const shaded = drag\n ? selection\n : [...new Set([highlightIndex, active])].filter((index) => index >= 0);\n\n return (\n <div className={`w-full ${className}`} style={style}>\n {legendRow}\n <div\n ref={setContainer}\n role=\"group\"\n aria-roledescription=\"chart\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={active >= 0 ? tooltipId : undefined}\n aria-busy={loading || undefined}\n tabIndex={slots.length ? 0 : -1}\n onKeyDown={onKeyDown}\n onBlur={() => setActiveIndex(-1)}\n className={`relative rounded-lg ${FOCUS_RING}`}\n style={{\n height,\n opacity: loading && hasData ? 0.5 : 1,\n transition: 'opacity 150ms ease',\n }}\n >\n {loading && !hasData ? (\n <div style={{ ...centredStyle, height }}>\n <Spinner size=\"xsmall\" />\n </div>\n ) : (\n width > 0 && (\n <svg\n ref={svgRef}\n width={width}\n height={height}\n aria-hidden\n style={{\n display: 'block',\n cursor: onRangeSelect ? 'crosshair' : undefined,\n touchAction: onRangeSelect ? 'none' : undefined,\n userSelect: 'none',\n }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={() => setDrag(null)}\n onPointerLeave={() => !drag && setActiveIndex(-1)}\n >\n {shaded.map((index) => {\n const { left, width: bandWidth } = band(index);\n return (\n <rect\n key={`band-${index}`}\n data-band={drag ? 'selection' : 'hover'}\n x={left}\n y={0}\n width={bandWidth}\n height={plotBottom}\n rx={4}\n fill={\n drag\n ? 'var(--malachite-accent-background-glass, rgba(0, 175, 102, 0.08))'\n : 'var(--malachite-card-border, rgb(232, 232, 232))'\n }\n />\n );\n })}\n <TimeBarChartAxes\n yTicks={yTicks}\n yOf={yOf}\n xTicks={ticks}\n xOf={xOf}\n plotLeft={plotLeft}\n plotRight={plotRight}\n labelY={height - 6}\n />\n <TimeBarChartBars\n series={series}\n slots={slots}\n values={values}\n totals={totals}\n xOf={xOf}\n plotBottom={plotBottom}\n plotTop={plotTop}\n yMax={yMax}\n />\n </svg>\n )\n )}\n {activeBand && (\n <TimeBarChartTooltip\n id={tooltipId}\n band={activeBand}\n containerWidth={width}\n top={plotTop}\n heading={formatBucket(slots[active].start, interval.unit)}\n total={totals[active]}\n valueLabel={valueLabel}\n series={series}\n values={values[active]}\n />\n )}\n </div>\n <TimeBarChartTable\n caption={ariaLabel}\n labelledBy={ariaLabelledBy}\n series={series}\n slots={slots}\n values={values}\n totals={totals}\n unit={interval.unit}\n valueLabel={valueLabel}\n />\n </div>\n );\n};\n\nexport default TimeBarChart;\nexport { TimeBarChart };\n"],"names":["SIZE_HEIGHT","Y_GUTTER","X_BAND","TOP_PAD","RIGHT_PAD","BAND_FILL","MIN_DRAG_PX","centredStyle","TimeBarChart","series","buckets","interval","range","size","loading","error","errorTitle","errorSubTitle","valueLabel","legend","highlightTime","onRangeSelect","ariaLabel","ariaLabelledBy","className","style","container","setContainer","useState","svgRef","useRef","width","setWidth","activeIndex","setActiveIndex","drag","setDrag","tooltipId","useId","height","useLayoutEffect","observer","entry","model","useMemo","starts","bucket","toInstant","from","to","slots","bucketSlots","values","index","slot","slotIndexOf","position","count","totals","row","sum","value","valueTicks","yTicks","plotLeft","plotRight","plotTop","plotBottom","plotHeight","domainStart","_a","domainEnd","_b","yMax","xOf","instant","yOf","band","left","slotWidth","shaded","ticks","axisTicks","highlightIndex","pixelAt","clientX","rect","slotAtPixel","pixel","draggedSlots","right","onPointerDown","event","onPointerMove","onPointerUp","selected","current","onKeyDown","last","moves","hasData","total","legendRow","jsx","TimeBarChartLegend","jsxs","active","activeBand","selection","FOCUS_RING","Spinner","bandWidth","TimeBarChartAxes","TimeBarChartBars","TimeBarChartTooltip","formatBucket","TimeBarChartTable"],"mappings":";;;;;;;;;;AA+EA,MAAMA,KAAgD,EAAE,OAAO,KAAK,QAAQ,KAAK,OAAO,IAAA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;AAAA,IAAA;AAAA,IAGR,gBAAAH;AAAA,MAACa;AAAA,MAAA;AAAA,QACG,SAAS9F;AAAA,QACT,YAAYC;AAAA,QACZ,QAAAd;AAAA,QACA,OAAAyC;AAAA,QACA,QAAAE;AAAA,QACA,QAAAM;AAAA,QACA,MAAM/C,EAAS;AAAA,QACf,YAAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EACJ,GACJ;AAER;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs as d, Fragment as b, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { formatCompact as y } from "./timeBuckets.js";
|
|
3
|
+
const o = {
|
|
4
|
+
fontSize: 11,
|
|
5
|
+
fill: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
6
|
+
fontVariantNumeric: "tabular-nums"
|
|
7
|
+
}, l = 24, p = ({
|
|
8
|
+
yTicks: m,
|
|
9
|
+
yOf: r,
|
|
10
|
+
xTicks: i,
|
|
11
|
+
xOf: x,
|
|
12
|
+
plotLeft: a,
|
|
13
|
+
plotRight: s,
|
|
14
|
+
labelY: c
|
|
15
|
+
}) => /* @__PURE__ */ d(b, { children: [
|
|
16
|
+
m.map((e) => /* @__PURE__ */ d("g", { children: [
|
|
17
|
+
/* @__PURE__ */ n(
|
|
18
|
+
"line",
|
|
19
|
+
{
|
|
20
|
+
x1: a,
|
|
21
|
+
x2: s,
|
|
22
|
+
y1: r(e),
|
|
23
|
+
y2: r(e),
|
|
24
|
+
stroke: e === 0 ? "var(--malachite-card-border, rgb(232, 232, 232))" : "var(--malachite-card-subtle-divider, rgb(241, 241, 241))",
|
|
25
|
+
strokeWidth: 1,
|
|
26
|
+
shapeRendering: "crispEdges"
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ n(
|
|
30
|
+
"text",
|
|
31
|
+
{
|
|
32
|
+
x: a - 6,
|
|
33
|
+
y: r(e),
|
|
34
|
+
textAnchor: "end",
|
|
35
|
+
dominantBaseline: "middle",
|
|
36
|
+
style: o,
|
|
37
|
+
children: y(e)
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] }, `y-${e}`)),
|
|
41
|
+
i.map((e) => {
|
|
42
|
+
const t = x(e.at), h = t < a + l ? "start" : t > s - l ? "end" : "middle";
|
|
43
|
+
return /* @__PURE__ */ n("text", { x: t, y: c, textAnchor: h, style: o, children: e.label }, `x-${e.at}`);
|
|
44
|
+
})
|
|
45
|
+
] });
|
|
46
|
+
export {
|
|
47
|
+
p as default
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=TimeBarChartAxes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeBarChartAxes.js","sources":["../../../src/components/TimeBarChart/TimeBarChartAxes.tsx"],"sourcesContent":["import type React from 'react';\nimport { type AxisTick, formatCompact } from './timeBuckets';\n\nconst textStyle: React.CSSProperties = {\n fontSize: 11,\n fill: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n fontVariantNumeric: 'tabular-nums',\n};\n\n/** Labels this close to an end of the plot anchor to that end rather than overflow it. */\nconst EDGE_ANCHOR_PX = 24;\n\ninterface TimeBarChartAxesProps {\n yTicks: number[];\n yOf: (value: number) => number;\n xTicks: AxisTick[];\n xOf: (instant: number) => number;\n plotLeft: number;\n plotRight: number;\n /** Where the time labels' baseline sits. */\n labelY: number;\n}\n\n/** The value gridlines with their labels, and the time labels under the plot. */\nconst TimeBarChartAxes: React.FC<TimeBarChartAxesProps> = ({\n yTicks,\n yOf,\n xTicks,\n xOf,\n plotLeft,\n plotRight,\n labelY,\n}) => (\n <>\n {yTicks.map((tick) => (\n <g key={`y-${tick}`}>\n <line\n x1={plotLeft}\n x2={plotRight}\n y1={yOf(tick)}\n y2={yOf(tick)}\n stroke={\n tick === 0\n ? 'var(--malachite-card-border, rgb(232, 232, 232))'\n : 'var(--malachite-card-subtle-divider, rgb(241, 241, 241))'\n }\n strokeWidth={1}\n shapeRendering=\"crispEdges\"\n />\n <text\n x={plotLeft - 6}\n y={yOf(tick)}\n textAnchor=\"end\"\n dominantBaseline=\"middle\"\n style={textStyle}\n >\n {formatCompact(tick)}\n </text>\n </g>\n ))}\n {xTicks.map((tick) => {\n const x = xOf(tick.at);\n const anchor =\n x < plotLeft + EDGE_ANCHOR_PX\n ? 'start'\n : x > plotRight - EDGE_ANCHOR_PX\n ? 'end'\n : 'middle';\n return (\n <text key={`x-${tick.at}`} x={x} y={labelY} textAnchor={anchor} style={textStyle}>\n {tick.label}\n </text>\n );\n })}\n </>\n);\n\nexport default TimeBarChartAxes;\n"],"names":["textStyle","EDGE_ANCHOR_PX","TimeBarChartAxes","yTicks","yOf","xTicks","xOf","plotLeft","plotRight","labelY","jsxs","Fragment","tick","jsx","x","anchor"],"mappings":";;AAGA,MAAMA,IAAiC;AAAA,EACnC,UAAU;AAAA,EACV,MAAM;AAAA,EACN,oBAAoB;AACxB,GAGMC,IAAiB,IAcjBC,IAAoD,CAAC;AAAA,EACvD,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AACJ,MACI,gBAAAC,EAAAC,GAAA,EACK,UAAA;AAAA,EAAAR,EAAO,IAAI,CAACS,MACT,gBAAAF,EAAC,KAAA,EACG,UAAA;AAAA,IAAA,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,IAAIN;AAAA,QACJ,IAAIC;AAAA,QACJ,IAAIJ,EAAIQ,CAAI;AAAA,QACZ,IAAIR,EAAIQ,CAAI;AAAA,QACZ,QACIA,MAAS,IACH,qDACA;AAAA,QAEV,aAAa;AAAA,QACb,gBAAe;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnB,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,GAAGN,IAAW;AAAA,QACd,GAAGH,EAAIQ,CAAI;AAAA,QACX,YAAW;AAAA,QACX,kBAAiB;AAAA,QACjB,OAAOZ;AAAA,QAEN,YAAcY,CAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EACvB,EAAA,GAtBI,KAAKA,CAAI,EAuBjB,CACH;AAAA,EACAP,EAAO,IAAI,CAACO,MAAS;AAClB,UAAME,IAAIR,EAAIM,EAAK,EAAE,GACfG,IACFD,IAAIP,IAAWN,IACT,UACAa,IAAIN,IAAYP,IACd,QACA;AACZ,WACI,gBAAAY,EAAC,QAAA,EAA0B,GAAAC,GAAM,GAAGL,GAAQ,YAAYM,GAAQ,OAAOf,GAClE,UAAAY,EAAK,MAAA,GADC,KAAKA,EAAK,EAAE,EAEvB;AAAA,EAER,CAAC;AAAA,EAAA,CACL;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { layoutStack as h } from "./stackLayout.js";
|
|
3
|
+
import { TONE_STACK as p, TONE_FILL as I } from "./tones.js";
|
|
4
|
+
const S = 24, b = 0.7, j = 4, C = (t, a, c, e) => {
|
|
5
|
+
const r = Math.min(j, c / 2, e);
|
|
6
|
+
return [
|
|
7
|
+
`M${t},${a + e}`,
|
|
8
|
+
`V${a + r}`,
|
|
9
|
+
`Q${t},${a} ${t + r},${a}`,
|
|
10
|
+
`H${t + c - r}`,
|
|
11
|
+
`Q${t + c},${a} ${t + c},${a + r}`,
|
|
12
|
+
`V${a + e}`,
|
|
13
|
+
"Z"
|
|
14
|
+
].join(" ");
|
|
15
|
+
}, O = ({
|
|
16
|
+
series: t,
|
|
17
|
+
slots: a,
|
|
18
|
+
values: c,
|
|
19
|
+
totals: e,
|
|
20
|
+
xOf: r,
|
|
21
|
+
plotTop: B,
|
|
22
|
+
plotBottom: M,
|
|
23
|
+
yMax: T
|
|
24
|
+
}) => {
|
|
25
|
+
const L = t.map((n, o) => o).sort((n, o) => p[t[n].tone] - p[t[o].tone]);
|
|
26
|
+
return a.map((n, o) => {
|
|
27
|
+
if (!e[o]) return null;
|
|
28
|
+
const d = r(n.start), s = r(n.end) - d, $ = Math.max(1, Math.min(S, s * b)), l = d + (s - $) / 2, k = h(L, c[o], { plotTop: B, plotBottom: M, yMax: T });
|
|
29
|
+
return /* @__PURE__ */ u("g", { "data-bucket": n.start, children: k.map(({ position: m, top: _, height: f }, R) => {
|
|
30
|
+
const A = I[t[m].tone];
|
|
31
|
+
return R === k.length - 1 ? /* @__PURE__ */ u(
|
|
32
|
+
"path",
|
|
33
|
+
{
|
|
34
|
+
"data-series": t[m].key,
|
|
35
|
+
"data-malachite-shape": !0,
|
|
36
|
+
d: C(l, _, $, f),
|
|
37
|
+
fill: A
|
|
38
|
+
},
|
|
39
|
+
t[m].key
|
|
40
|
+
) : /* @__PURE__ */ u(
|
|
41
|
+
"rect",
|
|
42
|
+
{
|
|
43
|
+
"data-series": t[m].key,
|
|
44
|
+
x: l,
|
|
45
|
+
y: _,
|
|
46
|
+
width: $,
|
|
47
|
+
height: f,
|
|
48
|
+
fill: A
|
|
49
|
+
},
|
|
50
|
+
t[m].key
|
|
51
|
+
);
|
|
52
|
+
}) }, n.start);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
O as default
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=TimeBarChartBars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeBarChartBars.js","sources":["../../../src/components/TimeBarChart/TimeBarChartBars.tsx"],"sourcesContent":["import type React from 'react';\nimport type { TimeBarChartSeries } from './TimeBarChart';\nimport { layoutStack } from './stackLayout';\nimport type { TimeSlot } from './timeBuckets';\nimport { TONE_FILL, TONE_STACK } from './tones';\n\n/** Bars stay thin however wide their slot, and fill this much of a narrow one. */\nconst MAX_BAR_PX = 24;\nconst BAR_FILL = 0.7;\nconst BAR_RADIUS = 4;\n\nconst roundedTop = (x: number, y: number, width: number, height: number) => {\n const radius = Math.min(BAR_RADIUS, width / 2, height);\n return [\n `M${x},${y + height}`,\n `V${y + radius}`,\n `Q${x},${y} ${x + radius},${y}`,\n `H${x + width - radius}`,\n `Q${x + width},${y} ${x + width},${y + radius}`,\n `V${y + height}`,\n 'Z',\n ].join(' ');\n};\n\ninterface TimeBarChartBarsProps {\n series: TimeBarChartSeries[];\n slots: TimeSlot[];\n values: number[][];\n totals: number[];\n xOf: (instant: number) => number;\n plotTop: number;\n plotBottom: number;\n yMax: number;\n}\n\n/** One stack per non-empty bucket, its top segment rounded. */\nconst TimeBarChartBars: React.FC<TimeBarChartBarsProps> = ({\n series,\n slots,\n values,\n totals,\n xOf,\n plotTop,\n plotBottom,\n yMax,\n}) => {\n // Stable, so series sharing a tone keep the order they were given in.\n const stackOrder = series\n .map((_entry, position) => position)\n .sort((left, right) => TONE_STACK[series[left].tone] - TONE_STACK[series[right].tone]);\n return slots.map((slot, index) => {\n if (!totals[index]) return null;\n const left = xOf(slot.start);\n const slotWidth = xOf(slot.end) - left;\n const barWidth = Math.max(1, Math.min(MAX_BAR_PX, slotWidth * BAR_FILL));\n const x = left + (slotWidth - barWidth) / 2;\n const segments = layoutStack(stackOrder, values[index], { plotTop, plotBottom, yMax });\n return (\n <g key={slot.start} data-bucket={slot.start}>\n {segments.map(({ position, top, height }, place) => {\n const fill = TONE_FILL[series[position].tone];\n return place === segments.length - 1 ? (\n <path\n key={series[position].key}\n data-series={series[position].key}\n data-malachite-shape\n d={roundedTop(x, top, barWidth, height)}\n fill={fill}\n />\n ) : (\n <rect\n key={series[position].key}\n data-series={series[position].key}\n x={x}\n y={top}\n width={barWidth}\n height={height}\n fill={fill}\n />\n );\n })}\n </g>\n );\n });\n};\n\nexport default TimeBarChartBars;\n"],"names":["MAX_BAR_PX","BAR_FILL","BAR_RADIUS","roundedTop","x","y","width","height","radius","TimeBarChartBars","series","slots","values","totals","xOf","plotTop","plotBottom","yMax","stackOrder","_entry","position","left","right","TONE_STACK","slot","index","slotWidth","barWidth","segments","layoutStack","jsx","top","place","fill","TONE_FILL"],"mappings":";;;AAOA,MA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AACrF,WACI,gBAAAa,EAAC,KAAA,EAAmB,eAAaN,EAAK,OACjC,UAAAI,EAAS,IAAI,CAAC,EAAE,UAAAR,GAAU,KAAAW,GAAK,QAAAxB,EAAA,GAAUyB,MAAU;AAChD,YAAMC,IAAOC,EAAUxB,EAAOU,CAAQ,EAAE,IAAI;AAC5C,aAAOY,MAAUJ,EAAS,SAAS,IAC/B,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UAEG,eAAapB,EAAOU,CAAQ,EAAE;AAAA,UAC9B,wBAAoB;AAAA,UACpB,GAAGjB,EAAWC,GAAG2B,GAAKJ,GAAUpB,CAAM;AAAA,UACtC,MAAA0B;AAAA,QAAA;AAAA,QAJKvB,EAAOU,CAAQ,EAAE;AAAA,MAAA,IAO1B,gBAAAU;AAAA,QAAC;AAAA,QAAA;AAAA,UAEG,eAAapB,EAAOU,CAAQ,EAAE;AAAA,UAC9B,GAAAhB;AAAA,UACA,GAAG2B;AAAA,UACH,OAAOJ;AAAA,UACP,QAAApB;AAAA,UACA,MAAA0B;AAAA,QAAA;AAAA,QANKvB,EAAOU,CAAQ,EAAE;AAAA,MAAA;AAAA,IASlC,CAAC,EAAA,GAtBGI,EAAK,KAuBb;AAAA,EAER,CAAC;AACL;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as a, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { TONE_FILL as l } from "./tones.js";
|
|
3
|
+
const n = ({ series: t }) => /* @__PURE__ */ a("div", { style: { display: "flex", gap: 16, marginBottom: 8 }, children: t.map((e) => /* @__PURE__ */ i(
|
|
4
|
+
"span",
|
|
5
|
+
{
|
|
6
|
+
className: "text-[length:var(--malachite-font-size-xsmall,11px)] text-[var(--malachite-text-secondary,rgb(123,123,123))]",
|
|
7
|
+
style: { display: "inline-flex", alignItems: "center", gap: 6 },
|
|
8
|
+
children: [
|
|
9
|
+
/* @__PURE__ */ a(
|
|
10
|
+
"span",
|
|
11
|
+
{
|
|
12
|
+
"aria-hidden": !0,
|
|
13
|
+
style: {
|
|
14
|
+
width: 8,
|
|
15
|
+
height: 8,
|
|
16
|
+
borderRadius: 2,
|
|
17
|
+
background: l[e.tone]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
e.label
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
e.key
|
|
25
|
+
)) });
|
|
26
|
+
export {
|
|
27
|
+
n as default
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=TimeBarChartLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeBarChartLegend.js","sources":["../../../src/components/TimeBarChart/TimeBarChartLegend.tsx"],"sourcesContent":["import type React from 'react';\nimport type { TimeBarChartSeries } from './TimeBarChart';\nimport { TONE_FILL } from './tones';\n\nconst TimeBarChartLegend: React.FC<{ series: TimeBarChartSeries[] }> = ({ series }) => (\n <div style={{ display: 'flex', gap: 16, marginBottom: 8 }}>\n {series.map((entry) => (\n <span\n key={entry.key}\n className=\"text-[length:var(--malachite-font-size-xsmall,11px)] text-[var(--malachite-text-secondary,rgb(123,123,123))]\"\n style={{ display: 'inline-flex', alignItems: 'center', gap: 6 }}\n >\n <span\n aria-hidden\n style={{\n width: 8,\n height: 8,\n borderRadius: 2,\n background: TONE_FILL[entry.tone],\n }}\n />\n {entry.label}\n </span>\n ))}\n </div>\n);\n\nexport default TimeBarChartLegend;\n"],"names":["TimeBarChartLegend","series","jsx","entry","jsxs","TONE_FILL"],"mappings":";;AAIA,MAAMA,IAAiE,CAAC,EAAE,QAAAC,QACtE,gBAAAC,EAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,KAAK,IAAI,cAAc,EAAA,GACjD,UAAAD,EAAO,IAAI,CAACE,MACT,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IAEG,WAAU;AAAA,IACV,OAAO,EAAE,SAAS,eAAe,YAAY,UAAU,KAAK,EAAA;AAAA,IAE5D,UAAA;AAAA,MAAA,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,eAAW;AAAA,UACX,OAAO;AAAA,YACH,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,YAAYG,EAAUF,EAAM,IAAI;AAAA,UAAA;AAAA,QACpC;AAAA,MAAA;AAAA,MAEHA,EAAM;AAAA,IAAA;AAAA,EAAA;AAAA,EAbFA,EAAM;AAcf,CACH,EAAA,CACL;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { formatBucket as f, formatCount as a } from "./timeBuckets.js";
|
|
3
|
+
const k = ({
|
|
4
|
+
caption: l,
|
|
5
|
+
labelledBy: o,
|
|
6
|
+
series: d,
|
|
7
|
+
slots: i,
|
|
8
|
+
values: n,
|
|
9
|
+
totals: h,
|
|
10
|
+
unit: m,
|
|
11
|
+
valueLabel: s
|
|
12
|
+
}) => (
|
|
13
|
+
// On a wrapper: a table ignores sr-only's 1px box and would still take its full height.
|
|
14
|
+
/* @__PURE__ */ r("div", { className: "sr-only", children: /* @__PURE__ */ t("table", { "aria-labelledby": l ? void 0 : o, children: [
|
|
15
|
+
l && /* @__PURE__ */ r("caption", { children: l }),
|
|
16
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
17
|
+
/* @__PURE__ */ r("th", { scope: "col", children: "Time" }),
|
|
18
|
+
d.map((e) => /* @__PURE__ */ r("th", { scope: "col", children: e.label }, e.key)),
|
|
19
|
+
/* @__PURE__ */ r("th", { scope: "col", children: s })
|
|
20
|
+
] }) }),
|
|
21
|
+
/* @__PURE__ */ r("tbody", { children: i.map(
|
|
22
|
+
(e, c) => h[c] ? /* @__PURE__ */ t("tr", { children: [
|
|
23
|
+
/* @__PURE__ */ r("th", { scope: "row", children: f(e.start, m) }),
|
|
24
|
+
n[c].map((p, b) => /* @__PURE__ */ r("td", { children: a(p) }, d[b].key)),
|
|
25
|
+
/* @__PURE__ */ r("td", { children: a(h[c]) })
|
|
26
|
+
] }, e.start) : null
|
|
27
|
+
) })
|
|
28
|
+
] }) })
|
|
29
|
+
);
|
|
30
|
+
export {
|
|
31
|
+
k as default
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=TimeBarChartTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeBarChartTable.js","sources":["../../../src/components/TimeBarChart/TimeBarChartTable.tsx"],"sourcesContent":["import type React from 'react';\nimport type { TimeBarChartSeries } from './TimeBarChart';\nimport { type TimeBarChartUnit, type TimeSlot, formatBucket, formatCount } from './timeBuckets';\n\ninterface TimeBarChartTableProps {\n caption?: string;\n /** Names the table when there is no caption, from the element naming the chart. */\n labelledBy?: string;\n series: TimeBarChartSeries[];\n slots: TimeSlot[];\n values: number[][];\n totals: number[];\n unit: TimeBarChartUnit;\n valueLabel: string;\n}\n\n/** The chart's numbers for screen readers, one row per non-empty bucket. */\nconst TimeBarChartTable: React.FC<TimeBarChartTableProps> = ({\n caption,\n labelledBy,\n series,\n slots,\n values,\n totals,\n unit,\n valueLabel,\n}) => (\n // On a wrapper: a table ignores sr-only's 1px box and would still take its full height.\n <div className=\"sr-only\">\n <table aria-labelledby={caption ? undefined : labelledBy}>\n {caption && <caption>{caption}</caption>}\n <thead>\n <tr>\n <th scope=\"col\">Time</th>\n {series.map((entry) => (\n <th key={entry.key} scope=\"col\">\n {entry.label}\n </th>\n ))}\n <th scope=\"col\">{valueLabel}</th>\n </tr>\n </thead>\n <tbody>\n {slots.map((slot, index) =>\n totals[index] ? (\n <tr key={slot.start}>\n <th scope=\"row\">{formatBucket(slot.start, unit)}</th>\n {values[index].map((value, position) => (\n <td key={series[position].key}>{formatCount(value)}</td>\n ))}\n <td>{formatCount(totals[index])}</td>\n </tr>\n ) : null,\n )}\n </tbody>\n </table>\n </div>\n);\n\nexport default TimeBarChartTable;\n"],"names":["TimeBarChartTable","caption","labelledBy","series","slots","values","totals","unit","valueLabel","jsx","jsxs","entry","slot","index","value","position","formatCount"],"mappings":";;AAiBA,MAAMA,IAAsD,CAAC;AAAA,EACzD,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,YAAAC;AACJ;AAAA;AAAA,EAEI,gBAAAC,EAAC,SAAI,WAAU,WACX,4BAAC,SAAA,EAAM,mBAAiBR,IAAU,SAAYC,GACzC,UAAA;AAAA,IAAAD,KAAW,gBAAAQ,EAAC,aAAS,UAAAR,EAAA,CAAQ;AAAA,IAC9B,gBAAAQ,EAAC,SAAA,EACG,UAAA,gBAAAC,EAAC,MAAA,EACG,UAAA;AAAA,MAAA,gBAAAD,EAAC,MAAA,EAAG,OAAM,OAAM,UAAA,QAAI;AAAA,MACnBN,EAAO,IAAI,CAACQ,MACT,gBAAAF,EAAC,MAAA,EAAmB,OAAM,OACrB,UAAAE,EAAM,MAAA,GADFA,EAAM,GAEf,CACH;AAAA,MACD,gBAAAF,EAAC,MAAA,EAAG,OAAM,OAAO,UAAAD,EAAA,CAAW;AAAA,IAAA,EAAA,CAChC,EAAA,CACJ;AAAA,IACA,gBAAAC,EAAC,WACI,UAAAL,EAAM;AAAA,MAAI,CAACQ,GAAMC,MACdP,EAAOO,CAAK,sBACP,MAAA,EACG,UAAA;AAAA,QAAA,gBAAAJ,EAAC,QAAG,OAAM,OAAO,YAAaG,EAAK,OAAOL,CAAI,GAAE;AAAA,QAC/CF,EAAOQ,CAAK,EAAE,IAAI,CAACC,GAAOC,MACvB,gBAAAN,EAAC,MAAA,EAA+B,UAAAO,EAAYF,CAAK,EAAA,GAAxCX,EAAOY,CAAQ,EAAE,GAAyB,CACtD;AAAA,0BACA,MAAA,EAAI,UAAAC,EAAYV,EAAOO,CAAK,CAAC,EAAA,CAAE;AAAA,MAAA,KAL3BD,EAAK,KAMd,IACA;AAAA,IAAA,EACR,CACJ;AAAA,EAAA,EAAA,CACJ,EAAA,CACJ;AAAA;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { formatCount as f } from "./timeBuckets.js";
|
|
3
|
+
import { TONE_FILL as v } from "./tones.js";
|
|
4
|
+
const m = 8, d = 168, p = { overflow: "hidden", textOverflow: "ellipsis" }, L = (t, e) => {
|
|
5
|
+
const o = t.left - m, r = t.left + t.width + m, i = e - r;
|
|
6
|
+
return o >= d ? { onLeft: !0, left: o, room: o } : i >= d ? { onLeft: !1, left: r, room: i } : { onLeft: !1, left: 0, room: e };
|
|
7
|
+
}, T = ({
|
|
8
|
+
id: t,
|
|
9
|
+
band: e,
|
|
10
|
+
containerWidth: o,
|
|
11
|
+
top: r,
|
|
12
|
+
heading: i,
|
|
13
|
+
total: c,
|
|
14
|
+
valueLabel: h,
|
|
15
|
+
series: g,
|
|
16
|
+
values: u
|
|
17
|
+
}) => {
|
|
18
|
+
const n = L(e, o);
|
|
19
|
+
return /* @__PURE__ */ s(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
id: t,
|
|
23
|
+
className: "pointer-events-none rounded-lg",
|
|
24
|
+
style: {
|
|
25
|
+
position: "absolute",
|
|
26
|
+
top: r,
|
|
27
|
+
left: n.left,
|
|
28
|
+
transform: n.onLeft ? "translateX(-100%)" : void 0,
|
|
29
|
+
minWidth: Math.min(d, n.room),
|
|
30
|
+
maxWidth: n.room,
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
padding: "10px 12px",
|
|
33
|
+
background: "var(--malachite-tooltip-background, rgb(59, 59, 59))",
|
|
34
|
+
color: "var(--malachite-tooltip-foreground, rgb(255, 255, 255))",
|
|
35
|
+
boxShadow: "var(--malachite-tooltip-shadow, 0px 0px 10px 0px rgba(0, 0, 0, 0.2))",
|
|
36
|
+
fontSize: 12,
|
|
37
|
+
zIndex: 1,
|
|
38
|
+
whiteSpace: "nowrap"
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 600, ...p }, children: i }),
|
|
42
|
+
/* @__PURE__ */ s("div", { style: { opacity: 0.7, marginBottom: 8 }, children: [
|
|
43
|
+
f(c),
|
|
44
|
+
" ",
|
|
45
|
+
h
|
|
46
|
+
] }),
|
|
47
|
+
g.map((l, x) => /* @__PURE__ */ s(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
style: { display: "flex", alignItems: "center", gap: 8, marginTop: 4 },
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ a(
|
|
53
|
+
"span",
|
|
54
|
+
{
|
|
55
|
+
"aria-hidden": !0,
|
|
56
|
+
style: {
|
|
57
|
+
width: 10,
|
|
58
|
+
height: 2,
|
|
59
|
+
borderRadius: 1,
|
|
60
|
+
background: v[l.tone]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ a("span", { style: { opacity: 0.7, flex: 1, minWidth: 0, ...p }, children: l.label }),
|
|
65
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600, fontVariantNumeric: "tabular-nums" }, children: f(u[x]) })
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
l.key
|
|
69
|
+
))
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
T as default
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=TimeBarChartTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeBarChartTooltip.js","sources":["../../../src/components/TimeBarChart/TimeBarChartTooltip.tsx"],"sourcesContent":["import type React from 'react';\nimport type { TimeBarChartSeries } from './TimeBarChart';\nimport { formatCount } from './timeBuckets';\nimport { TONE_FILL } from './tones';\n\nconst TOOLTIP_GAP = 8;\nconst TOOLTIP_MIN_WIDTH = 168;\n\n// A long label is cut short rather than pushing the tooltip past the chart's edge.\nconst CLIPPED: React.CSSProperties = { overflow: 'hidden', textOverflow: 'ellipsis' };\n\n/** Beside the band, left when there is room, else right, else across the chart from its left. */\nconst placeBeside = (band: { left: number; width: number }, containerWidth: number) => {\n const roomLeft = band.left - TOOLTIP_GAP;\n const rightStart = band.left + band.width + TOOLTIP_GAP;\n const roomRight = containerWidth - rightStart;\n if (roomLeft >= TOOLTIP_MIN_WIDTH) return { onLeft: true, left: roomLeft, room: roomLeft };\n if (roomRight >= TOOLTIP_MIN_WIDTH) return { onLeft: false, left: rightStart, room: roomRight };\n return { onLeft: false, left: 0, room: containerWidth };\n};\n\ninterface TimeBarChartTooltipProps {\n id: string;\n /** The shaded band of the bucket it describes. */\n band: { left: number; width: number };\n /** The chart's width, which the tooltip stays inside. */\n containerWidth: number;\n top: number;\n heading: string;\n total: number;\n valueLabel: string;\n series: TimeBarChartSeries[];\n values: number[];\n}\n\nconst TimeBarChartTooltip: React.FC<TimeBarChartTooltipProps> = ({\n id,\n band,\n containerWidth,\n top,\n heading,\n total,\n valueLabel,\n series,\n values,\n}) => {\n const placement = placeBeside(band, containerWidth);\n return (\n <div\n id={id}\n className=\"pointer-events-none rounded-lg\"\n style={{\n position: 'absolute',\n top,\n left: placement.left,\n transform: placement.onLeft ? 'translateX(-100%)' : undefined,\n minWidth: Math.min(TOOLTIP_MIN_WIDTH, placement.room),\n maxWidth: placement.room,\n overflow: 'hidden',\n padding: '10px 12px',\n background: 'var(--malachite-tooltip-background, rgb(59, 59, 59))',\n color: 'var(--malachite-tooltip-foreground, rgb(255, 255, 255))',\n boxShadow: 'var(--malachite-tooltip-shadow, 0px 0px 10px 0px rgba(0, 0, 0, 0.2))',\n fontSize: 12,\n zIndex: 1,\n whiteSpace: 'nowrap',\n }}\n >\n <div style={{ fontWeight: 600, ...CLIPPED }}>{heading}</div>\n <div style={{ opacity: 0.7, marginBottom: 8 }}>\n {formatCount(total)} {valueLabel}\n </div>\n {series.map((entry, position) => (\n <div\n key={entry.key}\n style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 4 }}\n >\n <span\n aria-hidden\n style={{\n width: 10,\n height: 2,\n borderRadius: 1,\n background: TONE_FILL[entry.tone],\n }}\n />\n <span style={{ opacity: 0.7, flex: 1, minWidth: 0, ...CLIPPED }}>\n {entry.label}\n </span>\n <span style={{ fontWeight: 600, fontVariantNumeric: 'tabular-nums' }}>\n {formatCount(values[position])}\n </span>\n </div>\n ))}\n </div>\n );\n};\n\nexport default TimeBarChartTooltip;\n"],"names":["TOOLTIP_GAP","TOOLTIP_MIN_WIDTH","CLIPPED","placeBeside","band","containerWidth","roomLeft","rightStart","roomRight","TimeBarChartTooltip","id","top","heading","total","valueLabel","series","values","placement","jsxs","jsx","formatCount","entry","position","TONE_FILL"],"mappings":";;;AAKA,MAAMA,IAAc,GACdC,IAAoB,KAGpBC,IAA+B,EAAE,UAAU,UAAU,cAAc,WAAA,GAGnEC,IAAc,CAACC,GAAuCC,MAA2B;AACnF,QAAMC,IAAWF,EAAK,OAAOJ,GACvBO,IAAaH,EAAK,OAAOA,EAAK,QAAQJ,GACtCQ,IAAYH,IAAiBE;AACnC,SAAID,KAAYL,IAA0B,EAAE,QAAQ,IAAM,MAAMK,GAAU,MAAMA,EAAA,IAC5EE,KAAaP,IAA0B,EAAE,QAAQ,IAAO,MAAMM,GAAY,MAAMC,EAAA,IAC7E,EAAE,QAAQ,IAAO,MAAM,GAAG,MAAMH,EAAA;AAC3C,GAgBMI,IAA0D,CAAC;AAAA,EAC7D,IAAAC;AAAA,EACA,MAAAN;AAAA,EACA,gBAAAC;AAAA,EACA,KAAAM;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACJ,MAAM;AACF,QAAMC,IAAYd,EAAYC,GAAMC,CAAc;AAClD,SACI,gBAAAa;AAAA,IAAC;AAAA,IAAA;A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AAC,EAAYJ,EAAOM,CAAQ,CAAC,EAAA,CACjC;AAAA,YAAA;AAAA,UAAA;AAAA,UAjBKD,EAAM;AAAA,QAAA,CAmBlB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const _ = (M, a, { plotTop: r, plotBottom: s, yMax: u }) => {
|
|
2
|
+
const N = s - r, h = [];
|
|
3
|
+
let n = s;
|
|
4
|
+
for (const t of M) {
|
|
5
|
+
const o = a[t];
|
|
6
|
+
if (!(o > 0)) continue;
|
|
7
|
+
const c = n === s ? n : n - 2, i = Math.min(n - o / u * N, c - 2);
|
|
8
|
+
h.push({ position: t, top: i, height: c - i }), n = i;
|
|
9
|
+
}
|
|
10
|
+
const e = r - n;
|
|
11
|
+
if (e <= 0 || !h.length) return h;
|
|
12
|
+
const E = h.reduce(
|
|
13
|
+
(t, o, c) => o.height > h[t].height ? c : t,
|
|
14
|
+
0
|
|
15
|
+
);
|
|
16
|
+
return h.map((t, o) => {
|
|
17
|
+
if (o < E) return t;
|
|
18
|
+
const c = o === E ? Math.max(2, t.height - e) : t.height;
|
|
19
|
+
return { ...t, top: t.top + e, height: c };
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
_ as layoutStack
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=stackLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stackLayout.js","sources":["../../../src/components/TimeBarChart/stackLayout.ts"],"sourcesContent":["/** Surface gap between stacked segments. */\nconst SEGMENT_GAP = 2;\n/** A non-zero count never draws thinner than this, so one failure among hundreds still shows. */\nconst MIN_SEGMENT_PX = 2;\n\nexport interface StackSegment {\n position: number;\n top: number;\n height: number;\n}\n\ninterface StackFrame {\n plotTop: number;\n plotBottom: number;\n yMax: number;\n}\n\n/**\n * The drawn segments of one stack, bottom to top, for the non-zero values in `order`. Each gap\n * comes off a segment's foot, so the top sits at the true total unless a segment needed lifting\n * to stay visible; a lift that would carry the stack above the plot comes out of its tallest\n * segment instead.\n */\nexport const layoutStack = (\n order: number[],\n values: number[],\n { plotTop, plotBottom, yMax }: StackFrame,\n): StackSegment[] => {\n const plotHeight = plotBottom - plotTop;\n const segments: StackSegment[] = [];\n let base = plotBottom;\n for (const position of order) {\n const value = values[position];\n if (!(value > 0)) continue;\n const foot = base === plotBottom ? base : base - SEGMENT_GAP;\n const top = Math.min(base - (value / yMax) * plotHeight, foot - MIN_SEGMENT_PX);\n segments.push({ position, top, height: foot - top });\n base = top;\n }\n const overshoot = plotTop - base;\n if (overshoot <= 0 || !segments.length) return segments;\n const tallest = segments.reduce(\n (best, segment, index) => (segment.height > segments[best].height ? index : best),\n 0,\n );\n return segments.map((segment, index) => {\n if (index < tallest) return segment;\n const height =\n index === tallest\n ? Math.max(MIN_SEGMENT_PX, segment.height - overshoot)\n : segment.height;\n return { ...segment, top: segment.top + overshoot, height };\n });\n};\n"],"names":["layoutStack","order","values","plotTop","plotBottom","yMax","plotHeight","segments","base","position","value","foot","top","overshoot","tallest","best","segment","index","height"],"mappings":"AAuBO,MAAMA,IAAc,CACvBC,GACAC,GACA,EAAE,SAAAC,GAAS,YAAAC,GAAY,MAAAC,QACN;AACjB,QAAMC,IAAaF,IAAaD,GAC1BI,IAA2B,CAAA;AACjC,MAAIC,IAAOJ;AACX,aAAWK,KAAYR,GAAO;AAC1B,UAAMS,IAAQR,EAAOO,CAAQ;AAC7B,QAAI,EAAEC,IAAQ,GAAI;AAClB,UAAMC,IAAOH,MAASJ,IAAaI,IAAOA,IAAO,GAC3CI,IAAM,KAAK,IAAIJ,IAAQE,IAAQL,IAAQC,GAAYK,IAAO,CAAc;AAC9E,IAAAJ,EAAS,KAAK,EAAE,UAAAE,GAAU,KAAAG,GAAK,QAAQD,IAAOC,GAAK,GACnDJ,IAAOI;AAAA,EACX;AACA,QAAMC,IAAYV,IAAUK;AAC5B,MAAIK,KAAa,KAAK,CAACN,EAAS,OAAQ,QAAOA;AAC/C,QAAMO,IAAUP,EAAS;AAAA,IACrB,CAACQ,GAAMC,GAASC,MAAWD,EAAQ,SAAST,EAASQ,CAAI,EAAE,SAASE,IAAQF;AAAA,IAC5E;AAAA,EAAA;AAEJ,SAAOR,EAAS,IAAI,CAACS,GAASC,MAAU;AACpC,QAAIA,IAAQH,EAAS,QAAOE;AAC5B,UAAME,IACFD,MAAUH,IACJ,KAAK,IAAI,GAAgBE,EAAQ,SAASH,CAAS,IACnDG,EAAQ;AAClB,WAAO,EAAE,GAAGA,GAAS,KAAKA,EAAQ,MAAMH,GAAW,QAAAK,EAAA;AAAA,EACvD,CAAC;AACL;"}
|