@sequenceholdings/atlas-ui 0.1.3 → 0.1.5

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/charts.d.ts CHANGED
@@ -57,6 +57,7 @@ export declare const CHART_JS_TOOLTIP_STYLE: {
57
57
  readonly boxPadding: 4;
58
58
  };
59
59
 
60
+ /** DES-334: computed — Chart.js / Recharts tick APIs take numeric px, not CSS vars */
60
61
  export declare const CHART_TICK: {
61
62
  readonly fontSize: 10;
62
63
  readonly fill: "#94A3B8";
@@ -64,10 +65,10 @@ export declare const CHART_TICK: {
64
65
  };
65
66
 
66
67
  export declare const CHART_TOOLTIP: {
67
- readonly borderRadius: 8;
68
+ readonly borderRadius: "var(--corner-surface-nested)";
68
69
  readonly border: "1px solid #E2E8F0";
69
- readonly boxShadow: "0 2px 8px rgba(0,0,0,0.06)";
70
- readonly fontSize: 12;
70
+ readonly boxShadow: "var(--elevation-popover)";
71
+ readonly fontSize: "var(--type-caption)";
71
72
  readonly fontFamily: "ui-monospace, monospace";
72
73
  };
73
74
 
@@ -127,7 +128,7 @@ declare interface StackedBarChartProps {
127
128
  labels: string[];
128
129
  datasets: BarDataset[];
129
130
  stacked?: boolean;
130
- yFormat?: 'currency' | 'count';
131
+ yFormat?: 'currency' | 'count' | 'percent';
131
132
  onClick?: (index: number) => void;
132
133
  barTotals?: boolean;
133
134
  maxTicksLimit?: number;
@@ -135,7 +136,7 @@ declare interface StackedBarChartProps {
135
136
  className?: string;
136
137
  }
137
138
 
138
- export declare function TimeseriesLineChart({ labels, datasets, yFormat, tension, maxTicksLimit, height, className, }: TimeseriesLineChartProps): JSX.Element | null;
139
+ export declare function TimeseriesLineChart({ labels, datasets, yFormat, tension, maxTicksLimit, showPoints, showValueLabels, height, className, }: TimeseriesLineChartProps): JSX.Element | null;
139
140
 
140
141
  declare interface TimeseriesLineChartProps {
141
142
  labels: string[];
@@ -143,6 +144,8 @@ declare interface TimeseriesLineChartProps {
143
144
  yFormat?: 'currency' | 'percent' | 'number';
144
145
  tension?: number;
145
146
  maxTicksLimit?: number;
147
+ showPoints?: boolean;
148
+ showValueLabels?: boolean;
146
149
  height?: number;
147
150
  className?: string;
148
151
  }
package/dist/charts.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./utils-BZS7Y02J.js";
1
+ import { t as e } from "./utils-D-IFNYlh.js";
2
2
  import { forwardRef as t, useEffect as n, useMemo as r, useRef as i } from "react";
3
3
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
4
  //#region ../../../atlas/src/shared/components/ui/chart-card.tsx
@@ -7412,7 +7412,7 @@ function ll({ segments: e, centerLabel: t, centerValue: n, size: s = 220, classN
7412
7412
  className: "text-lg font-semibold text-foreground",
7413
7413
  children: n
7414
7414
  }), t && /* @__PURE__ */ a("span", {
7415
- className: "text-xs font-medium uppercase tracking-wider text-black-50",
7415
+ className: "text-xs font-medium uppercase tracking-wider text-muted-foreground",
7416
7416
  children: t
7417
7417
  })]
7418
7418
  })]
@@ -7491,13 +7491,19 @@ function ml({ labels: e, datasets: t, stacked: n = !0, yFormat: o = "currency",
7491
7491
  backgroundColor: e.color,
7492
7492
  borderColor: e.borderColor ?? e.color,
7493
7493
  borderWidth: +!!e.borderColor,
7494
- borderRadius: 3,
7495
- borderSkipped: !1
7494
+ borderRadius: o === "percent" ? 1 : 3,
7495
+ borderSkipped: !1,
7496
+ barPercentage: o === "percent" ? .72 : .9,
7497
+ categoryPercentage: o === "percent" ? .82 : .9
7496
7498
  }))
