@gearbox-protocol/ui-kit 4.0.0-next.22 → 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.
Files changed (40) hide show
  1. package/dist/cjs/components/base/history-chart/history-chart.cjs +1 -1
  2. package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
  3. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
  4. package/dist/cjs/components/graph/default-config.cjs +1 -1
  5. package/dist/cjs/components/graph/formatters.cjs +1 -1
  6. package/dist/cjs/components/graph/graph-current-value.cjs +1 -1
  7. package/dist/cjs/components/graph/graph-tooltip.cjs +1 -1
  8. package/dist/cjs/components/graph/graph.cjs +1 -1
  9. package/dist/cjs/components/graph/index.cjs +1 -1
  10. package/dist/cjs/components/graph/y-axis-scale.cjs +1 -0
  11. package/dist/cjs/components/index.cjs +1 -1
  12. package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
  13. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  14. package/dist/cjs/index.cjs +1 -1
  15. package/dist/cjs/locale/en.json.cjs +1 -1
  16. package/dist/esm/components/base/history-chart/history-chart.js +16 -15
  17. package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +41 -25
  18. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +38 -39
  19. package/dist/esm/components/graph/default-config.js +44 -24
  20. package/dist/esm/components/graph/formatters.js +123 -128
  21. package/dist/esm/components/graph/graph-current-value.js +11 -11
  22. package/dist/esm/components/graph/graph-tooltip.js +6 -6
  23. package/dist/esm/components/graph/graph.js +597 -547
  24. package/dist/esm/components/graph/index.js +32 -27
  25. package/dist/esm/components/graph/y-axis-scale.js +112 -0
  26. package/dist/esm/components/index.js +496 -491
  27. package/dist/esm/components/trading-view/trading-view.js +83 -82
  28. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +94 -55
  29. package/dist/esm/index.js +649 -644
  30. package/dist/esm/locale/en.json.js +16 -4
  31. package/dist/types/components/base/history-chart/history-chart.d.ts +2 -1
  32. package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -2
  33. package/dist/types/components/graph/default-config.d.ts +23 -0
  34. package/dist/types/components/graph/formatters.d.ts +5 -1
  35. package/dist/types/components/graph/graph.d.ts +12 -4
  36. package/dist/types/components/graph/y-axis-scale.d.ts +48 -0
  37. package/dist/types/components/trading-view/trading-view.d.ts +5 -1
  38. package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +4 -2
  39. package/dist/types/locale/en.json.d.ts +14 -2
  40. package/package.json +3 -3
@@ -1,36 +1,36 @@
1
- import { jsx as e, jsxs as m, Fragment as N } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as s, Fragment as A } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import "@gearbox-protocol/sdk";
4
4
  import "clsx";
5
5
  import "tailwind-merge";
6
6
  import "sonner";
7
- import { formatMoney as y } from "../../../utils/format-money.js";
7
+ import { formatMoney as N } from "../../../utils/format-money.js";
8
8
  import "@gearbox-protocol/sdk/common-utils";
9
9
  import "luxon";
10
10
  import "../../../utils/z-index.js";
11
11
  import "../../points-icon/points-icon.js";
12
- import { UtilizationValue as C } from "../../base/values/scalars.js";
12
+ import { UtilizationValue as y } from "../../base/values/scalars.js";
13
13
  import "../../badge/badge.js";
14
14
  import "../../badge/chip.js";
15
- import { FormattedMessageTyped as a } from "../../typed-intl/index.js";
16
- import { AllocationWheel as S } from "../../collateral-allocation-tooltip/allocation-wheel.js";
15
+ import { FormattedMessageTyped as m } from "../../typed-intl/index.js";
16
+ import { AllocationWheel as C } from "../../collateral-allocation-tooltip/allocation-wheel.js";
17
17
  import "@fortawesome/free-solid-svg-icons";
18
18
  import "../../icons/fa-icon.js";
19
19
  import "../../token-icon/token-icon.js";
20
20
  import "../../tooltip/simple-tooltip.js";
21
21
  import "../../tooltip/tooltip.js";
