@quantumwake/terminal-ux-dashboard-components 0.1.24 → 0.1.26

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
@@ -148,6 +148,7 @@ interface ChartStyle {
148
148
  areaOpacity: number;
149
149
  yFromZero: boolean;
150
150
  barLabels: boolean;
151
+ animate: boolean;
151
152
  seriesColors: string[];
152
153
  }
153
154
  declare const DEFAULT_CHART_STYLE: ChartStyle;
package/dist/index.d.ts CHANGED
@@ -148,6 +148,7 @@ interface ChartStyle {
148
148
  areaOpacity: number;
149
149
  yFromZero: boolean;
150
150
  barLabels: boolean;
151
+ animate: boolean;
151
152
  seriesColors: string[];
152
153
  }
153
154
  declare const DEFAULT_CHART_STYLE: ChartStyle;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useMemo, useId, useState, useEffect, useRef, useCallback, Suspense } from 'react';
1
+ import { createContext, useContext, useMemo, useRef, useId, useState, useEffect, 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';
@@ -277,6 +277,7 @@ var DEFAULT_CHART_STYLE = {
277
277
  areaOpacity: 0.15,
278
278
  yFromZero: false,
279
279
  barLabels: true,
280
+ animate: false,
280
281
  seriesColors: []
281
282
  };
282
283
  var DEFAULT_SERIES_COLORS = [
@@ -603,6 +604,7 @@ function BarView({ records, groupColumn, valueColumn, aggFn = "count", data: pre
603
604
  labelSkipWidth: 12,
604
605
  labelSkipHeight: 12,
605
606
  labelTextColor: { from: "color", modifiers: [["darker", 3]] },
607
+ animate: s.animate,
606
608
  theme: buildNivoTheme(style)
607
609
  }
608
610
  ) });
@@ -641,6 +643,7 @@ function PieView({ records, groupColumn, data: presetData, style }) {
641
643
  arcLabelsSkipAngle: 10,
642
644
  arcLabelsTextColor: { from: "color", modifiers: [["darker", 3]] },
643
645
  legends: legend ? [legend] : [],
646
+ animate: s.animate,
644
647
  theme: buildNivoTheme(style)
645
648
  }
646
649
  ) });
@@ -667,10 +670,12 @@ function LineView({ records, xColumn, yColumn, data: presetData, style }) {
667
670
  ]));
668
671
  const longest = data.reduce((a, b) => b.data.length > a.data.length ? b : a, { id: "", data: [] });
669
672
  const tickValues = thinTicks(longest.data.map((d) => d.x), s.maxXTicks);
673
+ const ceilRef = useRef(0);
670
674
  let yScale = { type: "linear", min: "auto", max: "auto" };
671
675
  if (s.yFromZero) {
672
676
  const dataMax = Math.max(0, ...data.flatMap((serie) => serie.data.map((d) => Math.max(d.y, d.hi ?? d.y))));
673
- yScale = { type: "linear", min: 0, max: niceCeil(dataMax) };
677
+ ceilRef.current = Math.max(ceilRef.current, niceCeil(dataMax));
678
+ yScale = { type: "linear", min: 0, max: ceilRef.current };
674
679
  }
675
680
  const bandedIds = new Set(data.filter((serie) => serie.data.some((d) => d.lo != null)).map((serie) => serie.id));
676
681
  const bandsLayer = ({ series, yScale: yScale2, lineGenerator }) => /* @__PURE__ */ jsx(Fragment, { children: series.map((serie) => {
@@ -712,6 +717,7 @@ function LineView({ records, xColumn, yColumn, data: presetData, style }) {
712
717
  axisLeft: makeAxis(style, "y", yColumn, { numeric: true }),
713
718
  useMesh: true,
714
719
  layers: ["grid", "markers", "axes", "areas", bandsLayer, linesLayer, "crosshair", "slices", "mesh", "legends"],
720
+ animate: s.animate,
715
721
  theme: buildNivoTheme(style)
716
722
  }
717
723
  ) });
@@ -773,6 +779,7 @@ function ScatterView({ records, xColumn, yColumn, data: presetData, style }) {
773
779
  axisBottom: makeAxis(style, "x", xColumn, { numeric: true }),
774
780
  axisLeft: makeAxis(style, "y", yColumn, { numeric: true }),
775
781
  useMesh: true,
782
+ animate: s.animate,
776
783
  theme: buildNivoTheme(style)
777
784
  }
778
785
  ) });
@@ -880,6 +887,7 @@ function HeatmapView({
880
887
  borderColor: "#334155",
881
888
  labelTextColor: { from: "color", modifiers: [["darker", 3]] },
882
889
  hoverTarget: "cell",
890
+ animate: s.animate,
883
891
  theme: buildNivoTheme(style)
884
892
  }
885
893
  ) });
@@ -1034,6 +1042,7 @@ function HeatmapPlusView({
1034
1042
  borderColor: "#334155",
1035
1043
  labelTextColor: ((cell) => heatLabelColor(tAt(cell.serieId, cell.data.x))),
1036
1044
  hoverTarget: "cell",
1045
+ animate: s.animate,
1037
1046
  theme: buildNivoTheme(style)
1038
1047
  }
1039
1048
  ) });