@burdenoff/microfe-bigconsole 2026.1115.1 → 2026.1115.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,101 +5,191 @@ import { BarChart as a } from "./charts/BarChart.js";
5
5
  import { AreaChart as o } from "./charts/AreaChart.js";
6
6
  import { PieChart as s } from "./charts/PieChart.js";
7
7
  import { FunnelChart as c } from "./charts/FunnelChart.js";
8
- import { ComboChart as l } from "./charts/ComboChart.js";
9
- import { WaterfallChart as u } from "./charts/WaterfallChart.js";
10
- import { ScatterChart as d } from "./charts/ScatterChart.js";
11
- import { ChartLegend as f } from "./ChartLegend.js";
8
+ import { funnelFields as l } from "./charts/funnelData.js";
9
+ import { ComboChart as u } from "./charts/ComboChart.js";
10
+ import { WaterfallChart as d } from "./charts/WaterfallChart.js";
11
+ import { ScatterChart as f } from "./charts/ScatterChart.js";
12
+ import { ChartLegend as p } from "./ChartLegend.js";
12
13
  import "../../../contexts/index.js";
13
- import { memo as p, useCallback as m, useMemo as h, useState as g } from "react";
14
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
14
+ import { WidgetEmptyState as m } from "../states/EmptyState.js";
15
+ import { classifyChartData as h } from "./chartRows.js";
16
+ import { memo as g, useCallback as _, useMemo as v, useState as y } from "react";
17
+ import { useI18n as b } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
18
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
15
19
  // src/bigconsole/components/widgets/chart/ChartWidget.tsx
