@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.
Files changed (38) 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/graph/default-config.cjs +1 -1
  4. package/dist/cjs/components/graph/formatters.cjs +1 -1
  5. package/dist/cjs/components/graph/graph-current-value.cjs +1 -1
  6. package/dist/cjs/components/graph/graph-tooltip.cjs +1 -1
  7. package/dist/cjs/components/graph/graph.cjs +1 -1
  8. package/dist/cjs/components/graph/index.cjs +1 -1
  9. package/dist/cjs/components/graph/y-axis-scale.cjs +1 -0
  10. package/dist/cjs/components/index.cjs +1 -1
  11. package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
  12. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  13. package/dist/cjs/index.cjs +1 -1
  14. package/dist/cjs/locale/en.json.cjs +1 -1
  15. package/dist/esm/components/base/history-chart/history-chart.js +16 -15
  16. package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +41 -25
  17. package/dist/esm/components/graph/default-config.js +44 -24
  18. package/dist/esm/components/graph/formatters.js +123 -128
  19. package/dist/esm/components/graph/graph-current-value.js +11 -11
  20. package/dist/esm/components/graph/graph-tooltip.js +6 -6
  21. package/dist/esm/components/graph/graph.js +597 -547
  22. package/dist/esm/components/graph/index.js +32 -27
  23. package/dist/esm/components/graph/y-axis-scale.js +112 -0
  24. package/dist/esm/components/index.js +496 -491
  25. package/dist/esm/components/trading-view/trading-view.js +83 -82
  26. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +94 -55
  27. package/dist/esm/index.js +649 -644
  28. package/dist/esm/locale/en.json.js +16 -4
  29. package/dist/types/components/base/history-chart/history-chart.d.ts +2 -1
  30. package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -2
  31. package/dist/types/components/graph/default-config.d.ts +23 -0
  32. package/dist/types/components/graph/formatters.d.ts +5 -1
  33. package/dist/types/components/graph/graph.d.ts +12 -4
  34. package/dist/types/components/graph/y-axis-scale.d.ts +48 -0
  35. package/dist/types/components/trading-view/trading-view.d.ts +5 -1
  36. package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +4 -2
  37. package/dist/types/locale/en.json.d.ts +14 -2
  38. package/package.json +3 -3
