@gearbox-protocol/ui-kit 4.0.0-next.23 → 4.0.0-next.24
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/cjs/components/base/history-chart/history-chart.cjs +1 -1
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/graph/default-config.cjs +1 -1
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/graph/graph-current-value.cjs +1 -1
- package/dist/cjs/components/graph/graph-tooltip.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/graph/index.cjs +1 -1
- package/dist/cjs/components/graph/y-axis-scale.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/base/history-chart/history-chart.js +16 -15
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +41 -25
- package/dist/esm/components/graph/default-config.js +44 -24
- package/dist/esm/components/graph/formatters.js +123 -128
- package/dist/esm/components/graph/graph-current-value.js +11 -11
- package/dist/esm/components/graph/graph-tooltip.js +6 -6
- package/dist/esm/components/graph/graph.js +597 -547
- package/dist/esm/components/graph/index.js +32 -27
- package/dist/esm/components/graph/y-axis-scale.js +112 -0
- package/dist/esm/components/index.js +496 -491
- package/dist/esm/components/trading-view/trading-view.js +83 -82
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +94 -55
- package/dist/esm/index.js +649 -644
- package/dist/esm/locale/en.json.js +16 -4
- package/dist/types/components/base/history-chart/history-chart.d.ts +2 -1
- package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -2
- package/dist/types/components/graph/default-config.d.ts +23 -0
- package/dist/types/components/graph/formatters.d.ts +5 -1
- package/dist/types/components/graph/graph.d.ts +12 -4
- package/dist/types/components/graph/y-axis-scale.d.ts +48 -0
- package/dist/types/components/trading-view/trading-view.d.ts +5 -1
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +4 -2
- package/dist/types/locale/en.json.d.ts +14 -2
- package/package.json +3 -3
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { resolveCSSColor as o } from "../../utils/colors.js";
|
|
2
|
-
const
|
|
2
|
+
const l = {
|
|
3
3
|
topColor: "rgba(76, 175, 80, 0.56)",
|
|
4
4
|
bottomColor: "rgba(76, 175, 80, 0.04)",
|
|
5
5
|
lineColor: "#02c39a",
|
|
6
|
-
lineWidth: 2
|
|
7
|
-
|
|
6
|
+
lineWidth: 2,
|
|
7
|
+
lastValueVisible: !1,
|
|
8
|
+
priceLineVisible: !1
|
|
9
|
+
}, b = {
|
|
8
10
|
showLabel: !0,
|
|
9
11
|
color: "#02c39a",
|
|
10
12
|
labelBackgroundColor: "#02c39a",
|
|
11
13
|
width: 2
|
|
12
|
-
},
|
|
13
|
-
function
|
|
14
|
+
}, t = 'Rubik, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', e = 14, i = 5, n = Math.ceil(e / 2) + 2, c = e + 6, u = 40;
|
|
15
|
+
function g() {
|
|
14
16
|
const r = o(
|
|
15
17
|
"hsl(var(--muted-foreground))",
|
|
16
18
|
"rgb(163, 163, 163)"
|
|
17
|
-
),
|
|
19
|
+
), a = o("hsl(var(--card))", "rgb(24, 24, 24)");
|
|
18
20
|
return {
|
|
19
21
|
timeScale: {
|
|
20
22
|
borderVisible: !0,
|
|
@@ -26,6 +28,16 @@ function b() {
|
|
|
26
28
|
// and legend appears). Avoids range shrinking to a few days.
|
|
27
29
|
lockVisibleTimeRangeOnResize: !0
|
|
28
30
|
},
|
|
31
|
+
leftPriceScale: {
|
|
32
|
+
visible: !1,
|
|
33
|
+
autoScale: !0,
|
|
34
|
+
alignLabels: !0,
|
|
35
|
+
borderVisible: !0,
|
|
36
|
+
borderColor: "rgba(224, 227, 235, 0.1)",
|
|
37
|
+
entireTextOnly: !1,
|
|
38
|
+
tickMarkDensity: i,
|
|
39
|
+
textColor: r
|
|
40
|
+
},
|
|
29
41
|
rightPriceScale: {
|
|
30
42
|
visible: !0,
|
|
31
43
|
autoScale: !0,
|
|
@@ -33,15 +45,16 @@ function b() {
|
|
|
33
45
|
borderVisible: !0,
|
|
34
46
|
borderColor: "rgba(224, 227, 235, 0.1)",
|
|
35
47
|
entireTextOnly: !1,
|
|
48
|
+
tickMarkDensity: i,
|
|
36
49
|
textColor: r
|
|
37
50
|
},
|
|
38
51
|
layout: {
|
|
39
52
|
background: {
|
|
40
|
-
color:
|
|
53
|
+
color: a
|
|
41
54
|
},
|
|
42
55
|
textColor: r,
|
|
43
|
-
fontSize:
|
|
44
|
-
fontFamily:
|
|
56
|
+
fontSize: e,
|
|
57
|
+
fontFamily: t
|
|
45
58
|
},
|
|
46
59
|
crosshair: {
|
|
47
60
|
horzLine: {
|
|
@@ -67,23 +80,25 @@ function b() {
|
|
|
67
80
|
}
|
|
68
81
|
};
|
|
69
82
|
}
|
|
70
|
-
function
|
|
83
|
+
function f() {
|
|
71
84
|
return {
|
|
72
85
|
topColor: "rgba(76, 175, 80, 0.56)",
|
|
73
86
|
bottomColor: "rgba(76, 175, 80, 0.04)",
|
|
74
|
-
lineColor:
|
|
75
|
-
lineWidth: 2
|
|
87
|
+
lineColor: l.lineColor,
|
|
88
|
+
lineWidth: 2,
|
|
89
|
+
lastValueVisible: !1,
|
|
90
|
+
priceLineVisible: !1
|
|
76
91
|
};
|
|
77
92
|
}
|
|
78
|
-
function
|
|
93
|
+
function d() {
|
|
79
94
|
return {
|
|
80
95
|
showLabel: !0,
|
|
81
|
-
color:
|
|
82
|
-
labelBackgroundColor:
|
|
96
|
+
color: l.lineColor,
|
|
97
|
+
labelBackgroundColor: l.lineColor,
|
|
83
98
|
width: 2
|
|
84
99
|
};
|
|
85
100
|
}
|
|
86
|
-
const
|
|
101
|
+
const L = {
|
|
87
102
|
timeScale: {
|
|
88
103
|
borderVisible: !0,
|
|
89
104
|
borderColor: "rgba(224, 227, 235, 0.1)",
|
|
@@ -104,8 +119,8 @@ const u = {
|
|
|
104
119
|
color: "transparent"
|
|
105
120
|
},
|
|
106
121
|
textColor: "rgb(163, 163, 163)",
|
|
107
|
-
fontSize:
|
|
108
|
-
fontFamily:
|
|
122
|
+
fontSize: e,
|
|
123
|
+
fontFamily: t
|
|
109
124
|
},
|
|
110
125
|
crosshair: {
|
|
111
126
|
horzLine: {
|
|
@@ -131,10 +146,15 @@ const u = {
|
|
|
131
146
|
}
|
|
132
147
|
};
|
|
133
148
|
export {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
149
|
+
n as AXIS_EDGE_LABEL_PADDING_PX,
|
|
150
|
+
e as AXIS_FONT_SIZE,
|
|
151
|
+
i as AXIS_TICK_MARK_DENSITY,
|
|
152
|
+
u as AXIS_TIME_EDGE_PADDING_PX,
|
|
153
|
+
c as AXIS_TOP_LABEL_PADDING_PX,
|
|
154
|
+
l as DEFAULT_AREA_SERIES,
|
|
155
|
+
L as DEFAULT_OPTIONS,
|
|
156
|
+
b as DEFAULT_VERTICAL_LINE,
|
|
157
|
+
g as getDefaultOptions,
|
|
158
|
+
f as getDefaultSeries,
|
|
159
|
+
d as getDefaultVerticalLine
|
|
140
160
|
};
|
|
@@ -1,195 +1,190 @@
|
|
|
1
|
-
import { TickMarkType as
|
|
2
|
-
import { DateTime as
|
|
3
|
-
import { isBelowDisplayThreshold as
|
|
4
|
-
const { MIN_DISPLAY_THRESHOLD:
|
|
5
|
-
if (
|
|
6
|
-
return e ? `<${
|
|
1
|
+
import { TickMarkType as S } from "lightweight-charts";
|
|
2
|
+
import { DateTime as D } from "luxon";
|
|
3
|
+
import { isBelowDisplayThreshold as T, FORMAT_CONSTANTS as U, toSignificantDigits as N, formatNumberWithSuffix as I } from "../../utils/format-number.js";
|
|
4
|
+
const { MIN_DISPLAY_THRESHOLD: h, MAX_EXPONENTIAL_THRESHOLD: L } = U, O = (t, e, n = "full") => {
|
|
5
|
+
if (T(t))
|
|
6
|
+
return e ? `<${h}${e}` : `<${h}`;
|
|
7
7
|
if (t === 0)
|
|
8
8
|
return e ? `0${e}` : "0";
|
|
9
|
-
const r =
|
|
10
|
-
maxExponentialThreshold:
|
|
9
|
+
const r = I(t, {
|
|
10
|
+
maxExponentialThreshold: L,
|
|
11
11
|
minimumFractionDigits: 0,
|
|
12
|
-
maximumFractionDigits:
|
|
13
|
-
format:
|
|
14
|
-
adaptiveDecimals:
|
|
12
|
+
maximumFractionDigits: n === "short" ? 1 : 0,
|
|
13
|
+
format: n,
|
|
14
|
+
adaptiveDecimals: n === "short"
|
|
15
15
|
});
|
|
16
16
|
return e ? `${r}${e}` : r;
|
|
17
|
-
},
|
|
18
|
-
if (
|
|
19
|
-
return e ? `<${
|
|
17
|
+
}, X = 2, H = (t, e) => {
|
|
18
|
+
if (T(t))
|
|
19
|
+
return e ? `<${h}${e}` : `<${h}`;
|
|
20
20
|
if (t === 0)
|
|
21
21
|
return e ? `0${e}` : "0";
|
|
22
|
-
const
|
|
23
|
-
return e ? `${
|
|
24
|
-
},
|
|
25
|
-
if (
|
|
26
|
-
return `<${
|
|
22
|
+
const n = N(t, X);
|
|
23
|
+
return e ? `${n}${e}` : n;
|
|
24
|
+
}, P = 4, w = (t) => {
|
|
25
|
+
if (T(t))
|
|
26
|
+
return `<${h}`;
|
|
27
27
|
if (t === 0)
|
|
28
28
|
return "0";
|
|
29
|
-
const e = Math.round(t),
|
|
30
|
-
return
|
|
31
|
-
},
|
|
32
|
-
if (
|
|
33
|
-
return e ? `<${
|
|
29
|
+
const e = Math.round(t), n = Math.abs(t - e);
|
|
30
|
+
return n > 0 && n < 0.01 ? t.toFixed(12).replace(/0+$/, "").replace(/\.$/, "") : N(t, P);
|
|
31
|
+
}, C = (t, e) => {
|
|
32
|
+
if (T(t))
|
|
33
|
+
return e ? `<${h} ${e}` : `<${h}`;
|
|
34
34
|
if (t === 0)
|
|
35
35
|
return e ? `0 ${e}` : "0";
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
return e ? `${
|
|
36
|
+
const n = Number.isInteger(t), r = Math.abs(t), c = n && r >= 1e3, s = Math.round(t), i = Math.abs(t - s);
|
|
37
|
+
if (i > 0 && i < 0.01 && !c) {
|
|
38
|
+
const F = t.toFixed(12).replace(/0+$/, "").replace(/\.$/, "");
|
|
39
|
+
return e ? `${F} ${e}` : F;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
maxExponentialThreshold:
|
|
43
|
-
minimumFractionDigits:
|
|
44
|
-
maximumFractionDigits:
|
|
45
|
-
format:
|
|
46
|
-
adaptiveDecimals:
|
|
41
|
+
const M = I(t, {
|
|
42
|
+
maxExponentialThreshold: L,
|
|
43
|
+
minimumFractionDigits: n ? 0 : 2,
|
|
44
|
+
maximumFractionDigits: c ? 1 : n ? 0 : 2,
|
|
45
|
+
format: c ? "short" : "full",
|
|
46
|
+
adaptiveDecimals: c
|
|
47
47
|
});
|
|
48
|
-
return e ? `${
|
|
49
|
-
},
|
|
50
|
-
"%":
|
|
51
|
-
$:
|
|
52
|
-
token:
|
|
53
|
-
none:
|
|
54
|
-
},
|
|
55
|
-
function
|
|
48
|
+
return e ? `${M} ${e}` : M;
|
|
49
|
+
}, A = {
|
|
50
|
+
"%": H,
|
|
51
|
+
$: O,
|
|
52
|
+
token: C,
|
|
53
|
+
none: w
|
|
54
|
+
}, Z = (t) => A[t] || A.token;
|
|
55
|
+
function V(t, e, n = 4) {
|
|
56
56
|
if (t === 0)
|
|
57
57
|
return e ? `0 ${e}` : "0";
|
|
58
|
-
const r = e && Math.abs(t) >= 1e3 ? 0 :
|
|
58
|
+
const r = e && Math.abs(t) >= 1e3 ? 0 : n, c = t.toLocaleString("en-US", {
|
|
59
59
|
minimumFractionDigits: 0,
|
|
60
60
|
maximumFractionDigits: r
|
|
61
61
|
});
|
|
62
|
-
return e ? `${
|
|
62
|
+
return e ? `${c} ${e}` : c;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function x(t, e) {
|
|
65
65
|
return !t || e === "none" || e === "token" ? t : e === "$" ? `$${t}` : e === "%" ? `${t}%` : `${t} ${e}`;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return t.includes("/")
|
|
67
|
+
function Y(t) {
|
|
68
|
+
return t.includes("/");
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
function l(t) {
|
|
71
|
+
return Y(t) ? "none" : t;
|
|
72
|
+
}
|
|
73
|
+
function b(t, e, n) {
|
|
74
|
+
const r = n?.yScaleMin;
|
|
75
|
+
let c = t.length > 0 ? Math.min(...t) : 0, s = t.length > 0 ? Math.max(...t) : 0;
|
|
76
|
+
const i = () => {
|
|
77
|
+
const o = (c + s) / 2;
|
|
78
|
+
let a = 1, m = "";
|
|
79
|
+
return o >= 1e9 ? (a = 1e9, m = "B") : o >= 1e6 ? (a = 1e6, m = "M") : o >= 1e3 && (a = 1e3, m = "K"), { scale: a, suffix: m };
|
|
80
|
+
}, u = 8;
|
|
81
|
+
let M = 0;
|
|
82
|
+
const F = (o, a, m, d) => {
|
|
83
|
+
const f = (a > 1 ? o / a : o).toLocaleString("en-US", {
|
|
81
84
|
minimumFractionDigits: 0,
|
|
82
85
|
maximumFractionDigits: d,
|
|
83
86
|
useGrouping: !1
|
|
84
87
|
});
|
|
85
|
-
return
|
|
86
|
-
},
|
|
87
|
-
for (let d = 0; d <=
|
|
88
|
+
return a > 1 ? `${f}${m}` : f;
|
|
89
|
+
}, p = (o, a, m) => {
|
|
90
|
+
for (let d = 0; d <= u; d++) {
|
|
88
91
|
const $ = /* @__PURE__ */ new Set();
|
|
89
|
-
let
|
|
90
|
-
for (const
|
|
91
|
-
const
|
|
92
|
-
if ($.has(
|
|
93
|
-
|
|
92
|
+
let f = !0;
|
|
93
|
+
for (const g of o) {
|
|
94
|
+
const k = F(g, a, m, d);
|
|
95
|
+
if ($.has(k)) {
|
|
96
|
+
f = !1;
|
|
94
97
|
break;
|
|
95
98
|
}
|
|
96
|
-
$.add(
|
|
99
|
+
$.add(k);
|
|
97
100
|
}
|
|
98
|
-
if (
|
|
101
|
+
if (f) return d;
|
|
99
102
|
}
|
|
100
|
-
return
|
|
101
|
-
},
|
|
102
|
-
if (r !== void 0 &&
|
|
103
|
-
if (
|
|
104
|
-
const { scale:
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
return u;
|
|
104
|
+
}, R = (o) => {
|
|
105
|
+
if (r !== void 0 && o < r) return "";
|
|
106
|
+
if (o === 0) return x("0", l(e));
|
|
107
|
+
const { scale: a, suffix: m } = i();
|
|
108
|
+
return x(
|
|
109
|
+
F(o, a, m, M),
|
|
110
|
+
l(e)
|
|
108
111
|
);
|
|
109
112
|
};
|
|
110
113
|
return {
|
|
111
|
-
formatter: (
|
|
112
|
-
tickmarksFormatter: (
|
|
113
|
-
const { scale:
|
|
114
|
-
(f) => Math.abs(f) >= d * D
|
|
115
|
-
) : a, h = n.filter(
|
|
114
|
+
formatter: (o) => R(o),
|
|
115
|
+
tickmarksFormatter: (o) => {
|
|
116
|
+
const { scale: a, suffix: m } = i(), d = o.filter(
|
|
116
117
|
(f) => f !== 0 && !(r !== void 0 && f < r)
|
|
117
118
|
);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
m
|
|
122
|
-
);
|
|
123
|
-
const T = /* @__PURE__ */ new Set();
|
|
124
|
-
return n.map((f) => {
|
|
119
|
+
M = p(d, a, m);
|
|
120
|
+
const $ = /* @__PURE__ */ new Set();
|
|
121
|
+
return o.map((f) => {
|
|
125
122
|
if (r !== void 0 && f < r) return "";
|
|
126
|
-
const
|
|
127
|
-
return !
|
|
123
|
+
const g = f === 0 ? "0" : F(f, a, m, M);
|
|
124
|
+
return !g || $.has(g) ? "" : ($.add(g), x(g, l(e)));
|
|
128
125
|
});
|
|
129
126
|
},
|
|
130
|
-
updateVisibleRange: (
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
updateLastValues: (n) => {
|
|
134
|
-
a = [...n];
|
|
127
|
+
updateVisibleRange: (o) => {
|
|
128
|
+
o.length > 0 && (c = Math.min(...o), s = Math.max(...o));
|
|
135
129
|
}
|
|
136
130
|
};
|
|
137
131
|
}
|
|
138
|
-
const
|
|
139
|
-
time:
|
|
140
|
-
"%":
|
|
132
|
+
const _ = (t) => D.fromSeconds(Number(t)).toFormat("dd/LL/yyyy HH:mm"), G = (t) => D.fromSeconds(Number(t)).toFormat("HH:mm"), W = (t, e) => H(Number(t), e), E = {
|
|
133
|
+
time: _,
|
|
134
|
+
"%": W
|
|
141
135
|
};
|
|
142
|
-
function
|
|
136
|
+
function q(t) {
|
|
143
137
|
const e = /* @__PURE__ */ new Map();
|
|
144
|
-
return (
|
|
145
|
-
const s =
|
|
146
|
-
let
|
|
138
|
+
return (n, r, c) => {
|
|
139
|
+
const s = D.fromSeconds(Number(n));
|
|
140
|
+
let i;
|
|
147
141
|
if (t === 0)
|
|
148
|
-
|
|
142
|
+
i = s.toFormat("HH:mm");
|
|
149
143
|
else
|
|
150
144
|
switch (r) {
|
|
151
|
-
case
|
|
152
|
-
|
|
145
|
+
case S.Year:
|
|
146
|
+
i = s.toFormat("yyyy");
|
|
153
147
|
break;
|
|
154
148
|
// Month boundaries (1st of a month) are reported as `Month` ticks by
|
|
155
149
|
// lightweight-charts. Render them the same way as regular day ticks so
|
|
156
150
|
// the axis reads uniformly ("01 Jul") instead of a stray "Jul 2026".
|
|
157
|
-
case
|
|
158
|
-
case
|
|
159
|
-
|
|
151
|
+
case S.Month:
|
|
152
|
+
case S.DayOfMonth:
|
|
153
|
+
i = t > 365 ? s.toFormat("dd MMM yyyy") : s.toFormat("dd MMM");
|
|
160
154
|
break;
|
|
161
|
-
case
|
|
162
|
-
case
|
|
163
|
-
|
|
155
|
+
case S.Time:
|
|
156
|
+
case S.TimeWithSeconds:
|
|
157
|
+
i = s.toFormat("HH:mm");
|
|
164
158
|
break;
|
|
165
159
|
default:
|
|
166
|
-
|
|
160
|
+
i = s.toFormat("dd MMM");
|
|
167
161
|
}
|
|
168
162
|
let u = e.get(r);
|
|
169
|
-
return u || (u = /* @__PURE__ */ new Set(), e.set(r, u)), u.has(
|
|
163
|
+
return u || (u = /* @__PURE__ */ new Set(), e.set(r, u)), u.has(i) ? " " : (u.add(i), i);
|
|
170
164
|
};
|
|
171
165
|
}
|
|
172
|
-
const
|
|
166
|
+
const B = (t, e) => {
|
|
173
167
|
if (t === "time" && e && e.length > 0) {
|
|
174
|
-
const r =
|
|
168
|
+
const r = D.fromSeconds(Number(e[0].time)), c = D.fromSeconds(
|
|
175
169
|
Number(e[e.length - 1].time)
|
|
176
|
-
), s = r.hasSame(
|
|
170
|
+
), s = r.hasSame(c, "day"), i = s ? 0 : Math.ceil(c.diff(r, "days").days);
|
|
177
171
|
return {
|
|
178
|
-
timeFormatter: s ?
|
|
179
|
-
tickMarkFormatter:
|
|
172
|
+
timeFormatter: s ? G : _,
|
|
173
|
+
tickMarkFormatter: q(i)
|
|
180
174
|
};
|
|
181
175
|
}
|
|
182
|
-
const
|
|
176
|
+
const n = E[t] || E.time;
|
|
183
177
|
return {
|
|
184
|
-
timeFormatter:
|
|
185
|
-
tickMarkFormatter: (r) =>
|
|
178
|
+
timeFormatter: n,
|
|
179
|
+
tickMarkFormatter: (r) => n(r, t)
|
|
186
180
|
};
|
|
187
|
-
},
|
|
181
|
+
}, v = (t, e) => B(t, e).timeFormatter;
|
|
188
182
|
export {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
183
|
+
b as createAdaptiveYAxisFormatter,
|
|
184
|
+
V as formatExactValue,
|
|
185
|
+
v as getXFormatter,
|
|
186
|
+
B as getXFormatters,
|
|
187
|
+
Z as getYFormatter,
|
|
188
|
+
Y as isRatioUnit,
|
|
189
|
+
x as withYAxisUnit
|
|
195
190
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
3
|
-
import { getXFormatter as c, formatExactValue as r } from "./formatters.js";
|
|
4
|
-
function
|
|
5
|
-
point:
|
|
1
|
+
import { jsxs as x, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { cn as a } from "../../utils/cn.js";
|
|
3
|
+
import { getXFormatter as c, isRatioUnit as f, formatExactValue as r } from "./formatters.js";
|
|
4
|
+
function w({
|
|
5
|
+
point: o,
|
|
6
6
|
xMeasureUnit: m,
|
|
7
7
|
yMeasureUnit: t,
|
|
8
8
|
className: s,
|
|
9
|
-
decimals:
|
|
9
|
+
decimals: e
|
|
10
10
|
}) {
|
|
11
|
-
const d = c(m)(
|
|
12
|
-
return /* @__PURE__ */
|
|
11
|
+
const d = c(m)(o.time, m), i = t !== "%" && t !== "$" && t !== "none" && !f(t) ? t : void 0, n = t === "$" ? `$${r(o.value, void 0, e)}` : t === "%" ? `${r(o.value, void 0, e)}%` : r(o.value, i, e);
|
|
12
|
+
return /* @__PURE__ */ x(
|
|
13
13
|
"div",
|
|
14
14
|
{
|
|
15
|
-
className:
|
|
15
|
+
className: a(
|
|
16
16
|
"absolute top-2 left-2 right-2 z-[100] pointer-events-none",
|
|
17
17
|
s
|
|
18
18
|
),
|
|
19
19
|
children: [
|
|
20
|
-
/* @__PURE__ */ l("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children:
|
|
20
|
+
/* @__PURE__ */ l("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: n }),
|
|
21
21
|
/* @__PURE__ */ l("div", { className: "text-xs sm:text-sm font-medium text-muted-foreground whitespace-nowrap overflow-hidden text-ellipsis mt-0.5", children: d })
|
|
22
22
|
]
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
export {
|
|
27
|
-
|
|
27
|
+
w as GraphCurrentValue
|
|
28
28
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as k, useState as F, useEffect as S } from "react";
|
|
3
3
|
import { cn as z } from "../../utils/cn.js";
|
|
4
|
-
import { getXFormatter as A, formatExactValue as x } from "./formatters.js";
|
|
5
|
-
import { getSeriesColorPalette as
|
|
4
|
+
import { getXFormatter as A, isRatioUnit as B, formatExactValue as x } from "./formatters.js";
|
|
5
|
+
import { getSeriesColorPalette as E } from "./graph.js";
|
|
6
6
|
function M({
|
|
7
7
|
points: d,
|
|
8
8
|
series: v,
|
|
@@ -36,7 +36,7 @@ function M({
|
|
|
36
36
|
const y = p + 8;
|
|
37
37
|
e - y < l ? e = t.y + 20 : e = t.y - y, a({ x: n, y: e });
|
|
38
38
|
}, [t, b]);
|
|
39
|
-
const
|
|
39
|
+
const R = f ? {
|
|
40
40
|
left: `${f.x}px`,
|
|
41
41
|
top: `${f.y}px`,
|
|
42
42
|
transform: "translate(-50%, 0)"
|
|
@@ -44,7 +44,7 @@ function M({
|
|
|
44
44
|
} : {};
|
|
45
45
|
if (d.size === 0)
|
|
46
46
|
return null;
|
|
47
|
-
const
|
|
47
|
+
const P = Array.from(d.values())[0], j = C(P.time, g);
|
|
48
48
|
return /* @__PURE__ */ m(
|
|
49
49
|
"div",
|
|
50
50
|
{
|
|
@@ -53,13 +53,13 @@ function M({
|
|
|
53
53
|
"absolute z-[100] pointer-events-none whitespace-nowrap",
|
|
54
54
|
$
|
|
55
55
|
),
|
|
56
|
-
style:
|
|
56
|
+
style: R,
|
|
57
57
|
children: /* @__PURE__ */ h("div", { className: "bg-background/90 backdrop-blur-sm rounded border border-border p-1.5 sm:p-2 space-y-1 sm:space-y-1.5", children: [
|
|
58
58
|
/* @__PURE__ */ m("div", { className: "text-xs sm:text-sm font-medium text-muted-foreground mb-0.5 sm:mb-1 whitespace-nowrap", children: j }),
|
|
59
59
|
v.map((r, c) => {
|
|
60
60
|
const o = d.get(r.label);
|
|
61
61
|
if (!o) return null;
|
|
62
|
-
const i =
|
|
62
|
+
const i = E(c), n = (r.lineColor ?? r.color) || i.line, e = r.yMeasureUnit || N, s = e !== "%" && e !== "$" && e !== "none" && !B(e) ? e : void 0, p = e === "$" ? `$${x(o.value, void 0, u)}` : e === "%" ? `${x(o.value, void 0, u)}%` : x(o.value, s, u);
|
|
63
63
|
return /* @__PURE__ */ h(
|
|
64
64
|
"div",
|
|
65
65
|
{
|