22
- import { NameCell as L } from "../../name-cell/name-cell.js";
23
- import { ShortString as b } from "../../short-string/short-string.js";
22
+ import { NameCell as S } from "../../name-cell/name-cell.js";
23
+ import { ShortString as U } from "../../short-string/short-string.js";
24
24
  import "react-intl";
25
25
  import "../../buttons/button/button.js";
26
- import { GridTableRow as U, GridTableCell as o } from "../../table/grid-table.js";
26
+ import { GridTableRow as k, GridTableCell as o } from "../../table/grid-table.js";
27
27
  import "../../skeleton/skeleton.js";
28
28
  import "../../table/table.js";
29
- import { TableLineSm as k, TableCellSm as n } from "../../table/table-sm.js";
30
- import { TokenSymbol as w } from "../../token-symbol/token-symbol.js";
29
+ import { TableLineSm as w, TableCellSm as a } from "../../table/table-sm.js";
30
+ import { TokenSymbol as L } from "../../token-symbol/token-symbol.js";
31
31
  import { TokenTemplate as v } from "../../token-template/token-template.js";
32
32
  import { VerticalIndicator as I } from "../../vertical-indicator/vertical-indicator.js";
33
- import { PoolAssetsTableTest as p } from "./constants.js";
33
+ import { PoolAssetsTableTest as n } from "./constants.js";
34
34
  function P(i, t) {
35
35
  if (t !== 0n)
36
36
  return Number(i * 10000n / t);
@@ -41,29 +41,28 @@ function j(i, t) {
41
41
  function ue({
42
42
  asset: i,
43
43
  underlyingToken: t,
44
- last: x,
45
- isCompact: c,
46
- totalUsed: T,
47
- colorIndex: z
44
+ last: b,
45
+ isCompact: p,
46
+ totalUsed: x,
47
+ colorIndex: T
48
48
  }) {
49
- const { token: r, limit: s, used: l } = i, A = c ? 40 : 21, d = j(l.value, T), u = () => /* @__PURE__ */ e(
50
- L,
49
+ const { token: c, limit: r, used: l } = i, z = p ? 40 : 21, d = j(l.value, x), u = () => /* @__PURE__ */ e(
50
+ S,
51
51
  {
52
- leading: /* @__PURE__ */ e(w, { size: 32, token: r }),
53
- title: /* @__PURE__ */ e(b, { maxLength: A, children: r.symbol }),
54
- subtitle: /* @__PURE__ */ e(b, { maxLength: 20, children: r.name })
52
+ leading: /* @__PURE__ */ e(L, { size: 32, token: c }),
53
+ title: /* @__PURE__ */ e(U, { maxLength: z, children: c.symbol })
55
54
  }
56
- ), h = () => /* @__PURE__ */ m(
55
+ ), h = () => /* @__PURE__ */ s(
57
56
  "div",
58
57
  {
59
58
  className: "flex items-center justify-end gap-2",
60
- "data-testid": p.exposureCell,
59
+ "data-testid": n.exposureCell,
61
60
  children: [
62
61
  /* @__PURE__ */ e(
63
- S,
62
+ C,
64
63
  {
65
64
  share: d,
66
- colorIndex: z,
65
+ colorIndex: T,
67
66
  idle: d === 0
68
67
  }
69
68
  ),
@@ -80,30 +79,30 @@ function ue({
80
79
  value: l.value
81
80
  }
82
81
  ),
83
- valueDescription: l.valueUsd === null ? "—" : y(l.valueUsd)
82
+ valueDescription: l.valueUsd === null ? "—" : N(l.valueUsd)
84
83
  }
85
84
  )
86
85
  ]
87
86
  }
88
- ), f = () => /* @__PURE__ */ e("div", { "data-testid": p.capCell, children: s.value === 0n ? /* @__PURE__ */ e("span", { children: "—" }) : /* @__PURE__ */ e(
87
+ ), f = () => /* @__PURE__ */ e("div", { "data-testid": n.capCell, children: r.value === 0n ? /* @__PURE__ */ e("span", { children: "—" }) : /* @__PURE__ */ e(
89
88
  v,
90
89
  {
91
90
  decimalPartLength: 2,
92
91
  precision: 2,
93
92
  showSymbol: !1,
94
93
  token: t,
95
- value: s.value
94
+ value: r.value
96
95
  }
97
- ) }), g = () => /* @__PURE__ */ e("div", { "data-testid": p.capUtilizationCell, children: /* @__PURE__ */ e(C, { data: P(l.value, s.value) }) });
96
+ ) }), g = () => /* @__PURE__ */ e("div", { "data-testid": n.capUtilizationCell, children: /* @__PURE__ */ e(y, { data: P(l.value, r.value) }) });
98
97
  return /* @__PURE__ */ e(
99
- U,
98
+ k,
100
99
  {
101
- last: x,
100
+ last: b,
102
101
  height: "auto",
103
102
  className: "cursor-default",
104
103
  style: { minHeight: "75px" },
105
- children: c ? /* @__PURE__ */ e(o, { className: "px-3 py-0!", size: "sm", span: "full", children: /* @__PURE__ */ m(
106
- k,
104
+ children: p ? /* @__PURE__ */ e(o, { className: "px-3 py-0!", size: "sm", span: "full", children: /* @__PURE__ */ s(
105
+ w,
107
106
  {
108
107
  className: "w-full",
109
108
  columns: 3,
@@ -111,29 +110,29 @@ function ue({
111
110
  title: u(),
112
111
  children: [
113
112
  /* @__PURE__ */ e(
114
- n,
113
+ a,
115
114
  {
116
- title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.exposure" }),
115
+ title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.exposure" }),
117
116
  children: h()
118
117
  }
119
118
  ),
120
119
  /* @__PURE__ */ e(
121
- n,
120
+ a,
122
121
  {
123
- title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.cap" }),
122
+ title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.cap" }),
124
123
  children: f()
125
124
  }
126
125
  ),
127
126
  /* @__PURE__ */ e(
128
- n,
127
+ a,
129
128
  {
130
- title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.capUtilization" }),
129
+ title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.capUtilization" }),
131
130
  children: g()
132
131
  }
133
132
  )
134
133
  ]
135
134
  }
136
- ) }) : /* @__PURE__ */ m(N, { children: [
135
+ ) }) : /* @__PURE__ */ s(A, { children: [
137
136
  /* @__PURE__ */ e(o, { className: "pl-4", size: "sm", textAlign: "left", children: u() }),
138
137
  /* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: h() }),
139
138
  /* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: f() }),
@@ -1,20 +1,22 @@
1
1
  import { resolveCSSColor as o } from "../../utils/colors.js";
2
- const e = {
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
- }, s = {
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
- }, l = 'Rubik, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', t = 14;
13
- function b() {
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
- ), i = o("hsl(var(--card))", "rgb(24, 24, 24)");
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: i
53
+ color: a
41
54
  },
42
55
  textColor: r,
43
- fontSize: t,
44
- fontFamily: l
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 n() {
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: e.lineColor,
75
- lineWidth: 2
87
+ lineColor: l.lineColor,
88
+ lineWidth: 2,
89
+ lastValueVisible: !1,
90
+ priceLineVisible: !1
76
91
  };
77
92
  }
78
- function c() {
93
+ function d() {
79
94
  return {
80
95
  showLabel: !0,
81
- color: e.lineColor,
82
- labelBackgroundColor: e.lineColor,
96
+ color: l.lineColor,
97
+ labelBackgroundColor: l.lineColor,
83
98
  width: 2
84
99
  };
85
100
  }
86
- const u = {
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: t,
108
- fontFamily: l
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
- e as DEFAULT_AREA_SERIES,
135
- u as DEFAULT_OPTIONS,
136
- s as DEFAULT_VERTICAL_LINE,
137
- b as getDefaultOptions,
138
- n as getDefaultSeries,
139
- c as getDefaultVerticalLine
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 g } from "lightweight-charts";
2
- import { DateTime as S } from "luxon";
3
- import { isBelowDisplayThreshold as x, FORMAT_CONSTANTS as P, toSignificantDigits as I, formatNumberWithSuffix as p } from "../../utils/format-number.js";
4
- const { MIN_DISPLAY_THRESHOLD: M, MAX_EXPONENTIAL_THRESHOLD: H } = P, w = (t, e, o = "full") => {
5
- if (x(t))
6
- return e ? `<${M}${e}` : `<${M}`;
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 = p(t, {
10
- maxExponentialThreshold: H,
9
+ const r = I(t, {
10
+ maxExponentialThreshold: L,
11
11
  minimumFractionDigits: 0,
12
- maximumFractionDigits: o === "short" ? 1 : 0,
13
- format: o,
14
- adaptiveDecimals: o === "short"
12
+ maximumFractionDigits: n === "short" ? 1 : 0,
13
+ format: n,
14
+ adaptiveDecimals: n === "short"
15
15
  });
16
16
  return e ? `${r}${e}` : r;
17
- }, C = 2, R = (t, e) => {
18
- if (x(t))
19
- return e ? `<${M}${e}` : `<${M}`;
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 o = I(t, C);
23
- return e ? `${o}${e}` : o;
24
- }, Y = 4, G = (t) => {
25
- if (x(t))
26
- return `<${M}`;
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), o = Math.abs(t - e);
30
- return o > 0 && o < 0.01 ? t.toFixed(12).replace(/0+$/, "").replace(/\.$/, "") : I(t, Y);
31
- }, V = (t, e) => {
32
- if (x(t))
33
- return e ? `<${M} ${e}` : `<${M}`;
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 o = Number.isInteger(t), r = Math.abs(t), i = o && r >= 1e3, s = Math.round(t), a = Math.abs(t - s);
37
- if (a > 0 && a < 0.01 && !i) {
38
- const D = t.toFixed(12).replace(/0+$/, "").replace(/\.$/, "");
39
- return e ? `${D} ${e}` : D;
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 F = p(t, {
42
- maxExponentialThreshold: H,
43
- minimumFractionDigits: o ? 0 : 2,
44
- maximumFractionDigits: i ? 1 : o ? 0 : 2,
45
- format: i ? "short" : "full",
46
- adaptiveDecimals: i
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 ? `${F} ${e}` : F;
49
- }, N = {
50
- "%": R,
51
- $: w,
52
- token: V,
53
- none: G
54
- }, v = (t) => N[t] || N.token;
55
- function tt(t, e, o = 4) {
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 : o, i = t.toLocaleString("en-US", {
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 ? `${i} ${e}` : i;
62
+ return e ? `${c} ${e}` : c;
63
63
  }
64
- function k(t, e) {
64
+ function x(t, e) {
65
65
  return !t || e === "none" || e === "token" ? t : e === "$" ? `$${t}` : e === "%" ? `${t}%` : `${t} ${e}`;
66
66
  }
67
- function L(t) {
68
- return t.includes("/") ? "none" : t;
67
+ function Y(t) {
68
+ return t.includes("/");
69
69
  }
70
- function et(t, e, o) {
71
- const r = o?.yScaleMin;
72
- let i = t.length > 0 ? Math.min(...t) : 0, s = t.length > 0 ? Math.max(...t) : 0, a = [];
73
- const u = () => {
74
- const n = (i + s) / 2;
75
- let c = 1, m = "";
76
- return n >= 1e9 ? (c = 1e9, m = "B") : n >= 1e6 ? (c = 1e6, m = "M") : n >= 1e3 && (c = 1e3, m = "K"), { scale: c, suffix: m };
77
- }, F = 8, D = 0.02;
78
- let A = 0;
79
- const E = (n, c, m, d) => {
80
- const h = (c > 1 ? n / c : n).toLocaleString("en-US", {
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 c > 1 ? `${h}${m}` : h;
86
- }, U = (n, c, m) => {
87
- for (let d = 0; d <= F; 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 h = !0;
90
- for (const T of n) {
91
- const f = E(T, c, m, d);
92
- if ($.has(f)) {
93
- h = !1;
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(f);
99
+ $.add(k);
97
100
  }
98
- if (h) return d;
101
+ if (f) return d;
99
102
  }
100
- return F;
101
- }, X = (n) => {
102
- if (r !== void 0 && n < r) return "";
103
- if (n === 0) return k("0", L(e));
104
- const { scale: c, suffix: m } = u();
105
- return k(
106
- E(n, c, m, A),
107
- L(e)
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: (n) => X(n),
112
- tickmarksFormatter: (n) => {
113
- const { scale: c, suffix: m } = u(), d = s - i, $ = d > 0 ? a.filter(
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
- A = U(
119
- [...h, ...$],
120
- c,
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 l = f === 0 ? "0" : E(f, c, m, A);
127
- return !l || T.has(l) ? "" : (T.add(l), k(l, L(e)));
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: (n) => {
131
- n.length > 0 && (i = Math.min(...n), s = Math.max(...n));
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 O = (t) => S.fromSeconds(Number(t)).toFormat("dd/LL/yyyy HH:mm"), W = (t) => S.fromSeconds(Number(t)).toFormat("HH:mm"), q = (t, e) => R(Number(t), e), _ = {
139
- time: O,
140
- "%": q
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 B(t) {
136
+ function q(t) {
143
137
  const e = /* @__PURE__ */ new Map();
144
- return (o, r, i) => {
145
- const s = S.fromSeconds(Number(o));
146
- let a;
138
+ return (n, r, c) => {
139
+ const s = D.fromSeconds(Number(n));
140
+ let i;
147
141
  if (t === 0)
148
- a = s.toFormat("HH:mm");
142
+ i = s.toFormat("HH:mm");
149
143
  else
150
144
  switch (r) {
151
- case g.Year:
152
- a = s.toFormat("yyyy");
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 g.Month:
158
- case g.DayOfMonth:
159
- a = t > 365 ? s.toFormat("dd MMM yyyy") : s.toFormat("dd MMM");
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 g.Time:
162
- case g.TimeWithSeconds:
163
- a = s.toFormat("HH:mm");
155
+ case S.Time:
156
+ case S.TimeWithSeconds:
157
+ i = s.toFormat("HH:mm");
164
158
  break;
165
159
  default:
166
- a = s.toFormat("dd MMM");
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(a) ? " " : (u.add(a), a);
163
+ return u || (u = /* @__PURE__ */ new Set(), e.set(r, u)), u.has(i) ? " " : (u.add(i), i);
170
164
  };
171
165
  }
172
- const y = (t, e) => {
166
+ const B = (t, e) => {
173
167
  if (t === "time" && e && e.length > 0) {
174
- const r = S.fromSeconds(Number(e[0].time)), i = S.fromSeconds(
168
+ const r = D.fromSeconds(Number(e[0].time)), c = D.fromSeconds(
175
169
  Number(e[e.length - 1].time)
176
- ), s = r.hasSame(i, "day"), a = s ? 0 : Math.ceil(i.diff(r, "days").days);
170
+ ), s = r.hasSame(c, "day"), i = s ? 0 : Math.ceil(c.diff(r, "days").days);
177
171
  return {
178
- timeFormatter: s ? W : O,
179
- tickMarkFormatter: B(a)
172
+ timeFormatter: s ? G : _,
173
+ tickMarkFormatter: q(i)
180
174
  };
181
175
  }
182
- const o = _[t] || _.time;
176
+ const n = E[t] || E.time;
183
177
  return {
184
- timeFormatter: o,
185
- tickMarkFormatter: (r) => o(r, t)
178
+ timeFormatter: n,
179
+ tickMarkFormatter: (r) => n(r, t)
186
180
  };
187
- }, rt = (t, e) => y(t, e).timeFormatter;
181
+ }, v = (t, e) => B(t, e).timeFormatter;
188
182
  export {
189
- et as createAdaptiveYAxisFormatter,
190
- tt as formatExactValue,
191
- rt as getXFormatter,
192
- y as getXFormatters,
193
- v as getYFormatter,
194
- k as withYAxisUnit
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 a, jsx as l } from "react/jsx-runtime";
2
- import { cn as i } from "../../utils/cn.js";
3
- import { getXFormatter as c, formatExactValue as r } from "./formatters.js";
4
- function u({
5
- point: e,
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: o
9
+ decimals: e
10
10
  }) {
11
- const d = c(m)(e.time, m), n = t !== "%" && t !== "$" && t !== "none" ? t : void 0, x = t === "$" ? `$${r(e.value, void 0, o)}` : t === "%" ? `${r(e.value, void 0, o)}%` : r(e.value, n, o);
12
- return /* @__PURE__ */ a(
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: i(
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: x }),
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
- u as GraphCurrentValue
27
+ w as GraphCurrentValue
28
28
  };