7497
- }), [e, t]), m = r(() => ({
7499
+ }), [
7500
+ e,
7501
+ t,
7502
+ o
7503
+ ]), m = r(() => ({
7498
7504
  responsive: !0,
7499
7505
  maintainAspectRatio: !1,
7500
- layout: c ? { padding: { top: 24 } } : void 0,
7506
+ layout: c ? { padding: { top: 24 } } : o === "percent" ? { padding: { top: 10 } } : void 0,
7501
7507
  interaction: {
7502
7508
  mode: "index",
7503
7509
  intersect: !1
@@ -7516,7 +7522,7 @@ function ml({ labels: e, datasets: t, stacked: n = !0, yFormat: o = "currency",
7516
7522
  callbacks: o === "currency" ? {
7517
7523
  label: (e) => ` ${e.dataset.label}: ${fl(e.raw)}`,
7518
7524
  footer: (e) => `Total: ${fl(e.reduce((e, t) => e + t.raw, 0))}`
7519
- } : void 0
7525
+ } : o === "percent" ? { label: (e) => ` ${e.dataset.label}: ${e.raw.toFixed(1)}%` } : void 0
7520
7526
  },
7521
7527
  legend: { display: !1 }
7522
7528
  },
@@ -7543,11 +7549,12 @@ function ml({ labels: e, datasets: t, stacked: n = !0, yFormat: o = "currency",
7543
7549
  family: "ui-monospace, monospace"
7544
7550
  },
7545
7551
  color: "#94A3B8",
7546
- callback: o === "currency" ? dl : void 0,
7552
+ callback: o === "currency" ? dl : o === "percent" ? (e) => Number(e) > 100 ? "" : `${e}%` : void 0,
7547
7553
  ...o === "count" ? { stepSize: 1 } : {}
7548
7554
  },
7549
7555
  border: { display: !1 },
7550
- beginAtZero: !0
7556
+ beginAtZero: !0,
7557
+ ...o === "percent" ? { max: 102 } : {}
7551
7558
  }
7552
7559
  }
7553
7560
  }), [
@@ -7601,8 +7608,11 @@ function _l(e) {
7601
7608
  maximumFractionDigits: 2
7602
7609
  }).format(e);
7603
7610
  }