16
- var y = [
20
+ var C = [], w = {
21
+ number: {
22
+ key: "bigconsole.widget.chart.unsupported.number",
23
+ fallback: "This data is a single value."
24
+ },
25
+ text: {
26
+ key: "bigconsole.widget.chart.unsupported.text",
27
+ fallback: "This data is text."
28
+ },
29
+ object: {
30
+ key: "bigconsole.widget.chart.unsupported.object",
31
+ fallback: "This data is one record, not a list of rows."
32
+ },
33
+ values: {
34
+ key: "bigconsole.widget.chart.unsupported.values",
35
+ fallback: "This data is a list of values without field names."
36
+ }
37
+ }, T = [
17
38
  "var(--color-chart-1)",
18
39
  "var(--color-chart-2)",
19
40
  "var(--color-chart-3)",
20
41
  "var(--color-chart-4)",
21
42
  "var(--color-chart-5)"
22
- ], b = p(function({ widget: p, data: b = [], onClick: x, onDrilldown: S }) {
23
- let C = p.config, [w, T] = g([]), { handleDataClick: E, enabled: D } = t(p.id, C?.crossFilterMappings || [{
24
- sourceField: C?.labelField || "name",
43
+ ], E = g(function({ widget: g, data: E = [], onClick: D, onDrilldown: O }) {
44
+ let { t: k } = b(), A = g.config, [j, M] = y([]), N = v(() => h(E), [E]), P = N.kind === "rows" ? N.rows : C, { handleDataClick: F, enabled: I } = t(g.id, A?.crossFilterMappings || [{
45
+ sourceField: A?.labelField || "name",
25
46
  targetFilterId: "category"
26
- }]), { clearAllCrossFilters: O, hasCrossFilters: k } = e(), A = h(() => ({
27
- type: C?.chartType?.toLowerCase() || "line",
28
- xAxisKey: C?.xAxisField || C?.labelField || "name",
29
- xAxisLabel: C?.xAxisLabel,
30
- yAxisLabel: C?.yAxisLabel,
31
- showGrid: C?.showGrid,
32
- showLegend: C?.showLegend,
33
- legendPosition: C?.legendPosition,
34
- showDots: C?.showDataPoints,
35
- curveType: C?.curveType,
36
- colors: C?.colors,
37
- seriesNames: C?.seriesLabels,
38
- stacked: C?.stacked,
39
- isDonut: C?.showAsDonut,
40
- innerRadius: C?.innerRadius,
41
- outerRadius: C?.outerRadius,
42
- referenceLines: C?.referenceLines,
43
- series: C?.series,
44
- selectedFields: C?.selectedFields,
45
- dualAxis: C?.dualAxis,
46
- yAxisRightLabel: C?.yAxisRightLabel,
47
- logScale: C?.logScale,
48
- startAtZero: C?.startAtZero,
49
- yMin: C?.yMin,
50
- yMax: C?.yMax,
51
- valueField: C?.valueField,
52
- labelField: C?.labelField,
53
- showTotal: C?.showTotal,
54
- totalLabel: C?.totalLabel,
55
- xField: C?.xField,
56
- yField: C?.yField,
57
- sizeField: C?.sizeField,
58
- colorField: C?.colorField
59
- }), [C]), j = A.type === "combo" || A.dualAxis === !0 || A.series?.some((e) => e.axis === "right" || e.type === "bar") && A.series?.some((e) => e.type === "line") || !1, M = h(() => !b.length || A.type === "pie" || A.type === "funnel" || A.type === "scatter" || A.type === "waterfall" ? [] : (j && A.selectedFields !== void 0 ? n(b, A).map((e) => e.field) : r(b, A.xAxisKey, A.selectedFields)).map((e, t) => ({
47
+ }]), { clearAllCrossFilters: L, hasCrossFilters: R } = e(), z = v(() => ({
48
+ type: g.type === "funnel_chart" ? "funnel" : A?.chartType?.toLowerCase() || "line",
49
+ xAxisKey: A?.xAxisField || A?.labelField || "name",
50
+ xAxisLabel: A?.xAxisLabel,
51
+ yAxisLabel: A?.yAxisLabel,
52
+ showGrid: A?.showGrid,
53
+ showLegend: A?.showLegend,
54
+ legendPosition: A?.legendPosition,
55
+ showDots: A?.showDataPoints,
56
+ curveType: A?.curveType,
57
+ colors: A?.colors,
58
+ seriesNames: A?.seriesLabels,
59
+ stacked: A?.stacked,
60
+ isDonut: A?.showAsDonut,
61
+ innerRadius: A?.innerRadius,
62
+ outerRadius: A?.outerRadius,
63
+ referenceLines: A?.referenceLines,
64
+ series: A?.series,
65
+ selectedFields: A?.selectedFields,
66
+ dualAxis: A?.dualAxis,
67
+ yAxisRightLabel: A?.yAxisRightLabel,
68
+ logScale: A?.logScale,
69
+ startAtZero: A?.startAtZero,
70
+ yMin: A?.yMin,
71
+ yMax: A?.yMax,
72
+ valueField: A?.valueField,
73
+ labelField: A?.labelField,
74
+ showTotal: A?.showTotal,
75
+ totalLabel: A?.totalLabel,
76
+ xField: A?.xField,
77
+ yField: A?.yField,
78
+ sizeField: A?.sizeField,
79
+ colorField: A?.colorField
80
+ }), [A, g.type]), B = z.type !== "funnel" && (z.type === "combo" || z.dualAxis === !0 || z.series?.some((e) => e.axis === "right" || e.type === "bar") && z.series?.some((e) => e.type === "line") || !1), V = v(() => !P.length || z.type === "pie" || z.type === "funnel" || z.type === "scatter" || z.type === "waterfall" ? [] : (B && z.selectedFields !== void 0 ? n(P, z).map((e) => e.field) : r(P, z.xAxisKey, z.selectedFields)).map((e, t) => ({
60
81
  dataKey: e,
61
- name: A.seriesNames?.[e] || e,
62
- color: A.colors?.[t] || y[t % y.length],
63
- hidden: w.includes(e)
82
+ name: z.seriesNames?.[e] || e,
83
+ color: z.colors?.[t] || T[t % T.length],
84
+ hidden: j.includes(e)
64
85
  })), [
65
- b,
66
- A,
67
- w,
68
- C?.selectedFields,
69
- j
70
- ]), N = m((e) => {
71
- T((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
72
- }, []), P = m((e, t) => {
73
- if (D) {
74
- let t = e[C?.labelField || "name"];
75
- E(e, t);
86
+ P,
87
+ z,
88
+ j,
89
+ A?.selectedFields,
90
+ B
91
+ ]), H = _((e) => {
92
+ M((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
93
+ }, []), U = _((e, t) => {
94
+ if (I) {
95
+ let t = e[A?.labelField || "name"];
96
+ F(e, t);
76
97
  }
77
- S ? S(e) : x && p.drilldowns?.length && x(e, t);
98
+ O ? O(e) : D && g.drilldowns?.length && D(e, t);
78
99
  }, [
79
- x,
80
- S,
81
- p.drilldowns,
82
100
  D,
83
- E,
84
- C?.labelField
85
- ]);
86
- return /* @__PURE__ */ v("div", {
101
+ O,
102
+ g.drilldowns,
103
+ I,
104
+ F,
105
+ A?.labelField
106
+ ]), W = () => {
107
+ if (B) return /* @__PURE__ */ x(u, {
108
+ data: P,
109
+ config: z,
110
+ hiddenSeries: j,
111
+ onDataClick: U
112
+ });
113
+ switch (z.type) {
114
+ case "waterfall": return /* @__PURE__ */ x(d, {
115
+ data: P,
116
+ config: z,
117
+ onDataClick: U
118
+ });
119
+ case "scatter": return /* @__PURE__ */ x(f, {
120
+ data: P,
121
+ config: z,
122
+ onDataClick: U
123
+ });
124
+ case "bar": return /* @__PURE__ */ x(a, {
125
+ data: P,
126
+ config: z,
127
+ hiddenSeries: j,
128
+ onDataClick: U
129
+ });
130
+ case "area": return /* @__PURE__ */ x(o, {
131
+ data: P,
132
+ config: z,
133
+ hiddenSeries: j,
134
+ onDataClick: U
135
+ });
136
+ case "pie": return /* @__PURE__ */ x(s, {
137
+ data: P,
138
+ config: z,
139
+ dataKey: A?.valueField || "value",
140
+ nameKey: A?.labelField || "name",
141
+ onDataClick: U
142
+ });
143
+ case "funnel": {
144
+ let e = l(P, {
145
+ valueField: A?.valueField,
146
+ labelField: A?.labelField
147
+ });
148
+ return /* @__PURE__ */ x(c, {
149
+ data: P,
150
+ config: z,
151
+ dataKey: e.valueField,
152
+ nameKey: e.labelField,
153
+ onDataClick: U
154
+ });
155
+ }
156
+ default: return /* @__PURE__ */ x(i, {
157
+ data: P,
158
+ config: z,
159
+ hiddenSeries: j,
160
+ onDataClick: U
161
+ });
162
+ }
163
+ };
164
+ if (N.kind === "empty") return /* @__PURE__ */ x(m, {
165
+ widgetType: "chart",
166
+ hasDataSource: !0
167
+ });
168
+ if (N.kind === "unsupported") {
169
+ let e = w[N.shape];
170
+ return /* @__PURE__ */ x(m, {
171
+ widgetType: "chart",
172
+ hasDataSource: !0,
173
+ message: `${k(e.key, e.fallback)} ${k("bigconsole.widget.chart.unsupported.hint", "A chart needs a list of rows. Pick a parser that returns rows, or use a Metric Card for one number.")}`
174
+ });
175
+ }
176
+ return /* @__PURE__ */ S("div", {
87
177
  className: "flex flex-col h-full p-4",
88
178
  children: [
89
- k && /* @__PURE__ */ _("div", {
179
+ R && /* @__PURE__ */ x("div", {
90
180
  className: "flex items-center gap-2 mb-2 -mt-1",
91
- children: /* @__PURE__ */ v("button", {
181
+ children: /* @__PURE__ */ S("button", {
92
182
  type: "button",
93
183
  onClick: (e) => {
94
- e.stopPropagation(), O();
184
+ e.stopPropagation(), L();
95
185
  },
96
186
  className: "\n inline-flex items-center gap-1.5\n px-2.5 py-1 rounded-md\n text-xs font-medium\n bg-action-primary-bg/10 text-action-primary-text\n hover:bg-action-primary-bg/20\n transition-colors\n ",
97
- children: [/* @__PURE__ */ _("svg", {
187
+ children: [/* @__PURE__ */ x("svg", {
98
188
  className: "w-3.5 h-3.5",
99
189
  fill: "none",
100
190
  stroke: "currentColor",
101
191
  viewBox: "0 0 24 24",
102
- children: /* @__PURE__ */ _("path", {
192
+ children: /* @__PURE__ */ x("path", {
103
193
  strokeLinecap: "round",
104
194
  strokeLinejoin: "round",
105
195
  strokeWidth: 2,
@@ -108,72 +198,21 @@ var y = [
108
198
  }), "Clear Filter"]
109
199
  })
110
200
  }),
111
- A.legendPosition === "top" && M.length > 0 && /* @__PURE__ */ _(f, {
112
- items: M,
201
+ z.legendPosition === "top" && V.length > 0 && /* @__PURE__ */ x(p, {
202
+ items: V,
113
203
  position: "top",
114
- onItemClick: N
204
+ onItemClick: H
115
205
  }),
116
- /* @__PURE__ */ _("div", {
206
+ /* @__PURE__ */ x("div", {
117
207
  className: "flex-1 min-h-0",
118
- children: (() => {
119
- if (j) return /* @__PURE__ */ _(l, {
120
- data: b,
121
- config: A,
122
- hiddenSeries: w,
123
- onDataClick: P
124
- });
125
- switch (A.type) {
126
- case "waterfall": return /* @__PURE__ */ _(u, {
127
- data: b,
128
- config: A,
129
- onDataClick: P
130
- });
131
- case "scatter": return /* @__PURE__ */ _(d, {
132
- data: b,
133
- config: A,
134
- onDataClick: P
135
- });
136
- case "bar": return /* @__PURE__ */ _(a, {
137
- data: b,
138
- config: A,
139
- hiddenSeries: w,
140
- onDataClick: P
141
- });
142
- case "area": return /* @__PURE__ */ _(o, {
143
- data: b,
144
- config: A,
145
- hiddenSeries: w,
146
- onDataClick: P
147
- });
148
- case "pie": return /* @__PURE__ */ _(s, {
149
- data: b,
150
- config: A,
151
- dataKey: C?.valueField || "value",
152
- nameKey: C?.labelField || "name",
153
- onDataClick: P
154
- });
155
- case "funnel": return /* @__PURE__ */ _(c, {
156
- data: b,
157
- config: A,
158
- dataKey: C?.valueField || "value",
159
- nameKey: C?.labelField || "name",
160
- onDataClick: P
161
- });
162
- default: return /* @__PURE__ */ _(i, {
163
- data: b,
164
- config: A,
165
- hiddenSeries: w,
166
- onDataClick: P
167
- });
168
- }
169
- })()
208
+ children: W()
170
209
  }),
171
- A.legendPosition === "bottom" && M.length > 0 && /* @__PURE__ */ _(f, {
172
- items: M,
210
+ z.legendPosition === "bottom" && V.length > 0 && /* @__PURE__ */ x(p, {
211
+ items: V,
173
212
  position: "bottom",
174
- onItemClick: N
213
+ onItemClick: H
175
214
  })
176
215
  ]
177
216
  });
178
217
  });
179
- export { b as ChartWidget, b as default };
218
+ export { E as ChartWidget, E as default };
@@ -0,0 +1,13 @@
1
+ import { ChartData } from './charts/types';
2
+ /** Why the data cannot be drawn. Drives the message, not the logic. */
3
+ export type UnsupportedChartShape = 'number' | 'text' | 'object' | 'values';
4
+ export type ChartRowsResult = {
5
+ readonly kind: 'rows';
6
+ readonly rows: ChartData[];
7
+ } | {
8
+ readonly kind: 'empty';
9
+ } | {
10
+ readonly kind: 'unsupported';
11
+ readonly shape: UnsupportedChartShape;
12
+ };
13
+ export declare function classifyChartData(data: unknown): ChartRowsResult;
@@ -0,0 +1,27 @@
1
+ // src/bigconsole/components/widgets/chart/chartRows.ts
2
+ var e = (e) => typeof e == "object" && !!e && !Array.isArray(e);
3
+ function t(t) {
4
+ if (t == null) return { kind: "empty" };
5
+ if (Array.isArray(t)) {
6
+ if (t.length === 0) return { kind: "empty" };
7
+ let n = t.filter(e);
8
+ return n.length === 0 ? {
9
+ kind: "unsupported",
10
+ shape: "values"
11
+ } : {
12
+ kind: "rows",
13
+ rows: n
14
+ };
15
+ }
16
+ return typeof t == "number" || typeof t == "bigint" || typeof t == "boolean" ? {
17
+ kind: "unsupported",
18
+ shape: "number"
19
+ } : typeof t == "string" ? {
20
+ kind: "unsupported",
21
+ shape: "text"
22
+ } : {
23
+ kind: "unsupported",
24
+ shape: "object"
25
+ };
26
+ }
27
+ export { t as classifyChartData };
@@ -6,3 +6,19 @@ export declare function funnelStages(data: ChartData[], valueField: string, labe
6
6
  label: string;
7
7
  conversion: number | undefined;
8
8
  }[] | null;
9
+ /**
10
+ * The value and label fields a funnel should read (BOFF-10138).
11
+ *
12
+ * The configured fields win when every row holds them. Otherwise `value` / `name` (the
13
+ * historical defaults), then the first field every row holds: a count that is not itself a
14
+ * rate (`count`, not `conversionRate`) and a non-empty label (`stage`). Generated consoles
15
+ * send stage rows such as `{ stage, count, conversionRate }` with no field mapping, which
16
+ * left the funnel saying its rows had no label or value.
17
+ */
18
+ export declare function funnelFields(rows: ChartData[], configured?: {
19
+ valueField?: string;
20
+ labelField?: string;
21
+ }): {
22
+ valueField: string;
23
+ labelField: string;
24
+ };
@@ -13,4 +13,15 @@ function e(e, t, n) {
13
13
  };
14
14
  });
15
15
  }
16
- export { e as funnelStages };
16
+ var t = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0, n = (e) => (typeof e == "string" || typeof e == "number") && String(e).trim() !== "", r = /rate|percent|pct|ratio|conversion/i;
17
+ function i(e, t, n) {
18
+ return !!t && e.length > 0 && e.every((e) => n(e?.[t]));
19
+ }
20
+ function a(e, a = {}) {
21
+ let o = e.length > 0 ? Object.keys(e[0] ?? {}) : [], s = [a.valueField, "value"].find((n) => i(e, n, t)) ?? o.find((n) => !r.test(n) && i(e, n, t)) ?? a.valueField ?? "value";
22
+ return {
23
+ valueField: s,
24
+ labelField: [a.labelField, "name"].find((t) => i(e, t, n)) ?? o.find((t) => t !== s && i(e, t, (e) => typeof e == "string" && e.trim() !== "")) ?? a.labelField ?? "name"
25
+ };
26
+ }
27
+ export { a as funnelFields, e as funnelStages };
@@ -1,7 +1,8 @@
1
- import { memo as e, useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
2
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
1
+ import { toHeatmapData as e } from "./heatmapData.js";
2
+ import { memo as t, useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
3
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
3
4
  // src/bigconsole/components/widgets/heatmap/HeatmapWidget.tsx
4
- var c = {
5
+ var l = {
5
6
  blue: [
6
7
  "bg-action-primary-bg/10",
7
8
  "bg-action-primary-bg/30",
@@ -24,59 +25,59 @@ var c = {
24
25
  "bg-status-error-bg/90"
25
26
  ]
26
27
  };
27
- function l(e) {
28
- return c[e ?? "blue"] ?? c.blue;
28
+ function u(e) {
29
+ return l[e ?? "blue"] ?? l.blue;
29
30
  }
30
- function u(e, t) {
31
+ function d(e, t) {
31
32
  return t.onDrilldown ? (t.onDrilldown({
32
33
  row: e.row,
33
34
  column: e.column,
34
35
  value: e.value
35
36
  }), !0) : t.onClick && t.hasLegacyDrilldowns ? (t.onClick(e), !0) : !1;
36
37
  }
37
- function d(e, t, n) {
38
+ function f(e, t, n) {
38
39
  return e + t < n - 1;
39
40
  }
40
- function f(e, t, n, r = "blue") {
41
+ function p(e, t, n, r = "blue") {
41
42
  let i = Math.max(0, Math.min(1, (e - t) / (n - t || 1)));
42
- return l(r)[i < .2 ? 0 : i < .4 ? 1 : i < .6 ? 2 : i < .8 ? 3 : 4];
43
+ return u(r)[i < .2 ? 0 : i < .4 ? 1 : i < .6 ? 2 : i < .8 ? 3 : 4];
43
44
  }
44
- var p = e(function({ widget: e, data: c, onClick: p, onDrilldown: m }) {
45
- let h = e.config, g = r(() => {
45
+ var m = t(function({ widget: t, data: l, onClick: m, onDrilldown: h }) {
46
+ let g = t.config, _ = i(() => e(l, g ?? {}), [l, g]), v = i(() => {
46
47
  let e = /* @__PURE__ */ new Map();
47
- return c?.cells && Array.isArray(c.cells) && c.cells.forEach((t) => {
48
+ return _?.cells && Array.isArray(_.cells) && _.cells.forEach((t) => {
48
49
  e.set(`${t.row}:${t.column}`, t.value);
49
50
  }), e;
50
- }, [c?.cells]), { minValue: _, maxValue: v } = r(() => {
51
- if (!c?.cells || !Array.isArray(c.cells) || !c.cells.length) return {
51
+ }, [_?.cells]), { minValue: y, maxValue: b } = i(() => {
52
+ if (!_?.cells || !Array.isArray(_.cells) || !_.cells.length) return {
52
53
  minValue: 0,
53
54
  maxValue: 100
54
55
  };
55
- let e = c.cells.map((e) => e.value);
56
+ let e = _.cells.map((e) => e.value);
56
57
  return {
57
- minValue: c.minValue ?? Math.min(...e),
58
- maxValue: c.maxValue ?? Math.max(...e)
58
+ minValue: _.minValue ?? Math.min(...e),
59
+ maxValue: _.maxValue ?? Math.max(...e)
59
60
  };
60
- }, [c]), y = !!(p && e.drilldowns?.length), b = t((t, n, r) => {
61
- u({
62
- row: t,
61
+ }, [_]), x = !!(m && t.drilldowns?.length), S = n((e, n, r) => {
62
+ d({
63
+ row: e,
63
64
  column: n,
64
65
  value: r
65
66
  }, {
66
- onDrilldown: m,
67
- onClick: p,
68
- hasLegacyDrilldowns: !!e.drilldowns?.length
67
+ onDrilldown: h,
68
+ onClick: m,
69
+ hasLegacyDrilldowns: !!t.drilldowns?.length
69
70
  });
70
71
  }, [
72
+ h,
71
73
  m,
72
- p,
73
- e.drilldowns
74
- ]), x = !!m || y, S = i(null), [C, w] = a(!1), [T, E] = a(!1), D = Array.isArray(c?.rows) ? c.rows.length : 0;
75
- return n(() => {
76
- let e = S.current;
74
+ t.drilldowns
75
+ ]), C = !!h || x, w = a(null), [T, E] = o(!1), [D, O] = o(!1), k = Array.isArray(_?.rows) ? _.rows.length : 0;
76
+ return r(() => {
77
+ let e = w.current;
77
78
  if (!e) return;
78
79
  let t = () => {
79
- E(e.scrollHeight > e.clientHeight + 1), w(d(e.scrollTop, e.clientHeight, e.scrollHeight));
80
+ O(e.scrollHeight > e.clientHeight + 1), E(f(e.scrollTop, e.clientHeight, e.scrollHeight));
80
81
  };
81
82
  t(), e.addEventListener("scroll", t, { passive: !0 });
82
83
  let n = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
@@ -85,64 +86,64 @@ var p = e(function({ widget: e, data: c, onClick: p, onDrilldown: m }) {
85
86
  return r && n?.observe(r), () => {
86
87
  e.removeEventListener("scroll", t), n?.disconnect();
87
88
  };
88
- }, [D]), !c || !Array.isArray(c.rows) || !Array.isArray(c.columns) || !c.rows.length || !c.columns.length ? /* @__PURE__ */ o("div", {
89
+ }, [k]), !_ || !Array.isArray(_.rows) || !Array.isArray(_.columns) || !_.rows.length || !_.columns.length ? /* @__PURE__ */ s("div", {
89
90
  className: "flex items-center justify-center h-full text-text-secondary text-sm",
90
91
  children: "No heatmap data available"
91
- }) : /* @__PURE__ */ s("div", {
92
+ }) : /* @__PURE__ */ c("div", {
92
93
  className: "flex h-full min-h-0 flex-col gap-2",
93
- children: [/* @__PURE__ */ s("div", {
94
+ children: [/* @__PURE__ */ c("div", {
94
95
  className: "relative min-h-0 flex-1",
95
- children: [/* @__PURE__ */ o("div", {
96
- ref: S,
96
+ children: [/* @__PURE__ */ s("div", {
97
+ ref: w,
97
98
  className: "h-full overflow-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg",
98
- tabIndex: T ? 0 : void 0,
99
- role: T ? "region" : void 0,
100
- "aria-label": T ? `${e.title || "Heatmap"}: scroll for more rows` : void 0,
101
- children: /* @__PURE__ */ s("table", {
99
+ tabIndex: D ? 0 : void 0,
100
+ role: D ? "region" : void 0,
101
+ "aria-label": D ? `${t.title || "Heatmap"}: scroll for more rows` : void 0,
102
+ children: /* @__PURE__ */ c("table", {
102
103
  className: "h-full w-full border-separate border-spacing-0.5",
103
- children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [/* @__PURE__ */ o("th", { className: "sticky top-0 z-[1] bg-bg-surface px-2 py-1 text-xs text-text-secondary text-left" }), c.columns.map((e) => /* @__PURE__ */ o("th", {
104
+ children: [/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ c("tr", { children: [/* @__PURE__ */ s("th", { className: "sticky top-0 z-[1] bg-bg-surface px-2 py-1 text-xs text-text-secondary text-left" }), _.columns.map((e) => /* @__PURE__ */ s("th", {
104
105
  scope: "col",
105
106
  className: "sticky top-0 z-[1] bg-bg-surface px-2 py-1 text-xs font-medium text-text-secondary text-center min-w-[60px]",
106
107
  children: e
107
- }, e))] }) }), /* @__PURE__ */ o("tbody", { children: c.rows.map((e) => /* @__PURE__ */ s("tr", { children: [/* @__PURE__ */ o("th", {
108
+ }, e))] }) }), /* @__PURE__ */ s("tbody", { children: _.rows.map((e) => /* @__PURE__ */ c("tr", { children: [/* @__PURE__ */ s("th", {
108
109
  scope: "row",
109
110
  className: "px-2 py-0.5 text-xs font-medium text-text-secondary text-left whitespace-nowrap",
110
111
  children: e
111
- }), c.columns.map((t) => {
112
- let n = g.get(`${e}:${t}`) ?? 0, r = f(n, _, v, h?.colorScheme);
113
- return /* @__PURE__ */ o("td", {
112
+ }), _.columns.map((t) => {
113
+ let n = v.get(`${e}:${t}`) ?? 0, r = p(n, y, b, g?.colorScheme);
114
+ return /* @__PURE__ */ s("td", {
114
115
  className: `
115
116
  h-6 rounded px-2 py-0.5 text-center text-xs align-middle
116
117
  ${r}
117
- ${x ? "cursor-pointer hover:ring-2 hover:ring-inset hover:ring-action-primary-bg" : ""}
118
+ ${C ? "cursor-pointer hover:ring-2 hover:ring-inset hover:ring-action-primary-bg" : ""}
118
119
  transition-all
119
120
  `,
120
- onClick: () => b(e, t, n),
121
+ onClick: () => S(e, t, n),
121
122
  title: `${e} / ${t}: ${n}`,
122
- children: h?.showValues !== !1 && /* @__PURE__ */ o("span", {
123
+ children: g?.showValues !== !1 && /* @__PURE__ */ s("span", {
123
124
  className: "text-xs font-medium text-text-primary",
124
- children: typeof n == "number" ? n.toFixed(h?.decimals || 0) : n
125
+ children: typeof n == "number" ? n.toFixed(g?.decimals || 0) : n
125
126
  })
126
127
  }, t);
127
128
  })] }, e)) })]
128
129
  })
129
- }), C && /* @__PURE__ */ o("div", {
130
+ }), T && /* @__PURE__ */ s("div", {
130
131
  "aria-hidden": "true",
131
132
  "data-testid": "heatmap-more-below",
132
133
  className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-bg-surface to-bg-surface/0"
133
134
  })]
134
- }), h?.showLegend !== !1 && /* @__PURE__ */ s("div", {
135
+ }), g?.showLegend !== !1 && /* @__PURE__ */ c("div", {
135
136
  className: "flex shrink-0 items-center justify-center gap-2",
136
137
  children: [
137
- /* @__PURE__ */ o("span", {
138
+ /* @__PURE__ */ s("span", {
138
139
  className: "text-xs text-text-secondary",
139
140
  children: "Low"
140
141
  }),
141
- /* @__PURE__ */ o("div", {
142
+ /* @__PURE__ */ s("div", {
142
143
  className: "flex gap-0.5",
143
- children: l(h?.colorScheme).map((e) => /* @__PURE__ */ o("div", { className: `w-6 h-4 rounded ${e}` }, e))
144
+ children: u(g?.colorScheme).map((e) => /* @__PURE__ */ s("div", { className: `w-6 h-4 rounded ${e}` }, e))
144
145
  }),
145
- /* @__PURE__ */ o("span", {
146
+ /* @__PURE__ */ s("span", {
146
147
  className: "text-xs text-text-secondary",
147
148
  children: "High"
148
149
  })
@@ -150,4 +151,4 @@ var p = e(function({ widget: e, data: c, onClick: p, onDrilldown: m }) {
150
151
  })]
151
152
  });
152
153
  });
153
- export { p as HeatmapWidget, p as default, u as dispatchHeatmapCellClick, d as hasMoreBelow };
154
+ export { m as HeatmapWidget, m as default, d as dispatchHeatmapCellClick, f as hasMoreBelow };
@@ -0,0 +1,10 @@
1
+ import { HeatmapData } from './HeatmapWidget';
2
+ export interface HeatmapFieldConfig {
3
+ /** Column field (x axis). */
4
+ xAxisField?: string;
5
+ /** Row field (y axis). */
6
+ yAxisField?: string;
7
+ valueField?: string;
8
+ }
9
+ /** The grid to draw, or null when the data cannot make one. */
10
+ export declare function toHeatmapData(data: unknown, config?: HeatmapFieldConfig): HeatmapData | null;