@@ -1,31 +1,36 @@
1
- import { DEFAULT_AREA_SERIES as r, DEFAULT_OPTIONS as o, DEFAULT_VERTICAL_LINE as a, getDefaultOptions as i, getDefaultSeries as p, getDefaultVerticalLine as l } from "./default-config.js";
2
- import { getXFormatter as g, getXFormatters as E, getYFormatter as f } from "./formatters.js";
3
- import { DEFAULT_SERIES_COLORS as n, Graph as V, GraphLegend as h, getSeriesColorPalette as S, getVerticalLineLabelStyle as A, getVerticalLineTooltipContent as D } from "./graph.js";
4
- import { GraphCurrentValue as s } from "./graph-current-value.js";
5
- import { GraphTooltip as F } from "./graph-tooltip.js";
6
- import { GraphView as _, GraphViewWithData as u, graphViewVariants as C, useGraphAside as I } from "./graph-view.js";
7
- import { VertLine as R } from "./plugins/vertical-line.js";
1
+ import { AXIS_EDGE_LABEL_PADDING_PX as r, AXIS_FONT_SIZE as o, AXIS_TICK_MARK_DENSITY as a, AXIS_TIME_EDGE_PADDING_PX as _, AXIS_TOP_LABEL_PADDING_PX as E, DEFAULT_AREA_SERIES as A, DEFAULT_OPTIONS as i, DEFAULT_VERTICAL_LINE as p, getDefaultOptions as D, getDefaultSeries as I, getDefaultVerticalLine as L } from "./default-config.js";
2
+ import { getXFormatter as l, getXFormatters as T, getYFormatter as G } from "./formatters.js";
3
+ import { DEFAULT_SERIES_COLORS as f, Graph as m, GraphLegend as n, getSeriesColorPalette as V, getVerticalLineLabelStyle as X, getVerticalLineTooltipContent as h } from "./graph.js";
4
+ import { GraphCurrentValue as F } from "./graph-current-value.js";
5
+ import { GraphTooltip as x } from "./graph-tooltip.js";
6
+ import { GraphView as O, GraphViewWithData as u, graphViewVariants as C, useGraphAside as R } from "./graph-view.js";
7
+ import { VertLine as c } from "./plugins/vertical-line.js";
8
8
  export {
9
- r as DEFAULT_AREA_SERIES,
10
- o as DEFAULT_OPTIONS,
11
- n as DEFAULT_SERIES_COLORS,
12
- a as DEFAULT_VERTICAL_LINE,
13
- V as Graph,
14
- s as GraphCurrentValue,
15
- h as GraphLegend,
16
- F as GraphTooltip,
17
- _ as GraphView,
9
+ r as AXIS_EDGE_LABEL_PADDING_PX,
10
+ o as AXIS_FONT_SIZE,
11
+ a as AXIS_TICK_MARK_DENSITY,
12
+ _ as AXIS_TIME_EDGE_PADDING_PX,
13
+ E as AXIS_TOP_LABEL_PADDING_PX,
14
+ A as DEFAULT_AREA_SERIES,
15
+ i as DEFAULT_OPTIONS,
16
+ f as DEFAULT_SERIES_COLORS,
17
+ p as DEFAULT_VERTICAL_LINE,
18
+ m as Graph,
19
+ F as GraphCurrentValue,
20
+ n as GraphLegend,
21
+ x as GraphTooltip,
22
+ O as GraphView,
18
23
  u as GraphViewWithData,
19
- R as VertLine,
20
- i as getDefaultOptions,
21
- p as getDefaultSeries,
22
- l as getDefaultVerticalLine,
23
- S as getSeriesColorPalette,
24
- A as getVerticalLineLabelStyle,
25
- D as getVerticalLineTooltipContent,
26
- g as getXFormatter,
27
- E as getXFormatters,
28
- f as getYFormatter,
24
+ c as VertLine,
25
+ D as getDefaultOptions,
26
+ I as getDefaultSeries,
27
+ L as getDefaultVerticalLine,
28
+ V as getSeriesColorPalette,
29
+ X as getVerticalLineLabelStyle,
30
+ h as getVerticalLineTooltipContent,
31
+ l as getXFormatter,
32
+ T as getXFormatters,
33
+ G as getYFormatter,
29
34
  C as graphViewVariants,
30
- I as useGraphAside
35
+ R as useGraphAside
31
36
  };