7604
- function vl({ labels: e, datasets: t, yFormat: n = "currency", tension: i = .3, maxTicksLimit: o, height: s = 220, className: c }) {
7605
- let l = r(() => ({
7611
+ function vl(e, t) {
7612
+ return t === "currency" ? gl(e) : t === "percent" ? `${e.toFixed(0)}%` : e.toLocaleString();
7613
+ }
7614
+ function yl({ labels: e, datasets: t, yFormat: n = "currency", tension: i = .3, maxTicksLimit: o, showPoints: s = !1, showValueLabels: c = !1, height: l = 220, className: u }) {
7615
+ let d = r(() => ({
7606
7616
  labels: e,
7607
7617
  datasets: t.map((e) => ({
7608
7618
  label: e.label,
@@ -7611,17 +7621,36 @@ function vl({ labels: e, datasets: t, yFormat: n = "currency", tension: i = .3,
7611
7621
  backgroundColor: e.fill ? `${e.color}33` : "transparent",
7612
7622
  fill: e.fill ?? !1,
7613
7623
  tension: i,
7614
- pointRadius: 0,
7615
- pointHoverRadius: 4,
7624
+ pointRadius: s ? 3 : 0,
7625
+ pointHoverRadius: s ? 5 : 4,
7626
+ pointBackgroundColor: e.color,
7627
+ pointBorderColor: "#FFFFFF",
7628
+ pointBorderWidth: s ? 1.5 : 0,
7616
7629
  borderWidth: 2
7617
7630
  }))
7618
7631
  }), [
7619
7632
  e,
7620
7633
  t,
7621
- i
7622
- ]), u = r(() => ({
7634
+ i,
7635
+ s
7636
+ ]), f = r(() => ({
7637
+ id: "lineValueLabels",
7638
+ afterDatasetsDraw(e) {
7639
+ if (!c) return;
7640
+ let { ctx: t } = e;
7641
+ t.save(), t.font = "600 10px ui-monospace, monospace", t.fillStyle = "#64748B", t.textAlign = "center", t.textBaseline = "bottom", e.data.datasets.forEach((r, i) => {
7642
+ e.getDatasetMeta(i).data.forEach((i, a) => {
7643
+ let o = r.data[a];
7644
+ if (typeof o != "number") return;
7645
+ let s = vl(o, n), c = t.measureText(s).width / 2, l = Math.min(Math.max(i.x, e.chartArea.left + c + 4), e.chartArea.right - c - 4);
7646
+ t.fillText(s, l, i.y - 8);
7647
+ });
7648
+ }), t.restore();
7649
+ }
7650
+ }), [c, n]), p = r(() => ({
7623
7651
  responsive: !0,
7624
7652
  maintainAspectRatio: !1,
7653
+ layout: c ? { padding: { top: 20 } } : void 0,
7625
7654
  interaction: {
7626
7655
  mode: "index",
7627
7656
  intersect: !1
@@ -7668,23 +7697,28 @@ function vl({ labels: e, datasets: t, yFormat: n = "currency", tension: i = .3,
7668
7697
  ...n === "percent" ? { max: 100 } : {}
7669
7698
  }
7670
7699
  }
7671
- }), [n, o]);
7700
+ }), [
7701
+ n,
7702
+ o,
7703
+ c
7704
+ ]);
7672
7705
  return !e.length || !t.length ? null : /* @__PURE__ */ a("div", {
7673
- className: c,
7674
- style: { height: s },
7706
+ className: u,
7707
+ style: { height: l },
7675
7708
  children: /* @__PURE__ */ a(al, {
7676
- data: l,
7677
- options: u
7709
+ data: d,
7710
+ options: p,
7711
+ plugins: c ? [f] : []
7678
7712
  })
7679
7713
  });
7680
7714
  }
7681
7715
  //#endregion
7682
7716
  //#region ../../../atlas/src/shared/lib/chart-styles.ts
7683
- var yl = {
7717
+ var bl = {
7684
7718
  fontSize: 10,
7685
7719
  fill: "#94A3B8",
7686
7720
  fontFamily: "ui-monospace, monospace"
7687
- }, bl = {
7721
+ }, xl = {
7688
7722
  backgroundColor: "#fff",
7689
7723
  titleColor: "#0F172A",
7690
7724
  bodyColor: "#334155",
@@ -7709,28 +7743,28 @@ var yl = {
7709
7743
  padding: 10,
7710
7744
  cornerRadius: 8,
7711
7745
  boxPadding: 4
7712
- }, xl = {
7746
+ }, Sl = {
7713
7747
  font: {
7714
7748
  size: 10,
7715
7749
  family: "ui-monospace, monospace"
7716
7750
  },
7717
7751
  color: "#94A3B8"
7718
7752
  };
7719
- function Sl(e) {
7753
+ function Cl(e) {
7720
7754
  let t = Number(e);
7721
7755
  return t >= 1e9 ? `$${(t / 1e9).toFixed(t >= 1e10 ? 0 : 1)}B` : t >= 1e6 ? `$${(t / 1e6).toFixed(t >= 1e7 ? 0 : 1)}M` : t >= 1e3 ? `$${(t / 1e3).toFixed(t >= 1e4 ? 0 : 1)}k` : `$${t}`;
7722
7756
  }
7723
- var Cl = {
7724
- borderRadius: 8,
7757
+ var wl = {
7758
+ borderRadius: "var(--corner-surface-nested)",
7725
7759
  border: "1px solid #E2E8F0",
7726
- boxShadow: "0 2px 8px rgba(0,0,0,0.06)",
7727
- fontSize: 12,
7760
+ boxShadow: "var(--elevation-popover)",
7761
+ fontSize: "var(--type-caption)",
7728
7762
  fontFamily: "ui-monospace, monospace"
7729
- }, wl = {
7763
+ }, Tl = {
7730
7764
  horizontal: !0,
7731
7765
  vertical: !1,
7732
7766
  strokeDasharray: "3 3",
7733
7767
  stroke: "#E2E8F0"
7734
7768
  };
7735
7769
  //#endregion
7736
- export { wl as CHART_GRID, xl as CHART_JS_SCALE_TICKS, bl as CHART_JS_TOOLTIP_STYLE, yl as CHART_TICK, Cl as CHART_TOOLTIP, s as ChartCard, c as ChartLegend, ll as DonutChart, ml as StackedBarChart, vl as TimeseriesLineChart, Sl as formatChartCurrencyTick };
7770
+ export { Tl as CHART_GRID, Sl as CHART_JS_SCALE_TICKS, xl as CHART_JS_TOOLTIP_STYLE, bl as CHART_TICK, wl as CHART_TOOLTIP, s as ChartCard, c as ChartLegend, ll as DonutChart, ml as StackedBarChart, yl as TimeseriesLineChart, Cl as formatChartCurrencyTick };