@turquoisehealth/pit-viper 2.224.1-dev.3 → 2.225.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.
@@ -1,6 +1,5 @@
1
1
  import { ChipSection, CrosslineOverlayGroup, VerticalLineOverlay } from './types';
2
2
  export declare const DEFAULT_CROSSLINE_OVERLAY_COLOR = "#E7E2D9";
3
- export declare const LEGACY_CROSSLINE_OVERLAY_COLOR = "#7C8AF4";
4
3
  export declare const scaleValueToIndex: (value: number, buckets: {
5
4
  bucketMin: number;
6
5
  bucketMax: number;
@@ -11,7 +10,7 @@ export interface CrosslineAxisDomain {
11
10
  axisMin: number;
12
11
  axisMax: number;
13
12
  }
14
- export declare const getCrosslineAxisDomain: (numCategories: number, showDistributionRangeLabels: boolean | undefined) => CrosslineAxisDomain;
13
+ export declare const getCrosslineAxisDomain: (numCategories: number, isHistogramWithBuckets: boolean | undefined) => CrosslineAxisDomain;
15
14
  export declare const scaledIndexToAxisFraction: (scaledValue: number, domain: CrosslineAxisDomain) => number;
16
15
  export declare const resolveCrosslineOverlays: (groups: CrosslineOverlayGroup[], activeGroupIds: Set<string>) => VerticalLineOverlay[];
17
16
  export declare const computeChipSections: (groups: CrosslineOverlayGroup[], activeGroupIds: Set<string>, formatValue: (value: number) => string | number) => ChipSection[];
@@ -75,9 +75,8 @@ export declare const calculateMinChartSeriesValue: (data: any[] | undefined, ser
75
75
  * Builds the category axis's label formatter. Exactly one of three behaviors applies:
76
76
  * - `hideLabel`: every label is blank (e.g. a chart type that doesn't show x-axis labels).
77
77
  * - `showDistributionRangeLabels`: only the two blank pad categories flanking a histogram's
78
- * real buckets (under `useDistributionV2Styling`) are labeled, with the overall lowest
79
- * min / highest max bucket boundary; every other category (including the real buckets
80
- * themselves) is blank.
78
+ * real buckets are labeled, with the overall lowest min / highest max bucket boundary;
79
+ * every other category (including the real buckets themselves) is blank.
81
80
  * - Otherwise: normal category labels, formatted via `columnValueFormatter`, with the
82
81
  * separator/single-bar-padding sentinel categories hidden, a focus suffix appended, and
83
82
  * the result truncated to `MAX_LABEL_LENGTH`.
@@ -142,12 +142,6 @@ export interface PvDataTableWithChartProps<T> extends PvDataTableProps<T> {
142
142
  showSeriesLabels?: boolean;
143
143
  /** When true, truncates long category labels on the chart axis. */
144
144
  truncateLabelValues?: boolean;
145
- /**
146
- * Gate for distribution/histogram chart styling changes that must ship together.
147
- * When true, notates the x-axis of histogram charts with the overall lowest min
148
- * (left) and highest max (right) bucket bounds.
149
- */
150
- useDistributionV2Styling?: boolean;
151
145
  /** Pre-populated chart data to render before any server-side fetch completes. */
152
146
  initialChartData?: AgChartOptions["data"];
153
147
  /** When true, wraps large charts in a native Pit Viper-styled scroll container. */
@@ -9,7 +9,6 @@ export interface CrosslineTooltip {
9
9
  }
10
10
  interface UseBenchmarkOverlaysOptions {
11
11
  crosslineOverlayGroups: ComputedRef<CrosslineOverlayGroup[]>;
12
- useDistributionV2Styling: ComputedRef<boolean | undefined>;
13
12
  isHistogramWithBuckets: ComputedRef<boolean | undefined>;
14
13
  isHorizontalBarChart: ComputedRef<boolean>;
15
14
  computedChartData: ComputedRef<{
@@ -13881,46 +13881,46 @@ var zp = (e, t) => {
13881
13881
  }), [...r.values()];
13882
13882
  }, Wp = (e) => !!(e.visible && !e.disabled);
13883
13883
  function Gp(e) {
13884
- let { crosslineOverlayGroups: t, useDistributionV2Styling: n, isHistogramWithBuckets: i, isHorizontalBarChart: a, computedChartData: o, pvChartRef: s, formatValue: c, initialActiveOverlayGroupIds: l } = e, u = k(new Set(l?.value ?? t.value.filter((e) => Wp(e)).map((e) => e.id))), d = new Map(t.value.map((e) => [e.id, Wp(e)]));
13884
+ let { crosslineOverlayGroups: t, isHistogramWithBuckets: n, isHorizontalBarChart: i, computedChartData: a, pvChartRef: o, formatValue: s, initialActiveOverlayGroupIds: c } = e, l = k(new Set(c?.value ?? t.value.filter((e) => Wp(e)).map((e) => e.id))), u = new Map(t.value.map((e) => [e.id, Wp(e)]));
13885
13885
  U(t, (e) => {
13886
- let t = new Set(u.value), n = !1, r = l?.value !== void 0;
13886
+ let t = new Set(l.value), n = !1, r = c?.value !== void 0;
13887
13887
  for (let i of e) {
13888
- let e = Wp(i), a = d.has(i.id) ? !d.get(i.id) : !r;
13889
- e && a ? (t.add(i.id), n = !0) : !e && d.get(i.id) && (t.delete(i.id), n = !0);
13888
+ let e = Wp(i), a = u.has(i.id) ? !u.get(i.id) : !r;
13889
+ e && a ? (t.add(i.id), n = !0) : !e && u.get(i.id) && (t.delete(i.id), n = !0);
13890
13890
  }
13891
- d = new Map(e.map((e) => [e.id, Wp(e)])), n && (u.value = t);
13891
+ u = new Map(e.map((e) => [e.id, Wp(e)])), n && (l.value = t);
13892
13892
  });
13893
- let f = r(() => Hp(t.value, u.value)), p = r(() => n.value ? Up(t.value, u.value, c) : []), m = k(null);
13893
+ let d = r(() => Hp(t.value, l.value)), f = r(() => Up(t.value, l.value, s)), p = k(null);
13894
13894
  return {
13895
- activeCrosslineOverlayGroups: u,
13896
- resolvedCrosslineOverlays: f,
13897
- chipSections: p,
13898
- hoveredBenchmarkKey: m,
13895
+ activeCrosslineOverlayGroups: l,
13896
+ resolvedCrosslineOverlays: d,
13897
+ chipSections: f,
13898
+ hoveredBenchmarkKey: p,
13899
13899
  hoveredCrosslineTooltip: r(() => {
13900
- if (!m.value || !o.value) return null;
13901
- let e = f.value.find((e) => e.key === m.value);
13900
+ if (!p.value || !a.value) return null;
13901
+ let e = d.value.find((e) => e.key === p.value);
13902
13902
  if (!e) return null;
13903
- let t = zp(e.value, o.value);
13903
+ let t = zp(e.value, a.value);
13904
13904
  if (t == null) return null;
13905
- let r = (s.value?.$el)?.querySelector(".ag-charts-series-area")?.getBoundingClientRect();
13905
+ let r = (o.value?.$el)?.querySelector(".ag-charts-series-area")?.getBoundingClientRect();
13906
13906
  if (!r) return null;
13907
- let l = Vp(t, Bp(o.value.length || 1, i.value && n.value)), u = e.formatValue ? e.formatValue(e.value) : c(e.value);
13908
- return a.value ? {
13907
+ let c = Vp(t, Bp(a.value.length || 1, n.value)), l = e.formatValue ? e.formatValue(e.value) : s(e.value);
13908
+ return i.value ? {
13909
13909
  label: e.label,
13910
- value: u,
13910
+ value: l,
13911
13911
  arrowClass: "ag-charts-tooltip--arrow-left",
13912
13912
  style: {
13913
13913
  "--left": `${r.left + 8}px`,
13914
- "--top": `${r.top + (1 - l) * r.height}px`,
13914
+ "--top": `${r.top + (1 - c) * r.height}px`,
13915
13915
  transform: "translateY(-50%)",
13916
13916
  pointerEvents: "none"
13917
13917
  }
13918
13918
  } : {
13919
13919
  label: e.label,
13920
- value: u,
13920
+ value: l,
13921
13921
  arrowClass: "ag-charts-tooltip--arrow-bottom",
13922
13922
  style: {
13923
- "--left": `${r.left + l * r.width}px`,
13923
+ "--left": `${r.left + c * r.width}px`,
13924
13924
  "--top": `${r.top - 8}px`,
13925
13925
  transform: "translate(-50%, -100%)",
13926
13926
  pointerEvents: "none"
@@ -13967,10 +13967,6 @@ var Kp = { style: {
13967
13967
  type: Boolean,
13968
13968
  default: !0
13969
13969
  },
13970
- useDistributionV2Styling: {
13971
- type: Boolean,
13972
- default: !1
13973
- },
13974
13970
  initialChartData: {},
13975
13971
  enableChartScrolling: {
13976
13972
  type: Boolean,
@@ -14374,7 +14370,7 @@ var Kp = { style: {
14374
14370
  });
14375
14371
  }
14376
14372
  });
14377
- let Be = (e) => e?.label ?? "", Ve = r(() => Be(ne(V.value, Q.value))), He = r(() => ne(H.value, Ne.value)), Ue = r(() => Be(He.value)), We = r(() => Oe.value.isHorizontal === !0), Ge = r(() => P.value.length > 1), Ke = r(() => !we.value || V.value.length === 0 ? [] : Oe.value.seriesFamily === "pie" ? Qe.value : Ze.value), qe = r(() => we.value?.id === "histogram" && l.useDistributionV2Styling ? !1 : l.showSeriesLabels), Je = r(() => we.value?.id.includes("stacked")), Ye = r(() => P.value.length > 1), Xe = r(() => we.value?.id === "histogram" && at.value && at.value.length > 0 && typeof at.value[0]?.bucketMin == "number" && typeof at.value[0]?.bucketMax == "number"), Ze = r(() => {
14373
+ let Be = (e) => e?.label ?? "", Ve = r(() => Be(ne(V.value, Q.value))), He = r(() => ne(H.value, Ne.value)), Ue = r(() => Be(He.value)), We = r(() => Oe.value.isHorizontal === !0), Ge = r(() => P.value.length > 1), Ke = r(() => !we.value || V.value.length === 0 ? [] : Oe.value.seriesFamily === "pie" ? Qe.value : Ze.value), qe = r(() => we.value?.id === "histogram" ? !1 : l.showSeriesLabels), Je = r(() => we.value?.id.includes("stacked")), Ye = r(() => P.value.length > 1), Xe = r(() => we.value?.id === "histogram" && at.value && at.value.length > 0 && typeof at.value[0]?.bucketMin == "number" && typeof at.value[0]?.bucketMax == "number"), Ze = r(() => {
14378
14374
  let e = Je.value, t = Oe.value.agChartType, n = [], r = ve(Q.value, !0), i = ve(Fe.value?.fieldName, !0), a = (e) => t === "line" ? {} : { placement: e };
14379
14375
  if (Ge.value) Fe.value?.fieldValues.forEach((o) => {
14380
14376
  let s = {
@@ -14475,7 +14471,7 @@ var Kp = { style: {
14475
14471
  label: { enabled: !1 },
14476
14472
  tooltip: { enabled: !1 },
14477
14473
  visible: !1
14478
- }, { categoryPadOffset: i } = Bp(e, Xe.value && l.useDistributionV2Styling), a = {
14474
+ }, { categoryPadOffset: i } = Bp(e, !0), a = {
14479
14475
  type: "scatter",
14480
14476
  xKey: "__dummy_x__",
14481
14477
  yKey: "__dummy_y__",
@@ -14678,7 +14674,6 @@ var Kp = { style: {
14678
14674
  return e;
14679
14675
  }), { activeCrosslineOverlayGroups: st, resolvedCrosslineOverlays: ct, chipSections: lt, hoveredBenchmarkKey: ut, hoveredCrosslineTooltip: dt } = Gp({
14680
14676
  crosslineOverlayGroups: Pe,
14681
- useDistributionV2Styling: r(() => l.useDistributionV2Styling),
14682
14677
  isHistogramWithBuckets: Xe,
14683
14678
  isHorizontalBarChart: We,
14684
14679
  computedChartData: at,
@@ -14777,22 +14772,22 @@ var Kp = { style: {
14777
14772
  }), zt = r(() => Lt.value || ce.value || !l.isLoading && Rt.value !== ""), Bt = r(() => {
14778
14773
  let e = {};
14779
14774
  e.overlays = { noData: { text: "" } };
14780
- let t = Xe.value && l.useDistributionV2Styling, n = t ? [
14775
+ let t = Xe.value ? [
14781
14776
  { [I.value]: Jo },
14782
14777
  ...at.value ?? [],
14783
14778
  { [I.value]: Yo }
14784
14779
  ] : at.value;
14785
- e.data = zt.value ? [] : n, e.legend = {
14780
+ e.data = zt.value ? [] : t, e.legend = {
14786
14781
  toggleSeries: !1,
14787
14782
  preventHidingAll: !0,
14788
14783
  enabled: P.value.length > 1
14789
14784
  };
14790
- let r = Ge.value ? Fe.value?.fieldValues.map((e) => Ss(Q.value, e)) || [] : Q.value ? [Q.value] : [], i = (() => {
14785
+ let n = Ge.value ? Fe.value?.fieldValues.map((e) => Ss(Q.value, e)) || [] : Q.value ? [Q.value] : [], r = (() => {
14791
14786
  if (!Ne.value) return [];
14792
14787
  let e = Ne.value;
14793
14788
  return Je.value ? [`${e}${Qo}`] : Ge.value ? Fe.value?.fieldValues.map((t) => Ss(e, String(t))) || [] : [e];
14794
- })(), a = Oe.value.xAxis.hideLabel === !0 && !t, o = [];
14795
- if (o.push({
14789
+ })(), i = Oe.value.xAxis.hideLabel === !0 && !Xe.value, a = [];
14790
+ if (a.push({
14796
14791
  type: "category",
14797
14792
  keys: [I.value],
14798
14793
  position: We.value ? "left" : "bottom",
@@ -14810,10 +14805,10 @@ var Kp = { style: {
14810
14805
  autoRotate: !0,
14811
14806
  truncate: !1,
14812
14807
  wrapping: "never",
14813
- ...t ? { spacing: 2 } : {},
14808
+ ...Xe.value ? { spacing: 2 } : {},
14814
14809
  formatter: Os({
14815
- hideLabel: a,
14816
- showDistributionRangeLabels: !!t,
14810
+ hideLabel: i,
14811
+ showDistributionRangeLabels: !!Xe.value,
14817
14812
  chartData: at.value,
14818
14813
  formatBucketBoundary: Se,
14819
14814
  columnValueFormatter: ve(I.value),
@@ -14823,71 +14818,71 @@ var Kp = { style: {
14823
14818
  })
14824
14819
  },
14825
14820
  paddingInner: Nt.value,
14826
- paddingOuter: t ? 0 : Pt.value,
14821
+ paddingOuter: Xe.value ? 0 : Pt.value,
14827
14822
  groupPaddingInner: Ft.value
14828
14823
  }), Xe.value && ct.value.length > 0) {
14829
- let { categoryPadOffset: e, axisMin: n, axisMax: r } = Bp(at.value?.length || 1, t);
14830
- o.push({
14824
+ let { categoryPadOffset: e, axisMin: t, axisMax: n } = Bp(at.value?.length || 1, !0);
14825
+ a.push({
14831
14826
  type: "number",
14832
14827
  keys: ["__dummy_x__"],
14833
14828
  position: We.value ? "left" : "bottom",
14834
14829
  crosshair: { enabled: !1 },
14835
- min: n,
14836
- max: r,
14830
+ min: t,
14831
+ max: n,
14837
14832
  nice: !1,
14838
14833
  label: { enabled: !1 },
14839
14834
  tick: { enabled: !1 },
14840
14835
  line: { enabled: !1 },
14841
14836
  gridLine: { enabled: !1 },
14842
- crossLines: ct.value.map((n) => {
14837
+ crossLines: ct.value.map((t) => {
14843
14838
  if (!at.value) return null;
14844
- let r = zp(n.value, at.value);
14845
- if (r == null) return null;
14846
- let i = ut.value != null && n.key === ut.value, a = ut.value != null && !i;
14839
+ let n = zp(t.value, at.value);
14840
+ if (n == null) return null;
14841
+ let r = ut.value != null && t.key === ut.value, i = ut.value != null && !r;
14847
14842
  return {
14848
14843
  type: "line",
14849
- value: r + e,
14850
- stroke: n.color || (t ? "#E7E2D9" : "#7C8AF4"),
14851
- strokeWidth: i ? 3 : 2,
14852
- strokeOpacity: a ? .2 : i ? 1 : .8,
14844
+ value: n + e,
14845
+ stroke: t.color || "#E7E2D9",
14846
+ strokeWidth: r ? 3 : 2,
14847
+ strokeOpacity: i ? .2 : r ? 1 : .8,
14853
14848
  lineDash: [6, 3]
14854
14849
  };
14855
14850
  }).filter((e) => e !== null)
14856
14851
  });
14857
14852
  }
14858
- let s = !!Ne.value, c = s ? He.value?.secondaryAxisMax : void 0, u = s && Number.isFinite(At.value) && At.value < 0, d = s && Number.isFinite(jt.value) && jt.value < 0, f = u || d, p = s ? _s(Ot.value, 5) : 0, m = s ? c ?? _s(kt.value, 5) : 0, h = s && !f && p > 0 && m > 0;
14859
- if (o.push({
14853
+ let o = !!Ne.value, s = o ? He.value?.secondaryAxisMax : void 0, c = o && Number.isFinite(At.value) && At.value < 0, u = o && Number.isFinite(jt.value) && jt.value < 0, d = c || u, f = o ? _s(Ot.value, 5) : 0, p = o ? s ?? _s(kt.value, 5) : 0, m = o && !d && f > 0 && p > 0;
14854
+ if (a.push({
14860
14855
  type: "number",
14861
- keys: r,
14856
+ keys: n,
14862
14857
  position: We.value ? "bottom" : "left",
14863
- ...h ? {
14858
+ ...m ? {
14864
14859
  min: 0,
14865
- max: p,
14860
+ max: f,
14866
14861
  nice: !1,
14867
- interval: { step: p / 5 }
14862
+ interval: { step: f / 5 }
14868
14863
  } : {},
14869
14864
  label: { formatter: ve(Q.value) },
14870
14865
  title: {
14871
14866
  enabled: !0,
14872
14867
  text: Ve.value
14873
14868
  }
14874
- }), s && o.push({
14869
+ }), o && a.push({
14875
14870
  type: "number",
14876
- keys: i,
14871
+ keys: r,
14877
14872
  position: We.value ? "top" : "right",
14878
14873
  crosshair: { enabled: !1 },
14879
- ...h ? {
14874
+ ...m ? {
14880
14875
  min: 0,
14881
- max: m,
14876
+ max: p,
14882
14877
  nice: !1,
14883
- interval: { step: m / 5 }
14878
+ interval: { step: p / 5 }
14884
14879
  } : {
14885
- ...d ? {} : { min: 0 },
14886
- ...c === void 0 ? {} : {
14887
- max: c,
14880
+ ...u ? {} : { min: 0 },
14881
+ ...s === void 0 ? {} : {
14882
+ max: s,
14888
14883
  nice: !1
14889
14884
  },
14890
- ...f ? { gridLine: { enabled: !1 } } : {}
14885
+ ...d ? { gridLine: { enabled: !1 } } : {}
14891
14886
  },
14892
14887
  label: { color: _t },
14893
14888
  title: {
@@ -14897,7 +14892,7 @@ var Kp = { style: {
14897
14892
  }
14898
14893
  }), Xe.value && ct.value.length > 0) {
14899
14894
  let e = Number.isFinite(Ot.value) ? Ot.value : 0;
14900
- o.push({
14895
+ a.push({
14901
14896
  type: "number",
14902
14897
  keys: ["__dummy_y__"],
14903
14898
  position: "left",
@@ -14911,7 +14906,7 @@ var Kp = { style: {
14911
14906
  gridLine: { enabled: !1 }
14912
14907
  });
14913
14908
  }
14914
- return e.axes = o, e.series = Ke.value, e;
14909
+ return e.axes = a, e.series = Ke.value, e;
14915
14910
  }), Vt = r(() => E.value || l.isLoading && (!at.value || at.value.length === 0)), Ht = r(() => Lt.value || !ce.value && !l.isLoading && Rt.value !== ""), Ut = (e) => {
14916
14911
  b.value = e, d("chart-collapsed", e);
14917
14912
  }, Wt = (e) => {