@quantumwake/terminal-ux-dashboard-components 0.1.19 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -104,6 +104,12 @@ declare const shapeChartData: (chartType: ChartType, rows: Row[], { yFields }?:
104
104
  type LegendAnchor = 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
105
105
  type LegendPosition = 'start' | 'middle' | 'end';
106
106
  type TitleAlign = 'left' | 'center' | 'right';
107
+ interface ChartMargin {
108
+ top: number;
109
+ right: number;
110
+ bottom: number;
111
+ left: number;
112
+ }
107
113
  interface ChartStyle {
108
114
  background: string;
109
115
  textColor: string;
@@ -135,8 +141,23 @@ interface ChartStyle {
135
141
  titleBold: boolean;
136
142
  titleBackground: string;
137
143
  titleColor: string;
144
+ height: number;
145
+ margin: Partial<ChartMargin> | null;
146
+ maxXTicks: number;
147
+ seriesColors: string[];
138
148
  }
139
149
  declare const DEFAULT_CHART_STYLE: ChartStyle;
150
+ declare const DEFAULT_SERIES_COLORS: string[];
151
+ declare const SERIES_OVERFLOW_COLOR = "#707078";
152
+ declare const seriesColor: (i: number, style?: Partial<ChartStyle> | null) => string;
153
+ declare const chartSizing: (style: Partial<ChartStyle> | null | undefined, defaultMargin: ChartMargin) => {
154
+ frameClass: string;
155
+ frameStyle: {
156
+ height?: number;
157
+ };
158
+ margin: ChartMargin;
159
+ };
160
+ declare function thinTicks<T>(values: T[], max: number): T[] | undefined;
140
161
  declare const LEGEND_ANCHORS: LegendAnchor[];
141
162
  declare const withStyleDefaults: (style?: Partial<ChartStyle> | null) => ChartStyle;
142
163
  declare const buildNivoTheme: (style?: Partial<ChartStyle> | null) => {
@@ -311,6 +332,16 @@ interface LineViewProps {
311
332
  }
312
333
  declare function LineView({ records, xColumn, yColumn, data: presetData, style }: LineViewProps): react.JSX.Element;
313
334
 
335
+ interface SparklineViewProps {
336
+ /** The series, oldest first. */
337
+ data: number[];
338
+ /** Viewbox height in px (the svg scales to its container's width). */
339
+ height?: number;
340
+ /** Line + area hue. */
341
+ color?: string;
342
+ }
343
+ declare function SparklineView({ data, height, color }: SparklineViewProps): react.JSX.Element;
344
+
314
345
  interface ScatterSerie {
315
346
  id: string;
316
347
  data: {
@@ -606,4 +637,4 @@ interface DataExplorerProps {
606
637
  }
607
638
  declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, defaultMode, tabs, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
608
639
 
609
- export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, type ColorMethod, type ColorOptions, type ColorScope, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, HEAT_STATS, type HeatCell, type HeatPlusDatum, type HeatStat, HeatmapPlusView, type HeatmapPlusViewProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, PanelChart, type PanelChartProps, type PanelInput, type PanelLayout, type PanelRef, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, heatColor, heatLabelColor, legendConfig, normalizeCells, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
640
+ export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartMargin, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, type ColorMethod, type ColorOptions, type ColorScope, DEFAULT_CHART_STYLE, DEFAULT_SERIES_COLORS, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, HEAT_STATS, type HeatCell, type HeatPlusDatum, type HeatStat, HeatmapPlusView, type HeatmapPlusViewProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, PanelChart, type PanelChartProps, type PanelInput, type PanelLayout, type PanelRef, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, SERIES_OVERFLOW_COLOR, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SparklineView, type SparklineViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, chartSizing, compileWhere, groupBy, heatColor, heatLabelColor, legendConfig, normalizeCells, qIdent, qLit, seriesColor, shapeChartData, thinTicks, useCapabilities, useDashboard, withStyleDefaults };
package/dist/index.d.ts CHANGED
@@ -104,6 +104,12 @@ declare const shapeChartData: (chartType: ChartType, rows: Row[], { yFields }?:
104
104
  type LegendAnchor = 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
105
105
  type LegendPosition = 'start' | 'middle' | 'end';
106
106
  type TitleAlign = 'left' | 'center' | 'right';
107
+ interface ChartMargin {
108
+ top: number;
109
+ right: number;
110
+ bottom: number;
111
+ left: number;
112
+ }
107
113
  interface ChartStyle {
108
114
  background: string;
109
115
  textColor: string;
@@ -135,8 +141,23 @@ interface ChartStyle {
135
141
  titleBold: boolean;
136
142
  titleBackground: string;
137
143
  titleColor: string;
144
+ height: number;
145
+ margin: Partial<ChartMargin> | null;
146
+ maxXTicks: number;
147
+ seriesColors: string[];
138
148
  }
139
149
  declare const DEFAULT_CHART_STYLE: ChartStyle;
150
+ declare const DEFAULT_SERIES_COLORS: string[];
151
+ declare const SERIES_OVERFLOW_COLOR = "#707078";
152
+ declare const seriesColor: (i: number, style?: Partial<ChartStyle> | null) => string;
153
+ declare const chartSizing: (style: Partial<ChartStyle> | null | undefined, defaultMargin: ChartMargin) => {
154
+ frameClass: string;
155
+ frameStyle: {
156
+ height?: number;
157
+ };
158
+ margin: ChartMargin;
159
+ };
160
+ declare function thinTicks<T>(values: T[], max: number): T[] | undefined;
140
161
  declare const LEGEND_ANCHORS: LegendAnchor[];
141
162
  declare const withStyleDefaults: (style?: Partial<ChartStyle> | null) => ChartStyle;
142
163
  declare const buildNivoTheme: (style?: Partial<ChartStyle> | null) => {
@@ -311,6 +332,16 @@ interface LineViewProps {
311
332
  }
312
333
  declare function LineView({ records, xColumn, yColumn, data: presetData, style }: LineViewProps): react.JSX.Element;
313
334
 
335
+ interface SparklineViewProps {
336
+ /** The series, oldest first. */
337
+ data: number[];
338
+ /** Viewbox height in px (the svg scales to its container's width). */
339
+ height?: number;
340
+ /** Line + area hue. */
341
+ color?: string;
342
+ }
343
+ declare function SparklineView({ data, height, color }: SparklineViewProps): react.JSX.Element;
344
+
314
345
  interface ScatterSerie {
315
346
  id: string;
316
347
  data: {
@@ -606,4 +637,4 @@ interface DataExplorerProps {
606
637
  }
607
638
  declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, defaultMode, tabs, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
608
639
 
609
- export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, type ColorMethod, type ColorOptions, type ColorScope, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, HEAT_STATS, type HeatCell, type HeatPlusDatum, type HeatStat, HeatmapPlusView, type HeatmapPlusViewProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, PanelChart, type PanelChartProps, type PanelInput, type PanelLayout, type PanelRef, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, heatColor, heatLabelColor, legendConfig, normalizeCells, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
640
+ export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartMargin, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, type ColorMethod, type ColorOptions, type ColorScope, DEFAULT_CHART_STYLE, DEFAULT_SERIES_COLORS, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, HEAT_STATS, type HeatCell, type HeatPlusDatum, type HeatStat, HeatmapPlusView, type HeatmapPlusViewProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, PanelChart, type PanelChartProps, type PanelInput, type PanelLayout, type PanelRef, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, SERIES_OVERFLOW_COLOR, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SparklineView, type SparklineViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, chartSizing, compileWhere, groupBy, heatColor, heatLabelColor, legendConfig, normalizeCells, qIdent, qLit, seriesColor, shapeChartData, thinTicks, useCapabilities, useDashboard, withStyleDefaults };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useMemo, useState, useEffect, useRef, useCallback, Suspense } from 'react';
1
+ import { createContext, useContext, useMemo, useId, useState, useEffect, useRef, useCallback, Suspense } from 'react';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { interpolateRdYlGn } from 'd3-scale-chromatic';
4
4
  import { ResponsiveBar } from '@nivo/bar';
@@ -268,8 +268,54 @@ var DEFAULT_CHART_STYLE = {
268
268
  titleAlign: "left",
269
269
  titleBold: false,
270
270
  titleBackground: "",
271
- titleColor: ""
271
+ titleColor: "",
272
+ // Chart frame + series color model.
273
+ height: 0,
274
+ margin: null,
275
+ maxXTicks: 0,
276
+ seriesColors: []
272
277
  };
278
+ var DEFAULT_SERIES_COLORS = [
279
+ "#3987e5",
280
+ // blue
281
+ "#d95926",
282
+ // orange
283
+ "#199e70",
284
+ // aqua
285
+ "#c98500",
286
+ // yellow
287
+ "#d55181",
288
+ // magenta
289
+ "#008300",
290
+ // green
291
+ "#9085e9",
292
+ // violet
293
+ "#e66767"
294
+ // red
295
+ ];
296
+ var SERIES_OVERFLOW_COLOR = "#707078";
297
+ var seriesColor = (i, style) => {
298
+ const s = withStyleDefaults(style);
299
+ const palette = s.seriesColors.length ? s.seriesColors : DEFAULT_SERIES_COLORS;
300
+ return i < palette.length ? palette[i] : SERIES_OVERFLOW_COLOR;
301
+ };
302
+ var chartSizing = (style, defaultMargin) => {
303
+ const s = withStyleDefaults(style);
304
+ return {
305
+ frameClass: s.height > 0 ? "w-full" : "h-full w-full min-h-[160px]",
306
+ frameStyle: s.height > 0 ? { height: s.height } : {},
307
+ margin: { ...defaultMargin, ...s.margin || {} }
308
+ };
309
+ };
310
+ function thinTicks(values, max) {
311
+ if (max <= 0 || values.length <= max) return void 0;
312
+ if (max === 1) return [values[values.length - 1]];
313
+ const picked = [];
314
+ for (let i = 0; i < max; i++) {
315
+ picked.push(values[Math.round(i * (values.length - 1) / (max - 1))]);
316
+ }
317
+ return [...new Set(picked)];
318
+ }
273
319
  var LEGEND_ANCHORS = ["right", "top-left", "top-right", "bottom-left", "bottom-right", "none"];
274
320
  var withStyleDefaults = (style) => ({
275
321
  ...DEFAULT_CHART_STYLE,
@@ -528,15 +574,17 @@ function BarView({ records, groupColumn, valueColumn, aggFn = "count", data: pre
528
574
  return Object.entries(groups).map(([key, recs]) => ({ group: key, value: aggregate(recs, valueColumn, aggFn) })).sort((a, b) => b.value - a.value).slice(0, 50);
529
575
  }, [records, groupColumn, valueColumn, aggFn, presetData]);
530
576
  const data = presetData || computed;
531
- return /* @__PURE__ */ jsx("div", { className: "h-full w-full min-h-[160px]", children: /* @__PURE__ */ jsx(
577
+ const s = withStyleDefaults(style);
578
+ const { frameClass, frameStyle, margin } = chartSizing(style, { top: 20, right: 20, bottom: 60, left: 60 });
579
+ return /* @__PURE__ */ jsx("div", { className: frameClass, style: frameStyle, children: /* @__PURE__ */ jsx(
532
580
  ResponsiveBar,
533
581
  {
534
582
  data,
535
583
  keys: ["value"],
536
584
  indexBy: "group",
537
- margin: { top: 20, right: 20, bottom: 60, left: 60 },
585
+ margin,
538
586
  padding: 0.3,
539
- colors: ["rgba(74, 222, 128, 0.8)"],
587
+ colors: [s.seriesColors[0] || "rgba(74, 222, 128, 0.8)"],
540
588
  borderColor: { from: "color", modifiers: [["darker", 1.6]] },
541
589
  axisBottom: makeAxis(style, "x", groupColumn),
542
590
  axisLeft: makeAxis(style, "y", valueColumn, { numeric: true }),
@@ -560,16 +608,19 @@ function PieView({ records, groupColumn, data: presetData, style }) {
560
608
  }, [records, groupColumn, presetData]);
561
609
  const data = presetData || computed;
562
610
  const legend = legendConfig(style);
563
- return /* @__PURE__ */ jsx("div", { className: "h-full w-full min-h-[160px]", children: /* @__PURE__ */ jsx(
611
+ const s = withStyleDefaults(style);
612
+ const { frameClass, frameStyle, margin } = chartSizing(style, { top: 20, right: 120, bottom: 20, left: 20 });
613
+ const colorById = new Map(data.map((d, i) => [d.id, seriesColor(i, s)]));
614
+ return /* @__PURE__ */ jsx("div", { className: frameClass, style: frameStyle, children: /* @__PURE__ */ jsx(
564
615
  ResponsivePie,
565
616
  {
566
617
  data,
567
- margin: { top: 20, right: 120, bottom: 20, left: 20 },
618
+ margin,
568
619
  innerRadius: 0.4,
569
620
  padAngle: 1,
570
621
  cornerRadius: 3,
571
622
  activeOuterRadiusOffset: 8,
572
- colors: { scheme: "set2" },
623
+ colors: ((d) => colorById.get(d.id)),
573
624
  borderWidth: 1,
574
625
  borderColor: { from: "color", modifiers: [["darker", 0.2]] },
575
626
  arcLinkLabelsSkipAngle: 10,
@@ -596,29 +647,54 @@ function LineView({ records, xColumn, yColumn, data: presetData, style }) {
596
647
  }];
597
648
  }, [records, xColumn, yColumn, presetData]);
598
649
  const data = presetData || computed;
599
- return /* @__PURE__ */ jsx("div", { className: "h-full w-full min-h-[160px]", children: /* @__PURE__ */ jsx(
650
+ const s = withStyleDefaults(style);
651
+ const { frameClass, frameStyle, margin } = chartSizing(style, { top: 20, right: 20, bottom: 60, left: 60 });
652
+ const colorById = new Map(data.map((serie, i) => [
653
+ serie.id,
654
+ s.seriesColors.length || data.length > 1 ? seriesColor(i, s) : "rgba(96, 165, 250, 0.9)"
655
+ ]));
656
+ const tickValues = thinTicks(data[0]?.data.map((d) => d.x) ?? [], s.maxXTicks);
657
+ return /* @__PURE__ */ jsx("div", { className: frameClass, style: frameStyle, children: /* @__PURE__ */ jsx(
600
658
  ResponsiveLine,
601
659
  {
602
660
  data,
603
- margin: { top: 20, right: 20, bottom: 60, left: 60 },
661
+ margin,
604
662
  xScale: { type: "point" },
605
663
  yScale: { type: "linear", min: "auto", max: "auto" },
606
664
  curve: "monotoneX",
607
665
  enableArea: true,
608
666
  areaOpacity: 0.15,
609
- colors: ["rgba(96, 165, 250, 0.9)"],
667
+ colors: ((serie) => colorById.get(serie.id)),
610
668
  pointSize: (data[0]?.data.length ?? 0) > 50 ? 0 : 6,
611
669
  pointColor: { theme: "background" },
612
670
  pointBorderWidth: 2,
613
671
  pointBorderColor: { from: "serieColor" },
614
672
  enableGridX: false,
615
- axisBottom: makeAxis(style, "x", xColumn),
673
+ axisBottom: { ...makeAxis(style, "x", xColumn), ...tickValues ? { tickValues } : {} },
616
674
  axisLeft: makeAxis(style, "y", yColumn, { numeric: true }),
617
675
  useMesh: true,
618
676
  theme: buildNivoTheme(style)
619
677
  }
620
678
  ) });
621
679
  }
680
+ function SparklineView({ data, height = 56, color = "#3987e5" }) {
681
+ const gradientId = useId();
682
+ const width = 260;
683
+ const pts = data && data.length ? data : [0];
684
+ const max = Math.max(...pts, 1);
685
+ const dx = pts.length > 1 ? width / (pts.length - 1) : width;
686
+ const xy = (v, i) => [i * dx, height - v / max * (height - 4) - 2];
687
+ const line = pts.map((v, i) => `${i === 0 ? "M" : "L"} ${xy(v, i)[0].toFixed(1)} ${xy(v, i)[1].toFixed(1)}`).join(" ");
688
+ const area = `${line} L ${width} ${height} L 0 ${height} Z`;
689
+ return /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${width} ${height}`, height, className: "w-full", preserveAspectRatio: "none", children: [
690
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
691
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.25" }),
692
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
693
+ ] }) }),
694
+ /* @__PURE__ */ jsx("path", { d: area, fill: `url(#${gradientId})` }),
695
+ /* @__PURE__ */ jsx("path", { d: line, fill: "none", stroke: color, strokeWidth: "2", vectorEffect: "non-scaling-stroke" })
696
+ ] });
697
+ }
622
698
  function ScatterView({ records, xColumn, yColumn, data: presetData, style }) {
623
699
  const computed = useMemo(() => {
624
700
  if (presetData || !records) return [];
@@ -626,14 +702,20 @@ function ScatterView({ records, xColumn, yColumn, data: presetData, style }) {
626
702
  return [{ id: `${xColumn} vs ${yColumn}`, data: points }];
627
703
  }, [records, xColumn, yColumn, presetData]);
628
704
  const data = presetData || computed;
629
- return /* @__PURE__ */ jsx("div", { className: "h-full w-full min-h-[160px]", children: /* @__PURE__ */ jsx(
705
+ const s = withStyleDefaults(style);
706
+ const { frameClass, frameStyle, margin } = chartSizing(style, { top: 20, right: 20, bottom: 60, left: 60 });
707
+ const colorById = new Map(data.map((serie, i) => [
708
+ serie.id,
709
+ s.seriesColors.length || data.length > 1 ? seriesColor(i, s) : "rgba(167, 139, 250, 0.7)"
710
+ ]));
711
+ return /* @__PURE__ */ jsx("div", { className: frameClass, style: frameStyle, children: /* @__PURE__ */ jsx(
630
712
  ResponsiveScatterPlot,
631
713
  {
632
714
  data,
633
- margin: { top: 20, right: 20, bottom: 60, left: 60 },
715
+ margin,
634
716
  xScale: { type: "linear", min: "auto", max: "auto" },
635
717
  yScale: { type: "linear", min: "auto", max: "auto" },
636
- colors: ["rgba(167, 139, 250, 0.7)"],
718
+ colors: ((serie) => colorById.get(serie.serieId ?? serie.id ?? "")),
637
719
  nodeSize: 6,
638
720
  axisBottom: makeAxis(style, "x", xColumn, { numeric: true }),
639
721
  axisLeft: makeAxis(style, "y", yColumn, { numeric: true }),
@@ -729,8 +811,8 @@ function HeatmapView({
729
811
  if (!data.length || !data[0].data.length) {
730
812
  return /* @__PURE__ */ jsx("div", { className: "p-8 text-center text-midnight-text-muted", children: "Not enough distinct values for a heatmap" });
731
813
  }
732
- const margin = showTotals ? { top: 60, right: 70, bottom: 60, left: 100 } : { top: 60, right: 20, bottom: 20, left: 100 };
733
- return /* @__PURE__ */ jsx("div", { className: "h-full w-full min-h-[160px]", children: /* @__PURE__ */ jsx(
814
+ const { frameClass, frameStyle, margin } = chartSizing(style, showTotals ? { top: 60, right: 70, bottom: 60, left: 100 } : { top: 60, right: 20, bottom: 20, left: 100 });
815
+ return /* @__PURE__ */ jsx("div", { className: frameClass, style: frameStyle, children: /* @__PURE__ */ jsx(
734
816
  ResponsiveHeatMap,
735
817
  {
736
818
  data,
@@ -884,11 +966,12 @@ function HeatmapPlusView({
884
966
  }
885
967
  const { nivoData, t } = built;
886
968
  const tAt = (serieId, x) => t.get(cellKey(serieId, x)) ?? 0;
887
- return /* @__PURE__ */ jsx("div", { className: "h-full w-full min-h-[160px]", children: /* @__PURE__ */ jsx(
969
+ const { frameClass, frameStyle, margin } = chartSizing(style, { top: 60, right: 20, bottom: showMargins ? 60 : 20, left: 100 });
970
+ return /* @__PURE__ */ jsx("div", { className: frameClass, style: frameStyle, children: /* @__PURE__ */ jsx(
888
971
  ResponsiveHeatMap,
889
972
  {
890
973
  data: nivoData,
891
- margin: { top: 60, right: 20, bottom: showMargins ? 60 : 20, left: 100 },
974
+ margin,
892
975
  valueFormat: ((v) => fmtNum2(v)),
893
976
  axisTop: { tickSize: 5, tickPadding: 5, tickRotation: s.xTickRotation, legend: s.showXLegend ? s.xAxisLabel || colColumn : "", legendPosition: s.xLegendPosition, legendOffset: -50 },
894
977
  axisLeft: { tickSize: 5, tickPadding: 5, legend: s.showYLegend ? s.yAxisLabel || rowColumn : "", legendPosition: s.yLegendPosition, legendOffset: -80 },
@@ -2900,6 +2983,6 @@ function DataExplorer({
2900
2983
  ] });
2901
2984
  }
2902
2985
 
2903
- export { BarView, ChartBuilder, ChartStyleControls, DEFAULT_CHART_STYLE, DashboardProvider, DashboardRenderer, DataExplorer, HEAT_STATS, HeatmapPlusView, HeatmapView, InsightView, LEGEND_ANCHORS, LineView, MetricView, PanelChart, PieView, PivotView, ScatterView, SqlConsole, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, heatColor, heatLabelColor, legendConfig, normalizeCells, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
2986
+ export { BarView, ChartBuilder, ChartStyleControls, DEFAULT_CHART_STYLE, DEFAULT_SERIES_COLORS, DashboardProvider, DashboardRenderer, DataExplorer, HEAT_STATS, HeatmapPlusView, HeatmapView, InsightView, LEGEND_ANCHORS, LineView, MetricView, PanelChart, PieView, PivotView, SERIES_OVERFLOW_COLOR, ScatterView, SparklineView, SqlConsole, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, chartSizing, compileWhere, groupBy, heatColor, heatLabelColor, legendConfig, normalizeCells, qIdent, qLit, seriesColor, shapeChartData, thinTicks, useCapabilities, useDashboard, withStyleDefaults };
2904
2987
  //# sourceMappingURL=index.js.map
2905
2988
  //# sourceMappingURL=index.js.map