@@ -0,0 +1,112 @@
1
+ const d = [
2
+ [2, 2.5, 2],
3
+ [2, 2, 2.5],
4
+ [2.5, 2, 2]
5
+ ];
6
+ function F(t) {
7
+ if (!(t > 0) || !Number.isFinite(t)) return 0.01;
8
+ const n = 10 ** Math.floor(Math.log10(t) - 3);
9
+ return Math.min(Math.max(n, 1e-8), t);
10
+ }
11
+ function k(t) {
12
+ if (t < 0) return !1;
13
+ if (t > 1e18) return !0;
14
+ for (let n = t; n > 1; n /= 10)
15
+ if (n % 10 !== 0) return !1;
16
+ return !0;
17
+ }
18
+ function T(t, n, i) {
19
+ return n - t <= i;
20
+ }
21
+ function v(t, n, i) {
22
+ return Math.abs(t - n) < i;
23
+ }
24
+ function R(t, n, i, a, u) {
25
+ const c = k(a) ? [2, 2.5, 2] : [], o = a === 0 ? 0 : 1 / a;
26
+ let e = 10 ** Math.max(0, Math.ceil(Math.log10(t - n))), I = 0, r = u[0] ?? 2;
27
+ for (; ; ) {
28
+ const S = T(e, o, 1e-14) && e > o + 1e-14, N = T(
29
+ e,
30
+ i * r,
31
+ 1e-14
32
+ ), m = T(e, 1, 1e-14);
33
+ if (!(S && N && m)) break;
34
+ e /= r, I += 1, r = u[I % u.length] ?? 2;
35
+ }
36
+ if (e <= o + 1e-14 && (e = o), e = Math.max(1, e), c.length > 0 && v(e, 1, 1e-14))
37
+ for (I = 0, r = c[0] ?? 2; T(e, i * r, 1e-14) && e > o + 1e-14; )
38
+ e /= r, I += 1, r = c[I % c.length] ?? 2;
39
+ return e;
40
+ }
41
+ function p({
42
+ min: t,
43
+ max: n,
44
+ scaleHeightPx: i,
45
+ fontSizePx: a,
46
+ tickMarkDensity: u,
47
+ minMove: c
48
+ }) {
49
+ const o = Math.max(t, n), e = Math.min(t, n);
50
+ if (!(o > e) || !(i > 0) || !(a > 0))
51
+ return c > 0 ? c : 0.01;
52
+ const I = Math.ceil(a * u), r = (o - e) * I / i, S = c > 0 ? Math.round(1 / c) : 100;
53
+ let N = Number.POSITIVE_INFINITY;
54
+ for (const m of d) {
55
+ const M = R(o, e, r, S, m);
56
+ M < N && (N = M);
57
+ }
58
+ return Number.isFinite(N) && N > 0 ? N : c > 0 ? c : 0.01;
59
+ }
60
+ function b(t, n, i) {
61
+ if (!(n > 0) || !Number.isFinite(n) || !Number.isFinite(t))
62
+ return t;
63
+ const a = t / n, u = i === "floor" ? Math.floor(a + 1e-14) : Math.ceil(a - 1e-14);
64
+ return Number((u * n).toPrecision(12));
65
+ }
66
+ function q({
67
+ min: t,
68
+ max: n,
69
+ floor: i,
70
+ scaleHeightPx: a,
71
+ fontSizePx: u,
72
+ tickMarkDensity: c,
73
+ minMove: o,
74
+ edgePaddingPx: e = 0,
75
+ edgePaddingTopPx: I
76
+ }) {
77
+ let r = Math.min(t, n);
78
+ const S = Math.max(t, n);
79
+ i !== void 0 && Number.isFinite(i) && r < i && (r = i);
80
+ const N = S - r, m = o ?? F(N);
81
+ if (!(N > 0) || !(a > 0)) {
82
+ const h = m > 0 ? m : 0.01, s = i !== void 0 ? Math.max(r, i) : r;
83
+ return { min: s, max: s + h * 5, step: h };
84
+ }
85
+ let M = r, l = S, _ = p({
86
+ min: M,
87
+ max: l,
88
+ scaleHeightPx: a,
89
+ fontSizePx: u,
90
+ tickMarkDensity: c,
91
+ minMove: m
92
+ });
93
+ for (let h = 0; h < 3; h++) {
94
+ let s = b(r, _, "floor"), f = b(S, _, "ceil");
95
+ i !== void 0 && Number.isFinite(i) && (s = Math.max(s, i)), f <= s && (f = s + _);
96
+ const E = Math.max(0, e), P = Math.max(0, I ?? e), C = Math.max(1, a - P - E), x = (f - s) / C, O = s - E * x, L = f + P * x, A = p({
97
+ min: O,
98
+ max: L,
99
+ scaleHeightPx: a,
100
+ fontSizePx: u,
101
+ tickMarkDensity: c,
102
+ minMove: m
103
+ }), K = A === _ && s === M && f === l;
104
+ if (M = s, l = f, _ = A, K) break;
105
+ }
106
+ return { min: M, max: l, step: _ };
107
+ }
108
+ export {
109
+ q as niceAxisRange,
110
+ F as pickMinMove,
111
+ p as pickTickSpan
112
+ };