@sequenceholdings/atlas-ui 0.1.2 → 0.1.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.
- package/dist/charts.d.ts +157 -0
- package/dist/charts.mjs +35 -23
- package/dist/index.d.ts +3961 -0
- package/dist/index.mjs +36736 -10455
- package/dist/{utils-Dhlckutd.js → utils-BZS7Y02J.js} +1 -3
- package/package.json +15 -7
- package/dist/charts.mjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/utils-Dhlckutd.js.map +0 -1
- package/src/charts.ts +0 -17
- package/src/index.ts +0 -216
- package/src/process-env.d.ts +0 -8
- package/src/tokens.css +0 -220
package/dist/charts.d.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export declare interface BarDataset {
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
data: number[];
|
|
8
|
+
color: string;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export declare const CHART_GRID: {
|
|
13
|
+
readonly horizontal: true;
|
|
14
|
+
readonly vertical: false;
|
|
15
|
+
readonly strokeDasharray: "3 3";
|
|
16
|
+
readonly stroke: "#E2E8F0";
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** Chart.js scale ticks — font size 10, ui-monospace, slate-400 */
|
|
20
|
+
export declare const CHART_JS_SCALE_TICKS: {
|
|
21
|
+
readonly font: {
|
|
22
|
+
readonly size: 10;
|
|
23
|
+
readonly family: "ui-monospace, monospace";
|
|
24
|
+
};
|
|
25
|
+
readonly color: "#94A3B8";
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Chart.js Tooltip plugin options — aligned with StackedBarChart / TimeseriesLineChart.
|
|
29
|
+
* `footerColor` / `footerFont` / `footerMarginTop` are required for the tooltip's
|
|
30
|
+
* footer slot ("Total: $X" callbacks on SpendTimeseriesChart, CreditsTab,
|
|
31
|
+
* StackedBarChart) to render visibly — without them the footer string is emitted
|
|
32
|
+
* but rendered with default body styling and visually blends into the line above. */
|
|
33
|
+
export declare const CHART_JS_TOOLTIP_STYLE: {
|
|
34
|
+
readonly backgroundColor: "#fff";
|
|
35
|
+
readonly titleColor: "#0F172A";
|
|
36
|
+
readonly bodyColor: "#334155";
|
|
37
|
+
readonly footerColor: "#0F172A";
|
|
38
|
+
readonly footerFont: {
|
|
39
|
+
readonly weight: "bold";
|
|
40
|
+
readonly size: 12;
|
|
41
|
+
readonly family: "ui-monospace, monospace";
|
|
42
|
+
};
|
|
43
|
+
readonly footerMarginTop: 8;
|
|
44
|
+
readonly borderColor: "#E2E8F0";
|
|
45
|
+
readonly borderWidth: 1;
|
|
46
|
+
readonly titleFont: {
|
|
47
|
+
readonly weight: "bold";
|
|
48
|
+
readonly size: 12;
|
|
49
|
+
readonly family: "ui-monospace, monospace";
|
|
50
|
+
};
|
|
51
|
+
readonly bodyFont: {
|
|
52
|
+
readonly size: 12;
|
|
53
|
+
readonly family: "ui-monospace, monospace";
|
|
54
|
+
};
|
|
55
|
+
readonly padding: 10;
|
|
56
|
+
readonly cornerRadius: 8;
|
|
57
|
+
readonly boxPadding: 4;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export declare const CHART_TICK: {
|
|
61
|
+
readonly fontSize: 10;
|
|
62
|
+
readonly fill: "#94A3B8";
|
|
63
|
+
readonly fontFamily: "ui-monospace, monospace";
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export declare const CHART_TOOLTIP: {
|
|
67
|
+
readonly borderRadius: 8;
|
|
68
|
+
readonly border: "1px solid #E2E8F0";
|
|
69
|
+
readonly boxShadow: "0 2px 8px rgba(0,0,0,0.06)";
|
|
70
|
+
readonly fontSize: 12;
|
|
71
|
+
readonly fontFamily: "ui-monospace, monospace";
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export declare function ChartCard({ title, toolbar, legend, children, className }: ChartCardProps): JSX.Element;
|
|
75
|
+
|
|
76
|
+
declare interface ChartCardProps {
|
|
77
|
+
title: string;
|
|
78
|
+
toolbar?: ReactNode;
|
|
79
|
+
legend?: ReactNode;
|
|
80
|
+
children: ReactNode;
|
|
81
|
+
className?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export declare function ChartLegend({ items, className }: ChartLegendProps): JSX.Element;
|
|
85
|
+
|
|
86
|
+
declare interface ChartLegendProps {
|
|
87
|
+
items: LegendItem[];
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export declare function DonutChart({ segments, centerLabel, centerValue, size, className, }: DonutChartProps): JSX.Element | null;
|
|
92
|
+
|
|
93
|
+
declare interface DonutChartProps {
|
|
94
|
+
segments: DonutSegment[];
|
|
95
|
+
centerLabel?: string;
|
|
96
|
+
centerValue?: string;
|
|
97
|
+
size?: number;
|
|
98
|
+
className?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export declare interface DonutSegment {
|
|
102
|
+
key: string;
|
|
103
|
+
label: string;
|
|
104
|
+
value: number;
|
|
105
|
+
color: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export declare function formatChartCurrencyTick(v: number | string): string;
|
|
109
|
+
|
|
110
|
+
declare interface LegendItem {
|
|
111
|
+
key: string;
|
|
112
|
+
label: string;
|
|
113
|
+
color: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare interface LineDataset {
|
|
117
|
+
key: string;
|
|
118
|
+
label: string;
|
|
119
|
+
data: number[];
|
|
120
|
+
color: string;
|
|
121
|
+
fill?: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export declare function StackedBarChart({ labels, datasets, stacked, yFormat, onClick, barTotals, maxTicksLimit, height, className, }: StackedBarChartProps): JSX.Element | null;
|
|
125
|
+
|
|
126
|
+
declare interface StackedBarChartProps {
|
|
127
|
+
labels: string[];
|
|
128
|
+
datasets: BarDataset[];
|
|
129
|
+
stacked?: boolean;
|
|
130
|
+
yFormat?: 'currency' | 'count';
|
|
131
|
+
onClick?: (index: number) => void;
|
|
132
|
+
barTotals?: boolean;
|
|
133
|
+
maxTicksLimit?: number;
|
|
134
|
+
height?: number;
|
|
135
|
+
className?: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export declare function TimeseriesLineChart({ labels, datasets, yFormat, tension, maxTicksLimit, height, className, }: TimeseriesLineChartProps): JSX.Element | null;
|
|
139
|
+
|
|
140
|
+
declare interface TimeseriesLineChartProps {
|
|
141
|
+
labels: string[];
|
|
142
|
+
datasets: LineDataset[];
|
|
143
|
+
yFormat?: 'currency' | 'percent' | 'number';
|
|
144
|
+
tension?: number;
|
|
145
|
+
maxTicksLimit?: number;
|
|
146
|
+
height?: number;
|
|
147
|
+
className?: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export { }
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
declare module 'chart.js' {
|
|
154
|
+
interface TooltipPositionerMap {
|
|
155
|
+
cursor: TooltipPositionerFunction<ChartType>;
|
|
156
|
+
}
|
|
157
|
+
}
|
package/dist/charts.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./utils-
|
|
1
|
+
import { t as e } from "./utils-BZS7Y02J.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
|
|
@@ -840,12 +840,10 @@ var Et = (e) => e === 0 || e === 1, Dt = (e, t, n) => -(2 ** (10 * --e) * Math.s
|
|
|
840
840
|
return Et(e) ? e : e < .5 ? .5 * Dt(e * 2, t, n) : .5 + .5 * Ot(e * 2 - 1, t, n);
|
|
841
841
|
},
|
|
842
842
|
easeInBack(e) {
|
|
843
|
-
|
|
844
|
-
return e * e * ((t + 1) * e - t);
|
|
843
|
+
return e * e * (2.70158 * e - 1.70158);
|
|
845
844
|
},
|
|
846
845
|
easeOutBack(e) {
|
|
847
|
-
|
|
848
|
-
return --e * e * ((t + 1) * e + t) + 1;
|
|
846
|
+
return --e * e * (2.70158 * e + 1.70158) + 1;
|
|
849
847
|
},
|
|
850
848
|
easeInOutBack(e) {
|
|
851
849
|
let t = 1.70158;
|
|
@@ -1056,7 +1054,7 @@ function Kt(e, t) {
|
|
|
1056
1054
|
function qt(e, t, n) {
|
|
1057
1055
|
return typeof t == "string" ? Me(Kt(e, t), n) : Me(Kt(e, ""), t);
|
|
1058
1056
|
}
|
|
1059
|
-
var G = /*
|
|
1057
|
+
var G = /* #__PURE__ */ new class {
|
|
1060
1058
|
constructor(e, t) {
|
|
1061
1059
|
this.animation = void 0, this.backgroundColor = "rgba(0,0,0,0.1)", this.borderColor = "rgba(0,0,0,0.1)", this.color = "#666", this.datasets = {}, this.devicePixelRatio = (e) => e.chart.platform.getDevicePixelRatio(), this.elements = {}, this.events = [
|
|
1062
1060
|
"mousemove",
|
|
@@ -1879,7 +1877,7 @@ function Pr(e, t) {
|
|
|
1879
1877
|
bottom: n.bottom === !1 ? e.height : r.bottom + (n.bottom === !0 ? 0 : n.bottom)
|
|
1880
1878
|
};
|
|
1881
1879
|
}
|
|
1882
|
-
var Y = /*
|
|
1880
|
+
var Y = /* #__PURE__ */ new class {
|
|
1883
1881
|
constructor() {
|
|
1884
1882
|
this._request = null, this._charts = /* @__PURE__ */ new Map(), this._running = !1, this._lastDate = void 0;
|
|
1885
1883
|
}
|
|
@@ -4315,7 +4313,7 @@ function Ka(e, t) {
|
|
|
4315
4313
|
function qa(e) {
|
|
4316
4314
|
return "id" in e && "defaults" in e;
|
|
4317
4315
|
}
|
|
4318
|
-
var X = /*
|
|
4316
|
+
var X = /* #__PURE__ */ new class {
|
|
4319
4317
|
constructor() {
|
|
4320
4318
|
this.controllers = new Wa(oi, "datasets", !0), this.elements = new Wa(Ca, "elements"), this.plugins = new Wa(Object, "plugins"), this.scales = new Wa(Ua, "scales"), this._typedRegistries = [
|
|
4321
4319
|
this.controllers,
|
|
@@ -7034,7 +7032,7 @@ var zc = {
|
|
|
7034
7032
|
common: !0,
|
|
7035
7033
|
size: 3154e7
|
|
7036
7034
|
}
|
|
7037
|
-
}, $ = /*
|
|
7035
|
+
}, $ = /* #__PURE__ */ Object.keys(zc);
|
|
7038
7036
|
function Bc(e, t) {
|
|
7039
7037
|
return e - t;
|
|
7040
7038
|
}
|
|
@@ -7332,7 +7330,7 @@ function nl(e, t) {
|
|
|
7332
7330
|
m
|
|
7333
7331
|
]), n(() => {
|
|
7334
7332
|
_.current && (y(), setTimeout(v));
|
|
7335
|
-
}, [l]), n(() => (v(), () => y()), []),
|
|
7333
|
+
}, [l]), n(() => (v(), () => y()), []), /*#__PURE__*/ a("canvas", {
|
|
7336
7334
|
ref: g,
|
|
7337
7335
|
role: "img",
|
|
7338
7336
|
height: r,
|
|
@@ -7341,18 +7339,16 @@ function nl(e, t) {
|
|
|
7341
7339
|
children: p
|
|
7342
7340
|
});
|
|
7343
7341
|
}
|
|
7344
|
-
var rl =
|
|
7342
|
+
var rl = /*#__PURE__*/ t(nl);
|
|
7345
7343
|
function il(e, n) {
|
|
7346
|
-
return jo.register(n),
|
|
7344
|
+
return jo.register(n), /*#__PURE__*/ t((t, n) => /*#__PURE__*/ a(rl, {
|
|
7347
7345
|
...t,
|
|
7348
7346
|
ref: n,
|
|
7349
7347
|
type: e
|
|
7350
7348
|
}));
|
|
7351
7349
|
}
|
|
7352
|
-
var al = /*
|
|
7353
|
-
|
|
7354
|
-
//#region ../../../atlas/src/shared/components/ui/donut-chart.tsx
|
|
7355
|
-
jo.register(Vo, sc);
|
|
7350
|
+
var al = /* #__PURE__ */ il("line", Ti), ol = /* #__PURE__ */ il("bar", Si), sl = /* #__PURE__ */ il("doughnut", wi);
|
|
7351
|
+
jo.register(Vo, sc), sc.positioners.cursor = (e, t) => t;
|
|
7356
7352
|
var cl = {
|
|
7357
7353
|
backgroundColor: "#fff",
|
|
7358
7354
|
titleColor: "#0F172A",
|
|
@@ -7390,9 +7386,10 @@ function ll({ segments: e, centerLabel: t, centerValue: n, size: s = 220, classN
|
|
|
7390
7386
|
plugins: {
|
|
7391
7387
|
tooltip: {
|
|
7392
7388
|
...cl,
|
|
7389
|
+
position: "cursor",
|
|
7393
7390
|
callbacks: { label: (t) => {
|
|
7394
|
-
let n = e.reduce((e, t) => e + t.value, 0)
|
|
7395
|
-
return ` ${t.
|
|
7391
|
+
let n = e.reduce((e, t) => e + t.value, 0);
|
|
7392
|
+
return ` ${n > 0 ? (t.raw / n * 100).toFixed(1) : "0"}%`;
|
|
7396
7393
|
} }
|
|
7397
7394
|
},
|
|
7398
7395
|
legend: { display: !1 }
|
|
@@ -7415,7 +7412,7 @@ function ll({ segments: e, centerLabel: t, centerValue: n, size: s = 220, classN
|
|
|
7415
7412
|
className: "text-lg font-semibold text-foreground",
|
|
7416
7413
|
children: n
|
|
7417
7414
|
}), t && /* @__PURE__ */ a("span", {
|
|
7418
|
-
className: "text-xs font-medium uppercase tracking-wider text-
|
|
7415
|
+
className: "text-xs font-medium uppercase tracking-wider text-black-50",
|
|
7419
7416
|
children: t
|
|
7420
7417
|
})]
|
|
7421
7418
|
})]
|
|
@@ -7428,6 +7425,13 @@ var ul = {
|
|
|
7428
7425
|
backgroundColor: "#fff",
|
|
7429
7426
|
titleColor: "#0F172A",
|
|
7430
7427
|
bodyColor: "#334155",
|
|
7428
|
+
footerColor: "#0F172A",
|
|
7429
|
+
footerFont: {
|
|
7430
|
+
weight: "bold",
|
|
7431
|
+
size: 12,
|
|
7432
|
+
family: "ui-monospace, monospace"
|
|
7433
|
+
},
|
|
7434
|
+
footerMarginTop: 8,
|
|
7431
7435
|
borderColor: "#E2E8F0",
|
|
7432
7436
|
borderWidth: 1,
|
|
7433
7437
|
titleFont: {
|
|
@@ -7629,7 +7633,10 @@ function vl({ labels: e, datasets: t, yFormat: n = "currency", tension: i = .3,
|
|
|
7629
7633
|
callbacks: n === "currency" ? {
|
|
7630
7634
|
label: (e) => ` ${e.dataset.label}: ${_l(e.raw)}`,
|
|
7631
7635
|
footer: (e) => `Total: ${_l(e.reduce((e, t) => e + t.raw, 0))}`
|
|
7632
|
-
} : n === "percent" ? { label: (e) => ` ${e.dataset.label}: ${e.raw.toFixed(1)}%` } :
|
|
7636
|
+
} : n === "percent" ? { label: (e) => ` ${e.dataset.label}: ${e.raw.toFixed(1)}%` } : n === "number" ? {
|
|
7637
|
+
label: (e) => ` ${e.dataset.label}: ${e.raw.toLocaleString()}`,
|
|
7638
|
+
footer: (e) => `Total: ${e.reduce((e, t) => e + t.raw, 0).toLocaleString()}`
|
|
7639
|
+
} : void 0
|
|
7633
7640
|
},
|
|
7634
7641
|
legend: { display: !1 }
|
|
7635
7642
|
},
|
|
@@ -7654,7 +7661,7 @@ function vl({ labels: e, datasets: t, yFormat: n = "currency", tension: i = .3,
|
|
|
7654
7661
|
family: "ui-monospace, monospace"
|
|
7655
7662
|
},
|
|
7656
7663
|
color: "#94A3B8",
|
|
7657
|
-
callback: n === "currency" ? gl : n === "percent" ? (e) => `${e}%` : void 0
|
|
7664
|
+
callback: n === "currency" ? gl : n === "percent" ? (e) => `${e}%` : n === "number" ? (e) => Number(e).toLocaleString() : void 0
|
|
7658
7665
|
},
|
|
7659
7666
|
border: { display: !1 },
|
|
7660
7667
|
beginAtZero: !0,
|
|
@@ -7681,6 +7688,13 @@ var yl = {
|
|
|
7681
7688
|
backgroundColor: "#fff",
|
|
7682
7689
|
titleColor: "#0F172A",
|
|
7683
7690
|
bodyColor: "#334155",
|
|
7691
|
+
footerColor: "#0F172A",
|
|
7692
|
+
footerFont: {
|
|
7693
|
+
weight: "bold",
|
|
7694
|
+
size: 12,
|
|
7695
|
+
family: "ui-monospace, monospace"
|
|
7696
|
+
},
|
|
7697
|
+
footerMarginTop: 8,
|
|
7684
7698
|
borderColor: "#E2E8F0",
|
|
7685
7699
|
borderWidth: 1,
|
|
7686
7700
|
titleFont: {
|
|
@@ -7720,5 +7734,3 @@ var Cl = {
|
|
|
7720
7734
|
};
|
|
7721
7735
|
//#endregion
|
|
7722
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 };
|
|
7723
|
-
|
|
7724
|
-
//# sourceMappingURL=charts.mjs.map
|